From c2d6b3524cc0039e152da52fe21eb375e63704cf Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Tue, 13 Nov 2018 21:01:51 +0000 Subject: [PATCH] Preparing release version 4.0.0 --- CHANGELOG.rst | 67 ++++++++++++++++++ changelog/3554.bugfix.rst | 1 - changelog/3737.removal.rst | 23 ------ changelog/4270.feature.rst | 3 - changelog/4358.removal.rst | 18 ----- doc/en/announce/index.rst | 1 + doc/en/announce/release-4.0.0.rst | 30 ++++++++ doc/en/example/parametrize.rst | 1 - doc/en/example/pythoncollection.rst | 2 - doc/en/example/reportingdemo.rst | 106 +++++++++++++--------------- doc/en/example/simple.rst | 2 +- 11 files changed, 149 insertions(+), 105 deletions(-) delete mode 100644 changelog/3554.bugfix.rst delete mode 100644 changelog/3737.removal.rst delete mode 100644 changelog/4270.feature.rst delete mode 100644 changelog/4358.removal.rst create mode 100644 doc/en/announce/release-4.0.0.rst diff --git a/CHANGELOG.rst b/CHANGELOG.rst index c537d6b79..4c3d2b249 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -18,6 +18,73 @@ with advance notice in the **Deprecations** section of releases. .. towncrier release notes start +pytest 4.0.0 (2018-11-13) +========================= + +Removals +-------- + +- `#3737 `_: **RemovedInPytest4Warnings are now errors by default.** + + Following our plan to remove deprecated features with as little disruption as + possible, all warnings of type ``RemovedInPytest4Warnings`` now generate errors + instead of warning messages. + + **The affected features will be effectively removed in pytest 4.1**, so please consult the + `Deprecations and Removals `__ + section in the docs for directions on how to update existing code. + + In the pytest ``4.0.X`` series, it is possible to change the errors back into warnings as a stop + gap measure by adding this to your ``pytest.ini`` file: + + .. code-block:: ini + + [pytest] + filterwarnings = + ignore::pytest.RemovedInPytest4Warning + + But this will stop working when pytest ``4.1`` is released. + + **If you have concerns** about the removal of a specific feature, please add a + comment to `#4348 `__. + + +- `#4358 `_: Remove the ``::()`` notation to denote a test class instance in node ids. + + Previously, node ids that contain test instances would use ``::()`` to denote the instance like this:: + + test_foo.py::Test::()::test_bar + + The extra ``::()`` was puzzling to most users and has been removed, so that the test id becomes now:: + + test_foo.py::Test::test_bar + + This change could not accompany a deprecation period as is usual when user-facing functionality changes because + it was not really possible to detect when the functionality was being used explicitly. + + The extra ``::()`` might have been removed in some places internally already, + which then led to confusion in places where it was expected, e.g. with + ``--deselect`` (`#4127 `_). + + Test class instances are also not listed with ``--collect-only`` anymore. + + + +Features +-------- + +- `#4270 `_: The ``cache_dir`` option uses ``$TOX_ENV_DIR`` as prefix (if set in the environment). + + This uses a different cache per tox environment by default. + + + +Bug Fixes +--------- + +- `#3554 `_: Fix ``CallInfo.__repr__`` for when the call is not finished yet. + + pytest 3.10.1 (2018-11-11) ========================== diff --git a/changelog/3554.bugfix.rst b/changelog/3554.bugfix.rst deleted file mode 100644 index b4c43cb8f..000000000 --- a/changelog/3554.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fix ``CallInfo.__repr__`` for when the call is not finished yet. diff --git a/changelog/3737.removal.rst b/changelog/3737.removal.rst deleted file mode 100644 index 7d7fa7786..000000000 --- a/changelog/3737.removal.rst +++ /dev/null @@ -1,23 +0,0 @@ -**RemovedInPytest4Warnings are now errors by default.** - -Following our plan to remove deprecated features with as little disruption as -possible, all warnings of type ``RemovedInPytest4Warnings`` now generate errors -instead of warning messages. - -**The affected features will be effectively removed in pytest 4.1**, so please consult the -`Deprecations and Removals `__ -section in the docs for directions on how to update existing code. - -In the pytest ``4.0.X`` series, it is possible to change the errors back into warnings as a stop -gap measure by adding this to your ``pytest.ini`` file: - -.. code-block:: ini - - [pytest] - filterwarnings = - ignore::pytest.RemovedInPytest4Warning - -But this will stop working when pytest ``4.1`` is released. - -**If you have concerns** about the removal of a specific feature, please add a -comment to `#4348 `__. diff --git a/changelog/4270.feature.rst b/changelog/4270.feature.rst deleted file mode 100644 index 2254937a2..000000000 --- a/changelog/4270.feature.rst +++ /dev/null @@ -1,3 +0,0 @@ -The ``cache_dir`` option uses ``$TOX_ENV_DIR`` as prefix (if set in the environment). - -This uses a different cache per tox environment by default. diff --git a/changelog/4358.removal.rst b/changelog/4358.removal.rst deleted file mode 100644 index d66fd483b..000000000 --- a/changelog/4358.removal.rst +++ /dev/null @@ -1,18 +0,0 @@ -Remove the ``::()`` notation to denote a test class instance in node ids. - -Previously, node ids that contain test instances would use ``::()`` to denote the instance like this:: - - test_foo.py::Test::()::test_bar - -The extra ``::()`` was puzzling to most users and has been removed, so that the test id becomes now:: - - test_foo.py::Test::test_bar - -This change could not accompany a deprecation period as is usual when user-facing functionality changes because -it was not really possible to detect when the functionality was being used explicitly. - -The extra ``::()`` might have been removed in some places internally already, -which then led to confusion in places where it was expected, e.g. with -``--deselect`` (`#4127 `_). - -Test class instances are also not listed with ``--collect-only`` anymore. diff --git a/doc/en/announce/index.rst b/doc/en/announce/index.rst index e0df8eb1d..504d63484 100644 --- a/doc/en/announce/index.rst +++ b/doc/en/announce/index.rst @@ -6,6 +6,7 @@ Release announcements :maxdepth: 2 + release-4.0.0 release-3.10.1 release-3.10.0 release-3.9.3 diff --git a/doc/en/announce/release-4.0.0.rst b/doc/en/announce/release-4.0.0.rst new file mode 100644 index 000000000..e5ad69b5f --- /dev/null +++ b/doc/en/announce/release-4.0.0.rst @@ -0,0 +1,30 @@ +pytest-4.0.0 +======================================= + +The pytest team is proud to announce the 4.0.0 release! + +pytest is a mature Python testing tool with more than a 2000 tests +against itself, passing on many different interpreters and platforms. + +This release contains a number of bugs fixes and improvements, so users are encouraged +to take a look at the CHANGELOG: + + https://docs.pytest.org/en/latest/changelog.html + +For complete documentation, please visit: + + https://docs.pytest.org/en/latest/ + +As usual, you can upgrade from pypi via: + + pip install -U pytest + +Thanks to all who contributed to this release, among them: + +* Bruno Oliveira +* Daniel Hahler +* Ronny Pfannschmidt + + +Happy testing, +The Pytest Development Team diff --git a/doc/en/example/parametrize.rst b/doc/en/example/parametrize.rst index 868dfcf57..dcd59cfb3 100644 --- a/doc/en/example/parametrize.rst +++ b/doc/en/example/parametrize.rst @@ -213,7 +213,6 @@ If you just collect tests you'll also nicely see 'advanced' and 'basic' as varia collected 4 items - diff --git a/doc/en/example/pythoncollection.rst b/doc/en/example/pythoncollection.rst index 500873817..9a439cbae 100644 --- a/doc/en/example/pythoncollection.rst +++ b/doc/en/example/pythoncollection.rst @@ -132,7 +132,6 @@ The test collection would look like this:: collected 2 items - @@ -187,7 +186,6 @@ You can always peek at the collection tree without running tests like this:: - diff --git a/doc/en/example/reportingdemo.rst b/doc/en/example/reportingdemo.rst index c599fe6b3..35ec7b6cc 100644 --- a/doc/en/example/reportingdemo.rst +++ b/doc/en/example/reportingdemo.rst @@ -18,15 +18,16 @@ get on the terminal - we are working on that):: failure_demo.py FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF [100%] ================================= FAILURES ================================= - ____________________________ test_generative[0] ____________________________ + ___________________________ test_generative[3-6] ___________________________ param1 = 3, param2 = 6 + @pytest.mark.parametrize("param1, param2", [(3, 6)]) def test_generative(param1, param2): > assert param1 * 2 < param2 E assert (3 * 2) < 6 - failure_demo.py:20: AssertionError + failure_demo.py:22: AssertionError _________________________ TestFailing.test_simple __________________________ self = @@ -43,7 +44,7 @@ get on the terminal - we are working on that):: E + where 42 = .f at 0xdeadbeef>() E + and 43 = .g at 0xdeadbeef>() - failure_demo.py:36: AssertionError + failure_demo.py:33: AssertionError ____________________ TestFailing.test_simple_multiline _____________________ self = @@ -51,7 +52,7 @@ get on the terminal - we are working on that):: def test_simple_multiline(self): > otherfunc_multi(42, 6 * 9) - failure_demo.py:39: + failure_demo.py:36: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ a = 42, b = 54 @@ -60,7 +61,7 @@ get on the terminal - we are working on that):: > assert a == b E assert 42 == 54 - failure_demo.py:16: AssertionError + failure_demo.py:17: AssertionError ___________________________ TestFailing.test_not ___________________________ self = @@ -73,7 +74,7 @@ get on the terminal - we are working on that):: E assert not 42 E + where 42 = .f at 0xdeadbeef>() - failure_demo.py:45: AssertionError + failure_demo.py:42: AssertionError _________________ TestSpecialisedExplanations.test_eq_text _________________ self = @@ -84,7 +85,7 @@ get on the terminal - we are working on that):: E - spam E + eggs - failure_demo.py:50: AssertionError + failure_demo.py:47: AssertionError _____________ TestSpecialisedExplanations.test_eq_similar_text _____________ self = @@ -97,7 +98,7 @@ get on the terminal - we are working on that):: E + foo 2 bar E ? ^ - failure_demo.py:53: AssertionError + failure_demo.py:50: AssertionError ____________ TestSpecialisedExplanations.test_eq_multiline_text ____________ self = @@ -110,7 +111,7 @@ get on the terminal - we are working on that):: E + eggs E bar - failure_demo.py:56: AssertionError + failure_demo.py:53: AssertionError ______________ TestSpecialisedExplanations.test_eq_long_text _______________ self = @@ -127,7 +128,7 @@ get on the terminal - we are working on that):: E + 1111111111b222222222 E ? ^ - failure_demo.py:61: AssertionError + failure_demo.py:58: AssertionError _________ TestSpecialisedExplanations.test_eq_long_text_multiline __________ self = @@ -147,7 +148,7 @@ get on the terminal - we are working on that):: E E ...Full output truncated (7 lines hidden), use '-vv' to show - failure_demo.py:66: AssertionError + failure_demo.py:63: AssertionError _________________ TestSpecialisedExplanations.test_eq_list _________________ self = @@ -158,7 +159,7 @@ get on the terminal - we are working on that):: E At index 2 diff: 2 != 3 E Use -v to get the full diff - failure_demo.py:69: AssertionError + failure_demo.py:66: AssertionError ______________ TestSpecialisedExplanations.test_eq_list_long _______________ self = @@ -171,7 +172,7 @@ get on the terminal - we are working on that):: E At index 100 diff: 1 != 2 E Use -v to get the full diff - failure_demo.py:74: AssertionError + failure_demo.py:71: AssertionError _________________ TestSpecialisedExplanations.test_eq_dict _________________ self = @@ -189,7 +190,7 @@ get on the terminal - we are working on that):: E E ...Full output truncated (2 lines hidden), use '-vv' to show - failure_demo.py:77: AssertionError + failure_demo.py:74: AssertionError _________________ TestSpecialisedExplanations.test_eq_set __________________ self = @@ -207,7 +208,7 @@ get on the terminal - we are working on that):: E E ...Full output truncated (2 lines hidden), use '-vv' to show - failure_demo.py:80: AssertionError + failure_demo.py:77: AssertionError _____________ TestSpecialisedExplanations.test_eq_longer_list ______________ self = @@ -218,7 +219,7 @@ get on the terminal - we are working on that):: E Right contains more items, first extra item: 3 E Use -v to get the full diff - failure_demo.py:83: AssertionError + failure_demo.py:80: AssertionError _________________ TestSpecialisedExplanations.test_in_list _________________ self = @@ -227,7 +228,7 @@ get on the terminal - we are working on that):: > assert 1 in [0, 2, 3, 4, 5] E assert 1 in [0, 2, 3, 4, 5] - failure_demo.py:86: AssertionError + failure_demo.py:83: AssertionError __________ TestSpecialisedExplanations.test_not_in_text_multiline __________ self = @@ -246,7 +247,7 @@ get on the terminal - we are working on that):: E E ...Full output truncated (2 lines hidden), use '-vv' to show - failure_demo.py:90: AssertionError + failure_demo.py:87: AssertionError ___________ TestSpecialisedExplanations.test_not_in_text_single ____________ self = @@ -259,7 +260,7 @@ get on the terminal - we are working on that):: E single foo line E ? +++ - failure_demo.py:94: AssertionError + failure_demo.py:91: AssertionError _________ TestSpecialisedExplanations.test_not_in_text_single_long _________ self = @@ -272,7 +273,7 @@ get on the terminal - we are working on that):: E head head foo tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail E ? +++ - failure_demo.py:98: AssertionError + failure_demo.py:95: AssertionError ______ TestSpecialisedExplanations.test_not_in_text_single_long_term _______ self = @@ -285,7 +286,7 @@ get on the terminal - we are working on that):: E head head fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffftail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail E ? ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - failure_demo.py:102: AssertionError + failure_demo.py:99: AssertionError ______________________________ test_attribute ______________________________ def test_attribute(): @@ -297,7 +298,7 @@ get on the terminal - we are working on that):: E assert 1 == 2 E + where 1 = .Foo object at 0xdeadbeef>.b - failure_demo.py:110: AssertionError + failure_demo.py:107: AssertionError _________________________ test_attribute_instance __________________________ def test_attribute_instance(): @@ -309,7 +310,7 @@ get on the terminal - we are working on that):: E + where 1 = .Foo object at 0xdeadbeef>.b E + where .Foo object at 0xdeadbeef> = .Foo'>() - failure_demo.py:117: AssertionError + failure_demo.py:114: AssertionError __________________________ test_attribute_failure __________________________ def test_attribute_failure(): @@ -322,7 +323,7 @@ get on the terminal - we are working on that):: i = Foo() > assert i.b == 2 - failure_demo.py:128: + failure_demo.py:125: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .Foo object at 0xdeadbeef> @@ -331,7 +332,7 @@ get on the terminal - we are working on that):: > raise Exception("Failed to get attrib") E Exception: Failed to get attrib - failure_demo.py:123: Exception + failure_demo.py:120: Exception _________________________ test_attribute_multiple __________________________ def test_attribute_multiple(): @@ -348,7 +349,7 @@ get on the terminal - we are working on that):: E + and 2 = .Bar object at 0xdeadbeef>.b E + where .Bar object at 0xdeadbeef> = .Bar'>() - failure_demo.py:138: AssertionError + failure_demo.py:135: AssertionError __________________________ TestRaises.test_raises __________________________ self = @@ -357,7 +358,7 @@ get on the terminal - we are working on that):: s = "qwe" # NOQA > raises(TypeError, "int(s)") - failure_demo.py:148: + failure_demo.py:145: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > int(s) @@ -372,7 +373,7 @@ get on the terminal - we are working on that):: > raises(IOError, "int('3')") E Failed: DID NOT RAISE - failure_demo.py:151: Failed + failure_demo.py:148: Failed __________________________ TestRaises.test_raise ___________________________ self = @@ -381,7 +382,7 @@ get on the terminal - we are working on that):: > raise ValueError("demo error") E ValueError: demo error - failure_demo.py:154: ValueError + failure_demo.py:151: ValueError ________________________ TestRaises.test_tupleerror ________________________ self = @@ -390,7 +391,7 @@ get on the terminal - we are working on that):: > a, b = [1] # NOQA E ValueError: not enough values to unpack (expected 2, got 1) - failure_demo.py:157: ValueError + failure_demo.py:154: ValueError ______ TestRaises.test_reinterpret_fails_with_print_for_the_fun_of_it ______ self = @@ -401,7 +402,7 @@ get on the terminal - we are working on that):: > a, b = items.pop() E TypeError: 'int' object is not iterable - failure_demo.py:162: TypeError + failure_demo.py:159: TypeError --------------------------- Captured stdout call --------------------------- items is [1, 2, 3] ________________________ TestRaises.test_some_error ________________________ @@ -412,7 +413,7 @@ get on the terminal - we are working on that):: > if namenotexi: # NOQA E NameError: name 'namenotexi' is not defined - failure_demo.py:165: NameError + failure_demo.py:162: NameError ____________________ test_dynamic_compile_shows_nicely _____________________ def test_dynamic_compile_shows_nicely(): @@ -427,14 +428,14 @@ get on the terminal - we are working on that):: sys.modules[name] = module > module.foo() - failure_demo.py:183: + failure_demo.py:180: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ def foo(): > assert 1 == 0 E AssertionError - <2-codegen 'abc-123' $REGENDOC_TMPDIR/assertion/failure_demo.py:180>:2: AssertionError + <2-codegen 'abc-123' $REGENDOC_TMPDIR/assertion/failure_demo.py:177>:2: AssertionError ____________________ TestMoreErrors.test_complex_error _____________________ self = @@ -448,9 +449,9 @@ get on the terminal - we are working on that):: > somefunc(f(), g()) - failure_demo.py:194: + failure_demo.py:191: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ - failure_demo.py:12: in somefunc + failure_demo.py:13: in somefunc otherfunc(x, y) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ @@ -460,7 +461,7 @@ get on the terminal - we are working on that):: > assert a == b E assert 44 == 43 - failure_demo.py:8: AssertionError + failure_demo.py:9: AssertionError ___________________ TestMoreErrors.test_z1_unpack_error ____________________ self = @@ -470,7 +471,7 @@ get on the terminal - we are working on that):: > a, b = items E ValueError: not enough values to unpack (expected 2, got 0) - failure_demo.py:198: ValueError + failure_demo.py:195: ValueError ____________________ TestMoreErrors.test_z2_type_error _____________________ self = @@ -480,7 +481,7 @@ get on the terminal - we are working on that):: > a, b = items E TypeError: 'int' object is not iterable - failure_demo.py:202: TypeError + failure_demo.py:199: TypeError ______________________ TestMoreErrors.test_startswith ______________________ self = @@ -493,7 +494,7 @@ get on the terminal - we are working on that):: E + where False = ('456') E + where = '123'.startswith - failure_demo.py:207: AssertionError + failure_demo.py:204: AssertionError __________________ TestMoreErrors.test_startswith_nested ___________________ self = @@ -512,7 +513,7 @@ get on the terminal - we are working on that):: E + where '123' = .f at 0xdeadbeef>() E + and '456' = .g at 0xdeadbeef>() - failure_demo.py:216: AssertionError + failure_demo.py:213: AssertionError _____________________ TestMoreErrors.test_global_func ______________________ self = @@ -523,7 +524,7 @@ get on the terminal - we are working on that):: E + where False = isinstance(43, float) E + where 43 = globf(42) - failure_demo.py:219: AssertionError + failure_demo.py:216: AssertionError _______________________ TestMoreErrors.test_instance _______________________ self = @@ -534,7 +535,7 @@ get on the terminal - we are working on that):: E assert 42 != 42 E + where 42 = .x - failure_demo.py:223: AssertionError + failure_demo.py:220: AssertionError _______________________ TestMoreErrors.test_compare ________________________ self = @@ -544,7 +545,7 @@ get on the terminal - we are working on that):: E assert 11 < 5 E + where 11 = globf(10) - failure_demo.py:226: AssertionError + failure_demo.py:223: AssertionError _____________________ TestMoreErrors.test_try_finally ______________________ self = @@ -555,7 +556,7 @@ get on the terminal - we are working on that):: > assert x == 0 E assert 1 == 0 - failure_demo.py:231: AssertionError + failure_demo.py:228: AssertionError ___________________ TestCustomAssertMsg.test_single_line ___________________ self = @@ -570,7 +571,7 @@ get on the terminal - we are working on that):: E assert 1 == 2 E + where 1 = .A'>.a - failure_demo.py:242: AssertionError + failure_demo.py:239: AssertionError ____________________ TestCustomAssertMsg.test_multiline ____________________ self = @@ -589,7 +590,7 @@ get on the terminal - we are working on that):: E assert 1 == 2 E + where 1 = .A'>.a - failure_demo.py:249: AssertionError + failure_demo.py:246: AssertionError ___________________ TestCustomAssertMsg.test_custom_repr ___________________ self = @@ -611,12 +612,5 @@ get on the terminal - we are working on that):: E assert 1 == 2 E + where 1 = This is JSON\n{\n 'foo': 'bar'\n}.a - failure_demo.py:262: AssertionError - ============================= warnings summary ============================= - failure_demo.py:25 - $REGENDOC_TMPDIR/assertion/failure_demo.py:25: RemovedInPytest4Warning: Metafunc.addcall is deprecated and scheduled to be removed in pytest 4.0. - Please use Metafunc.parametrize instead. - metafunc.addcall(funcargs=dict(param1=3, param2=6)) - - -- Docs: https://docs.pytest.org/en/latest/warnings.html - ================== 42 failed, 1 warnings in 0.12 seconds =================== + failure_demo.py:259: AssertionError + ======================== 42 failed in 0.12 seconds ========================= diff --git a/doc/en/example/simple.rst b/doc/en/example/simple.rst index b16070287..2edaf9a74 100644 --- a/doc/en/example/simple.rst +++ b/doc/en/example/simple.rst @@ -496,7 +496,7 @@ If we run this:: test_step.py:11: AssertionError ========================= short test summary info ========================== - XFAIL test_step.py::TestUserHandling::()::test_deletion + XFAIL test_step.py::TestUserHandling::test_deletion reason: previous test failed (test_modification) ============== 1 failed, 2 passed, 1 xfailed in 0.12 seconds ===============