From 3af3f569d5394bb1a18426b0d57a04a094800974 Mon Sep 17 00:00:00 2001 From: pytest bot Date: Sun, 23 Oct 2022 20:28:15 +0000 Subject: [PATCH] Prepare release version 7.2.0 --- changelog/10012.deprecation.rst | 1 - changelog/10150.bugfix.rst | 1 - changelog/10196.trivial.rst | 1 - changelog/10218.improvement.rst | 5 - changelog/10313.trivial.rst | 3 - changelog/10344.doc.rst | 1 - changelog/10381.improvement.rst | 1 - changelog/10382.bugfix.rst | 1 - changelog/10396.deprecation.rst | 1 - changelog/3426.improvement.rst | 1 - changelog/4562.deprecation.rst | 4 - changelog/7337.improvement.rst | 1 - changelog/7792.bugfix.rst | 5 - changelog/8508.improvement.rst | 2 - changelog/8646.improvement.rst | 2 - changelog/9159.bugfix.rst | 1 - changelog/9248.doc.rst | 1 - changelog/9291.doc.rst | 1 - changelog/9741.improvement.rst | 3 - changelog/9742.improvement.rst | 1 - changelog/9823.improvement.rst | 1 - changelog/9873.improvement.rst | 1 - changelog/9877.bugfix.rst | 1 - changelog/9883.improvement.rst | 1 - changelog/9886.deprecation.rst | 10 -- changelog/9897.feature.rst | 1 - changelog/9906.trivial.rst | 1 - changelog/9910.trivial.rst | 1 - changelog/9920.improvement.rst | 1 - changelog/9984.trivial.rst | 4 - changelog/9987.improvement.rst | 1 - doc/en/announce/index.rst | 1 + doc/en/announce/release-7.2.0.rst | 93 +++++++++++++++++++ doc/en/builtin.rst | 27 +++--- doc/en/changelog.rst | 148 ++++++++++++++++++++++++++++++ doc/en/example/markers.rst | 10 +- doc/en/example/simple.rst | 3 +- doc/en/getting-started.rst | 2 +- doc/en/how-to/cache.rst | 4 +- doc/en/how-to/output.rst | 3 +- doc/en/how-to/unittest.rst | 4 +- doc/en/reference/reference.rst | 69 +++++++------- 42 files changed, 302 insertions(+), 122 deletions(-) delete mode 100644 changelog/10012.deprecation.rst delete mode 100644 changelog/10150.bugfix.rst delete mode 100644 changelog/10196.trivial.rst delete mode 100644 changelog/10218.improvement.rst delete mode 100644 changelog/10313.trivial.rst delete mode 100644 changelog/10344.doc.rst delete mode 100644 changelog/10381.improvement.rst delete mode 100644 changelog/10382.bugfix.rst delete mode 100644 changelog/10396.deprecation.rst delete mode 100644 changelog/3426.improvement.rst delete mode 100644 changelog/4562.deprecation.rst delete mode 100644 changelog/7337.improvement.rst delete mode 100644 changelog/7792.bugfix.rst delete mode 100644 changelog/8508.improvement.rst delete mode 100644 changelog/8646.improvement.rst delete mode 100644 changelog/9159.bugfix.rst delete mode 100644 changelog/9248.doc.rst delete mode 100644 changelog/9291.doc.rst delete mode 100644 changelog/9741.improvement.rst delete mode 100644 changelog/9742.improvement.rst delete mode 100644 changelog/9823.improvement.rst delete mode 100644 changelog/9873.improvement.rst delete mode 100644 changelog/9877.bugfix.rst delete mode 100644 changelog/9883.improvement.rst delete mode 100644 changelog/9886.deprecation.rst delete mode 100644 changelog/9897.feature.rst delete mode 100644 changelog/9906.trivial.rst delete mode 100644 changelog/9910.trivial.rst delete mode 100644 changelog/9920.improvement.rst delete mode 100644 changelog/9984.trivial.rst delete mode 100644 changelog/9987.improvement.rst create mode 100644 doc/en/announce/release-7.2.0.rst diff --git a/changelog/10012.deprecation.rst b/changelog/10012.deprecation.rst deleted file mode 100644 index 66681263e32..00000000000 --- a/changelog/10012.deprecation.rst +++ /dev/null @@ -1 +0,0 @@ -Update :class:`pytest.PytestUnhandledCoroutineWarning` to a deprecation; it will raise an error in pytest 8. diff --git a/changelog/10150.bugfix.rst b/changelog/10150.bugfix.rst deleted file mode 100644 index 24c7ccd355a..00000000000 --- a/changelog/10150.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -:data:`sys.stdin` now contains all expected methods of a file-like object when capture is enabled. diff --git a/changelog/10196.trivial.rst b/changelog/10196.trivial.rst deleted file mode 100644 index edf458f84c5..00000000000 --- a/changelog/10196.trivial.rst +++ /dev/null @@ -1 +0,0 @@ -:class:`~pytest.PytestReturnNotNoneWarning` is now a subclass of :class:`~pytest.PytestRemovedIn8Warning`: the plan is to make returning non-``None`` from tests an error in the future. diff --git a/changelog/10218.improvement.rst b/changelog/10218.improvement.rst deleted file mode 100644 index e00325e2567..00000000000 --- a/changelog/10218.improvement.rst +++ /dev/null @@ -1,5 +0,0 @@ -``@pytest.mark.parametrize()`` (and similar functions) now accepts any ``Sequence[str]`` for the argument names, -instead of just ``list[str]`` and ``tuple[str, ...]``. - -(Note that ``str``, which is itself a ``Sequence[str]``, is still treated as a -comma-delimited name list, as before). diff --git a/changelog/10313.trivial.rst b/changelog/10313.trivial.rst deleted file mode 100644 index 8203b580211..00000000000 --- a/changelog/10313.trivial.rst +++ /dev/null @@ -1,3 +0,0 @@ -Made ``_pytest.doctest.DoctestItem`` export ``pytest.DoctestItem`` for -type check and runtime purposes. Made `_pytest.doctest` use internal APIs -to avoid circular imports. diff --git a/changelog/10344.doc.rst b/changelog/10344.doc.rst deleted file mode 100644 index 1c7885edc20..00000000000 --- a/changelog/10344.doc.rst +++ /dev/null @@ -1 +0,0 @@ -Update information on writing plugins to use ``pyproject.toml`` instead of ``setup.py``. diff --git a/changelog/10381.improvement.rst b/changelog/10381.improvement.rst deleted file mode 100644 index f979a83b132..00000000000 --- a/changelog/10381.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -The ``--no-showlocals`` flag has been added. This can be passed directly to tests to override ``--showlocals`` declared through ``addopts``. diff --git a/changelog/10382.bugfix.rst b/changelog/10382.bugfix.rst deleted file mode 100644 index 5876a9a43c2..00000000000 --- a/changelog/10382.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Do not break into pdb when ``raise unittest.SkipTest()`` appears top-level in a file. diff --git a/changelog/10396.deprecation.rst b/changelog/10396.deprecation.rst deleted file mode 100644 index 84461e82ede..00000000000 --- a/changelog/10396.deprecation.rst +++ /dev/null @@ -1 +0,0 @@ -pytest no longer depends on the ``py`` library. ``pytest`` provides a vendored copy of ``py.error`` and ``py.path`` modules but will use the ``py`` library if it is installed. If you need other ``py.*`` modules, continue to install the deprecated ``py`` library separately, otherwise it can usually be removed as a dependency. diff --git a/changelog/3426.improvement.rst b/changelog/3426.improvement.rst deleted file mode 100644 index e232d56aa6a..00000000000 --- a/changelog/3426.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -Assertion failures with strings in NFC and NFD forms that normalize to the same string now have a dedicated error message detailing the issue, and their utf-8 representation is expresed instead. diff --git a/changelog/4562.deprecation.rst b/changelog/4562.deprecation.rst deleted file mode 100644 index d459801d4a6..00000000000 --- a/changelog/4562.deprecation.rst +++ /dev/null @@ -1,4 +0,0 @@ -Deprecate configuring hook specs/impls using attributes/marks. - -Instead use :py:func:`pytest.hookimpl` and :py:func:`pytest.hookspec`. -For more details, see the :ref:`docs `. diff --git a/changelog/7337.improvement.rst b/changelog/7337.improvement.rst deleted file mode 100644 index 74d98d9b6c9..00000000000 --- a/changelog/7337.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -A warning is now emitted if a test function returns something other than `None`. This prevents a common mistake among beginners that expect that returning a `bool` (for example `return foo(a, b) == result`) would cause a test to pass or fail, instead of using `assert`. diff --git a/changelog/7792.bugfix.rst b/changelog/7792.bugfix.rst deleted file mode 100644 index 8f65637896d..00000000000 --- a/changelog/7792.bugfix.rst +++ /dev/null @@ -1,5 +0,0 @@ -Marks are now inherited according to the full MRO in test classes. Previously, if a test class inherited from two or more classes, only marks from the first super-class would apply. - -When inheriting marks from super-classes, marks from the sub-classes are now ordered before marks from the super-classes, in MRO order. Previously it was the reverse. - -When inheriting marks from super-classes, the `pytestmark` attribute of the sub-class now only contains the marks directly applied to it. Previously, it also contained marks from its super-classes. Please note that this attribute should not normally be accessed directly; use :func:`pytest.Node.iter_markers` instead. diff --git a/changelog/8508.improvement.rst b/changelog/8508.improvement.rst deleted file mode 100644 index 36fb945829c..00000000000 --- a/changelog/8508.improvement.rst +++ /dev/null @@ -1,2 +0,0 @@ -Introduce multiline display for warning matching via :py:func:`pytest.warns` and -enhance match comparison for :py:func:`_pytest._code.ExceptionInfo.match` as returned by :py:func:`pytest.raises`. diff --git a/changelog/8646.improvement.rst b/changelog/8646.improvement.rst deleted file mode 100644 index 9691c143429..00000000000 --- a/changelog/8646.improvement.rst +++ /dev/null @@ -1,2 +0,0 @@ -Improve :py:func:`pytest.raises`. Previously passing an empty tuple would give a confusing -error. We now raise immediately with a more helpful message. diff --git a/changelog/9159.bugfix.rst b/changelog/9159.bugfix.rst deleted file mode 100644 index 5e7f0a3014d..00000000000 --- a/changelog/9159.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Showing inner exceptions by forcing native display in ``ExceptionGroups`` even when using display options other than ``--tb=native``. A temporary step before full implementation of pytest-native display for inner exceptions in ``ExceptionGroups``. diff --git a/changelog/9248.doc.rst b/changelog/9248.doc.rst deleted file mode 100644 index 755e7b0f1af..00000000000 --- a/changelog/9248.doc.rst +++ /dev/null @@ -1 +0,0 @@ -The documentation is now built using Sphinx 5.x (up from 3.x previously). diff --git a/changelog/9291.doc.rst b/changelog/9291.doc.rst deleted file mode 100644 index fad8467dc90..00000000000 --- a/changelog/9291.doc.rst +++ /dev/null @@ -1 +0,0 @@ -Update documentation on how :func:`pytest.warns` affects :class:`DeprecationWarning`. diff --git a/changelog/9741.improvement.rst b/changelog/9741.improvement.rst deleted file mode 100644 index 1f9ab3eadf2..00000000000 --- a/changelog/9741.improvement.rst +++ /dev/null @@ -1,3 +0,0 @@ -On Python 3.11, use the standard library's :mod:`tomllib` to parse TOML. - -:mod:`tomli`` is no longer a dependency on Python 3.11. diff --git a/changelog/9742.improvement.rst b/changelog/9742.improvement.rst deleted file mode 100644 index a1abfc27469..00000000000 --- a/changelog/9742.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -Display assertion message without escaped newline characters with ``-vv``. diff --git a/changelog/9823.improvement.rst b/changelog/9823.improvement.rst deleted file mode 100644 index 0a14cab6743..00000000000 --- a/changelog/9823.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -Improved error message that is shown when no collector is found for a given file. diff --git a/changelog/9873.improvement.rst b/changelog/9873.improvement.rst deleted file mode 100644 index 431f9861b62..00000000000 --- a/changelog/9873.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -Some coloring has been added to the short test summary. diff --git a/changelog/9877.bugfix.rst b/changelog/9877.bugfix.rst deleted file mode 100644 index 1d2264c6157..00000000000 --- a/changelog/9877.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Ensure ``caplog.get_records(when)`` returns current/correct data after invoking ``caplog.clear()``. diff --git a/changelog/9883.improvement.rst b/changelog/9883.improvement.rst deleted file mode 100644 index 180784b5dba..00000000000 --- a/changelog/9883.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -Normalize the help description of all command-line options. diff --git a/changelog/9886.deprecation.rst b/changelog/9886.deprecation.rst deleted file mode 100644 index 94f51decfda..00000000000 --- a/changelog/9886.deprecation.rst +++ /dev/null @@ -1,10 +0,0 @@ -The functionality for running tests written for ``nose`` has been officially deprecated. - -This includes: - -* Plain ``setup`` and ``teardown`` functions and methods: this might catch users by surprise, as ``setup()`` and ``teardown()`` are not pytest idioms, but part of the ``nose`` support. -* Setup/teardown using the `@with_setup `_ decorator. - -For more details, consult the :ref:`deprecation docs `. - -.. _`with-setup-nose`: https://nose.readthedocs.io/en/latest/testing_tools.html?highlight=with_setup#nose.tools.with_setup diff --git a/changelog/9897.feature.rst b/changelog/9897.feature.rst deleted file mode 100644 index 7464067bfcd..00000000000 --- a/changelog/9897.feature.rst +++ /dev/null @@ -1 +0,0 @@ -Added shell-style wildcard support to ``testpaths``. diff --git a/changelog/9906.trivial.rst b/changelog/9906.trivial.rst deleted file mode 100644 index 8911b7190f6..00000000000 --- a/changelog/9906.trivial.rst +++ /dev/null @@ -1 +0,0 @@ -Made ``_pytest.compat`` re-export ``importlib_metadata`` in the eyes of type checkers. diff --git a/changelog/9910.trivial.rst b/changelog/9910.trivial.rst deleted file mode 100644 index 4b1a4683c1e..00000000000 --- a/changelog/9910.trivial.rst +++ /dev/null @@ -1 +0,0 @@ -Fix default encoding warning (``EncodingWarning``) in ``cacheprovider`` diff --git a/changelog/9920.improvement.rst b/changelog/9920.improvement.rst deleted file mode 100644 index ed47e872cac..00000000000 --- a/changelog/9920.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -Display full crash messages in ``short test summary info``, when runng in a CI environment. diff --git a/changelog/9984.trivial.rst b/changelog/9984.trivial.rst deleted file mode 100644 index cca8170629c..00000000000 --- a/changelog/9984.trivial.rst +++ /dev/null @@ -1,4 +0,0 @@ -Improve the error message when we attempt to access a fixture that has been -torn down. -Add an additional sentence to the docstring explaining when it's not a good -idea to call getfixturevalue. diff --git a/changelog/9987.improvement.rst b/changelog/9987.improvement.rst deleted file mode 100644 index cb1ae17ad2c..00000000000 --- a/changelog/9987.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -Added support for hidden configuration file by allowing ``.pytest.ini`` as an alternative to ``pytest.ini``. diff --git a/doc/en/announce/index.rst b/doc/en/announce/index.rst index 142425cdee7..021cbd1af39 100644 --- a/doc/en/announce/index.rst +++ b/doc/en/announce/index.rst @@ -6,6 +6,7 @@ Release announcements :maxdepth: 2 + release-7.2.0 release-7.1.3 release-7.1.2 release-7.1.1 diff --git a/doc/en/announce/release-7.2.0.rst b/doc/en/announce/release-7.2.0.rst new file mode 100644 index 00000000000..eca84aeb669 --- /dev/null +++ b/doc/en/announce/release-7.2.0.rst @@ -0,0 +1,93 @@ +pytest-7.2.0 +======================================= + +The pytest team is proud to announce the 7.2.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: + +* Aaron Berdy +* Adam Turner +* Albert Villanova del Moral +* Alice Purcell +* Anthony Sottile +* Anton Yakutovich +* Babak Keyvani +* Brandon Chinn +* Bruno Oliveira +* Chanvin Xiao +* Cheuk Ting Ho +* Chris Wheeler +* EmptyRabbit +* Ezio Melotti +* Florian Best +* Florian Bruhin +* Fredrik Berndtsson +* Gabriel Landau +* Gergely Kalmár +* Hugo van Kemenade +* James Gerity +* John Litborn +* Jon Parise +* Kevin C +* Kian Eliasi +* MatthewFlamm +* Miro Hrončok +* Nate Meyvis +* Neil Girdhar +* Nhieuvu1802 +* Nipunn Koorapati +* Ofek Lev +* Paul Müller +* Paul Reece +* Pax +* Pete Baughman +* Peyman Salehi +* Philipp A +* Ran Benita +* Robert O'Shea +* Ronny Pfannschmidt +* Rowin +* Ruth Comer +* Samuel Colvin +* Samuel Gaist +* Sandro Tosi +* Shantanu +* Simon K +* Stephen Rosen +* Sviatoslav Sydorenko +* Tatiana Ovary +* Thierry Moisan +* Thomas Grainger +* Tim Hoffmann +* Tobias Diez +* Tony Narlock +* Vivaan Verma +* Wolfremium +* Zac Hatfield-Dodds +* Zach OBrien +* aizpurua23a +* gresm +* holesch +* itxasos23 +* johnkangw +* skhomuti +* sommersoft +* wodny +* zx.qiu + + +Happy testing, +The pytest Development Team diff --git a/doc/en/builtin.rst b/doc/en/builtin.rst index 7e22002245d..1f55ea156fc 100644 --- a/doc/en/builtin.rst +++ b/doc/en/builtin.rst @@ -33,7 +33,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a Values can be any object handled by the json stdlib module. - capsys -- .../_pytest/capture.py:878 + capsys -- .../_pytest/capture.py:905 Enable text capturing of writes to ``sys.stdout`` and ``sys.stderr``. The captured output is made available via ``capsys.readouterr()`` method @@ -51,7 +51,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a captured = capsys.readouterr() assert captured.out == "hello\n" - capsysbinary -- .../_pytest/capture.py:906 + capsysbinary -- .../_pytest/capture.py:933 Enable bytes capturing of writes to ``sys.stdout`` and ``sys.stderr``. The captured output is made available via ``capsysbinary.readouterr()`` @@ -69,7 +69,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a captured = capsysbinary.readouterr() assert captured.out == b"hello\n" - capfd -- .../_pytest/capture.py:934 + capfd -- .../_pytest/capture.py:961 Enable text capturing of writes to file descriptors ``1`` and ``2``. The captured output is made available via ``capfd.readouterr()`` method @@ -87,7 +87,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a captured = capfd.readouterr() assert captured.out == "hello\n" - capfdbinary -- .../_pytest/capture.py:962 + capfdbinary -- .../_pytest/capture.py:989 Enable bytes capturing of writes to file descriptors ``1`` and ``2``. The captured output is made available via ``capfd.readouterr()`` method @@ -105,7 +105,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a captured = capfdbinary.readouterr() assert captured.out == b"hello\n" - doctest_namespace [session scope] -- .../_pytest/doctest.py:735 + doctest_namespace [session scope] -- .../_pytest/doctest.py:738 Fixture that returns a :py:class:`dict` that will be injected into the namespace of doctests. @@ -119,7 +119,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a For more details: :ref:`doctest_namespace`. - pytestconfig [session scope] -- .../_pytest/fixtures.py:1344 + pytestconfig [session scope] -- .../_pytest/fixtures.py:1351 Session-scoped fixture that returns the session's :class:`pytest.Config` object. @@ -163,7 +163,10 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a record_testsuite_property("ARCH", "PPC") record_testsuite_property("STORAGE_TYPE", "CEPH") - ``name`` must be a string, ``value`` will be converted to a string and properly xml-escaped. + :param name: + The property name. + :param value: + The property value. Will be converted to a string. .. warning:: @@ -193,7 +196,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:487 + caplog -- .../_pytest/logging.py:491 Access and control log capturing. Captured logs are available through the following properties/methods:: @@ -228,16 +231,16 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a To undo modifications done by the fixture in a contained scope, use :meth:`context() `. - recwarn -- .../_pytest/recwarn.py:29 + recwarn -- .../_pytest/recwarn.py:30 Return a :class:`WarningsRecorder` instance that records all warnings emitted by test functions. - See https://docs.python.org/library/how-to/capture-warnings.html for information + See https://docs.pytest.org/en/latest/how-to/capture-warnings.html for information on warning categories. - tmp_path_factory [session scope] -- .../_pytest/tmpdir.py:184 + tmp_path_factory [session scope] -- .../_pytest/tmpdir.py:188 Return a :class:`pytest.TempPathFactory` instance for the test session. - tmp_path -- .../_pytest/tmpdir.py:199 + tmp_path -- .../_pytest/tmpdir.py:203 Return a temporary directory path object which is unique to each test function invocation, created as a sub directory of the base temporary directory. diff --git a/doc/en/changelog.rst b/doc/en/changelog.rst index ef3a241cdb1..53ddafc52e7 100644 --- a/doc/en/changelog.rst +++ b/doc/en/changelog.rst @@ -28,6 +28,154 @@ with advance notice in the **Deprecations** section of releases. .. towncrier release notes start +pytest 7.2.0 (2022-10-23) +========================= + +Deprecations +------------ + +- `#10012 `_: Update :class:`pytest.PytestUnhandledCoroutineWarning` to a deprecation; it will raise an error in pytest 8. + + +- `#10396 `_: pytest no longer depends on the ``py`` library. ``pytest`` provides a vendored copy of ``py.error`` and ``py.path`` modules but will use the ``py`` library if it is installed. If you need other ``py.*`` modules, continue to install the deprecated ``py`` library separately, otherwise it can usually be removed as a dependency. + + +- `#4562 `_: Deprecate configuring hook specs/impls using attributes/marks. + + Instead use :py:func:`pytest.hookimpl` and :py:func:`pytest.hookspec`. + For more details, see the :ref:`docs `. + + +- `#9886 `_: The functionality for running tests written for ``nose`` has been officially deprecated. + + This includes: + + * Plain ``setup`` and ``teardown`` functions and methods: this might catch users by surprise, as ``setup()`` and ``teardown()`` are not pytest idioms, but part of the ``nose`` support. + * Setup/teardown using the `@with_setup `_ decorator. + + For more details, consult the :ref:`deprecation docs `. + + .. _`with-setup-nose`: https://nose.readthedocs.io/en/latest/testing_tools.html?highlight=with_setup#nose.tools.with_setup + + + +Features +-------- + +- `#9897 `_: Added shell-style wildcard support to ``testpaths``. + + + +Improvements +------------ + +- `#10218 `_: ``@pytest.mark.parametrize()`` (and similar functions) now accepts any ``Sequence[str]`` for the argument names, + instead of just ``list[str]`` and ``tuple[str, ...]``. + + (Note that ``str``, which is itself a ``Sequence[str]``, is still treated as a + comma-delimited name list, as before). + + +- `#10381 `_: The ``--no-showlocals`` flag has been added. This can be passed directly to tests to override ``--showlocals`` declared through ``addopts``. + + +- `#3426 `_: Assertion failures with strings in NFC and NFD forms that normalize to the same string now have a dedicated error message detailing the issue, and their utf-8 representation is expresed instead. + + +- `#7337 `_: A warning is now emitted if a test function returns something other than `None`. This prevents a common mistake among beginners that expect that returning a `bool` (for example `return foo(a, b) == result`) would cause a test to pass or fail, instead of using `assert`. + + +- `#8508 `_: Introduce multiline display for warning matching via :py:func:`pytest.warns` and + enhance match comparison for :py:func:`_pytest._code.ExceptionInfo.match` as returned by :py:func:`pytest.raises`. + + +- `#8646 `_: Improve :py:func:`pytest.raises`. Previously passing an empty tuple would give a confusing + error. We now raise immediately with a more helpful message. + + +- `#9741 `_: On Python 3.11, use the standard library's :mod:`tomllib` to parse TOML. + + :mod:`tomli`` is no longer a dependency on Python 3.11. + + +- `#9742 `_: Display assertion message without escaped newline characters with ``-vv``. + + +- `#9823 `_: Improved error message that is shown when no collector is found for a given file. + + +- `#9873 `_: Some coloring has been added to the short test summary. + + +- `#9883 `_: Normalize the help description of all command-line options. + + +- `#9920 `_: Display full crash messages in ``short test summary info``, when runng in a CI environment. + + +- `#9987 `_: Added support for hidden configuration file by allowing ``.pytest.ini`` as an alternative to ``pytest.ini``. + + + +Bug Fixes +--------- + +- `#10150 `_: :data:`sys.stdin` now contains all expected methods of a file-like object when capture is enabled. + + +- `#10382 `_: Do not break into pdb when ``raise unittest.SkipTest()`` appears top-level in a file. + + +- `#7792 `_: Marks are now inherited according to the full MRO in test classes. Previously, if a test class inherited from two or more classes, only marks from the first super-class would apply. + + When inheriting marks from super-classes, marks from the sub-classes are now ordered before marks from the super-classes, in MRO order. Previously it was the reverse. + + When inheriting marks from super-classes, the `pytestmark` attribute of the sub-class now only contains the marks directly applied to it. Previously, it also contained marks from its super-classes. Please note that this attribute should not normally be accessed directly; use :func:`pytest.Node.iter_markers` instead. + + +- `#9159 `_: Showing inner exceptions by forcing native display in ``ExceptionGroups`` even when using display options other than ``--tb=native``. A temporary step before full implementation of pytest-native display for inner exceptions in ``ExceptionGroups``. + + +- `#9877 `_: Ensure ``caplog.get_records(when)`` returns current/correct data after invoking ``caplog.clear()``. + + + +Improved Documentation +---------------------- + +- `#10344 `_: Update information on writing plugins to use ``pyproject.toml`` instead of ``setup.py``. + + +- `#9248 `_: The documentation is now built using Sphinx 5.x (up from 3.x previously). + + +- `#9291 `_: Update documentation on how :func:`pytest.warns` affects :class:`DeprecationWarning`. + + + +Trivial/Internal Changes +------------------------ + +- `#10196 `_: :class:`~pytest.PytestReturnNotNoneWarning` is now a subclass of :class:`~pytest.PytestRemovedIn8Warning`: the plan is to make returning non-``None`` from tests an error in the future. + + +- `#10313 `_: Made ``_pytest.doctest.DoctestItem`` export ``pytest.DoctestItem`` for + type check and runtime purposes. Made `_pytest.doctest` use internal APIs + to avoid circular imports. + + +- `#9906 `_: Made ``_pytest.compat`` re-export ``importlib_metadata`` in the eyes of type checkers. + + +- `#9910 `_: Fix default encoding warning (``EncodingWarning``) in ``cacheprovider`` + + +- `#9984 `_: Improve the error message when we attempt to access a fixture that has been + torn down. + Add an additional sentence to the docstring explaining when it's not a good + idea to call getfixturevalue. + + pytest 7.1.3 (2022-08-31) ========================= diff --git a/doc/en/example/markers.rst b/doc/en/example/markers.rst index 34d96c2bc00..55fd1f576cf 100644 --- a/doc/en/example/markers.rst +++ b/doc/en/example/markers.rst @@ -246,9 +246,9 @@ You can ask which markers exist for your test suite - the list includes our just @pytest.mark.usefixtures(fixturename1, fixturename2, ...): mark tests as needing all of the specified fixtures. see https://docs.pytest.org/en/stable/explanation/fixtures.html#usefixtures - @pytest.mark.tryfirst: mark a hook implementation function such that the plugin machinery will try to call it first/as early as possible. + @pytest.mark.tryfirst: mark a hook implementation function such that the plugin machinery will try to call it first/as early as possible. DEPRECATED, use @pytest.hookimpl(tryfirst=True) instead. - @pytest.mark.trylast: mark a hook implementation function such that the plugin machinery will try to call it last/as late as possible. + @pytest.mark.trylast: mark a hook implementation function such that the plugin machinery will try to call it last/as late as possible. DEPRECATED, use @pytest.hookimpl(trylast=True) instead. For an example on how to add and work with markers from a plugin, see @@ -438,9 +438,9 @@ The ``--markers`` option always gives you a list of available markers: @pytest.mark.usefixtures(fixturename1, fixturename2, ...): mark tests as needing all of the specified fixtures. see https://docs.pytest.org/en/stable/explanation/fixtures.html#usefixtures - @pytest.mark.tryfirst: mark a hook implementation function such that the plugin machinery will try to call it first/as early as possible. + @pytest.mark.tryfirst: mark a hook implementation function such that the plugin machinery will try to call it first/as early as possible. DEPRECATED, use @pytest.hookimpl(tryfirst=True) instead. - @pytest.mark.trylast: mark a hook implementation function such that the plugin machinery will try to call it last/as late as possible. + @pytest.mark.trylast: mark a hook implementation function such that the plugin machinery will try to call it last/as late as possible. DEPRECATED, use @pytest.hookimpl(trylast=True) instead. .. _`passing callables to custom markers`: @@ -611,7 +611,7 @@ then you will see two tests skipped and two executed tests as expected: test_plat.py s.s. [100%] ========================= short test summary info ========================== - SKIPPED [2] conftest.py:12: cannot run on platform linux + SKIPPED [2] conftest.py:13: cannot run on platform linux ======================= 2 passed, 2 skipped in 0.12s ======================= Note that if you specify a platform via the marker-command line option like this: diff --git a/doc/en/example/simple.rst b/doc/en/example/simple.rst index ba1acdfd164..e62060f191c 100644 --- a/doc/en/example/simple.rst +++ b/doc/en/example/simple.rst @@ -661,8 +661,7 @@ If we run this: test_step.py:11: AssertionError ========================= short test summary info ========================== - XFAIL test_step.py::TestUserHandling::test_deletion - reason: previous test failed (test_modification) + XFAIL test_step.py::TestUserHandling::test_deletion - reason: previous test failed (test_modification) ================== 1 failed, 2 passed, 1 xfailed in 0.12s ================== We'll see that ``test_deletion`` was not executed because ``test_modification`` diff --git a/doc/en/getting-started.rst b/doc/en/getting-started.rst index ce8ce815260..971982c2ce8 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.1.3 + pytest 7.2.0 .. _`simpletest`: diff --git a/doc/en/how-to/cache.rst b/doc/en/how-to/cache.rst index 529d97d53fb..8554a984c72 100644 --- a/doc/en/how-to/cache.rst +++ b/doc/en/how-to/cache.rst @@ -233,7 +233,7 @@ If you run this command for the first time, you can see the print statement: > assert mydata == 23 E assert 42 == 23 - test_caching.py:20: AssertionError + test_caching.py:19: AssertionError -------------------------- Captured stdout setup --------------------------- running expensive computation... ========================= short test summary info ========================== @@ -256,7 +256,7 @@ the cache and nothing will be printed: > assert mydata == 23 E assert 42 == 23 - test_caching.py:20: AssertionError + test_caching.py:19: AssertionError ========================= short test summary info ========================== FAILED test_caching.py::test_function - assert 42 == 23 1 failed in 0.12s diff --git a/doc/en/how-to/output.rst b/doc/en/how-to/output.rst index 85081a47c61..7d900ce3fdb 100644 --- a/doc/en/how-to/output.rst +++ b/doc/en/how-to/output.rst @@ -349,8 +349,7 @@ Example: test_example.py:14: AssertionError ========================= short test summary info ========================== SKIPPED [1] test_example.py:22: skipping this test - XFAIL test_example.py::test_xfail - reason: xfailing this test + XFAIL test_example.py::test_xfail - reason: xfailing this test XPASS test_example.py::test_xpass always xfail ERROR test_example.py::test_error - assert 0 FAILED test_example.py::test_fail - assert 0 diff --git a/doc/en/how-to/unittest.rst b/doc/en/how-to/unittest.rst index 658c69a14fd..37caf6e9fb7 100644 --- a/doc/en/how-to/unittest.rst +++ b/doc/en/how-to/unittest.rst @@ -157,7 +157,7 @@ the ``self.db`` values in the traceback: E AssertionError: .DummyDB object at 0xdeadbeef0001> E assert 0 - test_unittest_db.py:10: AssertionError + test_unittest_db.py:11: AssertionError ___________________________ MyTest.test_method2 ____________________________ self = @@ -167,7 +167,7 @@ the ``self.db`` values in the traceback: E AssertionError: .DummyDB object at 0xdeadbeef0001> E assert 0 - test_unittest_db.py:13: AssertionError + test_unittest_db.py:14: AssertionError ========================= short test summary info ========================== FAILED test_unittest_db.py::MyTest::test_method1 - AssertionError: