Skip to content

Commit 4ed2b3a

Browse files
authored
Merge pull request #10267 from nicoddemus/cherry-pick-release
Merge pull request #10259 from pytest-dev/release-7.1.3
2 parents 245a8c2 + 7f4b63b commit 4ed2b3a

15 files changed

+164
-33
lines changed

changelog/10060.bugfix.rst

-1
This file was deleted.

changelog/10114.trivial.rst

-1
This file was deleted.

changelog/10190.bugfix.rst

-1
This file was deleted.

changelog/10230.bugfix.rst

-1
This file was deleted.

changelog/3396.bugfix.rst

-1
This file was deleted.

changelog/9514.bugfix.rst

-1
This file was deleted.

changelog/9791.bugfix.rst

-1
This file was deleted.

changelog/9917.bugfix.rst

-1
This file was deleted.

changelog/9937.doc.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-7.1.3
910
release-7.1.2
1011
release-7.1.1
1112
release-7.1.0

doc/en/announce/release-7.1.3.rst

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
pytest-7.1.3
2+
=======================================
3+
4+
pytest 7.1.3 has just been released to PyPI.
5+
6+
This is a bug-fix release, being a drop-in replacement. To upgrade::
7+
8+
pip install --upgrade pytest
9+
10+
The full changelog is available at https://docs.pytest.org/en/stable/changelog.html.
11+
12+
Thanks to all of the contributors to this release:
13+
14+
* Anthony Sottile
15+
* Bruno Oliveira
16+
* Gergely Kalmár
17+
* Nipunn Koorapati
18+
* Pax
19+
* Sviatoslav Sydorenko
20+
* Tim Hoffmann
21+
* Tony Narlock
22+
* Wolfremium
23+
* Zach OBrien
24+
* aizpurua23a
25+
26+
27+
Happy testing,
28+
The pytest Development Team

doc/en/builtin.rst

+83-19
Original file line numberDiff line numberDiff line change
@@ -40,32 +40,86 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
4040
calls, which return a ``(out, err)`` namedtuple.
4141
``out`` and ``err`` will be ``text`` objects.
4242
43-
capsysbinary -- .../_pytest/capture.py:895
43+
Returns an instance of :class:`CaptureFixture[str] <pytest.CaptureFixture>`.
44+
45+
Example:
46+
47+
.. code-block:: python
48+
49+
def test_output(capsys):
50+
print("hello")
51+
captured = capsys.readouterr()
52+
assert captured.out == "hello\n"
53+
54+
capsysbinary -- .../_pytest/capture.py:906
4455
Enable bytes capturing of writes to ``sys.stdout`` and ``sys.stderr``.
4556
4657
The captured output is made available via ``capsysbinary.readouterr()``
4758
method calls, which return a ``(out, err)`` namedtuple.
4859
``out`` and ``err`` will be ``bytes`` objects.
4960
50-
capfd -- .../_pytest/capture.py:912
61+
Returns an instance of :class:`CaptureFixture[bytes] <pytest.CaptureFixture>`.
62+
63+
Example:
64+
65+
.. code-block:: python
66+
67+
def test_output(capsysbinary):
68+
print("hello")
69+
captured = capsysbinary.readouterr()
70+
assert captured.out == b"hello\n"
71+
72+
capfd -- .../_pytest/capture.py:934
5173
Enable text capturing of writes to file descriptors ``1`` and ``2``.
5274
5375
The captured output is made available via ``capfd.readouterr()`` method
5476
calls, which return a ``(out, err)`` namedtuple.
5577
``out`` and ``err`` will be ``text`` objects.
5678
57-
capfdbinary -- .../_pytest/capture.py:929
79+
Returns an instance of :class:`CaptureFixture[str] <pytest.CaptureFixture>`.
80+
81+
Example:
82+
83+
.. code-block:: python
84+
85+
def test_system_echo(capfd):
86+
os.system('echo "hello"')
87+
captured = capfd.readouterr()
88+
assert captured.out == "hello\n"
89+
90+
capfdbinary -- .../_pytest/capture.py:962
5891
Enable bytes capturing of writes to file descriptors ``1`` and ``2``.
5992
6093
The captured output is made available via ``capfd.readouterr()`` method
6194
calls, which return a ``(out, err)`` namedtuple.
6295
``out`` and ``err`` will be ``byte`` objects.
6396
64-
doctest_namespace [session scope] -- .../_pytest/doctest.py:731
97+
Returns an instance of :class:`CaptureFixture[bytes] <pytest.CaptureFixture>`.
98+
99+
Example:
100+
101+
.. code-block:: python
102+
103+
def test_system_echo(capfdbinary):
104+
os.system('echo "hello"')
105+
captured = capfdbinary.readouterr()
106+
assert captured.out == b"hello\n"
107+
108+
doctest_namespace [session scope] -- .../_pytest/doctest.py:735
65109
Fixture that returns a :py:class:`dict` that will be injected into the
66110
namespace of doctests.
67111
68-
pytestconfig [session scope] -- .../_pytest/fixtures.py:1334
112+
Usually this fixture is used in conjunction with another ``autouse`` fixture:
113+
114+
.. code-block:: python
115+
116+
@pytest.fixture(autouse=True)
117+
def add_np(doctest_namespace):
118+
doctest_namespace["np"] = numpy
119+
120+
For more details: :ref:`doctest_namespace`.
121+
122+
pytestconfig [session scope] -- .../_pytest/fixtures.py:1344
69123
Session-scoped fixture that returns the session's :class:`pytest.Config`
70124
object.
71125
@@ -117,10 +171,10 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
117171
`pytest-xdist <https://github.com/pytest-dev/pytest-xdist>`__ plugin. See
118172
:issue:`7767` for details.
119173
120-
tmpdir_factory [session scope] -- .../_pytest/legacypath.py:295
174+
tmpdir_factory [session scope] -- .../_pytest/legacypath.py:302
121175
Return a :class:`pytest.TempdirFactory` instance for the test session.
122176
123-
tmpdir -- .../_pytest/legacypath.py:302
177+
tmpdir -- .../_pytest/legacypath.py:309
124178
Return a temporary directory path object which is unique to each test
125179
function invocation, created as a sub directory of the base temporary
126180
directory.
@@ -132,6 +186,11 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
132186
133187
The returned object is a `legacy_path`_ object.
134188
189+
.. note::
190+
These days, it is preferred to use ``tmp_path``.
191+
192+
:ref:`About the tmpdir and tmpdir_factory fixtures<tmpdir and tmpdir_factory>`.
193+
135194
.. _legacy_path: https://py.readthedocs.io/en/latest/path.html
136195
137196
caplog -- .../_pytest/logging.py:487
@@ -148,21 +207,26 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
148207
monkeypatch -- .../_pytest/monkeypatch.py:29
149208
A convenient fixture for monkey-patching.
150209
151-
The fixture provides these methods to modify objects, dictionaries or
152-
os.environ::
210+
The fixture provides these methods to modify objects, dictionaries, or
211+
:data:`os.environ`:
153212
154-
monkeypatch.setattr(obj, name, value, raising=True)
155-
monkeypatch.delattr(obj, name, raising=True)
156-
monkeypatch.setitem(mapping, name, value)
157-
monkeypatch.delitem(obj, name, raising=True)
158-
monkeypatch.setenv(name, value, prepend=None)
159-
monkeypatch.delenv(name, raising=True)
160-
monkeypatch.syspath_prepend(path)
161-
monkeypatch.chdir(path)
213+
* :meth:`monkeypatch.setattr(obj, name, value, raising=True) <pytest.MonkeyPatch.setattr>`
214+
* :meth:`monkeypatch.delattr(obj, name, raising=True) <pytest.MonkeyPatch.delattr>`
215+
* :meth:`monkeypatch.setitem(mapping, name, value) <pytest.MonkeyPatch.setitem>`
216+
* :meth:`monkeypatch.delitem(obj, name, raising=True) <pytest.MonkeyPatch.delitem>`
217+
* :meth:`monkeypatch.setenv(name, value, prepend=None) <pytest.MonkeyPatch.setenv>`
218+
* :meth:`monkeypatch.delenv(name, raising=True) <pytest.MonkeyPatch.delenv>`
219+
* :meth:`monkeypatch.syspath_prepend(path) <pytest.MonkeyPatch.syspath_prepend>`
220+
* :meth:`monkeypatch.chdir(path) <pytest.MonkeyPatch.chdir>`
221+
* :meth:`monkeypatch.context() <pytest.MonkeyPatch.context>`
162222
163223
All modifications will be undone after the requesting test function or
164-
fixture has finished. The ``raising`` parameter determines if a KeyError
165-
or AttributeError will be raised if the set/deletion operation has no target.
224+
fixture has finished. The ``raising`` parameter determines if a :class:`KeyError`
225+
or :class:`AttributeError` will be raised if the set/deletion operation does not have the
226+
specified target.
227+
228+
To undo modifications done by the fixture in a contained scope,
229+
use :meth:`context() <pytest.MonkeyPatch.context>`.
166230
167231
recwarn -- .../_pytest/recwarn.py:29
168232
Return a :class:`WarningsRecorder` instance that records all warnings emitted by test functions.

doc/en/changelog.rst

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

2929
.. towncrier release notes start
3030
31+
pytest 7.1.3 (2022-08-31)
32+
=========================
33+
34+
Bug Fixes
35+
---------
36+
37+
- `#10060 <https://github.com/pytest-dev/pytest/issues/10060>`_: When running with ``--pdb``, ``TestCase.tearDown`` is no longer called for tests when the *class* has been skipped via ``unittest.skip`` or ``pytest.mark.skip``.
38+
39+
40+
- `#10190 <https://github.com/pytest-dev/pytest/issues/10190>`_: Invalid XML characters in setup or teardown error messages are now properly escaped for JUnit XML reports.
41+
42+
43+
- `#10230 <https://github.com/pytest-dev/pytest/issues/10230>`_: Ignore ``.py`` files created by ``pyproject.toml``-based editable builds introduced in `pip 21.3 <https://pip.pypa.io/en/stable/news/#v21-3>`__.
44+
45+
46+
- `#3396 <https://github.com/pytest-dev/pytest/issues/3396>`_: Doctests now respect the ``--import-mode`` flag.
47+
48+
49+
- `#9514 <https://github.com/pytest-dev/pytest/issues/9514>`_: Type-annotate ``FixtureRequest.param`` as ``Any`` as a stop gap measure until :issue:`8073` is fixed.
50+
51+
52+
- `#9791 <https://github.com/pytest-dev/pytest/issues/9791>`_: Fixed a path handling code in ``rewrite.py`` that seems to work fine, but was incorrect and fails in some systems.
53+
54+
55+
- `#9917 <https://github.com/pytest-dev/pytest/issues/9917>`_: Fixed string representation for :func:`pytest.approx` when used to compare tuples.
56+
57+
58+
59+
Improved Documentation
60+
----------------------
61+
62+
- `#9937 <https://github.com/pytest-dev/pytest/issues/9937>`_: Explicit note that :fixture:`tmpdir` fixture is discouraged in favour of :fixture:`tmp_path`.
63+
64+
65+
66+
Trivial/Internal Changes
67+
------------------------
68+
69+
- `#10114 <https://github.com/pytest-dev/pytest/issues/10114>`_: Replace `atomicwrites <https://github.com/untitaker/python-atomicwrites>`__ dependency on windows with `os.replace`.
70+
71+
3172
pytest 7.1.2 (2022-04-23)
3273
=========================
3374

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

doc/en/how-to/fixtures.rst

+10-4
Original file line numberDiff line numberDiff line change
@@ -735,8 +735,8 @@ does offer some nuances for when you're in a pinch.
735735
.. code-block:: pytest
736736
737737
$ pytest -q test_emaillib.py
738-
. [100%]
739-
1 passed in 0.12s
738+
. [100%]
739+
1 passed in 0.12s
740740
741741
Note on finalizer order
742742
""""""""""""""""""""""""
@@ -772,13 +772,15 @@ For yield fixtures, the first teardown code to run is from the right-most fixtur
772772
$ pytest -s test_finalizers.py
773773
=========================== test session starts ============================
774774
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
775+
rootdir: /home/sweet/project
775776
collected 1 item
776777
777778
test_finalizers.py test_bar
778779
.after_yield_2
779780
after_yield_1
780781
781782
783+
============================ 1 passed in 0.12s =============================
782784
783785
For finalizers, the first fixture to run is last call to `request.addfinalizer`.
784786

@@ -804,12 +806,16 @@ For finalizers, the first fixture to run is last call to `request.addfinalizer`.
804806
$ pytest -s test_finalizers.py
805807
=========================== test session starts ============================
806808
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
809+
rootdir: /home/sweet/project
807810
collected 1 item
808811
809812
test_finalizers.py test_bar
810813
.finalizer_1
811814
finalizer_2
812815
816+
817+
============================ 1 passed in 0.12s =============================
818+
813819
This is so because yield fixtures use `addfinalizer` behind the scenes: when the fixture executes, `addfinalizer` registers a function that resumes the generator, which in turn calls the teardown code.
814820

815821

@@ -1411,7 +1417,7 @@ Running the above tests results in the following test IDs being used:
14111417
=========================== test session starts ============================
14121418
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
14131419
rootdir: /home/sweet/project
1414-
collected 11 items
1420+
collected 12 items
14151421
14161422
<Module test_anothersmtp.py>
14171423
<Function test_showhelo[smtp.gmail.com]>
@@ -1431,7 +1437,7 @@ Running the above tests results in the following test IDs being used:
14311437
<Function test_ehlo[mail.python.org]>
14321438
<Function test_noop[mail.python.org]>
14331439
1434-
======================= 11 tests collected in 0.12s ========================
1440+
======================= 12 tests collected in 0.12s ========================
14351441
14361442
.. _`fixture-parametrize-marks`:
14371443

0 commit comments

Comments
 (0)