From d87e1e67dd2beddbed276074c4908ce06c4080d1 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Sun, 13 Mar 2022 16:58:05 +0200 Subject: [PATCH] Merge pull request #9758 from pytest-dev/release-7.1.0 Prepare release 7.1.0 (cherry picked from commit 7d4d1ecde6cdc3feae9ee076ee5aab4e05393fa6) --- changelog/5192.improvement.rst | 3 - changelog/8242.bugfix.rst | 3 - changelog/8838.breaking.rst | 15 ----- changelog/9362.improvement.rst | 1 - changelog/9437.breaking.rst | 1 - changelog/9493.bugfix.rst | 10 ---- changelog/9536.improvement.rst | 1 - changelog/9626.bugfix.rst | 3 - changelog/9644.improvement.rst | 4 -- changelog/9645.bugfix.rst | 1 - changelog/9678.improvement.rst | 3 - changelog/9692.improvement.rst | 3 - changelog/9708.bugfix.rst | 1 - changelog/9730.bugfix.rst | 1 - doc/en/announce/index.rst | 1 + doc/en/announce/release-7.1.0.rst | 48 ++++++++++++++++ doc/en/builtin.rst | 4 +- doc/en/changelog.rst | 92 +++++++++++++++++++++++++++++++ doc/en/example/reportingdemo.rst | 6 +- doc/en/getting-started.rst | 2 +- doc/en/how-to/assert.rst | 2 +- doc/en/how-to/output.rst | 4 +- 22 files changed, 150 insertions(+), 59 deletions(-) delete mode 100644 changelog/5192.improvement.rst delete mode 100644 changelog/8242.bugfix.rst delete mode 100644 changelog/8838.breaking.rst delete mode 100644 changelog/9362.improvement.rst delete mode 100644 changelog/9437.breaking.rst delete mode 100644 changelog/9493.bugfix.rst delete mode 100644 changelog/9536.improvement.rst delete mode 100644 changelog/9626.bugfix.rst delete mode 100644 changelog/9644.improvement.rst delete mode 100644 changelog/9645.bugfix.rst delete mode 100644 changelog/9678.improvement.rst delete mode 100644 changelog/9692.improvement.rst delete mode 100644 changelog/9708.bugfix.rst delete mode 100644 changelog/9730.bugfix.rst create mode 100644 doc/en/announce/release-7.1.0.rst diff --git a/changelog/5192.improvement.rst b/changelog/5192.improvement.rst deleted file mode 100644 index c51077ae5f1..00000000000 --- a/changelog/5192.improvement.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fixed test output for some data types where ``-v`` would show less information. - -Also, when showing diffs for sequences, ``-q`` would produce full diffs instead of the expected diff. diff --git a/changelog/8242.bugfix.rst b/changelog/8242.bugfix.rst deleted file mode 100644 index eaa46142eea..00000000000 --- a/changelog/8242.bugfix.rst +++ /dev/null @@ -1,3 +0,0 @@ -The deprecation of raising :class:`unittest.SkipTest` to skip collection of -tests during the pytest collection phase is reverted - this is now a supported -feature again. diff --git a/changelog/8838.breaking.rst b/changelog/8838.breaking.rst deleted file mode 100644 index f5c1fead874..00000000000 --- a/changelog/8838.breaking.rst +++ /dev/null @@ -1,15 +0,0 @@ -As per our policy, the following features have been deprecated in the 6.X series and are now -removed: - -* ``pytest._fillfuncargs`` function. - -* ``pytest_warning_captured`` hook - use ``pytest_warning_recorded`` instead. - -* ``-k -foobar`` syntax - use ``-k 'not foobar'`` instead. - -* ``-k foobar:`` syntax. - -* ``pytest.collect`` module - import from ``pytest`` directly. - -For more information consult -`Deprecations and Removals `__ in the docs. diff --git a/changelog/9362.improvement.rst b/changelog/9362.improvement.rst deleted file mode 100644 index ad7f8042ca9..00000000000 --- a/changelog/9362.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -pytest now avoids specialized assert formatting when it is detected that the default ``__eq__`` is overridden in ``attrs`` or ``dataclasses``. diff --git a/changelog/9437.breaking.rst b/changelog/9437.breaking.rst deleted file mode 100644 index 60d4337f420..00000000000 --- a/changelog/9437.breaking.rst +++ /dev/null @@ -1 +0,0 @@ -Dropped support for Python 3.6, which reached `end-of-life `__ at 2021-12-23. diff --git a/changelog/9493.bugfix.rst b/changelog/9493.bugfix.rst deleted file mode 100644 index d99c80b7d2c..00000000000 --- a/changelog/9493.bugfix.rst +++ /dev/null @@ -1,10 +0,0 @@ -Symbolic link components are no longer resolved in conftest paths. -This means that if a conftest appears twice in collection tree, using symlinks, it will be executed twice. -For example, given - - tests/real/conftest.py - tests/real/test_it.py - tests/link -> tests/real - -running ``pytest tests`` now imports the conftest twice, once as ``tests/real/conftest.py`` and once as ``tests/link/conftest.py``. -This is a fix to match a similar change made to test collection itself in pytest 6.0 (see :pull:`6523` for details). diff --git a/changelog/9536.improvement.rst b/changelog/9536.improvement.rst deleted file mode 100644 index c7769602f54..00000000000 --- a/changelog/9536.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -When ``-vv`` is given on command line, show skipping and xfail reasons in full instead of truncating them to fit the terminal width. diff --git a/changelog/9626.bugfix.rst b/changelog/9626.bugfix.rst deleted file mode 100644 index 44d3734a1d2..00000000000 --- a/changelog/9626.bugfix.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fixed count of selected tests on terminal collection summary when there were errors or skipped modules. - -If there were errors or skipped modules on collection, pytest would mistakenly subtract those from the selected count. diff --git a/changelog/9644.improvement.rst b/changelog/9644.improvement.rst deleted file mode 100644 index 6e29fd57a79..00000000000 --- a/changelog/9644.improvement.rst +++ /dev/null @@ -1,4 +0,0 @@ -More information about the location of resources that led Python to raise :class:`ResourceWarning` can now -be obtained by enabling :mod:`tracemalloc`. - -See :ref:`resource-warnings` for more information. diff --git a/changelog/9645.bugfix.rst b/changelog/9645.bugfix.rst deleted file mode 100644 index 089a783dee6..00000000000 --- a/changelog/9645.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed regression where ``--import-mode=importlib`` used together with :envvar:`PYTHONPATH` or :confval:`pythonpath` would cause import errors in test suites. diff --git a/changelog/9678.improvement.rst b/changelog/9678.improvement.rst deleted file mode 100644 index d7bb1083a4d..00000000000 --- a/changelog/9678.improvement.rst +++ /dev/null @@ -1,3 +0,0 @@ -More types are now accepted in the ``ids`` argument to ``@pytest.mark.parametrize``. -Previously only `str`, `float`, `int` and `bool` were accepted; -now `bytes`, `complex`, `re.Pattern`, `Enum` and anything with a `__name__` are also accepted. diff --git a/changelog/9692.improvement.rst b/changelog/9692.improvement.rst deleted file mode 100644 index ecc57a68c22..00000000000 --- a/changelog/9692.improvement.rst +++ /dev/null @@ -1,3 +0,0 @@ -:func:`pytest.approx` now raises a :class:`TypeError` when given an unordered sequence (such as :class:`set`). - -Note that this implies that custom classes which only implement ``__iter__`` and ``__len__`` are no longer supported as they don't guarantee order. diff --git a/changelog/9708.bugfix.rst b/changelog/9708.bugfix.rst deleted file mode 100644 index 9defbbd578f..00000000000 --- a/changelog/9708.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -:fixture:`pytester` now requests a :fixture:`monkeypatch` fixture instead of creating one internally. This solves some issues with tests that involve pytest environment variables. diff --git a/changelog/9730.bugfix.rst b/changelog/9730.bugfix.rst deleted file mode 100644 index df30ab7e360..00000000000 --- a/changelog/9730.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Malformed ``pyproject.toml`` files now produce a clearer error message. diff --git a/doc/en/announce/index.rst b/doc/en/announce/index.rst index 9505b0b9e46..e55dd33e81e 100644 --- a/doc/en/announce/index.rst +++ b/doc/en/announce/index.rst @@ -6,6 +6,7 @@ Release announcements :maxdepth: 2 + release-7.1.0 release-7.0.1 release-7.0.0 release-7.0.0rc1 diff --git a/doc/en/announce/release-7.1.0.rst b/doc/en/announce/release-7.1.0.rst new file mode 100644 index 00000000000..3361e1c8a32 --- /dev/null +++ b/doc/en/announce/release-7.1.0.rst @@ -0,0 +1,48 @@ +pytest-7.1.0 +======================================= + +The pytest team is proud to announce the 7.1.0 release! + +This release contains new features, improvements, and bug fixes, +the full list of changes is available in the changelog: + + https://docs.pytest.org/en/stable/changelog.html + +For complete documentation, please visit: + + https://docs.pytest.org/en/stable/ + +As usual, you can upgrade from PyPI via: + + pip install -U pytest + +Thanks to all of the contributors to this release: + +* Akuli +* Andrew Svetlov +* Anthony Sottile +* Brett Holman +* Bruno Oliveira +* Chris NeJame +* Dan Alvizu +* Elijah DeLee +* Emmanuel Arias +* Fabian Egli +* Florian Bruhin +* Gabor Szabo +* Hasan Ramezani +* Hugo van Kemenade +* Kian Meng, Ang +* Kojo Idrissa +* Masaru Tsuchiyama +* Olga Matoula +* P. L. Lim +* Ran Benita +* Tobias Deiminger +* Yuval Shimon +* eduardo naufel schettino +* Éric + + +Happy testing, +The pytest Development Team diff --git a/doc/en/builtin.rst b/doc/en/builtin.rst index c7e7863b218..455ae88121f 100644 --- a/doc/en/builtin.rst +++ b/doc/en/builtin.rst @@ -65,7 +65,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a Fixture that returns a :py:class:`dict` that will be injected into the namespace of doctests. - pytestconfig [session scope] -- .../_pytest/fixtures.py:1365 + pytestconfig [session scope] -- .../_pytest/fixtures.py:1334 Session-scoped fixture that returns the session's :class:`pytest.Config` object. @@ -134,7 +134,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a .. _legacy_path: https://py.readthedocs.io/en/latest/path.html - caplog -- .../_pytest/logging.py:483 + caplog -- .../_pytest/logging.py:487 Access and control log capturing. Captured logs are available through the following properties/methods:: diff --git a/doc/en/changelog.rst b/doc/en/changelog.rst index 41a79ce5b2f..64a22cbc7b5 100644 --- a/doc/en/changelog.rst +++ b/doc/en/changelog.rst @@ -28,6 +28,98 @@ with advance notice in the **Deprecations** section of releases. .. towncrier release notes start +pytest 7.1.0 (2022-03-13) +========================= + +Breaking Changes +---------------- + +- `#8838 `_: As per our policy, the following features have been deprecated in the 6.X series and are now + removed: + + * ``pytest._fillfuncargs`` function. + + * ``pytest_warning_captured`` hook - use ``pytest_warning_recorded`` instead. + + * ``-k -foobar`` syntax - use ``-k 'not foobar'`` instead. + + * ``-k foobar:`` syntax. + + * ``pytest.collect`` module - import from ``pytest`` directly. + + For more information consult + `Deprecations and Removals `__ in the docs. + + +- `#9437 `_: Dropped support for Python 3.6, which reached `end-of-life `__ at 2021-12-23. + + + +Improvements +------------ + +- `#5192 `_: Fixed test output for some data types where ``-v`` would show less information. + + Also, when showing diffs for sequences, ``-q`` would produce full diffs instead of the expected diff. + + +- `#9362 `_: pytest now avoids specialized assert formatting when it is detected that the default ``__eq__`` is overridden in ``attrs`` or ``dataclasses``. + + +- `#9536 `_: When ``-vv`` is given on command line, show skipping and xfail reasons in full instead of truncating them to fit the terminal width. + + +- `#9644 `_: More information about the location of resources that led Python to raise :class:`ResourceWarning` can now + be obtained by enabling :mod:`tracemalloc`. + + See :ref:`resource-warnings` for more information. + + +- `#9678 `_: More types are now accepted in the ``ids`` argument to ``@pytest.mark.parametrize``. + Previously only `str`, `float`, `int` and `bool` were accepted; + now `bytes`, `complex`, `re.Pattern`, `Enum` and anything with a `__name__` are also accepted. + + +- `#9692 `_: :func:`pytest.approx` now raises a :class:`TypeError` when given an unordered sequence (such as :class:`set`). + + Note that this implies that custom classes which only implement ``__iter__`` and ``__len__`` are no longer supported as they don't guarantee order. + + + +Bug Fixes +--------- + +- `#8242 `_: The deprecation of raising :class:`unittest.SkipTest` to skip collection of + tests during the pytest collection phase is reverted - this is now a supported + feature again. + + +- `#9493 `_: Symbolic link components are no longer resolved in conftest paths. + This means that if a conftest appears twice in collection tree, using symlinks, it will be executed twice. + For example, given + + tests/real/conftest.py + tests/real/test_it.py + tests/link -> tests/real + + running ``pytest tests`` now imports the conftest twice, once as ``tests/real/conftest.py`` and once as ``tests/link/conftest.py``. + This is a fix to match a similar change made to test collection itself in pytest 6.0 (see :pull:`6523` for details). + + +- `#9626 `_: Fixed count of selected tests on terminal collection summary when there were errors or skipped modules. + + If there were errors or skipped modules on collection, pytest would mistakenly subtract those from the selected count. + + +- `#9645 `_: Fixed regression where ``--import-mode=importlib`` used together with :envvar:`PYTHONPATH` or :confval:`pythonpath` would cause import errors in test suites. + + +- `#9708 `_: :fixture:`pytester` now requests a :fixture:`monkeypatch` fixture instead of creating one internally. This solves some issues with tests that involve pytest environment variables. + + +- `#9730 `_: Malformed ``pyproject.toml`` files now produce a clearer error message. + + pytest 7.0.1 (2022-02-11) ========================= diff --git a/doc/en/example/reportingdemo.rst b/doc/en/example/reportingdemo.rst index cab93143615..4c1ae1c05af 100644 --- a/doc/en/example/reportingdemo.rst +++ b/doc/en/example/reportingdemo.rst @@ -155,7 +155,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: > assert [0, 1, 2] == [0, 1, 3] E assert [0, 1, 2] == [0, 1, 3] E At index 2 diff: 2 != 3 - E Use -v to get the full diff + E Use -v to get more diff failure_demo.py:63: AssertionError ______________ TestSpecialisedExplanations.test_eq_list_long _______________ @@ -168,7 +168,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: > assert a == b E assert [0, 0, 0, 0, 0, 0, ...] == [0, 0, 0, 0, 0, 0, ...] E At index 100 diff: 1 != 2 - E Use -v to get the full diff + E Use -v to get more diff failure_demo.py:68: AssertionError _________________ TestSpecialisedExplanations.test_eq_dict _________________ @@ -215,7 +215,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: > assert [1, 2] == [1, 2, 3] E assert [1, 2] == [1, 2, 3] E Right contains one more item: 3 - E Use -v to get the full diff + E Use -v to get more diff failure_demo.py:77: AssertionError _________________ TestSpecialisedExplanations.test_in_list _________________ diff --git a/doc/en/getting-started.rst b/doc/en/getting-started.rst index 79b88ced9e1..73f6fc53b48 100644 --- a/doc/en/getting-started.rst +++ b/doc/en/getting-started.rst @@ -22,7 +22,7 @@ Install ``pytest`` .. code-block:: bash $ pytest --version - pytest 7.0.1 + pytest 7.1.0 .. _`simpletest`: diff --git a/doc/en/how-to/assert.rst b/doc/en/how-to/assert.rst index cb70db6b8ed..65f16129142 100644 --- a/doc/en/how-to/assert.rst +++ b/doc/en/how-to/assert.rst @@ -201,7 +201,7 @@ if you run this module: E '1' E Extra items in the right set: E '5' - E Use -v to get the full diff + E Use -v to get more diff test_assert2.py:4: AssertionError ========================= short test summary info ========================== diff --git a/doc/en/how-to/output.rst b/doc/en/how-to/output.rst index 4b90988f49d..dc3a86ba29d 100644 --- a/doc/en/how-to/output.rst +++ b/doc/en/how-to/output.rst @@ -84,7 +84,7 @@ Executing pytest normally gives us this output (we are skipping the header to fo > assert fruits1 == fruits2 E AssertionError: assert ['banana', 'a...elon', 'kiwi'] == ['banana', 'a...elon', 'kiwi'] E At index 2 diff: 'grapes' != 'orange' - E Use -v to get the full diff + E Use -v to get more diff test_verbosity_example.py:8: AssertionError ____________________________ test_numbers_fail _____________________________ @@ -99,7 +99,7 @@ Executing pytest normally gives us this output (we are skipping the header to fo E {'1': 1, '2': 2, '3': 3, '4': 4} E Right contains 4 more items: E {'10': 10, '20': 20, '30': 30, '40': 40} - E Use -v to get the full diff + E Use -v to get more diff test_verbosity_example.py:14: AssertionError ___________________________ test_long_text_fail ____________________________