Skip to content

Commit b9a167f

Browse files
committed
Prepare release version 8.1.0
1 parent 00043f7 commit b9a167f

26 files changed

+182
-61
lines changed

changelog/10865.improvement.rst

-3
This file was deleted.

changelog/11311.improvement.rst

-4
This file was deleted.

changelog/11475.feature.rst

-3
This file was deleted.

changelog/11475.improvement.rst

-3
This file was deleted.

changelog/11653.feature.rst

-2
This file was deleted.

changelog/11785.trivial.rst

-7
This file was deleted.

changelog/11790.doc.rst

-1
This file was deleted.

changelog/11801.improvement.rst

-2
This file was deleted.

changelog/11850.improvement.rst

-1
This file was deleted.

changelog/11904.bugfix.rst

-3
This file was deleted.

changelog/11962.improvement.rst

-1
This file was deleted.

changelog/11978.improvement.rst

-3
This file was deleted.

changelog/12011.bugfix.rst

-1
This file was deleted.

changelog/12014.bugfix.rst

-1
This file was deleted.

changelog/12039.bugfix.rst

-1
This file was deleted.

changelog/12047.improvement.rst

-2
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.1.0
910
release-8.0.2
1011
release-8.0.1
1112
release-8.0.0

doc/en/announce/release-8.1.0.rst

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
pytest-8.1.0
2+
=======================================
3+
4+
The pytest team is proud to announce the 8.1.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+
* Ben Brown
22+
* Ben Leith
23+
* Bruno Oliveira
24+
* Clément Robert
25+
* Dave Hall
26+
* Dương Quốc Khánh
27+
* Eero Vaher
28+
* Eric Larson
29+
* Fabian Sturm
30+
* Faisal Fawad
31+
* Florian Bruhin
32+
* Franck Charras
33+
* Joachim B Haga
34+
* John Litborn
35+
* Loïc Estève
36+
* Marc Bresson
37+
* Patrick Lannigan
38+
* Pierre Sassoulas
39+
* Ran Benita
40+
* Reagan Lee
41+
* Ronny Pfannschmidt
42+
* Russell Martin
43+
* clee2000
44+
* donghui
45+
* faph
46+
* jakkdl
47+
* mrbean-bremen
48+
* robotherapist
49+
* whysage
50+
* woutdenolf
51+
52+
53+
Happy testing,
54+
The pytest Development Team

doc/en/builtin.rst

+14-14
Original file line numberDiff line numberDiff line change
@@ -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:1007
36+
capsysbinary -- .../_pytest/capture.py:1008
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:1034
53+
capfd -- .../_pytest/capture.py:1035
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:1061
70+
capfdbinary -- .../_pytest/capture.py:1062
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:980
87+
capsys -- .../_pytest/capture.py:981
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:745
104+
doctest_namespace [session scope] -- .../_pytest/doctest.py:737
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:1354
118+
pytestconfig [session scope] -- .../_pytest/fixtures.py:1346
119119
Session-scoped fixture that returns the session's :class:`pytest.Config`
120120
object.
121121
@@ -170,18 +170,18 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
170170
`pytest-xdist <https://github.com/pytest-dev/pytest-xdist>`__ plugin. See
171171
:issue:`7767` for details.
172172
173-
tmpdir_factory [session scope] -- .../_pytest/legacypath.py:302
173+
tmpdir_factory [session scope] -- .../_pytest/legacypath.py:317
174174
Return a :class:`pytest.TempdirFactory` instance for the test session.
175175
176-
tmpdir -- .../_pytest/legacypath.py:309
176+
tmpdir -- .../_pytest/legacypath.py:324
177177
Return a temporary directory path object which is unique to each test
178178
function invocation, created as a sub directory of the base temporary
179179
directory.
180180
181181
By default, a new base temporary directory is created each test session,
182182
and old bases are removed after 3 sessions, to aid in debugging. If
183-
``--basetemp`` is used then it is cleared each session. See :ref:`base
184-
temporary directory`.
183+
``--basetemp`` is used then it is cleared each session. See
184+
:ref:`temporary directory location and retention`.
185185
186186
The returned object is a `legacy_path`_ object.
187187
@@ -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:594
195+
caplog -- .../_pytest/logging.py:601
196196
Access and control log capturing.
197197
198198
Captured logs are available through the following properties/methods::
@@ -227,7 +227,7 @@ 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:32
230+
recwarn -- .../_pytest/recwarn.py:31
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
@@ -245,8 +245,8 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
245245
and old bases are removed after 3 sessions, to aid in debugging.
246246
This behavior can be configured with :confval:`tmp_path_retention_count` and
247247
:confval:`tmp_path_retention_policy`.
248-
If ``--basetemp`` is used then it is cleared each session. See :ref:`base
249-
temporary directory`.
248+
If ``--basetemp`` is used then it is cleared each session. See
249+
:ref:`temporary directory location and retention`.
250250
251251
The returned object is a :class:`pathlib.Path` object.
252252

doc/en/changelog.rst

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

2929
.. towncrier release notes start
3030
31+
pytest 8.1.0 (2024-03-03)
32+
=========================
33+
34+
Features
35+
--------
36+
37+
- `#11475 <https://github.com/pytest-dev/pytest/issues/11475>`_: Added the new :confval:`consider_namespace_packages` configuration option, defaulting to ``False``.
38+
39+
If set to ``True``, pytest will attempt to identify modules that are part of `namespace packages <https://packaging.python.org/en/latest/guides/packaging-namespace-packages>`__ when importing modules.
40+
41+
42+
- `#11653 <https://github.com/pytest-dev/pytest/issues/11653>`_: Added the new :confval:`verbosity_test_cases` configuration option for fine-grained control of test execution verbosity.
43+
See :ref:`Fine-grained verbosity <pytest.fine_grained_verbosity>` for more details.
44+
45+
46+
47+
Improvements
48+
------------
49+
50+
- `#10865 <https://github.com/pytest-dev/pytest/issues/10865>`_: :func:`pytest.warns` now validates that :func:`warnings.warn` was called with a `str` or a `Warning`.
51+
Currently in Python it is possible to use other types, however this causes an exception when :func:`warnings.filterwarnings` is used to filter those warnings (see `CPython #103577 <https://github.com/python/cpython/issues/103577>`__ for a discussion).
52+
While this can be considered a bug in CPython, we decided to put guards in pytest as the error message produced without this check in place is confusing.
53+
54+
55+
- `#11311 <https://github.com/pytest-dev/pytest/issues/11311>`_: When using ``--override-ini`` for paths in invocations without a configuration file defined, the current working directory is used
56+
as the relative directory.
57+
58+
Previoulsy this would raise an :class:`AssertionError`.
59+
60+
61+
- `#11475 <https://github.com/pytest-dev/pytest/issues/11475>`_: :ref:`--import-mode=importlib <import-mode-importlib>` now tries to import modules using the standard import mechanism (but still without changing :py:data:`sys.path`), falling back to importing modules directly only if that fails.
62+
63+
This means that installed packages will be imported under their canonical name if possible first, for example ``app.core.models``, instead of having the module name always be derived from their path (for example ``.env310.lib.site_packages.app.core.models``).
64+
65+
66+
- `#11801 <https://github.com/pytest-dev/pytest/issues/11801>`_: Added the :func:`iter_parents() <_pytest.nodes.Node.iter_parents>` helper method on nodes.
67+
It is similar to :func:`listchain <_pytest.nodes.Node.listchain>`, but goes from bottom to top, and returns an iterator, not a list.
68+
69+
70+
- `#11850 <https://github.com/pytest-dev/pytest/issues/11850>`_: Added support for :data:`sys.last_exc` for post-mortem debugging on Python>=3.12.
71+
72+
73+
- `#11962 <https://github.com/pytest-dev/pytest/issues/11962>`_: In case no other suitable candidates for configuration file are found, a ``pyproject.toml`` (even without a ``[tool.pytest.ini_options]`` table) will be considered as the configuration file and define the ``rootdir``.
74+
75+
76+
- `#11978 <https://github.com/pytest-dev/pytest/issues/11978>`_: Add ``--log-file-mode`` option to the logging plugin, enabling appending to log-files. This option accepts either ``"w"`` or ``"a"`` and defaults to ``"w"``.
77+
78+
Previously, the mode was hard-coded to be ``"w"`` which truncates the file before logging.
79+
80+
81+
- `#12047 <https://github.com/pytest-dev/pytest/issues/12047>`_: When multiple finalizers of a fixture raise an exception, now all exceptions are reported as an exception group.
82+
Previously, only the first exception was reported.
83+
84+
85+
86+
Bug Fixes
87+
---------
88+
89+
- `#11904 <https://github.com/pytest-dev/pytest/issues/11904>`_: Fixed a regression in pytest 8.0.0 that would cause test collection to fail due to permission errors when using ``--pyargs``.
90+
91+
This change improves the collection tree for tests specified using ``--pyargs``, see :pull:`12043` for a comparison with pytest 8.0 and <8.
92+
93+
94+
- `#12011 <https://github.com/pytest-dev/pytest/issues/12011>`_: Fixed a regression in 8.0.1 whereby ``setup_module`` xunit-style fixtures are not executed when ``--doctest-modules`` is passed.
95+
96+
97+
- `#12014 <https://github.com/pytest-dev/pytest/issues/12014>`_: Fix the ``stacklevel`` used when warning about marks used on fixtures.
98+
99+
100+
- `#12039 <https://github.com/pytest-dev/pytest/issues/12039>`_: Fixed a regression in ``8.0.2`` where tests created using :fixture:`tmp_path` have been collected multiple times in CI under Windows.
101+
102+
103+
104+
Improved Documentation
105+
----------------------
106+
107+
- `#11790 <https://github.com/pytest-dev/pytest/issues/11790>`_: Documented the retention of temporary directories created using the ``tmp_path`` fixture in more detail.
108+
109+
110+
111+
Trivial/Internal Changes
112+
------------------------
113+
114+
- `#11785 <https://github.com/pytest-dev/pytest/issues/11785>`_: Some changes were made to private functions which may affect plugins which access them:
115+
116+
- ``FixtureManager._getautousenames()`` now takes a ``Node`` itself instead of the nodeid.
117+
- ``FixtureManager.getfixturedefs()`` now takes the ``Node`` itself instead of the nodeid.
118+
- The ``_pytest.nodes.iterparentnodeids()`` function is removed without replacement.
119+
Prefer to traverse the node hierarchy itself instead.
120+
If you really need to, copy the function from the previous pytest release.
121+
122+
31123
pytest 8.0.2 (2024-02-24)
32124
=========================
33125

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-194>
165+
<Dir parametrize.rst-195>
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-194>
242+
<Dir parametrize.rst-195>
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-194>
321+
<Dir parametrize.rst-195>
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-195>
155+
<Dir pythoncollection.rst-196>
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-195>
218+
<Dir pythoncollection.rst-196>
219219
<Dir CWD>
220220
<Module pythoncollection.py>
221221
<Function test_function>

doc/en/example/reportingdemo.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ Here is a nice run of several failures and how ``pytest`` presents things:
445445
self = <failure_demo.TestRaises object at 0xdeadbeef0020>
446446
447447
def test_tupleerror(self):
448-
> a, b = [1] # NOQA
448+
> a, b = [1] # noqa: F841
449449
E ValueError: not enough values to unpack (expected 2, got 1)
450450
451451
failure_demo.py:175: ValueError
@@ -467,7 +467,7 @@ Here is a nice run of several failures and how ``pytest`` presents things:
467467
self = <failure_demo.TestRaises object at 0xdeadbeef0022>
468468
469469
def test_some_error(self):
470-
> if namenotexi: # NOQA
470+
> if namenotexi: # noqa: F821
471471
E NameError: name 'namenotexi' is not defined
472472
473473
failure_demo.py:183: NameError

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.0.2
25+
pytest 8.1.0
2626
2727
.. _`simpletest`:
2828

0 commit comments

Comments
 (0)