Skip to content

Commit

Permalink
Merge pull request #12260 from nicoddemus/cherry-pick-release
Browse files Browse the repository at this point in the history
Cherry-pick release pytest-dev/release-8.2.0
  • Loading branch information
nicoddemus authored Apr 27, 2024
2 parents 835765c + 79ca819 commit 9eecdc7
Show file tree
Hide file tree
Showing 22 changed files with 188 additions and 56 deletions.
5 changes: 0 additions & 5 deletions changelog/11523.improvement.rst

This file was deleted.

1 change: 0 additions & 1 deletion changelog/11728.improvement.rst

This file was deleted.

1 change: 0 additions & 1 deletion changelog/11777.improvement.rst

This file was deleted.

1 change: 0 additions & 1 deletion changelog/11871.feature.rst

This file was deleted.

4 changes: 0 additions & 4 deletions changelog/12065.bugfix.rst

This file was deleted.

12 changes: 0 additions & 12 deletions changelog/12069.deprecation.rst

This file was deleted.

1 change: 0 additions & 1 deletion changelog/12069.trivial.rst

This file was deleted.

1 change: 0 additions & 1 deletion changelog/12112.improvement.rst

This file was deleted.

1 change: 0 additions & 1 deletion changelog/12135.bugfix.rst

This file was deleted.

1 change: 0 additions & 1 deletion changelog/12167.trivial.rst

This file was deleted.

1 change: 0 additions & 1 deletion changelog/12194.bugfix.rst

This file was deleted.

1 change: 0 additions & 1 deletion changelog/1489.bugfix.rst

This file was deleted.

1 change: 0 additions & 1 deletion changelog/9502.improvement.rst

This file was deleted.

1 change: 1 addition & 0 deletions doc/en/announce/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Release announcements
:maxdepth: 2


release-8.2.0
release-8.1.2
release-8.1.1
release-8.1.0
Expand Down
43 changes: 43 additions & 0 deletions doc/en/announce/release-8.2.0.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
pytest-8.2.0
=======================================

The pytest team is proud to announce the 8.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:

* Bruno Oliveira
* Daniel Miller
* Florian Bruhin
* HolyMagician03-UMich
* John Litborn
* Levon Saldamli
* Linghao Zhang
* Manuel López-Ibáñez
* Pierre Sassoulas
* Ran Benita
* Ronny Pfannschmidt
* Sebastian Meyer
* Shekhar verma
* Tamir Duberstein
* Tobias Stoeckmann
* dj
* jakkdl
* poulami-sau
* tserg


Happy testing,
The pytest Development Team
30 changes: 15 additions & 15 deletions doc/en/builtin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
cachedir: .pytest_cache
rootdir: /home/sweet/project
collected 0 items
cache -- .../_pytest/cacheprovider.py:527
cache -- .../_pytest/cacheprovider.py:542
Return a cache object that can persist state between testing sessions.
cache.get(key, default)
Expand All @@ -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.
capsysbinary -- .../_pytest/capture.py:1008
capsysbinary -- .../_pytest/capture.py:1003
Enable bytes capturing of writes to ``sys.stdout`` and ``sys.stderr``.
The captured output is made available via ``capsysbinary.readouterr()``
Expand All @@ -50,7 +50,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:1035
capfd -- .../_pytest/capture.py:1030
Enable text capturing of writes to file descriptors ``1`` and ``2``.
The captured output is made available via ``capfd.readouterr()`` method
Expand All @@ -67,7 +67,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:1062
capfdbinary -- .../_pytest/capture.py:1057
Enable bytes capturing of writes to file descriptors ``1`` and ``2``.
The captured output is made available via ``capfd.readouterr()`` method
Expand All @@ -84,7 +84,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
captured = capfdbinary.readouterr()
assert captured.out == b"hello\n"
capsys -- .../_pytest/capture.py:981
capsys -- .../_pytest/capture.py:976
Enable text capturing of writes to ``sys.stdout`` and ``sys.stderr``.
The captured output is made available via ``capsys.readouterr()`` method
Expand All @@ -101,7 +101,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
captured = capsys.readouterr()
assert captured.out == "hello\n"
doctest_namespace [session scope] -- .../_pytest/doctest.py:737
doctest_namespace [session scope] -- .../_pytest/doctest.py:738
Fixture that returns a :py:class:`dict` that will be injected into the
namespace of doctests.
Expand All @@ -115,7 +115,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:1346
pytestconfig [session scope] -- .../_pytest/fixtures.py:1335
Session-scoped fixture that returns the session's :class:`pytest.Config`
object.
Expand All @@ -125,7 +125,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
if pytestconfig.getoption("verbose") > 0:
...
record_property -- .../_pytest/junitxml.py:283
record_property -- .../_pytest/junitxml.py:284
Add extra properties to the calling test.
User properties become part of the test report and are available to the
Expand All @@ -139,13 +139,13 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
def test_function(record_property):
record_property("example_key", 1)
record_xml_attribute -- .../_pytest/junitxml.py:306
record_xml_attribute -- .../_pytest/junitxml.py:307
Add extra xml attributes to the tag for the calling test.
The fixture is callable with ``name, value``. The value is
automatically XML-encoded.
record_testsuite_property [session scope] -- .../_pytest/junitxml.py:344
record_testsuite_property [session scope] -- .../_pytest/junitxml.py:345
Record a new ``<property>`` tag as child of the root ``<testsuite>``.
This is suitable to writing global information regarding the entire test
Expand Down Expand Up @@ -192,7 +192,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:601
caplog -- .../_pytest/logging.py:602
Access and control log capturing.
Captured logs are available through the following properties/methods::
Expand All @@ -203,7 +203,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
* caplog.record_tuples -> list of (logger_name, level, message) tuples
* caplog.clear() -> clear captured records and formatted log output string
monkeypatch -- .../_pytest/monkeypatch.py:32
monkeypatch -- .../_pytest/monkeypatch.py:33
A convenient fixture for monkey-patching.
The fixture provides these methods to modify objects, dictionaries, or
Expand All @@ -227,16 +227,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() <pytest.MonkeyPatch.context>`.
recwarn -- .../_pytest/recwarn.py:31
recwarn -- .../_pytest/recwarn.py:32
Return a :class:`WarningsRecorder` instance that records all warnings emitted by test functions.
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:241
tmp_path_factory [session scope] -- .../_pytest/tmpdir.py:242
Return a :class:`pytest.TempPathFactory` instance for the test session.
tmp_path -- .../_pytest/tmpdir.py:256
tmp_path -- .../_pytest/tmpdir.py:257
Return a temporary directory path object which is unique to each test
function invocation, created as a sub directory of the base temporary
directory.
Expand Down
81 changes: 81 additions & 0 deletions doc/en/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,87 @@ with advance notice in the **Deprecations** section of releases.

.. towncrier release notes start
pytest 8.2.0 (2024-04-27)
=========================

Deprecations
------------

- `#12069 <https://github.com/pytest-dev/pytest/issues/12069>`_: A deprecation warning is now raised when implementations of one of the following hooks request a deprecated ``py.path.local`` parameter instead of the ``pathlib.Path`` parameter which replaced it:

- :hook:`pytest_ignore_collect` - the ``path`` parameter - use ``collection_path`` instead.
- :hook:`pytest_collect_file` - the ``path`` parameter - use ``file_path`` instead.
- :hook:`pytest_pycollect_makemodule` - the ``path`` parameter - use ``module_path`` instead.
- :hook:`pytest_report_header` - the ``startdir`` parameter - use ``start_path`` instead.
- :hook:`pytest_report_collectionfinish` - the ``startdir`` parameter - use ``start_path`` instead.

The replacement parameters are available since pytest 7.0.0.
The old parameters will be removed in pytest 9.0.0.

See :ref:`legacy-path-hooks-deprecated` for more details.



Features
--------

- `#11871 <https://github.com/pytest-dev/pytest/issues/11871>`_: Added support for reading command line arguments from a file using the prefix character ``@``, like e.g.: ``pytest @tests.txt``. The file must have one argument per line.

See :ref:`Read arguments from file <args-from-file>` for details.



Improvements
------------

- `#11523 <https://github.com/pytest-dev/pytest/issues/11523>`_: :func:`pytest.importorskip` will now issue a warning if the module could be found, but raised :class:`ImportError` instead of :class:`ModuleNotFoundError`.

The warning can be suppressed by passing ``exc_type=ImportError`` to :func:`pytest.importorskip`.

See :ref:`import-or-skip-import-error` for details.


- `#11728 <https://github.com/pytest-dev/pytest/issues/11728>`_: For ``unittest``-based tests, exceptions during class cleanup (as raised by functions registered with :meth:`TestCase.addClassCleanup <unittest.TestCase.addClassCleanup>`) are now reported instead of silently failing.


- `#11777 <https://github.com/pytest-dev/pytest/issues/11777>`_: Text is no longer truncated in the ``short test summary info`` section when ``-vv`` is given.


- `#12112 <https://github.com/pytest-dev/pytest/issues/12112>`_: Improved namespace packages detection when :confval:`consider_namespace_packages` is enabled, covering more situations (like editable installs).


- `#9502 <https://github.com/pytest-dev/pytest/issues/9502>`_: Added :envvar:`PYTEST_VERSION` environment variable which is defined at the start of the pytest session and undefined afterwards. It contains the value of ``pytest.__version__``, and among other things can be used to easily check if code is running from within a pytest run.



Bug Fixes
---------

- `#12065 <https://github.com/pytest-dev/pytest/issues/12065>`_: Fixed a regression in pytest 8.0.0 where test classes containing ``setup_method`` and tests using ``@staticmethod`` or ``@classmethod`` would crash with ``AttributeError: 'NoneType' object has no attribute 'setup_method'``.

Now the :attr:`request.instance <pytest.FixtureRequest.instance>` attribute of tests using ``@staticmethod`` and ``@classmethod`` is no longer ``None``, but a fresh instance of the class, like in non-static methods.
Previously it was ``None``, and all fixtures of such tests would share a single ``self``.


- `#12135 <https://github.com/pytest-dev/pytest/issues/12135>`_: Fixed issue where fixtures adding their finalizer multiple times to fixtures they request would cause unreliable and non-intuitive teardown ordering in some instances.


- `#12194 <https://github.com/pytest-dev/pytest/issues/12194>`_: Fixed a bug with ``--importmode=importlib`` and ``--doctest-modules`` where child modules did not appear as attributes in parent modules.


- `#1489 <https://github.com/pytest-dev/pytest/issues/1489>`_: Fixed some instances where teardown of higher-scoped fixtures was not happening in the reverse order they were initialized in.



Trivial/Internal Changes
------------------------

- `#12069 <https://github.com/pytest-dev/pytest/issues/12069>`_: ``pluggy>=1.5.0`` is now required.


- `#12167 <https://github.com/pytest-dev/pytest/issues/12167>`_: :ref:`cache <cache>`: create supporting files (``CACHEDIR.TAG``, ``.gitignore``, etc.) in a temporary directory to provide atomic semantics.


pytest 8.1.2 (2024-04-26)
=========================

Expand Down
6 changes: 3 additions & 3 deletions doc/en/example/parametrize.rst
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ objects, they are still using the default pytest representation:
rootdir: /home/sweet/project
collected 8 items
<Dir parametrize.rst-197>
<Dir parametrize.rst-198>
<Module test_time.py>
<Function test_timedistance_v0[a0-b0-expected0]>
<Function test_timedistance_v0[a1-b1-expected1]>
Expand Down Expand Up @@ -239,7 +239,7 @@ If you just collect tests you'll also nicely see 'advanced' and 'basic' as varia
rootdir: /home/sweet/project
collected 4 items
<Dir parametrize.rst-197>
<Dir parametrize.rst-198>
<Module test_scenarios.py>
<Class TestSampleWithScenarios>
<Function test_demo1[basic]>
Expand Down Expand Up @@ -318,7 +318,7 @@ Let's first see how it looks like at collection time:
rootdir: /home/sweet/project
collected 2 items
<Dir parametrize.rst-197>
<Dir parametrize.rst-198>
<Module test_backends.py>
<Function test_db_initialized[d1]>
<Function test_db_initialized[d2]>
Expand Down
4 changes: 2 additions & 2 deletions doc/en/example/pythoncollection.rst
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ The test collection would look like this:
configfile: pytest.ini
collected 2 items
<Dir pythoncollection.rst-198>
<Dir pythoncollection.rst-199>
<Module check_myapp.py>
<Class CheckMyApp>
<Function simple_check>
Expand Down Expand Up @@ -215,7 +215,7 @@ You can always peek at the collection tree without running tests like this:
configfile: pytest.ini
collected 3 items
<Dir pythoncollection.rst-198>
<Dir pythoncollection.rst-199>
<Dir CWD>
<Module pythoncollection.py>
<Function test_function>
Expand Down
2 changes: 1 addition & 1 deletion doc/en/getting-started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Install ``pytest``
.. code-block:: bash
$ pytest --version
pytest 8.1.2
pytest 8.2.0
.. _`simpletest`:

Expand Down
2 changes: 1 addition & 1 deletion doc/en/how-to/fixtures.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1418,7 +1418,7 @@ Running the above tests results in the following test IDs being used:
rootdir: /home/sweet/project
collected 12 items
<Dir fixtures.rst-216>
<Dir fixtures.rst-217>
<Module test_anothersmtp.py>
<Function test_showhelo[smtp.gmail.com]>
<Function test_showhelo[mail.python.org]>
Expand Down
Loading

0 comments on commit 9eecdc7

Please sign in to comment.