Skip to content

Commit 69c3bce

Browse files
authored
Merge pull request #12257 from pytest-dev/release-8.2.0
Prepare release 8.2.0
2 parents 835765c + 6bd3f31 commit 69c3bce

22 files changed

+188
-56
lines changed

changelog/11523.improvement.rst

-5
This file was deleted.

changelog/11728.improvement.rst

-1
This file was deleted.

changelog/11777.improvement.rst

-1
This file was deleted.

changelog/11871.feature.rst

-1
This file was deleted.

changelog/12065.bugfix.rst

-4
This file was deleted.

changelog/12069.deprecation.rst

-12
This file was deleted.

changelog/12069.trivial.rst

-1
This file was deleted.

changelog/12112.improvement.rst

-1
This file was deleted.

changelog/12135.bugfix.rst

-1
This file was deleted.

changelog/12167.trivial.rst

-1
This file was deleted.

changelog/12194.bugfix.rst

-1
This file was deleted.

changelog/1489.bugfix.rst

-1
This file was deleted.

changelog/9502.improvement.rst

-1
This file was deleted.

doc/en/announce/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Release announcements
66
:maxdepth: 2
77

88

9+
release-8.2.0
910
release-8.1.2
1011
release-8.1.1
1112
release-8.1.0

doc/en/announce/release-8.2.0.rst

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
pytest-8.2.0
2+
=======================================
3+
4+
The pytest team is proud to announce the 8.2.0 release!
5+
6+
This release contains new features, improvements, and bug fixes,
7+
the full list of changes is available in the changelog:
8+
9+
https://docs.pytest.org/en/stable/changelog.html
10+
11+
For complete documentation, please visit:
12+
13+
https://docs.pytest.org/en/stable/
14+
15+
As usual, you can upgrade from PyPI via:
16+
17+
pip install -U pytest
18+
19+
Thanks to all of the contributors to this release:
20+
21+
* Bruno Oliveira
22+
* Daniel Miller
23+
* Florian Bruhin
24+
* HolyMagician03-UMich
25+
* John Litborn
26+
* Levon Saldamli
27+
* Linghao Zhang
28+
* Manuel López-Ibáñez
29+
* Pierre Sassoulas
30+
* Ran Benita
31+
* Ronny Pfannschmidt
32+
* Sebastian Meyer
33+
* Shekhar verma
34+
* Tamir Duberstein
35+
* Tobias Stoeckmann
36+
* dj
37+
* jakkdl
38+
* poulami-sau
39+
* tserg
40+
41+
42+
Happy testing,
43+
The pytest Development Team

doc/en/builtin.rst

+15-15
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
2222
cachedir: .pytest_cache
2323
rootdir: /home/sweet/project
2424
collected 0 items
25-
cache -- .../_pytest/cacheprovider.py:527
25+
cache -- .../_pytest/cacheprovider.py:542
2626
Return a cache object that can persist state between testing sessions.
2727
2828
cache.get(key, default)
@@ -33,7 +33,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
3333
3434
Values can be any object handled by the json stdlib module.
3535
36-
capsysbinary -- .../_pytest/capture.py:1008
36+
capsysbinary -- .../_pytest/capture.py:1003
3737
Enable bytes capturing of writes to ``sys.stdout`` and ``sys.stderr``.
3838
3939
The captured output is made available via ``capsysbinary.readouterr()``
@@ -50,7 +50,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
5050
captured = capsysbinary.readouterr()
5151
assert captured.out == b"hello\n"
5252
53-
capfd -- .../_pytest/capture.py:1035
53+
capfd -- .../_pytest/capture.py:1030
5454
Enable text capturing of writes to file descriptors ``1`` and ``2``.
5555
5656
The captured output is made available via ``capfd.readouterr()`` method
@@ -67,7 +67,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
6767
captured = capfd.readouterr()
6868
assert captured.out == "hello\n"
6969
70-
capfdbinary -- .../_pytest/capture.py:1062
70+
capfdbinary -- .../_pytest/capture.py:1057
7171
Enable bytes capturing of writes to file descriptors ``1`` and ``2``.
7272
7373
The captured output is made available via ``capfd.readouterr()`` method
@@ -84,7 +84,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
8484
captured = capfdbinary.readouterr()
8585
assert captured.out == b"hello\n"
8686
87-
capsys -- .../_pytest/capture.py:981
87+
capsys -- .../_pytest/capture.py:976
8888
Enable text capturing of writes to ``sys.stdout`` and ``sys.stderr``.
8989
9090
The captured output is made available via ``capsys.readouterr()`` method
@@ -101,7 +101,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
101101
captured = capsys.readouterr()
102102
assert captured.out == "hello\n"
103103
104-
doctest_namespace [session scope] -- .../_pytest/doctest.py:737
104+
doctest_namespace [session scope] -- .../_pytest/doctest.py:738
105105
Fixture that returns a :py:class:`dict` that will be injected into the
106106
namespace of doctests.
107107
@@ -115,7 +115,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
115115
116116
For more details: :ref:`doctest_namespace`.
117117
118-
pytestconfig [session scope] -- .../_pytest/fixtures.py:1346
118+
pytestconfig [session scope] -- .../_pytest/fixtures.py:1335
119119
Session-scoped fixture that returns the session's :class:`pytest.Config`
120120
object.
121121
@@ -125,7 +125,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
125125
if pytestconfig.getoption("verbose") > 0:
126126
...
127127
128-
record_property -- .../_pytest/junitxml.py:283
128+
record_property -- .../_pytest/junitxml.py:284
129129
Add extra properties to the calling test.
130130
131131
User properties become part of the test report and are available to the
@@ -139,13 +139,13 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
139139
def test_function(record_property):
140140
record_property("example_key", 1)
141141
142-
record_xml_attribute -- .../_pytest/junitxml.py:306
142+
record_xml_attribute -- .../_pytest/junitxml.py:307
143143
Add extra xml attributes to the tag for the calling test.
144144
145145
The fixture is callable with ``name, value``. The value is
146146
automatically XML-encoded.
147147
148-
record_testsuite_property [session scope] -- .../_pytest/junitxml.py:344
148+
record_testsuite_property [session scope] -- .../_pytest/junitxml.py:345
149149
Record a new ``<property>`` tag as child of the root ``<testsuite>``.
150150
151151
This is suitable to writing global information regarding the entire test
@@ -192,7 +192,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
192192
193193
.. _legacy_path: https://py.readthedocs.io/en/latest/path.html
194194
195-
caplog -- .../_pytest/logging.py:601
195+
caplog -- .../_pytest/logging.py:602
196196
Access and control log capturing.
197197
198198
Captured logs are available through the following properties/methods::
@@ -203,7 +203,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
203203
* caplog.record_tuples -> list of (logger_name, level, message) tuples
204204
* caplog.clear() -> clear captured records and formatted log output string
205205
206-
monkeypatch -- .../_pytest/monkeypatch.py:32
206+
monkeypatch -- .../_pytest/monkeypatch.py:33
207207
A convenient fixture for monkey-patching.
208208
209209
The fixture provides these methods to modify objects, dictionaries, or
@@ -227,16 +227,16 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
227227
To undo modifications done by the fixture in a contained scope,
228228
use :meth:`context() <pytest.MonkeyPatch.context>`.
229229
230-
recwarn -- .../_pytest/recwarn.py:31
230+
recwarn -- .../_pytest/recwarn.py:32
231231
Return a :class:`WarningsRecorder` instance that records all warnings emitted by test functions.
232232
233233
See https://docs.pytest.org/en/latest/how-to/capture-warnings.html for information
234234
on warning categories.
235235
236-
tmp_path_factory [session scope] -- .../_pytest/tmpdir.py:241
236+
tmp_path_factory [session scope] -- .../_pytest/tmpdir.py:242
237237
Return a :class:`pytest.TempPathFactory` instance for the test session.
238238
239-
tmp_path -- .../_pytest/tmpdir.py:256
239+
tmp_path -- .../_pytest/tmpdir.py:257
240240
Return a temporary directory path object which is unique to each test
241241
function invocation, created as a sub directory of the base temporary
242242
directory.

doc/en/changelog.rst

+81
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,87 @@ with advance notice in the **Deprecations** section of releases.
2828

2929
.. towncrier release notes start
3030
31+
pytest 8.2.0 (2024-04-27)
32+
=========================
33+
34+
Deprecations
35+
------------
36+
37+
- `#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:
38+
39+
- :hook:`pytest_ignore_collect` - the ``path`` parameter - use ``collection_path`` instead.
40+
- :hook:`pytest_collect_file` - the ``path`` parameter - use ``file_path`` instead.
41+
- :hook:`pytest_pycollect_makemodule` - the ``path`` parameter - use ``module_path`` instead.
42+
- :hook:`pytest_report_header` - the ``startdir`` parameter - use ``start_path`` instead.
43+
- :hook:`pytest_report_collectionfinish` - the ``startdir`` parameter - use ``start_path`` instead.
44+
45+
The replacement parameters are available since pytest 7.0.0.
46+
The old parameters will be removed in pytest 9.0.0.
47+
48+
See :ref:`legacy-path-hooks-deprecated` for more details.
49+
50+
51+
52+
Features
53+
--------
54+
55+
- `#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.
56+
57+
See :ref:`Read arguments from file <args-from-file>` for details.
58+
59+
60+
61+
Improvements
62+
------------
63+
64+
- `#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`.
65+
66+
The warning can be suppressed by passing ``exc_type=ImportError`` to :func:`pytest.importorskip`.
67+
68+
See :ref:`import-or-skip-import-error` for details.
69+
70+
71+
- `#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.
72+
73+
74+
- `#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.
75+
76+
77+
- `#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).
78+
79+
80+
- `#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.
81+
82+
83+
84+
Bug Fixes
85+
---------
86+
87+
- `#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'``.
88+
89+
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.
90+
Previously it was ``None``, and all fixtures of such tests would share a single ``self``.
91+
92+
93+
- `#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.
94+
95+
96+
- `#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.
97+
98+
99+
- `#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.
100+
101+
102+
103+
Trivial/Internal Changes
104+
------------------------
105+
106+
- `#12069 <https://github.com/pytest-dev/pytest/issues/12069>`_: ``pluggy>=1.5.0`` is now required.
107+
108+
109+
- `#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.
110+
111+
31112
pytest 8.1.2 (2024-04-26)
32113
=========================
33114

doc/en/example/parametrize.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ objects, they are still using the default pytest representation:
162162
rootdir: /home/sweet/project
163163
collected 8 items
164164
165-
<Dir parametrize.rst-197>
165+
<Dir parametrize.rst-198>
166166
<Module test_time.py>
167167
<Function test_timedistance_v0[a0-b0-expected0]>
168168
<Function test_timedistance_v0[a1-b1-expected1]>
@@ -239,7 +239,7 @@ If you just collect tests you'll also nicely see 'advanced' and 'basic' as varia
239239
rootdir: /home/sweet/project
240240
collected 4 items
241241
242-
<Dir parametrize.rst-197>
242+
<Dir parametrize.rst-198>
243243
<Module test_scenarios.py>
244244
<Class TestSampleWithScenarios>
245245
<Function test_demo1[basic]>
@@ -318,7 +318,7 @@ Let's first see how it looks like at collection time:
318318
rootdir: /home/sweet/project
319319
collected 2 items
320320
321-
<Dir parametrize.rst-197>
321+
<Dir parametrize.rst-198>
322322
<Module test_backends.py>
323323
<Function test_db_initialized[d1]>
324324
<Function test_db_initialized[d2]>

doc/en/example/pythoncollection.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ The test collection would look like this:
152152
configfile: pytest.ini
153153
collected 2 items
154154
155-
<Dir pythoncollection.rst-198>
155+
<Dir pythoncollection.rst-199>
156156
<Module check_myapp.py>
157157
<Class CheckMyApp>
158158
<Function simple_check>
@@ -215,7 +215,7 @@ You can always peek at the collection tree without running tests like this:
215215
configfile: pytest.ini
216216
collected 3 items
217217
218-
<Dir pythoncollection.rst-198>
218+
<Dir pythoncollection.rst-199>
219219
<Dir CWD>
220220
<Module pythoncollection.py>
221221
<Function test_function>

doc/en/getting-started.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Install ``pytest``
2222
.. code-block:: bash
2323
2424
$ pytest --version
25-
pytest 8.1.2
25+
pytest 8.2.0
2626
2727
.. _`simpletest`:
2828

doc/en/how-to/fixtures.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1418,7 +1418,7 @@ Running the above tests results in the following test IDs being used:
14181418
rootdir: /home/sweet/project
14191419
collected 12 items
14201420
1421-
<Dir fixtures.rst-216>
1421+
<Dir fixtures.rst-217>
14221422
<Module test_anothersmtp.py>
14231423
<Function test_showhelo[smtp.gmail.com]>
14241424
<Function test_showhelo[mail.python.org]>

0 commit comments

Comments
 (0)