Merge pull request #8131 from bluetech/cherry-pick-release
Merge pull request #8130 from pytest-dev/release-6.2.0
This commit is contained in:
commit
09582048be
|
@ -1 +0,0 @@
|
||||||
Added an ``__str__`` implementation to the :class:`~pytest.pytester.LineMatcher` class which is returned from ``pytester.run_pytest().stdout`` and similar. It returns the entire output, like the existing ``str()`` method.
|
|
|
@ -1 +0,0 @@
|
||||||
Verbose mode now shows the reason that a test was skipped in the test's terminal line after the "SKIPPED", "XFAIL" or "XPASS".
|
|
|
@ -1 +0,0 @@
|
||||||
Fixed quadratic behavior and improved performance of collection of items using autouse fixtures and xunit fixtures.
|
|
|
@ -1,2 +0,0 @@
|
||||||
pytest now warns about unraisable exceptions and unhandled thread exceptions that occur in tests on Python>=3.8.
|
|
||||||
See :ref:`unraisable` for more information.
|
|
|
@ -1,5 +0,0 @@
|
||||||
New :fixture:`pytester` fixture, which is identical to :fixture:`testdir` but its methods return :class:`pathlib.Path` when appropriate instead of ``py.path.local``.
|
|
||||||
|
|
||||||
This is part of the movement to use :class:`pathlib.Path` objects internally, in order to remove the dependency to ``py`` in the future.
|
|
||||||
|
|
||||||
Internally, the old :class:`Testdir <_pytest.pytester.Testdir>` is now a thin wrapper around :class:`Pytester <_pytest.pytester.Pytester>`, preserving the old interface.
|
|
|
@ -1 +0,0 @@
|
||||||
Add more information and use cases about skipping doctests.
|
|
|
@ -1,18 +0,0 @@
|
||||||
Directly constructing/calling the following classes/functions is now deprecated:
|
|
||||||
|
|
||||||
- ``_pytest.cacheprovider.Cache``
|
|
||||||
- ``_pytest.cacheprovider.Cache.for_config()``
|
|
||||||
- ``_pytest.cacheprovider.Cache.clear_cache()``
|
|
||||||
- ``_pytest.cacheprovider.Cache.cache_dir_from_config()``
|
|
||||||
- ``_pytest.capture.CaptureFixture``
|
|
||||||
- ``_pytest.fixtures.FixtureRequest``
|
|
||||||
- ``_pytest.fixtures.SubRequest``
|
|
||||||
- ``_pytest.logging.LogCaptureFixture``
|
|
||||||
- ``_pytest.pytester.Pytester``
|
|
||||||
- ``_pytest.pytester.Testdir``
|
|
||||||
- ``_pytest.recwarn.WarningsRecorder``
|
|
||||||
- ``_pytest.recwarn.WarningsChecker``
|
|
||||||
- ``_pytest.tmpdir.TempPathFactory``
|
|
||||||
- ``_pytest.tmpdir.TempdirFactory``
|
|
||||||
|
|
||||||
These have always been considered private, but now issue a deprecation warning, which may become a hard error in pytest 7.0.0.
|
|
|
@ -1,23 +0,0 @@
|
||||||
It is now possible to construct a :class:`MonkeyPatch` object directly as ``pytest.MonkeyPatch()``,
|
|
||||||
in cases when the :fixture:`monkeypatch` fixture cannot be used. Previously some users imported it
|
|
||||||
from the private `_pytest.monkeypatch.MonkeyPatch` namespace.
|
|
||||||
|
|
||||||
The types of builtin pytest fixtures are now exported so they may be used in type annotations of test functions.
|
|
||||||
The newly-exported types are:
|
|
||||||
|
|
||||||
- ``pytest.FixtureRequest`` for the :fixture:`request` fixture.
|
|
||||||
- ``pytest.Cache`` for the :fixture:`cache` fixture.
|
|
||||||
- ``pytest.CaptureFixture[str]`` for the :fixture:`capfd` and :fixture:`capsys` fixtures.
|
|
||||||
- ``pytest.CaptureFixture[bytes]`` for the :fixture:`capfdbinary` and :fixture:`capsysbinary` fixtures.
|
|
||||||
- ``pytest.LogCaptureFixture`` for the :fixture:`caplog` fixture.
|
|
||||||
- ``pytest.Pytester`` for the :fixture:`pytester` fixture.
|
|
||||||
- ``pytest.Testdir`` for the :fixture:`testdir` fixture.
|
|
||||||
- ``pytest.TempdirFactory`` for the :fixture:`tmpdir_factory` fixture.
|
|
||||||
- ``pytest.TempPathFactory`` for the :fixture:`tmp_path_factory` fixture.
|
|
||||||
- ``pytest.MonkeyPatch`` for the :fixture:`monkeypatch` fixture.
|
|
||||||
- ``pytest.WarningsRecorder`` for the :fixture:`recwarn` fixture.
|
|
||||||
|
|
||||||
Constructing them is not supported (except for `MonkeyPatch`); they are only meant for use in type annotations.
|
|
||||||
Doing so will emit a deprecation warning, and may become a hard-error in pytest 7.0.
|
|
||||||
|
|
||||||
Subclassing them is also not supported. This is not currently enforced at runtime, but is detected by type-checkers such as mypy.
|
|
|
@ -1 +0,0 @@
|
||||||
When a comparison between :func:`namedtuple <collections.namedtuple>` instances of the same type fails, pytest now shows the differing field names (possibly nested) instead of their indexes.
|
|
|
@ -1,4 +0,0 @@
|
||||||
The ``--strict`` command-line option has been deprecated, use ``--strict-markers`` instead.
|
|
||||||
|
|
||||||
We have plans to maybe in the future to reintroduce ``--strict`` and make it an encompassing flag for all strictness
|
|
||||||
related options (``--strict-markers`` and ``--strict-config`` at the moment, more might be introduced in the future).
|
|
|
@ -1 +0,0 @@
|
||||||
:meth:`Node.warn <_pytest.nodes.Node.warn>` now permits any subclass of :class:`Warning`, not just :class:`PytestWarning <pytest.PytestWarning>`.
|
|
|
@ -1,19 +0,0 @@
|
||||||
A new hook was added, `pytest_markeval_namespace` which should return a dictionary.
|
|
||||||
This dictionary will be used to augment the "global" variables available to evaluate skipif/xfail/xpass markers.
|
|
||||||
|
|
||||||
Pseudo example
|
|
||||||
|
|
||||||
``conftest.py``:
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
def pytest_markeval_namespace():
|
|
||||||
return {"color": "red"}
|
|
||||||
|
|
||||||
``test_func.py``:
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
@pytest.mark.skipif("color == 'blue'", reason="Color is not red")
|
|
||||||
def test_func():
|
|
||||||
assert False
|
|
|
@ -1 +0,0 @@
|
||||||
Improved reporting when using ``--collected-only``. It will now show the number of collected tests in the summary stats.
|
|
|
@ -1,4 +0,0 @@
|
||||||
Use strict equality comparison for non-numeric types in :func:`pytest.approx` instead of
|
|
||||||
raising :class:`TypeError`.
|
|
||||||
|
|
||||||
This was the undocumented behavior before 3.7, but is now officially a supported feature.
|
|
|
@ -1 +0,0 @@
|
||||||
Fixed an issue where some files in packages are getting lost from ``--lf`` even though they contain tests that failed. Regressed in pytest 5.4.0.
|
|
|
@ -1 +0,0 @@
|
||||||
Classes which should not be inherited from are now marked ``final class`` in the API reference.
|
|
|
@ -1 +0,0 @@
|
||||||
The ``attrs`` dependency requirement is now >=19.2.0 instead of >=17.4.0.
|
|
|
@ -1 +0,0 @@
|
||||||
pytest now supports python3.6+ only.
|
|
|
@ -1 +0,0 @@
|
||||||
``_pytest.config.argparsing.Parser.addini()`` accepts explicit ``None`` and ``"string"``.
|
|
|
@ -1 +0,0 @@
|
||||||
In pull request section, ask to commit after editing changelog and authors file.
|
|
|
@ -1 +0,0 @@
|
||||||
Directories created by by :fixture:`tmp_path` and :fixture:`tmpdir` are now considered stale after 3 days without modification (previous value was 3 hours) to avoid deleting directories still in use in long running test suites.
|
|
|
@ -1 +0,0 @@
|
||||||
Fixed a crash or hang in :meth:`pytester.spawn <_pytest.pytester.Pytester.spawn>` when the :mod:`readline` module is involved.
|
|
|
@ -1 +0,0 @@
|
||||||
New ``--sw-skip`` argument which is a shorthand for ``--stepwise-skip``.
|
|
|
@ -1 +0,0 @@
|
||||||
Fixed handling of recursive symlinks when collecting tests.
|
|
|
@ -1 +0,0 @@
|
||||||
Fixed symlinked directories not being followed during collection. Regressed in pytest 6.1.0.
|
|
|
@ -1,3 +0,0 @@
|
||||||
The ``@pytest.yield_fixture`` decorator/function is now deprecated. Use :func:`pytest.fixture` instead.
|
|
||||||
|
|
||||||
``yield_fixture`` has been an alias for ``fixture`` for a very long time, so can be search/replaced safely.
|
|
|
@ -1,8 +0,0 @@
|
||||||
It is now possible to construct a :class:`~pytest.MonkeyPatch` object directly as ``pytest.MonkeyPatch()``,
|
|
||||||
in cases when the :fixture:`monkeypatch` fixture cannot be used. Previously some users imported it
|
|
||||||
from the private `_pytest.monkeypatch.MonkeyPatch` namespace.
|
|
||||||
|
|
||||||
Additionally, :meth:`MonkeyPatch.context <pytest.MonkeyPatch.context>` is now a classmethod,
|
|
||||||
and can be used as ``with MonkeyPatch.context() as mp: ...``. This is the recommended way to use
|
|
||||||
``MonkeyPatch`` directly, since unlike the ``monkeypatch`` fixture, an instance created directly
|
|
||||||
is not ``undo()``-ed automatically.
|
|
|
@ -1,2 +0,0 @@
|
||||||
`.pyc` files created by pytest's assertion rewriting now conform to the newer PEP-552 format on Python>=3.7.
|
|
||||||
(These files are internal and only interpreted by pytest itself.)
|
|
|
@ -1 +0,0 @@
|
||||||
Fixed only one doctest being collected when using ``pytest --doctest-modules path/to/an/__init__.py``.
|
|
|
@ -1 +0,0 @@
|
||||||
Added ``'node_modules'`` to default value for :confval:`norecursedirs`.
|
|
|
@ -1 +0,0 @@
|
||||||
:meth:`doClassCleanups <unittest.TestCase.doClassCleanups>` (introduced in :mod:`unittest` in Python and 3.8) is now called appropriately.
|
|
|
@ -6,6 +6,7 @@ Release announcements
|
||||||
:maxdepth: 2
|
:maxdepth: 2
|
||||||
|
|
||||||
|
|
||||||
|
release-6.2.0
|
||||||
release-6.1.2
|
release-6.1.2
|
||||||
release-6.1.1
|
release-6.1.1
|
||||||
release-6.1.0
|
release-6.1.0
|
||||||
|
|
|
@ -0,0 +1,76 @@
|
||||||
|
pytest-6.2.0
|
||||||
|
=======================================
|
||||||
|
|
||||||
|
The pytest team is proud to announce the 6.2.0 release!
|
||||||
|
|
||||||
|
This release contains new features, improvements, bug fixes, and breaking changes, so users
|
||||||
|
are encouraged to take a look at the CHANGELOG carefully:
|
||||||
|
|
||||||
|
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:
|
||||||
|
|
||||||
|
* Adam Johnson
|
||||||
|
* Albert Villanova del Moral
|
||||||
|
* Anthony Sottile
|
||||||
|
* Anton
|
||||||
|
* Ariel Pillemer
|
||||||
|
* Bruno Oliveira
|
||||||
|
* Charles Aracil
|
||||||
|
* Christine M
|
||||||
|
* Christine Mecklenborg
|
||||||
|
* Cserna Zsolt
|
||||||
|
* Dominic Mortlock
|
||||||
|
* Emiel van de Laar
|
||||||
|
* Florian Bruhin
|
||||||
|
* Garvit Shubham
|
||||||
|
* Gustavo Camargo
|
||||||
|
* Hugo Martins
|
||||||
|
* Hugo van Kemenade
|
||||||
|
* Jakob van Santen
|
||||||
|
* Josias Aurel
|
||||||
|
* Jürgen Gmach
|
||||||
|
* Karthikeyan Singaravelan
|
||||||
|
* Katarzyna
|
||||||
|
* Kyle Altendorf
|
||||||
|
* Manuel Mariñez
|
||||||
|
* Matthew Hughes
|
||||||
|
* Matthias Gabriel
|
||||||
|
* Max Voitko
|
||||||
|
* Maximilian Cosmo Sitter
|
||||||
|
* Mikhail Fesenko
|
||||||
|
* Nimesh Vashistha
|
||||||
|
* Pedro Algarvio
|
||||||
|
* Petter Strandmark
|
||||||
|
* Prakhar Gurunani
|
||||||
|
* Prashant Sharma
|
||||||
|
* Ran Benita
|
||||||
|
* Ronny Pfannschmidt
|
||||||
|
* Sanket Duthade
|
||||||
|
* Shubham Adep
|
||||||
|
* Simon K
|
||||||
|
* Tanvi Mehta
|
||||||
|
* Thomas Grainger
|
||||||
|
* Tim Hoffmann
|
||||||
|
* Vasilis Gerakaris
|
||||||
|
* William Jamir Silva
|
||||||
|
* Zac Hatfield-Dodds
|
||||||
|
* crricks
|
||||||
|
* dependabot[bot]
|
||||||
|
* duthades
|
||||||
|
* frankgerhardt
|
||||||
|
* kwgchi
|
||||||
|
* mickeypash
|
||||||
|
* symonk
|
||||||
|
|
||||||
|
|
||||||
|
Happy testing,
|
||||||
|
The pytest Development Team
|
|
@ -158,6 +158,11 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
|
||||||
function invocation, created as a sub directory of the base temporary
|
function invocation, created as a sub directory of the base temporary
|
||||||
directory.
|
directory.
|
||||||
|
|
||||||
|
By default, a new base temporary directory is created each test session,
|
||||||
|
and old bases are removed after 3 sessions, to aid in debugging. If
|
||||||
|
``--basetemp`` is used then it is cleared each session. See :ref:`base
|
||||||
|
temporary directory`.
|
||||||
|
|
||||||
The returned object is a `py.path.local`_ path object.
|
The returned object is a `py.path.local`_ path object.
|
||||||
|
|
||||||
.. _`py.path.local`: https://py.readthedocs.io/en/latest/path.html
|
.. _`py.path.local`: https://py.readthedocs.io/en/latest/path.html
|
||||||
|
@ -167,6 +172,11 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
|
||||||
function invocation, created as a sub directory of the base temporary
|
function invocation, created as a sub directory of the base temporary
|
||||||
directory.
|
directory.
|
||||||
|
|
||||||
|
By default, a new base temporary directory is created each test session,
|
||||||
|
and old bases are removed after 3 sessions, to aid in debugging. If
|
||||||
|
``--basetemp`` is used then it is cleared each session. See :ref:`base
|
||||||
|
temporary directory`.
|
||||||
|
|
||||||
The returned object is a :class:`pathlib.Path` object.
|
The returned object is a :class:`pathlib.Path` object.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,203 @@ with advance notice in the **Deprecations** section of releases.
|
||||||
|
|
||||||
.. towncrier release notes start
|
.. towncrier release notes start
|
||||||
|
|
||||||
|
pytest 6.2.0 (2020-12-12)
|
||||||
|
=========================
|
||||||
|
|
||||||
|
Breaking Changes
|
||||||
|
----------------
|
||||||
|
|
||||||
|
- `#7808 <https://github.com/pytest-dev/pytest/issues/7808>`_: pytest now supports python3.6+ only.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Deprecations
|
||||||
|
------------
|
||||||
|
|
||||||
|
- `#7469 <https://github.com/pytest-dev/pytest/issues/7469>`_: Directly constructing/calling the following classes/functions is now deprecated:
|
||||||
|
|
||||||
|
- ``_pytest.cacheprovider.Cache``
|
||||||
|
- ``_pytest.cacheprovider.Cache.for_config()``
|
||||||
|
- ``_pytest.cacheprovider.Cache.clear_cache()``
|
||||||
|
- ``_pytest.cacheprovider.Cache.cache_dir_from_config()``
|
||||||
|
- ``_pytest.capture.CaptureFixture``
|
||||||
|
- ``_pytest.fixtures.FixtureRequest``
|
||||||
|
- ``_pytest.fixtures.SubRequest``
|
||||||
|
- ``_pytest.logging.LogCaptureFixture``
|
||||||
|
- ``_pytest.pytester.Pytester``
|
||||||
|
- ``_pytest.pytester.Testdir``
|
||||||
|
- ``_pytest.recwarn.WarningsRecorder``
|
||||||
|
- ``_pytest.recwarn.WarningsChecker``
|
||||||
|
- ``_pytest.tmpdir.TempPathFactory``
|
||||||
|
- ``_pytest.tmpdir.TempdirFactory``
|
||||||
|
|
||||||
|
These have always been considered private, but now issue a deprecation warning, which may become a hard error in pytest 7.0.0.
|
||||||
|
|
||||||
|
|
||||||
|
- `#7530 <https://github.com/pytest-dev/pytest/issues/7530>`_: The ``--strict`` command-line option has been deprecated, use ``--strict-markers`` instead.
|
||||||
|
|
||||||
|
We have plans to maybe in the future to reintroduce ``--strict`` and make it an encompassing flag for all strictness
|
||||||
|
related options (``--strict-markers`` and ``--strict-config`` at the moment, more might be introduced in the future).
|
||||||
|
|
||||||
|
|
||||||
|
- `#7988 <https://github.com/pytest-dev/pytest/issues/7988>`_: The ``@pytest.yield_fixture`` decorator/function is now deprecated. Use :func:`pytest.fixture` instead.
|
||||||
|
|
||||||
|
``yield_fixture`` has been an alias for ``fixture`` for a very long time, so can be search/replaced safely.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Features
|
||||||
|
--------
|
||||||
|
|
||||||
|
- `#5299 <https://github.com/pytest-dev/pytest/issues/5299>`_: pytest now warns about unraisable exceptions and unhandled thread exceptions that occur in tests on Python>=3.8.
|
||||||
|
See :ref:`unraisable` for more information.
|
||||||
|
|
||||||
|
|
||||||
|
- `#7425 <https://github.com/pytest-dev/pytest/issues/7425>`_: New :fixture:`pytester` fixture, which is identical to :fixture:`testdir` but its methods return :class:`pathlib.Path` when appropriate instead of ``py.path.local``.
|
||||||
|
|
||||||
|
This is part of the movement to use :class:`pathlib.Path` objects internally, in order to remove the dependency to ``py`` in the future.
|
||||||
|
|
||||||
|
Internally, the old :class:`Testdir <_pytest.pytester.Testdir>` is now a thin wrapper around :class:`Pytester <_pytest.pytester.Pytester>`, preserving the old interface.
|
||||||
|
|
||||||
|
|
||||||
|
- `#7695 <https://github.com/pytest-dev/pytest/issues/7695>`_: A new hook was added, `pytest_markeval_namespace` which should return a dictionary.
|
||||||
|
This dictionary will be used to augment the "global" variables available to evaluate skipif/xfail/xpass markers.
|
||||||
|
|
||||||
|
Pseudo example
|
||||||
|
|
||||||
|
``conftest.py``:
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
def pytest_markeval_namespace():
|
||||||
|
return {"color": "red"}
|
||||||
|
|
||||||
|
``test_func.py``:
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
@pytest.mark.skipif("color == 'blue'", reason="Color is not red")
|
||||||
|
def test_func():
|
||||||
|
assert False
|
||||||
|
|
||||||
|
|
||||||
|
- `#8006 <https://github.com/pytest-dev/pytest/issues/8006>`_: It is now possible to construct a :class:`~pytest.MonkeyPatch` object directly as ``pytest.MonkeyPatch()``,
|
||||||
|
in cases when the :fixture:`monkeypatch` fixture cannot be used. Previously some users imported it
|
||||||
|
from the private `_pytest.monkeypatch.MonkeyPatch` namespace.
|
||||||
|
|
||||||
|
Additionally, :meth:`MonkeyPatch.context <pytest.MonkeyPatch.context>` is now a classmethod,
|
||||||
|
and can be used as ``with MonkeyPatch.context() as mp: ...``. This is the recommended way to use
|
||||||
|
``MonkeyPatch`` directly, since unlike the ``monkeypatch`` fixture, an instance created directly
|
||||||
|
is not ``undo()``-ed automatically.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Improvements
|
||||||
|
------------
|
||||||
|
|
||||||
|
- `#1265 <https://github.com/pytest-dev/pytest/issues/1265>`_: Added an ``__str__`` implementation to the :class:`~pytest.pytester.LineMatcher` class which is returned from ``pytester.run_pytest().stdout`` and similar. It returns the entire output, like the existing ``str()`` method.
|
||||||
|
|
||||||
|
|
||||||
|
- `#2044 <https://github.com/pytest-dev/pytest/issues/2044>`_: Verbose mode now shows the reason that a test was skipped in the test's terminal line after the "SKIPPED", "XFAIL" or "XPASS".
|
||||||
|
|
||||||
|
|
||||||
|
- `#7469 <https://github.com/pytest-dev/pytest/issues/7469>`_ The types of builtin pytest fixtures are now exported so they may be used in type annotations of test functions.
|
||||||
|
The newly-exported types are:
|
||||||
|
|
||||||
|
- ``pytest.FixtureRequest`` for the :fixture:`request` fixture.
|
||||||
|
- ``pytest.Cache`` for the :fixture:`cache` fixture.
|
||||||
|
- ``pytest.CaptureFixture[str]`` for the :fixture:`capfd` and :fixture:`capsys` fixtures.
|
||||||
|
- ``pytest.CaptureFixture[bytes]`` for the :fixture:`capfdbinary` and :fixture:`capsysbinary` fixtures.
|
||||||
|
- ``pytest.LogCaptureFixture`` for the :fixture:`caplog` fixture.
|
||||||
|
- ``pytest.Pytester`` for the :fixture:`pytester` fixture.
|
||||||
|
- ``pytest.Testdir`` for the :fixture:`testdir` fixture.
|
||||||
|
- ``pytest.TempdirFactory`` for the :fixture:`tmpdir_factory` fixture.
|
||||||
|
- ``pytest.TempPathFactory`` for the :fixture:`tmp_path_factory` fixture.
|
||||||
|
- ``pytest.MonkeyPatch`` for the :fixture:`monkeypatch` fixture.
|
||||||
|
- ``pytest.WarningsRecorder`` for the :fixture:`recwarn` fixture.
|
||||||
|
|
||||||
|
Constructing them is not supported (except for `MonkeyPatch`); they are only meant for use in type annotations.
|
||||||
|
Doing so will emit a deprecation warning, and may become a hard-error in pytest 7.0.
|
||||||
|
|
||||||
|
Subclassing them is also not supported. This is not currently enforced at runtime, but is detected by type-checkers such as mypy.
|
||||||
|
|
||||||
|
|
||||||
|
- `#7527 <https://github.com/pytest-dev/pytest/issues/7527>`_: When a comparison between :func:`namedtuple <collections.namedtuple>` instances of the same type fails, pytest now shows the differing field names (possibly nested) instead of their indexes.
|
||||||
|
|
||||||
|
|
||||||
|
- `#7615 <https://github.com/pytest-dev/pytest/issues/7615>`_: :meth:`Node.warn <_pytest.nodes.Node.warn>` now permits any subclass of :class:`Warning`, not just :class:`PytestWarning <pytest.PytestWarning>`.
|
||||||
|
|
||||||
|
|
||||||
|
- `#7701 <https://github.com/pytest-dev/pytest/issues/7701>`_: Improved reporting when using ``--collected-only``. It will now show the number of collected tests in the summary stats.
|
||||||
|
|
||||||
|
|
||||||
|
- `#7710 <https://github.com/pytest-dev/pytest/issues/7710>`_: Use strict equality comparison for non-numeric types in :func:`pytest.approx` instead of
|
||||||
|
raising :class:`TypeError`.
|
||||||
|
|
||||||
|
This was the undocumented behavior before 3.7, but is now officially a supported feature.
|
||||||
|
|
||||||
|
|
||||||
|
- `#7938 <https://github.com/pytest-dev/pytest/issues/7938>`_: New ``--sw-skip`` argument which is a shorthand for ``--stepwise-skip``.
|
||||||
|
|
||||||
|
|
||||||
|
- `#8023 <https://github.com/pytest-dev/pytest/issues/8023>`_: Added ``'node_modules'`` to default value for :confval:`norecursedirs`.
|
||||||
|
|
||||||
|
|
||||||
|
- `#8032 <https://github.com/pytest-dev/pytest/issues/8032>`_: :meth:`doClassCleanups <unittest.TestCase.doClassCleanups>` (introduced in :mod:`unittest` in Python and 3.8) is now called appropriately.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Bug Fixes
|
||||||
|
---------
|
||||||
|
|
||||||
|
- `#4824 <https://github.com/pytest-dev/pytest/issues/4824>`_: Fixed quadratic behavior and improved performance of collection of items using autouse fixtures and xunit fixtures.
|
||||||
|
|
||||||
|
|
||||||
|
- `#7758 <https://github.com/pytest-dev/pytest/issues/7758>`_: Fixed an issue where some files in packages are getting lost from ``--lf`` even though they contain tests that failed. Regressed in pytest 5.4.0.
|
||||||
|
|
||||||
|
|
||||||
|
- `#7911 <https://github.com/pytest-dev/pytest/issues/7911>`_: Directories created by by :fixture:`tmp_path` and :fixture:`tmpdir` are now considered stale after 3 days without modification (previous value was 3 hours) to avoid deleting directories still in use in long running test suites.
|
||||||
|
|
||||||
|
|
||||||
|
- `#7913 <https://github.com/pytest-dev/pytest/issues/7913>`_: Fixed a crash or hang in :meth:`pytester.spawn <_pytest.pytester.Pytester.spawn>` when the :mod:`readline` module is involved.
|
||||||
|
|
||||||
|
|
||||||
|
- `#7951 <https://github.com/pytest-dev/pytest/issues/7951>`_: Fixed handling of recursive symlinks when collecting tests.
|
||||||
|
|
||||||
|
|
||||||
|
- `#7981 <https://github.com/pytest-dev/pytest/issues/7981>`_: Fixed symlinked directories not being followed during collection. Regressed in pytest 6.1.0.
|
||||||
|
|
||||||
|
|
||||||
|
- `#8016 <https://github.com/pytest-dev/pytest/issues/8016>`_: Fixed only one doctest being collected when using ``pytest --doctest-modules path/to/an/__init__.py``.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Improved Documentation
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
- `#7429 <https://github.com/pytest-dev/pytest/issues/7429>`_: Add more information and use cases about skipping doctests.
|
||||||
|
|
||||||
|
|
||||||
|
- `#7780 <https://github.com/pytest-dev/pytest/issues/7780>`_: Classes which should not be inherited from are now marked ``final class`` in the API reference.
|
||||||
|
|
||||||
|
|
||||||
|
- `#7872 <https://github.com/pytest-dev/pytest/issues/7872>`_: ``_pytest.config.argparsing.Parser.addini()`` accepts explicit ``None`` and ``"string"``.
|
||||||
|
|
||||||
|
|
||||||
|
- `#7878 <https://github.com/pytest-dev/pytest/issues/7878>`_: In pull request section, ask to commit after editing changelog and authors file.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Trivial/Internal Changes
|
||||||
|
------------------------
|
||||||
|
|
||||||
|
- `#7802 <https://github.com/pytest-dev/pytest/issues/7802>`_: The ``attrs`` dependency requirement is now >=19.2.0 instead of >=17.4.0.
|
||||||
|
|
||||||
|
|
||||||
|
- `#8014 <https://github.com/pytest-dev/pytest/issues/8014>`_: `.pyc` files created by pytest's assertion rewriting now conform to the newer PEP-552 format on Python>=3.7.
|
||||||
|
(These files are internal and only interpreted by pytest itself.)
|
||||||
|
|
||||||
|
|
||||||
pytest 6.1.2 (2020-10-28)
|
pytest 6.1.2 (2020-10-28)
|
||||||
=========================
|
=========================
|
||||||
|
|
||||||
|
|
|
@ -102,4 +102,4 @@ interesting to just look at the collection tree:
|
||||||
<YamlItem hello>
|
<YamlItem hello>
|
||||||
<YamlItem ok>
|
<YamlItem ok>
|
||||||
|
|
||||||
========================== 2 tests found in 0.12s ===========================
|
======================== 2 tests collected in 0.12s ========================
|
||||||
|
|
|
@ -175,7 +175,7 @@ objects, they are still using the default pytest representation:
|
||||||
<Function test_timedistance_v3[forward]>
|
<Function test_timedistance_v3[forward]>
|
||||||
<Function test_timedistance_v3[backward]>
|
<Function test_timedistance_v3[backward]>
|
||||||
|
|
||||||
========================== 8 tests found in 0.12s ===========================
|
======================== 8 tests collected in 0.12s ========================
|
||||||
|
|
||||||
In ``test_timedistance_v3``, we used ``pytest.param`` to specify the test IDs
|
In ``test_timedistance_v3``, we used ``pytest.param`` to specify the test IDs
|
||||||
together with the actual data, instead of listing them separately.
|
together with the actual data, instead of listing them separately.
|
||||||
|
@ -252,7 +252,7 @@ If you just collect tests you'll also nicely see 'advanced' and 'basic' as varia
|
||||||
<Function test_demo1[advanced]>
|
<Function test_demo1[advanced]>
|
||||||
<Function test_demo2[advanced]>
|
<Function test_demo2[advanced]>
|
||||||
|
|
||||||
========================== 4 tests found in 0.12s ===========================
|
======================== 4 tests collected in 0.12s ========================
|
||||||
|
|
||||||
Note that we told ``metafunc.parametrize()`` that your scenario values
|
Note that we told ``metafunc.parametrize()`` that your scenario values
|
||||||
should be considered class-scoped. With pytest-2.3 this leads to a
|
should be considered class-scoped. With pytest-2.3 this leads to a
|
||||||
|
@ -328,7 +328,7 @@ Let's first see how it looks like at collection time:
|
||||||
<Function test_db_initialized[d1]>
|
<Function test_db_initialized[d1]>
|
||||||
<Function test_db_initialized[d2]>
|
<Function test_db_initialized[d2]>
|
||||||
|
|
||||||
========================== 2/2 tests found in 0.12s ===========================
|
======================== 2 tests collected in 0.12s ========================
|
||||||
|
|
||||||
And then when we run the test:
|
And then when we run the test:
|
||||||
|
|
||||||
|
|
|
@ -157,7 +157,7 @@ The test collection would look like this:
|
||||||
<Function simple_check>
|
<Function simple_check>
|
||||||
<Function complex_check>
|
<Function complex_check>
|
||||||
|
|
||||||
========================== 2 tests found in 0.12s ===========================
|
======================== 2 tests collected in 0.12s ========================
|
||||||
|
|
||||||
You can check for multiple glob patterns by adding a space between the patterns:
|
You can check for multiple glob patterns by adding a space between the patterns:
|
||||||
|
|
||||||
|
@ -220,7 +220,7 @@ You can always peek at the collection tree without running tests like this:
|
||||||
<Function test_method>
|
<Function test_method>
|
||||||
<Function test_anothermethod>
|
<Function test_anothermethod>
|
||||||
|
|
||||||
========================== 3 tests found in 0.12s ===========================
|
======================== 3 tests collected in 0.12s ========================
|
||||||
|
|
||||||
.. _customizing-test-collection:
|
.. _customizing-test-collection:
|
||||||
|
|
||||||
|
@ -296,7 +296,7 @@ file will be left out:
|
||||||
rootdir: $REGENDOC_TMPDIR, configfile: pytest.ini
|
rootdir: $REGENDOC_TMPDIR, configfile: pytest.ini
|
||||||
collected 0 items
|
collected 0 items
|
||||||
|
|
||||||
========================== no tests found in 0.12s ===========================
|
======================= no tests collected in 0.12s ========================
|
||||||
|
|
||||||
It's also possible to ignore files based on Unix shell-style wildcards by adding
|
It's also possible to ignore files based on Unix shell-style wildcards by adding
|
||||||
patterns to :globalvar:`collect_ignore_glob`.
|
patterns to :globalvar:`collect_ignore_glob`.
|
||||||
|
|
|
@ -446,7 +446,7 @@ Here is a nice run of several failures and how ``pytest`` presents things:
|
||||||
|
|
||||||
def test_reinterpret_fails_with_print_for_the_fun_of_it(self):
|
def test_reinterpret_fails_with_print_for_the_fun_of_it(self):
|
||||||
items = [1, 2, 3]
|
items = [1, 2, 3]
|
||||||
print("items is {!r}".format(items))
|
print(f"items is {items!r}")
|
||||||
> a, b = items.pop()
|
> a, b = items.pop()
|
||||||
E TypeError: cannot unpack non-iterable int object
|
E TypeError: cannot unpack non-iterable int object
|
||||||
|
|
||||||
|
|
|
@ -919,7 +919,7 @@ Running the above tests results in the following test IDs being used:
|
||||||
<Function test_ehlo[mail.python.org]>
|
<Function test_ehlo[mail.python.org]>
|
||||||
<Function test_noop[mail.python.org]>
|
<Function test_noop[mail.python.org]>
|
||||||
|
|
||||||
========================== 10 tests found in 0.12s ===========================
|
======================= 10 tests collected in 0.12s ========================
|
||||||
|
|
||||||
.. _`fixture-parametrize-marks`:
|
.. _`fixture-parametrize-marks`:
|
||||||
|
|
||||||
|
@ -958,7 +958,7 @@ Running this test will *skip* the invocation of ``data_set`` with value ``2``:
|
||||||
|
|
||||||
test_fixture_marks.py::test_data[0] PASSED [ 33%]
|
test_fixture_marks.py::test_data[0] PASSED [ 33%]
|
||||||
test_fixture_marks.py::test_data[1] PASSED [ 66%]
|
test_fixture_marks.py::test_data[1] PASSED [ 66%]
|
||||||
test_fixture_marks.py::test_data[2] SKIPPED [100%]
|
test_fixture_marks.py::test_data[2] SKIPPED (unconditional skip) [100%]
|
||||||
|
|
||||||
======================= 2 passed, 1 skipped in 0.12s =======================
|
======================= 2 passed, 1 skipped in 0.12s =======================
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ Install ``pytest``
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
$ pytest --version
|
$ pytest --version
|
||||||
pytest 6.1.2
|
pytest 6.2.0
|
||||||
|
|
||||||
.. _`simpletest`:
|
.. _`simpletest`:
|
||||||
|
|
||||||
|
|
|
@ -1749,7 +1749,8 @@ All the command-line flags can be obtained by running ``pytest --help``::
|
||||||
failures.
|
failures.
|
||||||
--sw, --stepwise exit on test failure and continue from last failing
|
--sw, --stepwise exit on test failure and continue from last failing
|
||||||
test next time
|
test next time
|
||||||
--stepwise-skip ignore the first failing test but stop on the next
|
--sw-skip, --stepwise-skip
|
||||||
|
ignore the first failing test but stop on the next
|
||||||
failing test
|
failing test
|
||||||
|
|
||||||
reporting:
|
reporting:
|
||||||
|
@ -1791,9 +1792,9 @@ All the command-line flags can be obtained by running ``pytest --help``::
|
||||||
--maxfail=num exit after first num failures or errors.
|
--maxfail=num exit after first num failures or errors.
|
||||||
--strict-config any warnings encountered while parsing the `pytest`
|
--strict-config any warnings encountered while parsing the `pytest`
|
||||||
section of the configuration file raise errors.
|
section of the configuration file raise errors.
|
||||||
--strict-markers, --strict
|
--strict-markers markers not registered in the `markers` section of
|
||||||
markers not registered in the `markers` section of
|
|
||||||
the configuration file raise errors.
|
the configuration file raise errors.
|
||||||
|
--strict (deprecated) alias to --strict-markers.
|
||||||
-c file load configuration from `file` instead of trying to
|
-c file load configuration from `file` instead of trying to
|
||||||
locate one of the implicit configuration files.
|
locate one of the implicit configuration files.
|
||||||
--continue-on-collection-errors
|
--continue-on-collection-errors
|
||||||
|
|
|
@ -61,7 +61,7 @@ Running this would result in a passed test except for the last
|
||||||
> assert 0
|
> assert 0
|
||||||
E assert 0
|
E assert 0
|
||||||
|
|
||||||
test_tmp_path.py:13: AssertionError
|
test_tmp_path.py:11: AssertionError
|
||||||
========================= short test summary info ==========================
|
========================= short test summary info ==========================
|
||||||
FAILED test_tmp_path.py::test_create_file - assert 0
|
FAILED test_tmp_path.py::test_create_file - assert 0
|
||||||
============================ 1 failed in 0.12s =============================
|
============================ 1 failed in 0.12s =============================
|
||||||
|
@ -129,7 +129,7 @@ Running this would result in a passed test except for the last
|
||||||
> assert 0
|
> assert 0
|
||||||
E assert 0
|
E assert 0
|
||||||
|
|
||||||
test_tmpdir.py:9: AssertionError
|
test_tmpdir.py:6: AssertionError
|
||||||
========================= short test summary info ==========================
|
========================= short test summary info ==========================
|
||||||
FAILED test_tmpdir.py::test_create_file - assert 0
|
FAILED test_tmpdir.py::test_create_file - assert 0
|
||||||
============================ 1 failed in 0.12s =============================
|
============================ 1 failed in 0.12s =============================
|
||||||
|
|
|
@ -449,13 +449,7 @@ Additionally it is possible to copy examples for an example folder before runnin
|
||||||
|
|
||||||
test_example.py .. [100%]
|
test_example.py .. [100%]
|
||||||
|
|
||||||
============================= warnings summary =============================
|
============================ 2 passed in 0.12s =============================
|
||||||
test_example.py::test_plugin
|
|
||||||
$REGENDOC_TMPDIR/test_example.py:4: PytestExperimentalApiWarning: testdir.copy_example is an experimental api that may change over time
|
|
||||||
testdir.copy_example("test_example.py")
|
|
||||||
|
|
||||||
-- Docs: https://docs.pytest.org/en/stable/warnings.html
|
|
||||||
======================= 2 passed, 1 warning in 0.12s =======================
|
|
||||||
|
|
||||||
For more information about the result object that ``runpytest()`` returns, and
|
For more information about the result object that ``runpytest()`` returns, and
|
||||||
the methods that it provides please check out the :py:class:`RunResult
|
the methods that it provides please check out the :py:class:`RunResult
|
||||||
|
|
Loading…
Reference in New Issue