Merge branch 'main' into Improvement-catch-duplicate-values-when-determining-param-indices-in-metafunc-parametrize
This commit is contained in:
commit
3a3697d3c2
|
@ -82,9 +82,14 @@ jobs:
|
|||
python -m pip install --upgrade pip
|
||||
pip install --upgrade tox
|
||||
|
||||
- name: Publish GitHub release notes
|
||||
env:
|
||||
GH_RELEASE_NOTES_TOKEN: ${{ github.token }}
|
||||
- name: Generate release notes
|
||||
run: |
|
||||
sudo apt-get install pandoc
|
||||
tox -e publish-gh-release-notes
|
||||
tox -e generate-gh-release-notes -- ${{ github.event.inputs.version }} scripts/latest-release-notes.md
|
||||
|
||||
- name: Publish GitHub Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
body_path: scripts/latest-release-notes.md
|
||||
files: dist/*
|
||||
tag_name: ${{ github.event.inputs.version }}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
repos:
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 23.12.0
|
||||
rev: 23.12.1
|
||||
hooks:
|
||||
- id: black
|
||||
args: [--safe, --quiet]
|
||||
|
@ -56,10 +56,10 @@ repos:
|
|||
hooks:
|
||||
- id: python-use-type-annotations
|
||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||
rev: v1.7.1
|
||||
rev: v1.8.0
|
||||
hooks:
|
||||
- id: mypy
|
||||
files: ^(src/|testing/)
|
||||
files: ^(src/|testing/|scripts/)
|
||||
args: []
|
||||
additional_dependencies:
|
||||
- iniconfig>=1.1.0
|
||||
|
@ -67,6 +67,7 @@ repos:
|
|||
- packaging
|
||||
- tomli
|
||||
- types-pkg_resources
|
||||
- types-tabulate
|
||||
# for mypy running on python>=3.11 since exceptiongroup is only a dependency
|
||||
# on <3.11
|
||||
- exceptiongroup>=1.0.0rc8
|
||||
|
|
3
AUTHORS
3
AUTHORS
|
@ -54,6 +54,7 @@ Aviral Verma
|
|||
Aviv Palivoda
|
||||
Babak Keyvani
|
||||
Barney Gale
|
||||
Ben Brown
|
||||
Ben Gartner
|
||||
Ben Webb
|
||||
Benjamin Peterson
|
||||
|
@ -137,6 +138,7 @@ Erik Hasse
|
|||
Erik M. Bray
|
||||
Evan Kepner
|
||||
Evgeny Seliverstov
|
||||
Fabian Sturm
|
||||
Fabien Zarifian
|
||||
Fabio Zadrozny
|
||||
Felix Hofstätter
|
||||
|
@ -242,6 +244,7 @@ Marc Mueller
|
|||
Marc Schlaich
|
||||
Marcelo Duarte Trevisani
|
||||
Marcin Bachry
|
||||
Marc Bresson
|
||||
Marco Gorelli
|
||||
Mark Abramowitz
|
||||
Mark Dickinson
|
||||
|
|
|
@ -97,8 +97,8 @@ Features
|
|||
- `Modular fixtures <https://docs.pytest.org/en/stable/explanation/fixtures.html>`_ for
|
||||
managing small or parametrized long-lived test resources
|
||||
|
||||
- Can run `unittest <https://docs.pytest.org/en/stable/how-to/unittest.html>`_ (or trial),
|
||||
`nose <https://docs.pytest.org/en/stable/how-to/nose.html>`_ test suites out of the box
|
||||
- Can run `unittest <https://docs.pytest.org/en/stable/how-to/unittest.html>`_ (or trial)
|
||||
test suites out of the box
|
||||
|
||||
- Python 3.8+ or PyPy3
|
||||
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
Added :func:`ExceptionInfo.group_contains() <pytest.ExceptionInfo.group_contains>`, an assertion
|
||||
helper that tests if an `ExceptionGroup` contains a matching exception.
|
|
@ -1 +0,0 @@
|
|||
Test functions returning a value other than None will now issue a :class:`pytest.PytestWarning` instead of :class:`pytest.PytestRemovedIn8Warning`, meaning this will stay a warning instead of becoming an error in the future.
|
|
@ -1,2 +0,0 @@
|
|||
Added more comprehensive set assertion rewrites for comparisons other than equality ``==``, with
|
||||
the following operations now providing better failure messages: ``!=``, ``<=``, ``>=``, ``<``, and ``>``.
|
|
@ -1,2 +0,0 @@
|
|||
:meth:`pytest.WarningsRecorder.pop` will return the most-closely-matched warning in the list,
|
||||
rather than the first warning which is an instance of the requested type.
|
|
@ -1 +0,0 @@
|
|||
Added a warning about modifying the root logger during tests when using ``caplog``.
|
|
@ -1,3 +0,0 @@
|
|||
Use pytestconfig instead of request.config in cache example
|
||||
|
||||
to be consistent with the API documentation.
|
|
@ -1 +0,0 @@
|
|||
Updated documentation and tests to refer to hyphonated options: replaced ``--junitxml`` with ``--junit-xml`` and ``--collectonly`` with ``--collect-only``.
|
|
@ -1,6 +0,0 @@
|
|||
``pluggy>=1.2.0`` is now required.
|
||||
|
||||
pytest now uses "new-style" hook wrappers internally, available since pluggy 1.2.0.
|
||||
See `pluggy's 1.2.0 changelog <https://pluggy.readthedocs.io/en/latest/changelog.html#pluggy-1-2-0-2023-06-21>`_ and the :ref:`updated docs <hookwrapper>` for details.
|
||||
|
||||
Plugins which want to use new-style wrappers can do so if they require this version of pytest or later.
|
|
@ -1,11 +0,0 @@
|
|||
:class:`pytest.Package` is no longer a :class:`pytest.Module` or :class:`pytest.File`.
|
||||
|
||||
The ``Package`` collector node designates a Python package, that is, a directory with an `__init__.py` file.
|
||||
Previously ``Package`` was a subtype of ``pytest.Module`` (which represents a single Python module),
|
||||
the module being the `__init__.py` file.
|
||||
This has been deemed a design mistake (see :issue:`11137` and :issue:`7777` for details).
|
||||
|
||||
The ``path`` property of ``Package`` nodes now points to the package directory instead of the ``__init__.py`` file.
|
||||
|
||||
Note that a ``Module`` node for ``__init__.py`` (which is not a ``Package``) may still exist,
|
||||
if it is picked up during collection (e.g. if you configured :confval:`python_files` to include ``__init__.py`` files).
|
|
@ -1 +0,0 @@
|
|||
- Prevent constants at the top of file from being detected as docstrings.
|
|
@ -1 +0,0 @@
|
|||
Dropped support for Python 3.7, which `reached end-of-life on 2023-06-27 <https://devguide.python.org/versions/>`__.
|
|
@ -1,2 +0,0 @@
|
|||
The (internal) ``FixtureDef.cached_result`` type has changed.
|
||||
Now the third item ``cached_result[2]``, when set, is an exception instance instead of an exception triplet.
|
|
@ -1 +0,0 @@
|
|||
If a test is skipped from inside an :ref:`xunit setup fixture <classic xunit>`, the test summary now shows the test location instead of the fixture location.
|
|
@ -1,5 +0,0 @@
|
|||
(This entry is meant to assist plugins which access private pytest internals to instantiate ``FixtureRequest`` objects.)
|
||||
|
||||
:class:`~pytest.FixtureRequest` is now an abstract class which can't be instantiated directly.
|
||||
A new concrete ``TopRequest`` subclass of ``FixtureRequest`` has been added for the ``request`` fixture in test functions,
|
||||
as counterpart to the existing ``SubRequest`` subclass for the ``request`` fixture in fixture functions.
|
|
@ -1 +0,0 @@
|
|||
Allow :func:`pytest.raises` ``match`` argument to match against `PEP-678 <https://peps.python.org/pep-0678/>` ``__notes__``.
|
|
@ -0,0 +1,5 @@
|
|||
Improvements to how ``-r`` for xfailures and xpasses:
|
||||
|
||||
* Report tracebacks for xfailures when ``-rx`` is set.
|
||||
* Report captured output for xpasses when ``-rX`` is set.
|
||||
* For xpasses, add ``-`` in summary between test name and reason, to match how xfail is displayed.
|
|
@ -1 +0,0 @@
|
|||
Fixed crash on `parametrize(..., scope="package")` without a package present.
|
|
@ -1,2 +0,0 @@
|
|||
Fixed a bug that when there are multiple fixtures for an indirect parameter,
|
||||
the scope of the highest-scope fixture is picked for the parameter set, instead of that of the one with the narrowest scope.
|
|
@ -1,11 +0,0 @@
|
|||
Sanitized the handling of the ``default`` parameter when defining configuration options.
|
||||
|
||||
Previously if ``default`` was not supplied for :meth:`parser.addini <pytest.Parser.addini>` and the configuration option value was not defined in a test session, then calls to :func:`config.getini <pytest.Config.getini>` returned an *empty list* or an *empty string* depending on whether ``type`` was supplied or not respectively, which is clearly incorrect. Also, ``None`` was not honored even if ``default=None`` was used explicitly while defining the option.
|
||||
|
||||
Now the behavior of :meth:`parser.addini <pytest.Parser.addini>` is as follows:
|
||||
|
||||
* If ``default`` is NOT passed but ``type`` is provided, then a type-specific default will be returned. For example ``type=bool`` will return ``False``, ``type=str`` will return ``""``, etc.
|
||||
* If ``default=None`` is passed and the option is not defined in a test session, then ``None`` will be returned, regardless of the ``type``.
|
||||
* If neither ``default`` nor ``type`` are provided, assume ``type=str`` and return ``""`` as default (this is as per previous behavior).
|
||||
|
||||
The team decided to not introduce a deprecation period for this change, as doing so would be complicated both in terms of communicating this to the community as well as implementing it, and also because the team believes this change should not break existing plugins except in rare cases.
|
|
@ -1,2 +0,0 @@
|
|||
Logging to a file using the ``--log-file`` option will use ``--log-level``, ``--log-format`` and ``--log-date-format`` as fallback
|
||||
if ``--log-file-level``, ``--log-file-format`` and ``--log-file-date-format`` are not provided respectively.
|
|
@ -1,3 +0,0 @@
|
|||
The :fixture:`pytester` fixture now uses the :fixture:`monkeypatch` fixture to manage the current working directory.
|
||||
If you use ``pytester`` in combination with :func:`monkeypatch.undo() <pytest.MonkeyPatch.undo>`, the CWD might get restored.
|
||||
Use :func:`monkeypatch.context() <pytest.MonkeyPatch.context>` instead.
|
|
@ -1,2 +0,0 @@
|
|||
Corrected the spelling of ``Config.ArgsSource.INVOCATION_DIR``.
|
||||
The previous spelling ``INCOVATION_DIR`` remains as an alias.
|
|
@ -1 +0,0 @@
|
|||
pluggy>=1.3.0 is now required. This adds typing to :class:`~pytest.PytestPluginManager`.
|
|
@ -1,5 +0,0 @@
|
|||
Added the new :confval:`verbosity_assertions` configuration option for fine-grained control of failed assertions verbosity.
|
||||
|
||||
See :ref:`Fine-grained verbosity <pytest.fine_grained_verbosity>` for more details.
|
||||
|
||||
For plugin authors, :attr:`config.get_verbosity <pytest.Config.get_verbosity>` can be used to retrieve the verbosity level for a specific verbosity type.
|
|
@ -1 +0,0 @@
|
|||
:func:`pytest.deprecated_call` now also considers warnings of type :class:`FutureWarning`.
|
|
@ -1,4 +0,0 @@
|
|||
Parametrized tests now *really do* ensure that the ids given to each input are unique - for
|
||||
example, ``a, a, a0`` now results in ``a1, a2, a0`` instead of the previous (buggy) ``a0, a1, a0``.
|
||||
This necessarily means changing nodeids where these were previously colliding, and for
|
||||
readability adds an underscore when non-unique ids end in a number.
|
|
@ -1,5 +0,0 @@
|
|||
Improved very verbose diff output to color it as a diff instead of only red.
|
||||
|
||||
Improved the error reporting to better separate each section.
|
||||
|
||||
Improved the error reporting to syntax-highlight Python code when Pygments is available.
|
|
@ -1 +0,0 @@
|
|||
Fixed crash when using an empty string for the same parametrized value more than once.
|
|
@ -1 +0,0 @@
|
|||
Handle an edge case where :data:`sys.stderr` and :data:`sys.__stderr__` might already be closed when :ref:`faulthandler` is tearing down.
|
|
@ -1 +0,0 @@
|
|||
Improved the documentation and type signature for :func:`pytest.mark.xfail <pytest.mark.xfail>`'s ``condition`` param to use ``False`` as the default value.
|
|
@ -1,2 +0,0 @@
|
|||
Added :func:`LogCaptureFixture.filtering() <pytest.LogCaptureFixture.filtering>` context manager that
|
||||
adds a given :class:`logging.Filter` object to the caplog fixture.
|
|
@ -1 +0,0 @@
|
|||
Fixed the selftests to pass correctly if ``FORCE_COLOR``, ``NO_COLOR`` or ``PY_COLORS`` is set in the calling environment.
|
|
@ -1,3 +0,0 @@
|
|||
pytest's ``setup.py`` file is removed.
|
||||
If you relied on this file, e.g. to install pytest using ``setup.py install``,
|
||||
please see `Why you shouldn't invoke setup.py directly <https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html#summary>`_ for alternatives.
|
|
@ -1,3 +0,0 @@
|
|||
The classes :class:`~_pytest.nodes.Node`, :class:`~pytest.Collector`, :class:`~pytest.Item`, :class:`~pytest.File`, :class:`~_pytest.nodes.FSCollector` are now marked abstract (see :mod:`abc`).
|
||||
|
||||
We do not expect this change to affect users and plugin authors, it will only cause errors when the code is already wrong or problematic.
|
|
@ -0,0 +1 @@
|
|||
Fix reporting of teardown errors in higher-scoped fixtures when using `--maxfail` or `--stepwise`.
|
|
@ -1 +0,0 @@
|
|||
Fixed handling ``NO_COLOR`` and ``FORCE_COLOR`` to ignore an empty value.
|
|
@ -0,0 +1,2 @@
|
|||
Fixed ``IndexError: string index out of range`` crash in ``if highlighted[-1] == "\n" and source[-1] != "\n"``.
|
||||
This bug was introduced in pytest 8.0.0rc1.
|
|
@ -1,4 +0,0 @@
|
|||
Improved the very verbose diff for every standard library container types: the indentation is now consistent and the markers are on their own separate lines, which should reduce the diffs shown to users.
|
||||
|
||||
Previously, the default python pretty printer was used to generate the output, which puts opening and closing
|
||||
markers on the same line as the first/last entry, in addition to not having consistent indentation.
|
|
@ -1,3 +0,0 @@
|
|||
Applying a mark to a fixture function now issues a warning: marks in fixtures never had any effect, but it is a common user error to apply a mark to a fixture (for example ``usefixtures``) and expect it to work.
|
||||
|
||||
This will become an error in the future.
|
|
@ -1,22 +0,0 @@
|
|||
**PytestRemovedIn8Warning deprecation warnings are now errors by default.**
|
||||
|
||||
Following our plan to remove deprecated features with as little disruption as
|
||||
possible, all warnings of type ``PytestRemovedIn8Warning`` now generate errors
|
||||
instead of warning messages by default.
|
||||
|
||||
**The affected features will be effectively removed in pytest 8.1**, so please consult the
|
||||
:ref:`deprecations` section in the docs for directions on how to update existing code.
|
||||
|
||||
In the pytest ``8.0.X`` series, it is possible to change the errors back into warnings as a
|
||||
stopgap measure by adding this to your ``pytest.ini`` file:
|
||||
|
||||
.. code-block:: ini
|
||||
|
||||
[pytest]
|
||||
filterwarnings =
|
||||
ignore::pytest.PytestRemovedIn8Warning
|
||||
|
||||
But this will stop working when pytest ``8.1`` is released.
|
||||
|
||||
**If you have concerns** about the removal of a specific feature, please add a
|
||||
comment to :issue:`7363`.
|
|
@ -1 +0,0 @@
|
|||
:class:`~pytest.FixtureDef` is now exported as ``pytest.FixtureDef`` for typing purposes.
|
|
@ -1 +0,0 @@
|
|||
Removes unhelpful error message from assertion rewrite mechanism when exceptions raised in __iter__ methods, and instead treats them as un-iterable.
|
|
@ -1,5 +0,0 @@
|
|||
Running `pytest pkg/__init__.py` now collects the `pkg/__init__.py` file (module) only.
|
||||
Previously, it collected the entire `pkg` package, including other test files in the directory, but excluding tests in the `__init__.py` file itself
|
||||
(unless :confval:`python_files` was changed to allow `__init__.py` file).
|
||||
|
||||
To collect the entire package, specify just the directory: `pytest pkg`.
|
|
@ -1 +0,0 @@
|
|||
``pytest.warns`` and similar functions now capture warnings when an exception is raised inside a ``with`` block.
|
|
@ -1,7 +0,0 @@
|
|||
:func:`~pytest.warns` now re-emits unmatched warnings when the context
|
||||
closes -- previously it would consume all warnings, hiding those that were not
|
||||
matched by the function.
|
||||
|
||||
While this is a new feature, we decided to announce this as a breaking change
|
||||
because many test suites are configured to error-out on warnings, and will
|
||||
therefore fail on the newly-re-emitted warnings.
|
|
@ -44,7 +44,7 @@ Partner projects, sign up here! (by 22 March)
|
|||
What does it mean to "adopt pytest"?
|
||||
-----------------------------------------
|
||||
|
||||
There can be many different definitions of "success". Pytest can run many nose_ and unittest_ tests by default, so using pytest as your testrunner may be possible from day 1. Job done, right?
|
||||
There can be many different definitions of "success". Pytest can run many unittest_ tests by default, so using pytest as your testrunner may be possible from day 1. Job done, right?
|
||||
|
||||
Progressive success might look like:
|
||||
|
||||
|
@ -62,7 +62,6 @@ Progressive success might look like:
|
|||
|
||||
It may be after the month is up, the partner project decides that pytest is not right for it. That's okay - hopefully the pytest team will also learn something about its weaknesses or deficiencies.
|
||||
|
||||
.. _nose: nose.html
|
||||
.. _unittest: unittest.html
|
||||
.. _assert: assert.html
|
||||
.. _pycmd: https://bitbucket.org/hpk42/pycmd/overview
|
||||
|
|
|
@ -6,6 +6,8 @@ Release announcements
|
|||
:maxdepth: 2
|
||||
|
||||
|
||||
release-8.0.0rc1
|
||||
release-7.4.4
|
||||
release-7.4.3
|
||||
release-7.4.2
|
||||
release-7.4.1
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
pytest-7.4.4
|
||||
=======================================
|
||||
|
||||
pytest 7.4.4 has just been released to PyPI.
|
||||
|
||||
This is a bug-fix release, being a drop-in replacement. To upgrade::
|
||||
|
||||
pip install --upgrade pytest
|
||||
|
||||
The full changelog is available at https://docs.pytest.org/en/stable/changelog.html.
|
||||
|
||||
Thanks to all of the contributors to this release:
|
||||
|
||||
* Bruno Oliveira
|
||||
* Ran Benita
|
||||
* Zac Hatfield-Dodds
|
||||
|
||||
|
||||
Happy testing,
|
||||
The pytest Development Team
|
|
@ -0,0 +1,82 @@
|
|||
pytest-8.0.0rc1
|
||||
=======================================
|
||||
|
||||
The pytest team is proud to announce the 8.0.0rc1 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:
|
||||
|
||||
* Akhilesh Ramakrishnan
|
||||
* Aleksandr Brodin
|
||||
* Anthony Sottile
|
||||
* Arthur Richard
|
||||
* Avasam
|
||||
* Benjamin Schubert
|
||||
* Bruno Oliveira
|
||||
* Carsten Grohmann
|
||||
* Cheukting
|
||||
* Chris Mahoney
|
||||
* Christoph Anton Mitterer
|
||||
* DetachHead
|
||||
* Erik Hasse
|
||||
* Florian Bruhin
|
||||
* Fraser Stark
|
||||
* Ha Pam
|
||||
* Hugo van Kemenade
|
||||
* Isaac Virshup
|
||||
* Israel Fruchter
|
||||
* Jens Tröger
|
||||
* Jon Parise
|
||||
* Kenny Y
|
||||
* Lesnek
|
||||
* Marc Mueller
|
||||
* Michał Górny
|
||||
* Mihail Milushev
|
||||
* Milan Lesnek
|
||||
* Miro Hrončok
|
||||
* Patrick Lannigan
|
||||
* Ran Benita
|
||||
* Reagan Lee
|
||||
* Ronny Pfannschmidt
|
||||
* Sadra Barikbin
|
||||
* Sean Malloy
|
||||
* Sean Patrick Malloy
|
||||
* Sharad Nair
|
||||
* Simon Blanchard
|
||||
* Sourabh Beniwal
|
||||
* Stefaan Lippens
|
||||
* Tanya Agarwal
|
||||
* Thomas Grainger
|
||||
* Tom Mortimer-Jones
|
||||
* Tushar Sadhwani
|
||||
* Tyler Smart
|
||||
* Uday Kumar
|
||||
* Warren Markham
|
||||
* WarrenTheRabbit
|
||||
* Zac Hatfield-Dodds
|
||||
* Ziad Kermadi
|
||||
* akhilramkee
|
||||
* antosikv
|
||||
* bowugit
|
||||
* mickeypash
|
||||
* neilmartin2000
|
||||
* pomponchik
|
||||
* ryanpudd
|
||||
* touilleWoman
|
||||
* ubaumann
|
||||
|
||||
|
||||
Happy testing,
|
||||
The pytest Development Team
|
|
@ -18,11 +18,11 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
|
|||
|
||||
$ pytest --fixtures -v
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python
|
||||
cachedir: .pytest_cache
|
||||
rootdir: /home/sweet/project
|
||||
collected 0 items
|
||||
cache -- .../_pytest/cacheprovider.py:532
|
||||
cache -- .../_pytest/cacheprovider.py:526
|
||||
Return a cache object that can persist state between testing sessions.
|
||||
|
||||
cache.get(key, default)
|
||||
|
@ -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:1001
|
||||
capsysbinary -- .../_pytest/capture.py:1008
|
||||
Enable bytes capturing of writes to ``sys.stdout`` and ``sys.stderr``.
|
||||
|
||||
The captured output is made available via ``capsysbinary.readouterr()``
|
||||
|
@ -51,7 +51,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:1029
|
||||
capfd -- .../_pytest/capture.py:1036
|
||||
Enable text capturing of writes to file descriptors ``1`` and ``2``.
|
||||
|
||||
The captured output is made available via ``capfd.readouterr()`` method
|
||||
|
@ -69,7 +69,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:1057
|
||||
capfdbinary -- .../_pytest/capture.py:1064
|
||||
Enable bytes capturing of writes to file descriptors ``1`` and ``2``.
|
||||
|
||||
The captured output is made available via ``capfd.readouterr()`` method
|
||||
|
@ -87,7 +87,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:973
|
||||
capsys -- .../_pytest/capture.py:980
|
||||
Enable text capturing of writes to ``sys.stdout`` and ``sys.stderr``.
|
||||
|
||||
The captured output is made available via ``capsys.readouterr()`` method
|
||||
|
@ -105,7 +105,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:757
|
||||
doctest_namespace [session scope] -- .../_pytest/doctest.py:743
|
||||
Fixture that returns a :py:class:`dict` that will be injected into the
|
||||
namespace of doctests.
|
||||
|
||||
|
@ -119,7 +119,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:1353
|
||||
pytestconfig [session scope] -- .../_pytest/fixtures.py:1365
|
||||
Session-scoped fixture that returns the session's :class:`pytest.Config`
|
||||
object.
|
||||
|
||||
|
@ -174,10 +174,10 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
|
|||
`pytest-xdist <https://github.com/pytest-dev/pytest-xdist>`__ plugin. See
|
||||
:issue:`7767` for details.
|
||||
|
||||
tmpdir_factory [session scope] -- .../_pytest/legacypath.py:302
|
||||
tmpdir_factory [session scope] -- .../_pytest/legacypath.py:300
|
||||
Return a :class:`pytest.TempdirFactory` instance for the test session.
|
||||
|
||||
tmpdir -- .../_pytest/legacypath.py:309
|
||||
tmpdir -- .../_pytest/legacypath.py:307
|
||||
Return a temporary directory path object which is unique to each test
|
||||
function invocation, created as a sub directory of the base temporary
|
||||
directory.
|
||||
|
@ -196,7 +196,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:570
|
||||
caplog -- .../_pytest/logging.py:593
|
||||
Access and control log capturing.
|
||||
|
||||
Captured logs are available through the following properties/methods::
|
||||
|
@ -237,10 +237,10 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
|
|||
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:245
|
||||
tmp_path_factory [session scope] -- .../_pytest/tmpdir.py:239
|
||||
Return a :class:`pytest.TempPathFactory` instance for the test session.
|
||||
|
||||
tmp_path -- .../_pytest/tmpdir.py:260
|
||||
tmp_path -- .../_pytest/tmpdir.py:254
|
||||
Return a temporary directory path object which is unique to each test
|
||||
function invocation, created as a sub directory of the base temporary
|
||||
directory.
|
||||
|
|
|
@ -28,6 +28,402 @@ with advance notice in the **Deprecations** section of releases.
|
|||
|
||||
.. towncrier release notes start
|
||||
|
||||
pytest 8.0.0rc1 (2023-12-30)
|
||||
============================
|
||||
|
||||
Breaking Changes
|
||||
----------------
|
||||
|
||||
Old Deprecations Are Now Errors
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
- `#7363 <https://github.com/pytest-dev/pytest/issues/7363>`_: **PytestRemovedIn8Warning deprecation warnings are now errors by default.**
|
||||
|
||||
Following our plan to remove deprecated features with as little disruption as
|
||||
possible, all warnings of type ``PytestRemovedIn8Warning`` now generate errors
|
||||
instead of warning messages by default.
|
||||
|
||||
**The affected features will be effectively removed in pytest 8.1**, so please consult the
|
||||
:ref:`deprecations` section in the docs for directions on how to update existing code.
|
||||
|
||||
In the pytest ``8.0.X`` series, it is possible to change the errors back into warnings as a
|
||||
stopgap measure by adding this to your ``pytest.ini`` file:
|
||||
|
||||
.. code-block:: ini
|
||||
|
||||
[pytest]
|
||||
filterwarnings =
|
||||
ignore::pytest.PytestRemovedIn8Warning
|
||||
|
||||
But this will stop working when pytest ``8.1`` is released.
|
||||
|
||||
**If you have concerns** about the removal of a specific feature, please add a
|
||||
comment to :issue:`7363`.
|
||||
|
||||
|
||||
Version Compatibility
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
- `#11151 <https://github.com/pytest-dev/pytest/issues/11151>`_: Dropped support for Python 3.7, which `reached end-of-life on 2023-06-27 <https://devguide.python.org/versions/>`__.
|
||||
|
||||
|
||||
- ``pluggy>=1.3.0`` is now required.
|
||||
|
||||
|
||||
Collection Changes
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
In this version we've made several breaking changes to pytest's collection phase,
|
||||
particularly around how filesystem directories and Python packages are collected,
|
||||
fixing deficiencies and allowing for cleanups and improvements to pytest's internals.
|
||||
A deprecation period for these changes was not possible.
|
||||
|
||||
|
||||
- `#7777 <https://github.com/pytest-dev/pytest/issues/7777>`_: Files and directories are now collected in alphabetical order jointly, unless changed by a plugin.
|
||||
Previously, files were collected before directories.
|
||||
See below for an example.
|
||||
|
||||
|
||||
- `#8976 <https://github.com/pytest-dev/pytest/issues/8976>`_: Running `pytest pkg/__init__.py` now collects the `pkg/__init__.py` file (module) only.
|
||||
Previously, it collected the entire `pkg` package, including other test files in the directory, but excluding tests in the `__init__.py` file itself
|
||||
(unless :confval:`python_files` was changed to allow `__init__.py` file).
|
||||
|
||||
To collect the entire package, specify just the directory: `pytest pkg`.
|
||||
|
||||
|
||||
- `#11137 <https://github.com/pytest-dev/pytest/issues/11137>`_: :class:`pytest.Package` is no longer a :class:`pytest.Module` or :class:`pytest.File`.
|
||||
|
||||
The ``Package`` collector node designates a Python package, that is, a directory with an `__init__.py` file.
|
||||
Previously ``Package`` was a subtype of ``pytest.Module`` (which represents a single Python module),
|
||||
the module being the `__init__.py` file.
|
||||
This has been deemed a design mistake (see :issue:`11137` and :issue:`7777` for details).
|
||||
|
||||
The ``path`` property of ``Package`` nodes now points to the package directory instead of the ``__init__.py`` file.
|
||||
|
||||
Note that a ``Module`` node for ``__init__.py`` (which is not a ``Package``) may still exist,
|
||||
if it is picked up during collection (e.g. if you configured :confval:`python_files` to include ``__init__.py`` files).
|
||||
|
||||
|
||||
- `#7777 <https://github.com/pytest-dev/pytest/issues/7777>`_: Added a new :class:`pytest.Directory` base collection node, which all collector nodes for filesystem directories are expected to subclass.
|
||||
This is analogous to the existing :class:`pytest.File` for file nodes.
|
||||
|
||||
Changed :class:`pytest.Package` to be a subclass of :class:`pytest.Directory`.
|
||||
A ``Package`` represents a filesystem directory which is a Python package,
|
||||
i.e. contains an ``__init__.py`` file.
|
||||
|
||||
:class:`pytest.Package` now only collects files in its own directory; previously it collected recursively.
|
||||
Sub-directories are collected as their own collector nodes, which then collect themselves, thus creating a collection tree which mirrors the filesystem hierarchy.
|
||||
|
||||
Added a new :class:`pytest.Dir` concrete collection node, a subclass of :class:`pytest.Directory`.
|
||||
This node represents a filesystem directory, which is not a :class:`pytest.Package`,
|
||||
that is, does not contain an ``__init__.py`` file.
|
||||
Similarly to ``Package``, it only collects the files in its own directory.
|
||||
|
||||
:class:`pytest.Session` now only collects the initial arguments, without recursing into directories.
|
||||
This work is now done by the :func:`recursive expansion process <pytest.Collector.collect>` of directory collector nodes.
|
||||
|
||||
:attr:`session.name <pytest.Session.name>` is now ``""``; previously it was the rootdir directory name.
|
||||
This matches :attr:`session.nodeid <_pytest.nodes.Node.nodeid>` which has always been `""`.
|
||||
|
||||
The collection tree now contains directories/packages up to the :ref:`rootdir <rootdir>`,
|
||||
for initial arguments that are found within the rootdir.
|
||||
For files outside the rootdir, only the immediate directory/package is collected --
|
||||
note however that collecting from outside the rootdir is discouraged.
|
||||
|
||||
As an example, given the following filesystem tree::
|
||||
|
||||
myroot/
|
||||
pytest.ini
|
||||
top/
|
||||
├── aaa
|
||||
│ └── test_aaa.py
|
||||
├── test_a.py
|
||||
├── test_b
|
||||
│ ├── __init__.py
|
||||
│ └── test_b.py
|
||||
├── test_c.py
|
||||
└── zzz
|
||||
├── __init__.py
|
||||
└── test_zzz.py
|
||||
|
||||
the collection tree, as shown by `pytest --collect-only top/` but with the otherwise-hidden :class:`~pytest.Session` node added for clarity,
|
||||
is now the following::
|
||||
|
||||
<Session>
|
||||
<Dir myroot>
|
||||
<Dir top>
|
||||
<Dir aaa>
|
||||
<Module test_aaa.py>
|
||||
<Function test_it>
|
||||
<Module test_a.py>
|
||||
<Function test_it>
|
||||
<Package test_b>
|
||||
<Module test_b.py>
|
||||
<Function test_it>
|
||||
<Module test_c.py>
|
||||
<Function test_it>
|
||||
<Package zzz>
|
||||
<Module test_zzz.py>
|
||||
<Function test_it>
|
||||
|
||||
Previously, it was::
|
||||
|
||||
<Session>
|
||||
<Module top/test_a.py>
|
||||
<Function test_it>
|
||||
<Module top/test_c.py>
|
||||
<Function test_it>
|
||||
<Module top/aaa/test_aaa.py>
|
||||
<Function test_it>
|
||||
<Package test_b>
|
||||
<Module test_b.py>
|
||||
<Function test_it>
|
||||
<Package zzz>
|
||||
<Module test_zzz.py>
|
||||
<Function test_it>
|
||||
|
||||
Code/plugins which rely on a specific shape of the collection tree might need to update.
|
||||
|
||||
|
||||
- `#11676 <https://github.com/pytest-dev/pytest/issues/11676>`_: The classes :class:`~_pytest.nodes.Node`, :class:`~pytest.Collector`, :class:`~pytest.Item`, :class:`~pytest.File`, :class:`~_pytest.nodes.FSCollector` are now marked abstract (see :mod:`abc`).
|
||||
|
||||
We do not expect this change to affect users and plugin authors, it will only cause errors when the code is already wrong or problematic.
|
||||
|
||||
|
||||
Other breaking changes
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
These are breaking changes where deprecation was not possible.
|
||||
|
||||
|
||||
- `#11282 <https://github.com/pytest-dev/pytest/issues/11282>`_: Sanitized the handling of the ``default`` parameter when defining configuration options.
|
||||
|
||||
Previously if ``default`` was not supplied for :meth:`parser.addini <pytest.Parser.addini>` and the configuration option value was not defined in a test session, then calls to :func:`config.getini <pytest.Config.getini>` returned an *empty list* or an *empty string* depending on whether ``type`` was supplied or not respectively, which is clearly incorrect. Also, ``None`` was not honored even if ``default=None`` was used explicitly while defining the option.
|
||||
|
||||
Now the behavior of :meth:`parser.addini <pytest.Parser.addini>` is as follows:
|
||||
|
||||
* If ``default`` is NOT passed but ``type`` is provided, then a type-specific default will be returned. For example ``type=bool`` will return ``False``, ``type=str`` will return ``""``, etc.
|
||||
* If ``default=None`` is passed and the option is not defined in a test session, then ``None`` will be returned, regardless of the ``type``.
|
||||
* If neither ``default`` nor ``type`` are provided, assume ``type=str`` and return ``""`` as default (this is as per previous behavior).
|
||||
|
||||
The team decided to not introduce a deprecation period for this change, as doing so would be complicated both in terms of communicating this to the community as well as implementing it, and also because the team believes this change should not break existing plugins except in rare cases.
|
||||
|
||||
|
||||
- `#11667 <https://github.com/pytest-dev/pytest/issues/11667>`_: pytest's ``setup.py`` file is removed.
|
||||
If you relied on this file, e.g. to install pytest using ``setup.py install``,
|
||||
please see `Why you shouldn't invoke setup.py directly <https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html#summary>`_ for alternatives.
|
||||
|
||||
|
||||
- `#9288 <https://github.com/pytest-dev/pytest/issues/9288>`_: :func:`~pytest.warns` now re-emits unmatched warnings when the context
|
||||
closes -- previously it would consume all warnings, hiding those that were not
|
||||
matched by the function.
|
||||
|
||||
While this is a new feature, we announce it as a breaking change
|
||||
because many test suites are configured to error-out on warnings, and will
|
||||
therefore fail on the newly-re-emitted warnings.
|
||||
|
||||
|
||||
|
||||
Deprecations
|
||||
------------
|
||||
|
||||
- `#10465 <https://github.com/pytest-dev/pytest/issues/10465>`_: Test functions returning a value other than ``None`` will now issue a :class:`pytest.PytestWarning` instead of ``pytest.PytestRemovedIn8Warning``, meaning this will stay a warning instead of becoming an error in the future.
|
||||
|
||||
|
||||
- `#3664 <https://github.com/pytest-dev/pytest/issues/3664>`_: Applying a mark to a fixture function now issues a warning: marks in fixtures never had any effect, but it is a common user error to apply a mark to a fixture (for example ``usefixtures``) and expect it to work.
|
||||
|
||||
This will become an error in pytest 9.0.
|
||||
|
||||
|
||||
|
||||
Features and Improvements
|
||||
-------------------------
|
||||
|
||||
Improved Diffs
|
||||
^^^^^^^^^^^^^^
|
||||
|
||||
These changes improve the diffs that pytest prints when an assertion fails.
|
||||
Note that syntax highlighting requires the ``pygments`` package.
|
||||
|
||||
|
||||
- `#11520 <https://github.com/pytest-dev/pytest/issues/11520>`_: The very verbose (``-vv``) diff output is now colored as a diff instead of a big chunk of red.
|
||||
|
||||
Python code in error reports is now syntax-highlighted as Python.
|
||||
|
||||
The sections in the error reports are now better separated.
|
||||
|
||||
|
||||
- `#1531 <https://github.com/pytest-dev/pytest/issues/1531>`_: The very verbose diff (``-vv``) for every standard library container type is improved. The indentation is now consistent and the markers are on their own separate lines, which should reduce the diffs shown to users.
|
||||
|
||||
Previously, the standard Python pretty printer was used to generate the output, which puts opening and closing
|
||||
markers on the same line as the first/last entry, in addition to not having consistent indentation.
|
||||
|
||||
|
||||
- `#10617 <https://github.com/pytest-dev/pytest/issues/10617>`_: Added more comprehensive set assertion rewrites for comparisons other than equality ``==``, with
|
||||
the following operations now providing better failure messages: ``!=``, ``<=``, ``>=``, ``<``, and ``>``.
|
||||
|
||||
|
||||
Separate Control For Assertion Verbosity
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
- `#11387 <https://github.com/pytest-dev/pytest/issues/11387>`_: Added the new :confval:`verbosity_assertions` configuration option for fine-grained control of failed assertions verbosity.
|
||||
|
||||
If you've ever wished that pytest always show you full diffs, but without making everything else verbose, this is for you.
|
||||
|
||||
See :ref:`Fine-grained verbosity <pytest.fine_grained_verbosity>` for more details.
|
||||
|
||||
For plugin authors, :attr:`config.get_verbosity <pytest.Config.get_verbosity>` can be used to retrieve the verbosity level for a specific verbosity type.
|
||||
|
||||
|
||||
Additional Support For Exception Groups and ``__notes__``
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
These changes improve pytest's support for exception groups.
|
||||
|
||||
|
||||
- `#10441 <https://github.com/pytest-dev/pytest/issues/10441>`_: Added :func:`ExceptionInfo.group_contains() <pytest.ExceptionInfo.group_contains>`, an assertion helper that tests if an :class:`ExceptionGroup` contains a matching exception.
|
||||
|
||||
See :ref:`assert-matching-exception-groups` for an example.
|
||||
|
||||
|
||||
- `#11227 <https://github.com/pytest-dev/pytest/issues/11227>`_: Allow :func:`pytest.raises` ``match`` argument to match against `PEP-678 <https://peps.python.org/pep-0678/>` ``__notes__``.
|
||||
|
||||
|
||||
Custom Directory collectors
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
- `#7777 <https://github.com/pytest-dev/pytest/issues/7777>`_: Added a new hook :hook:`pytest_collect_directory`,
|
||||
which is called by filesystem-traversing collector nodes,
|
||||
such as :class:`pytest.Session`, :class:`pytest.Dir` and :class:`pytest.Package`,
|
||||
to create a collector node for a sub-directory.
|
||||
It is expected to return a subclass of :class:`pytest.Directory`.
|
||||
This hook allows plugins to :ref:`customize the collection of directories <custom directory collectors>`.
|
||||
|
||||
|
||||
"New-style" Hook Wrappers
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
- `#11122 <https://github.com/pytest-dev/pytest/issues/11122>`_: pytest now uses "new-style" hook wrappers internally, available since pluggy 1.2.0.
|
||||
See `pluggy's 1.2.0 changelog <https://pluggy.readthedocs.io/en/latest/changelog.html#pluggy-1-2-0-2023-06-21>`_ and the :ref:`updated docs <hookwrapper>` for details.
|
||||
|
||||
Plugins which want to use new-style wrappers can do so if they require ``pytest>=8``.
|
||||
|
||||
|
||||
Other Improvements
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
- `#11216 <https://github.com/pytest-dev/pytest/issues/11216>`_: If a test is skipped from inside an :ref:`xunit setup fixture <classic xunit>`, the test summary now shows the test location instead of the fixture location.
|
||||
|
||||
|
||||
- `#11314 <https://github.com/pytest-dev/pytest/issues/11314>`_: Logging to a file using the ``--log-file`` option will use ``--log-level``, ``--log-format`` and ``--log-date-format`` as fallback
|
||||
if ``--log-file-level``, ``--log-file-format`` and ``--log-file-date-format`` are not provided respectively.
|
||||
|
||||
|
||||
- `#11610 <https://github.com/pytest-dev/pytest/issues/11610>`_: Added the :func:`LogCaptureFixture.filtering() <pytest.LogCaptureFixture.filtering>` context manager which
|
||||
adds a given :class:`logging.Filter` object to the :fixture:`caplog` fixture.
|
||||
|
||||
|
||||
- `#11447 <https://github.com/pytest-dev/pytest/issues/11447>`_: :func:`pytest.deprecated_call` now also considers warnings of type :class:`FutureWarning`.
|
||||
|
||||
|
||||
- `#11600 <https://github.com/pytest-dev/pytest/issues/11600>`_: Improved the documentation and type signature for :func:`pytest.mark.xfail <pytest.mark.xfail>`'s ``condition`` param to use ``False`` as the default value.
|
||||
|
||||
|
||||
- `#7469 <https://github.com/pytest-dev/pytest/issues/7469>`_: :class:`~pytest.FixtureDef` is now exported as ``pytest.FixtureDef`` for typing purposes.
|
||||
|
||||
|
||||
- `#11353 <https://github.com/pytest-dev/pytest/issues/11353>`_: Added typing to :class:`~pytest.PytestPluginManager`.
|
||||
|
||||
|
||||
Bug Fixes
|
||||
---------
|
||||
|
||||
- `#10701 <https://github.com/pytest-dev/pytest/issues/10701>`_: :meth:`pytest.WarningsRecorder.pop` will return the most-closely-matched warning in the list,
|
||||
rather than the first warning which is an instance of the requested type.
|
||||
|
||||
|
||||
- `#11255 <https://github.com/pytest-dev/pytest/issues/11255>`_: Fixed crash on `parametrize(..., scope="package")` without a package present.
|
||||
|
||||
|
||||
- `#11277 <https://github.com/pytest-dev/pytest/issues/11277>`_: Fixed a bug that when there are multiple fixtures for an indirect parameter,
|
||||
the scope of the highest-scope fixture is picked for the parameter set, instead of that of the one with the narrowest scope.
|
||||
|
||||
|
||||
- `#11456 <https://github.com/pytest-dev/pytest/issues/11456>`_: Parametrized tests now *really do* ensure that the ids given to each input are unique - for
|
||||
example, ``a, a, a0`` now results in ``a1, a2, a0`` instead of the previous (buggy) ``a0, a1, a0``.
|
||||
This necessarily means changing nodeids where these were previously colliding, and for
|
||||
readability adds an underscore when non-unique ids end in a number.
|
||||
|
||||
|
||||
- `#11563 <https://github.com/pytest-dev/pytest/issues/11563>`_: Fixed a crash when using an empty string for the same parametrized value more than once.
|
||||
|
||||
|
||||
- `#11712 <https://github.com/pytest-dev/pytest/issues/11712>`_: Fixed handling ``NO_COLOR`` and ``FORCE_COLOR`` to ignore an empty value.
|
||||
|
||||
|
||||
- `#9036 <https://github.com/pytest-dev/pytest/issues/9036>`_: ``pytest.warns`` and similar functions now capture warnings when an exception is raised inside a ``with`` block.
|
||||
|
||||
|
||||
|
||||
Improved Documentation
|
||||
----------------------
|
||||
|
||||
- `#11011 <https://github.com/pytest-dev/pytest/issues/11011>`_: Added a warning about modifying the root logger during tests when using ``caplog``.
|
||||
|
||||
|
||||
- `#11065 <https://github.com/pytest-dev/pytest/issues/11065>`_: Use ``pytestconfig`` instead of ``request.config`` in cache example to be consistent with the API documentation.
|
||||
|
||||
|
||||
Trivial/Internal Changes
|
||||
------------------------
|
||||
|
||||
- `#11208 <https://github.com/pytest-dev/pytest/issues/11208>`_: The (internal) ``FixtureDef.cached_result`` type has changed.
|
||||
Now the third item ``cached_result[2]``, when set, is an exception instance instead of an exception triplet.
|
||||
|
||||
|
||||
- `#11218 <https://github.com/pytest-dev/pytest/issues/11218>`_: (This entry is meant to assist plugins which access private pytest internals to instantiate ``FixtureRequest`` objects.)
|
||||
|
||||
:class:`~pytest.FixtureRequest` is now an abstract class which can't be instantiated directly.
|
||||
A new concrete ``TopRequest`` subclass of ``FixtureRequest`` has been added for the ``request`` fixture in test functions,
|
||||
as counterpart to the existing ``SubRequest`` subclass for the ``request`` fixture in fixture functions.
|
||||
|
||||
|
||||
- `#11315 <https://github.com/pytest-dev/pytest/issues/11315>`_: The :fixture:`pytester` fixture now uses the :fixture:`monkeypatch` fixture to manage the current working directory.
|
||||
If you use ``pytester`` in combination with :func:`monkeypatch.undo() <pytest.MonkeyPatch.undo>`, the CWD might get restored.
|
||||
Use :func:`monkeypatch.context() <pytest.MonkeyPatch.context>` instead.
|
||||
|
||||
|
||||
- `#11333 <https://github.com/pytest-dev/pytest/issues/11333>`_: Corrected the spelling of ``Config.ArgsSource.INVOCATION_DIR``.
|
||||
The previous spelling ``INCOVATION_DIR`` remains as an alias.
|
||||
|
||||
|
||||
- `#11638 <https://github.com/pytest-dev/pytest/issues/11638>`_: Fixed the selftests to pass correctly if ``FORCE_COLOR``, ``NO_COLOR`` or ``PY_COLORS`` is set in the calling environment.
|
||||
|
||||
pytest 7.4.4 (2023-12-31)
|
||||
=========================
|
||||
|
||||
Bug Fixes
|
||||
---------
|
||||
|
||||
- `#11140 <https://github.com/pytest-dev/pytest/issues/11140>`_: Fix non-string constants at the top of file being detected as docstrings on Python>=3.8.
|
||||
|
||||
|
||||
- `#11572 <https://github.com/pytest-dev/pytest/issues/11572>`_: Handle an edge case where :data:`sys.stderr` and :data:`sys.__stderr__` might already be closed when :ref:`faulthandler` is tearing down.
|
||||
|
||||
|
||||
- `#11710 <https://github.com/pytest-dev/pytest/issues/11710>`_: Fixed tracebacks from collection errors not getting pruned.
|
||||
|
||||
|
||||
- `#7966 <https://github.com/pytest-dev/pytest/issues/7966>`_: Removed unhelpful error message from assertion rewrite mechanism when exceptions are raised in ``__iter__`` methods. Now they are treated un-iterable instead.
|
||||
|
||||
|
||||
|
||||
Improved Documentation
|
||||
----------------------
|
||||
|
||||
- `#11091 <https://github.com/pytest-dev/pytest/issues/11091>`_: Updated documentation to refer to hyphenated options: replaced ``--junitxml`` with ``--junit-xml`` and ``--collectonly`` with ``--collect-only``.
|
||||
|
||||
|
||||
pytest 7.4.3 (2023-10-24)
|
||||
=========================
|
||||
|
||||
|
@ -861,7 +1257,7 @@ Deprecations
|
|||
See :ref:`the deprecation note <diamond-inheritance-deprecated>` for full details.
|
||||
|
||||
|
||||
- `#8592 <https://github.com/pytest-dev/pytest/issues/8592>`_: :hook:`pytest_cmdline_preparse` has been officially deprecated. It will be removed in a future release. Use :hook:`pytest_load_initial_conftests` instead.
|
||||
- `#8592 <https://github.com/pytest-dev/pytest/issues/8592>`_: ``pytest_cmdline_preparse`` has been officially deprecated. It will be removed in a future release. Use :hook:`pytest_load_initial_conftests` instead.
|
||||
|
||||
See :ref:`the deprecation note <cmdline-preparse-deprecated>` for full details.
|
||||
|
||||
|
|
|
@ -199,7 +199,6 @@ nitpick_ignore = [
|
|||
("py:class", "_tracing.TagTracerSub"),
|
||||
("py:class", "warnings.WarningMessage"),
|
||||
# Undocumented type aliases
|
||||
("py:class", "LEGACY_PATH"),
|
||||
("py:class", "_PluggyPlugin"),
|
||||
# TypeVars
|
||||
("py:class", "_pytest._code.code.E"),
|
||||
|
|
|
@ -44,7 +44,6 @@ How-to guides
|
|||
|
||||
how-to/existingtestsuite
|
||||
how-to/unittest
|
||||
how-to/nose
|
||||
how-to/xunit_setup
|
||||
|
||||
how-to/bash-completion
|
||||
|
|
|
@ -19,12 +19,273 @@ Below is a complete list of all pytest features which are considered deprecated.
|
|||
:class:`~pytest.PytestWarning` or subclasses, which can be filtered using :ref:`standard warning filters <warnings>`.
|
||||
|
||||
|
||||
.. _legacy-path-hooks-deprecated:
|
||||
|
||||
Configuring hook specs/impls using markers
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Before pluggy, pytest's plugin library, was its own package and had a clear API,
|
||||
pytest just used ``pytest.mark`` to configure hooks.
|
||||
|
||||
The :py:func:`pytest.hookimpl` and :py:func:`pytest.hookspec` decorators
|
||||
have been available since years and should be used instead.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@pytest.mark.tryfirst
|
||||
def pytest_runtest_call():
|
||||
...
|
||||
|
||||
|
||||
# or
|
||||
def pytest_runtest_call():
|
||||
...
|
||||
|
||||
|
||||
pytest_runtest_call.tryfirst = True
|
||||
|
||||
should be changed to:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@pytest.hookimpl(tryfirst=True)
|
||||
def pytest_runtest_call():
|
||||
...
|
||||
|
||||
Changed ``hookimpl`` attributes:
|
||||
|
||||
* ``tryfirst``
|
||||
* ``trylast``
|
||||
* ``optionalhook``
|
||||
* ``hookwrapper``
|
||||
|
||||
Changed ``hookwrapper`` attributes:
|
||||
|
||||
* ``firstresult``
|
||||
* ``historic``
|
||||
|
||||
|
||||
Directly constructing internal classes
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. deprecated:: 7.0
|
||||
|
||||
Directly constructing the following classes is now deprecated:
|
||||
|
||||
- ``_pytest.mark.structures.Mark``
|
||||
- ``_pytest.mark.structures.MarkDecorator``
|
||||
- ``_pytest.mark.structures.MarkGenerator``
|
||||
- ``_pytest.python.Metafunc``
|
||||
- ``_pytest.runner.CallInfo``
|
||||
- ``_pytest._code.ExceptionInfo``
|
||||
- ``_pytest.config.argparsing.Parser``
|
||||
- ``_pytest.config.argparsing.OptionGroup``
|
||||
- ``_pytest.pytester.HookRecorder``
|
||||
|
||||
These constructors have always been considered private, but now issue a deprecation warning, which may become a hard error in pytest 8.
|
||||
|
||||
.. _diamond-inheritance-deprecated:
|
||||
|
||||
Diamond inheritance between :class:`pytest.Collector` and :class:`pytest.Item`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. deprecated:: 7.0
|
||||
|
||||
Defining a custom pytest node type which is both an :class:`~pytest.Item` and a :class:`~pytest.Collector` (e.g. :class:`~pytest.File`) now issues a warning.
|
||||
It was never sanely supported and triggers hard to debug errors.
|
||||
|
||||
Some plugins providing linting/code analysis have been using this as a hack.
|
||||
Instead, a separate collector node should be used, which collects the item. See
|
||||
:ref:`non-python tests` for an example, as well as an `example pr fixing inheritance`_.
|
||||
|
||||
.. _example pr fixing inheritance: https://github.com/asmeurer/pytest-flakes/pull/40/files
|
||||
|
||||
|
||||
.. _uncooperative-constructors-deprecated:
|
||||
|
||||
Constructors of custom :class:`~_pytest.nodes.Node` subclasses should take ``**kwargs``
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. deprecated:: 7.0
|
||||
|
||||
If custom subclasses of nodes like :class:`pytest.Item` override the
|
||||
``__init__`` method, they should take ``**kwargs``. Thus,
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
class CustomItem(pytest.Item):
|
||||
def __init__(self, name, parent, additional_arg):
|
||||
super().__init__(name, parent)
|
||||
self.additional_arg = additional_arg
|
||||
|
||||
should be turned into:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
class CustomItem(pytest.Item):
|
||||
def __init__(self, *, additional_arg, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
self.additional_arg = additional_arg
|
||||
|
||||
to avoid hard-coding the arguments pytest can pass to the superclass.
|
||||
See :ref:`non-python tests` for a full example.
|
||||
|
||||
For cases without conflicts, no deprecation warning is emitted. For cases with
|
||||
conflicts (such as :class:`pytest.File` now taking ``path`` instead of
|
||||
``fspath``, as :ref:`outlined above <node-ctor-fspath-deprecation>`), a
|
||||
deprecation warning is now raised.
|
||||
|
||||
Applying a mark to a fixture function
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. deprecated:: 7.4
|
||||
|
||||
Applying a mark to a fixture function never had any effect, but it is a common user error.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@pytest.mark.usefixtures("clean_database")
|
||||
@pytest.fixture
|
||||
def user() -> User:
|
||||
...
|
||||
|
||||
Users expected in this case that the ``usefixtures`` mark would have its intended effect of using the ``clean_database`` fixture when ``user`` was invoked, when in fact it has no effect at all.
|
||||
|
||||
Now pytest will issue a warning when it encounters this problem, and will raise an error in the future versions.
|
||||
|
||||
|
||||
Returning non-None value in test functions
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. deprecated:: 7.2
|
||||
|
||||
A :class:`pytest.PytestReturnNotNoneWarning` is now emitted if a test function returns something other than `None`.
|
||||
|
||||
This prevents a common mistake among beginners that expect that returning a `bool` would cause a test to pass or fail, for example:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
["a", "b", "result"],
|
||||
[
|
||||
[1, 2, 5],
|
||||
[2, 3, 8],
|
||||
[5, 3, 18],
|
||||
],
|
||||
)
|
||||
def test_foo(a, b, result):
|
||||
return foo(a, b) == result
|
||||
|
||||
Given that pytest ignores the return value, this might be surprising that it will never fail.
|
||||
|
||||
The proper fix is to change the `return` to an `assert`:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
["a", "b", "result"],
|
||||
[
|
||||
[1, 2, 5],
|
||||
[2, 3, 8],
|
||||
[5, 3, 18],
|
||||
],
|
||||
)
|
||||
def test_foo(a, b, result):
|
||||
assert foo(a, b) == result
|
||||
|
||||
|
||||
The ``yield_fixture`` function/decorator
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. deprecated:: 6.2
|
||||
|
||||
``pytest.yield_fixture`` is a deprecated alias for :func:`pytest.fixture`.
|
||||
|
||||
It has been so for a very long time, so can be search/replaced safely.
|
||||
|
||||
|
||||
Removed Features and Breaking Changes
|
||||
-------------------------------------
|
||||
|
||||
As stated in our :ref:`backwards-compatibility` policy, deprecated features are removed only in major releases after
|
||||
an appropriate period of deprecation has passed.
|
||||
|
||||
Some breaking changes which could not be deprecated are also listed.
|
||||
|
||||
.. _node-ctor-fspath-deprecation:
|
||||
|
||||
``fspath`` argument for Node constructors replaced with ``pathlib.Path``
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. deprecated:: 7.0
|
||||
|
||||
In order to support the transition from ``py.path.local`` to :mod:`pathlib`,
|
||||
the ``fspath`` argument to :class:`~_pytest.nodes.Node` constructors like
|
||||
:func:`pytest.Function.from_parent()` and :func:`pytest.Class.from_parent()`
|
||||
is now deprecated.
|
||||
|
||||
Plugins which construct nodes should pass the ``path`` argument, of type
|
||||
:class:`pathlib.Path`, instead of the ``fspath`` argument.
|
||||
|
||||
Plugins which implement custom items and collectors are encouraged to replace
|
||||
``fspath`` parameters (``py.path.local``) with ``path`` parameters
|
||||
(``pathlib.Path``), and drop any other usage of the ``py`` library if possible.
|
||||
|
||||
If possible, plugins with custom items should use :ref:`cooperative
|
||||
constructors <uncooperative-constructors-deprecated>` to avoid hardcoding
|
||||
arguments they only pass on to the superclass.
|
||||
|
||||
.. note::
|
||||
The name of the :class:`~_pytest.nodes.Node` arguments and attributes (the
|
||||
new attribute being ``path``) is **the opposite** of the situation for
|
||||
hooks, :ref:`outlined below <legacy-path-hooks-deprecated>` (the old
|
||||
argument being ``path``).
|
||||
|
||||
This is an unfortunate artifact due to historical reasons, which should be
|
||||
resolved in future versions as we slowly get rid of the :pypi:`py`
|
||||
dependency (see :issue:`9283` for a longer discussion).
|
||||
|
||||
Due to the ongoing migration of methods like :meth:`~pytest.Item.reportinfo`
|
||||
which still is expected to return a ``py.path.local`` object, nodes still have
|
||||
both ``fspath`` (``py.path.local``) and ``path`` (``pathlib.Path``) attributes,
|
||||
no matter what argument was used in the constructor. We expect to deprecate the
|
||||
``fspath`` attribute in a future release.
|
||||
|
||||
|
||||
``py.path.local`` arguments for hooks replaced with ``pathlib.Path``
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. deprecated:: 7.0
|
||||
.. versionremoved:: 8.0
|
||||
|
||||
In order to support the transition from ``py.path.local`` to :mod:`pathlib`, the following hooks now receive additional arguments:
|
||||
|
||||
* :hook:`pytest_ignore_collect(collection_path: pathlib.Path) <pytest_ignore_collect>` as equivalent to ``path``
|
||||
* :hook:`pytest_collect_file(file_path: pathlib.Path) <pytest_collect_file>` as equivalent to ``path``
|
||||
* :hook:`pytest_pycollect_makemodule(module_path: pathlib.Path) <pytest_pycollect_makemodule>` as equivalent to ``path``
|
||||
* :hook:`pytest_report_header(start_path: pathlib.Path) <pytest_report_header>` as equivalent to ``startdir``
|
||||
* :hook:`pytest_report_collectionfinish(start_path: pathlib.Path) <pytest_report_collectionfinish>` as equivalent to ``startdir``
|
||||
|
||||
The accompanying ``py.path.local`` based paths have been deprecated: plugins which manually invoke those hooks should only pass the new ``pathlib.Path`` arguments, and users should change their hook implementations to use the new ``pathlib.Path`` arguments.
|
||||
|
||||
.. note::
|
||||
The name of the :class:`~_pytest.nodes.Node` arguments and attributes,
|
||||
:ref:`outlined above <node-ctor-fspath-deprecation>` (the new attribute
|
||||
being ``path``) is **the opposite** of the situation for hooks (the old
|
||||
argument being ``path``).
|
||||
|
||||
This is an unfortunate artifact due to historical reasons, which should be
|
||||
resolved in future versions as we slowly get rid of the :pypi:`py`
|
||||
dependency (see :issue:`9283` for a longer discussion).
|
||||
|
||||
|
||||
.. _nose-deprecation:
|
||||
|
||||
Support for tests written for nose
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. deprecated:: 7.2
|
||||
.. versionremoved:: 8.0
|
||||
|
||||
Support for running tests written for `nose <https://nose.readthedocs.io/en/latest/>`__ is now deprecated.
|
||||
|
||||
|
@ -125,160 +386,13 @@ Will also need to be ported to a supported pytest style. One way to do it is usi
|
|||
|
||||
.. _`with-setup-nose`: https://nose.readthedocs.io/en/latest/testing_tools.html?highlight=with_setup#nose.tools.with_setup
|
||||
|
||||
.. _instance-collector-deprecation:
|
||||
|
||||
The ``pytest.Instance`` collector
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. versionremoved:: 7.0
|
||||
|
||||
The ``pytest.Instance`` collector type has been removed.
|
||||
|
||||
Previously, Python test methods were collected as :class:`~pytest.Class` -> ``Instance`` -> :class:`~pytest.Function`.
|
||||
Now :class:`~pytest.Class` collects the test methods directly.
|
||||
|
||||
Most plugins which reference ``Instance`` do so in order to ignore or skip it,
|
||||
using a check such as ``if isinstance(node, Instance): return``.
|
||||
Such plugins should simply remove consideration of ``Instance`` on pytest>=7.
|
||||
However, to keep such uses working, a dummy type has been instanted in ``pytest.Instance`` and ``_pytest.python.Instance``,
|
||||
and importing it emits a deprecation warning. This will be removed in pytest 8.
|
||||
|
||||
|
||||
.. _node-ctor-fspath-deprecation:
|
||||
|
||||
``fspath`` argument for Node constructors replaced with ``pathlib.Path``
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. deprecated:: 7.0
|
||||
|
||||
In order to support the transition from ``py.path.local`` to :mod:`pathlib`,
|
||||
the ``fspath`` argument to :class:`~_pytest.nodes.Node` constructors like
|
||||
:func:`pytest.Function.from_parent()` and :func:`pytest.Class.from_parent()`
|
||||
is now deprecated.
|
||||
|
||||
Plugins which construct nodes should pass the ``path`` argument, of type
|
||||
:class:`pathlib.Path`, instead of the ``fspath`` argument.
|
||||
|
||||
Plugins which implement custom items and collectors are encouraged to replace
|
||||
``fspath`` parameters (``py.path.local``) with ``path`` parameters
|
||||
(``pathlib.Path``), and drop any other usage of the ``py`` library if possible.
|
||||
|
||||
If possible, plugins with custom items should use :ref:`cooperative
|
||||
constructors <uncooperative-constructors-deprecated>` to avoid hardcoding
|
||||
arguments they only pass on to the superclass.
|
||||
|
||||
.. note::
|
||||
The name of the :class:`~_pytest.nodes.Node` arguments and attributes (the
|
||||
new attribute being ``path``) is **the opposite** of the situation for
|
||||
hooks, :ref:`outlined below <legacy-path-hooks-deprecated>` (the old
|
||||
argument being ``path``).
|
||||
|
||||
This is an unfortunate artifact due to historical reasons, which should be
|
||||
resolved in future versions as we slowly get rid of the :pypi:`py`
|
||||
dependency (see :issue:`9283` for a longer discussion).
|
||||
|
||||
Due to the ongoing migration of methods like :meth:`~pytest.Item.reportinfo`
|
||||
which still is expected to return a ``py.path.local`` object, nodes still have
|
||||
both ``fspath`` (``py.path.local``) and ``path`` (``pathlib.Path``) attributes,
|
||||
no matter what argument was used in the constructor. We expect to deprecate the
|
||||
``fspath`` attribute in a future release.
|
||||
|
||||
.. _legacy-path-hooks-deprecated:
|
||||
|
||||
Configuring hook specs/impls using markers
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Before pluggy, pytest's plugin library, was its own package and had a clear API,
|
||||
pytest just used ``pytest.mark`` to configure hooks.
|
||||
|
||||
The :py:func:`pytest.hookimpl` and :py:func:`pytest.hookspec` decorators
|
||||
have been available since years and should be used instead.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@pytest.mark.tryfirst
|
||||
def pytest_runtest_call():
|
||||
...
|
||||
|
||||
|
||||
# or
|
||||
def pytest_runtest_call():
|
||||
...
|
||||
|
||||
|
||||
pytest_runtest_call.tryfirst = True
|
||||
|
||||
should be changed to:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@pytest.hookimpl(tryfirst=True)
|
||||
def pytest_runtest_call():
|
||||
...
|
||||
|
||||
Changed ``hookimpl`` attributes:
|
||||
|
||||
* ``tryfirst``
|
||||
* ``trylast``
|
||||
* ``optionalhook``
|
||||
* ``hookwrapper``
|
||||
|
||||
Changed ``hookwrapper`` attributes:
|
||||
|
||||
* ``firstresult``
|
||||
* ``historic``
|
||||
|
||||
|
||||
``py.path.local`` arguments for hooks replaced with ``pathlib.Path``
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. deprecated:: 7.0
|
||||
|
||||
In order to support the transition from ``py.path.local`` to :mod:`pathlib`, the following hooks now receive additional arguments:
|
||||
|
||||
* :hook:`pytest_ignore_collect(collection_path: pathlib.Path) <pytest_ignore_collect>` as equivalent to ``path``
|
||||
* :hook:`pytest_collect_file(file_path: pathlib.Path) <pytest_collect_file>` as equivalent to ``path``
|
||||
* :hook:`pytest_pycollect_makemodule(module_path: pathlib.Path) <pytest_pycollect_makemodule>` as equivalent to ``path``
|
||||
* :hook:`pytest_report_header(start_path: pathlib.Path) <pytest_report_header>` as equivalent to ``startdir``
|
||||
* :hook:`pytest_report_collectionfinish(start_path: pathlib.Path) <pytest_report_collectionfinish>` as equivalent to ``startdir``
|
||||
|
||||
The accompanying ``py.path.local`` based paths have been deprecated: plugins which manually invoke those hooks should only pass the new ``pathlib.Path`` arguments, and users should change their hook implementations to use the new ``pathlib.Path`` arguments.
|
||||
|
||||
.. note::
|
||||
The name of the :class:`~_pytest.nodes.Node` arguments and attributes,
|
||||
:ref:`outlined above <node-ctor-fspath-deprecation>` (the new attribute
|
||||
being ``path``) is **the opposite** of the situation for hooks (the old
|
||||
argument being ``path``).
|
||||
|
||||
This is an unfortunate artifact due to historical reasons, which should be
|
||||
resolved in future versions as we slowly get rid of the :pypi:`py`
|
||||
dependency (see :issue:`9283` for a longer discussion).
|
||||
|
||||
Directly constructing internal classes
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. deprecated:: 7.0
|
||||
|
||||
Directly constructing the following classes is now deprecated:
|
||||
|
||||
- ``_pytest.mark.structures.Mark``
|
||||
- ``_pytest.mark.structures.MarkDecorator``
|
||||
- ``_pytest.mark.structures.MarkGenerator``
|
||||
- ``_pytest.python.Metafunc``
|
||||
- ``_pytest.runner.CallInfo``
|
||||
- ``_pytest._code.ExceptionInfo``
|
||||
- ``_pytest.config.argparsing.Parser``
|
||||
- ``_pytest.config.argparsing.OptionGroup``
|
||||
- ``_pytest.pytester.HookRecorder``
|
||||
|
||||
These constructors have always been considered private, but now issue a deprecation warning, which may become a hard error in pytest 8.
|
||||
|
||||
.. _cmdline-preparse-deprecated:
|
||||
|
||||
Passing ``msg=`` to ``pytest.skip``, ``pytest.fail`` or ``pytest.exit``
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. deprecated:: 7.0
|
||||
.. versionremoved:: 8.0
|
||||
|
||||
Passing the keyword argument ``msg`` to :func:`pytest.skip`, :func:`pytest.fail` or :func:`pytest.exit`
|
||||
is now deprecated and ``reason`` should be used instead. This change is to bring consistency between these
|
||||
|
@ -307,12 +421,74 @@ functions and the ``@pytest.mark.skip`` and ``@pytest.mark.xfail`` markers which
|
|||
pytest.exit(reason="bar")
|
||||
|
||||
|
||||
.. _instance-collector-deprecation:
|
||||
|
||||
The ``pytest.Instance`` collector
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. versionremoved:: 7.0
|
||||
|
||||
The ``pytest.Instance`` collector type has been removed.
|
||||
|
||||
Previously, Python test methods were collected as :class:`~pytest.Class` -> ``Instance`` -> :class:`~pytest.Function`.
|
||||
Now :class:`~pytest.Class` collects the test methods directly.
|
||||
|
||||
Most plugins which reference ``Instance`` do so in order to ignore or skip it,
|
||||
using a check such as ``if isinstance(node, Instance): return``.
|
||||
Such plugins should simply remove consideration of ``Instance`` on pytest>=7.
|
||||
However, to keep such uses working, a dummy type has been instanted in ``pytest.Instance`` and ``_pytest.python.Instance``,
|
||||
and importing it emits a deprecation warning. This was removed in pytest 8.
|
||||
|
||||
|
||||
Using ``pytest.warns(None)``
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. deprecated:: 7.0
|
||||
.. versionremoved:: 8.0
|
||||
|
||||
:func:`pytest.warns(None) <pytest.warns>` is now deprecated because it was frequently misused.
|
||||
Its correct usage was checking that the code emits at least one warning of any type - like ``pytest.warns()``
|
||||
or ``pytest.warns(Warning)``.
|
||||
|
||||
See :ref:`warns use cases` for examples.
|
||||
|
||||
|
||||
Backward compatibilities in ``Parser.addoption``
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. deprecated:: 2.4
|
||||
.. versionremoved:: 8.0
|
||||
|
||||
Several behaviors of :meth:`Parser.addoption <pytest.Parser.addoption>` are now
|
||||
removed in pytest 8 (deprecated since pytest 2.4.0):
|
||||
|
||||
- ``parser.addoption(..., help=".. %default ..")`` - use ``%(default)s`` instead.
|
||||
- ``parser.addoption(..., type="int/string/float/complex")`` - use ``type=int`` etc. instead.
|
||||
|
||||
|
||||
The ``--strict`` command-line option
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. deprecated:: 6.2
|
||||
.. versionremoved:: 8.0
|
||||
|
||||
The ``--strict`` command-line option has been deprecated in favor of ``--strict-markers``, which
|
||||
better conveys what the option does.
|
||||
|
||||
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).
|
||||
|
||||
|
||||
.. _cmdline-preparse-deprecated:
|
||||
|
||||
Implementing the ``pytest_cmdline_preparse`` hook
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. deprecated:: 7.0
|
||||
.. versionremoved:: 8.0
|
||||
|
||||
Implementing the :hook:`pytest_cmdline_preparse` hook has been officially deprecated.
|
||||
Implementing the ``pytest_cmdline_preparse`` hook has been officially deprecated.
|
||||
Implement the :hook:`pytest_load_initial_conftests` hook instead.
|
||||
|
||||
.. code-block:: python
|
||||
|
@ -329,170 +505,90 @@ Implement the :hook:`pytest_load_initial_conftests` hook instead.
|
|||
) -> None:
|
||||
...
|
||||
|
||||
.. _diamond-inheritance-deprecated:
|
||||
|
||||
Diamond inheritance between :class:`pytest.Collector` and :class:`pytest.Item`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Collection changes in pytest 8
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. deprecated:: 7.0
|
||||
Added a new :class:`pytest.Directory` base collection node, which all collector nodes for filesystem directories are expected to subclass.
|
||||
This is analogous to the existing :class:`pytest.File` for file nodes.
|
||||
|
||||
Defining a custom pytest node type which is both an :class:`~pytest.Item` and a :class:`~pytest.Collector` (e.g. :class:`~pytest.File`) now issues a warning.
|
||||
It was never sanely supported and triggers hard to debug errors.
|
||||
Changed :class:`pytest.Package` to be a subclass of :class:`pytest.Directory`.
|
||||
A ``Package`` represents a filesystem directory which is a Python package,
|
||||
i.e. contains an ``__init__.py`` file.
|
||||
|
||||
Some plugins providing linting/code analysis have been using this as a hack.
|
||||
Instead, a separate collector node should be used, which collects the item. See
|
||||
:ref:`non-python tests` for an example, as well as an `example pr fixing inheritance`_.
|
||||
:class:`pytest.Package` now only collects files in its own directory; previously it collected recursively.
|
||||
Sub-directories are collected as sub-collector nodes, thus creating a collection tree which mirrors the filesystem hierarchy.
|
||||
|
||||
.. _example pr fixing inheritance: https://github.com/asmeurer/pytest-flakes/pull/40/files
|
||||
:attr:`session.name <pytest.Session.name>` is now ``""``; previously it was the rootdir directory name.
|
||||
This matches :attr:`session.nodeid <_pytest.nodes.Node.nodeid>` which has always been `""`.
|
||||
|
||||
Added a new :class:`pytest.Dir` concrete collection node, a subclass of :class:`pytest.Directory`.
|
||||
This node represents a filesystem directory, which is not a :class:`pytest.Package`,
|
||||
i.e. does not contain an ``__init__.py`` file.
|
||||
Similarly to ``Package``, it only collects the files in its own directory,
|
||||
while collecting sub-directories as sub-collector nodes.
|
||||
|
||||
.. _uncooperative-constructors-deprecated:
|
||||
Files and directories are now collected in alphabetical order jointly, unless changed by a plugin.
|
||||
Previously, files were collected before directories.
|
||||
|
||||
Constructors of custom :class:`~_pytest.nodes.Node` subclasses should take ``**kwargs``
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
The collection tree now contains directories/packages up to the :ref:`rootdir <rootdir>`,
|
||||
for initial arguments that are found within the rootdir.
|
||||
For files outside the rootdir, only the immediate directory/package is collected --
|
||||
note however that collecting from outside the rootdir is discouraged.
|
||||
|
||||
.. deprecated:: 7.0
|
||||
As an example, given the following filesystem tree::
|
||||
|
||||
If custom subclasses of nodes like :class:`pytest.Item` override the
|
||||
``__init__`` method, they should take ``**kwargs``. Thus,
|
||||
myroot/
|
||||
pytest.ini
|
||||
top/
|
||||
├── aaa
|
||||
│ └── test_aaa.py
|
||||
├── test_a.py
|
||||
├── test_b
|
||||
│ ├── __init__.py
|
||||
│ └── test_b.py
|
||||
├── test_c.py
|
||||
└── zzz
|
||||
├── __init__.py
|
||||
└── test_zzz.py
|
||||
|
||||
.. code-block:: python
|
||||
the collection tree, as shown by `pytest --collect-only top/` but with the otherwise-hidden :class:`~pytest.Session` node added for clarity,
|
||||
is now the following::
|
||||
|
||||
class CustomItem(pytest.Item):
|
||||
def __init__(self, name, parent, additional_arg):
|
||||
super().__init__(name, parent)
|
||||
self.additional_arg = additional_arg
|
||||
<Session>
|
||||
<Dir myroot>
|
||||
<Dir top>
|
||||
<Dir aaa>
|
||||
<Module test_aaa.py>
|
||||
<Function test_it>
|
||||
<Module test_a.py>
|
||||
<Function test_it>
|
||||
<Package test_b>
|
||||
<Module test_b.py>
|
||||
<Function test_it>
|
||||
<Module test_c.py>
|
||||
<Function test_it>
|
||||
<Package zzz>
|
||||
<Module test_zzz.py>
|
||||
<Function test_it>
|
||||
|
||||
should be turned into:
|
||||
Previously, it was::
|
||||
|
||||
.. code-block:: python
|
||||
<Session>
|
||||
<Module top/test_a.py>
|
||||
<Function test_it>
|
||||
<Module top/test_c.py>
|
||||
<Function test_it>
|
||||
<Module top/aaa/test_aaa.py>
|
||||
<Function test_it>
|
||||
<Package test_b>
|
||||
<Module test_b.py>
|
||||
<Function test_it>
|
||||
<Package zzz>
|
||||
<Module test_zzz.py>
|
||||
<Function test_it>
|
||||
|
||||
class CustomItem(pytest.Item):
|
||||
def __init__(self, *, additional_arg, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
self.additional_arg = additional_arg
|
||||
|
||||
to avoid hard-coding the arguments pytest can pass to the superclass.
|
||||
See :ref:`non-python tests` for a full example.
|
||||
|
||||
For cases without conflicts, no deprecation warning is emitted. For cases with
|
||||
conflicts (such as :class:`pytest.File` now taking ``path`` instead of
|
||||
``fspath``, as :ref:`outlined above <node-ctor-fspath-deprecation>`), a
|
||||
deprecation warning is now raised.
|
||||
|
||||
Applying a mark to a fixture function
|
||||
-------------------------------------
|
||||
|
||||
.. deprecated:: 7.4
|
||||
|
||||
Applying a mark to a fixture function never had any effect, but it is a common user error.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@pytest.mark.usefixtures("clean_database")
|
||||
@pytest.fixture
|
||||
def user() -> User:
|
||||
...
|
||||
|
||||
Users expected in this case that the ``usefixtures`` mark would have its intended effect of using the ``clean_database`` fixture when ``user`` was invoked, when in fact it has no effect at all.
|
||||
|
||||
Now pytest will issue a warning when it encounters this problem, and will raise an error in the future versions.
|
||||
|
||||
|
||||
Backward compatibilities in ``Parser.addoption``
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. deprecated:: 2.4
|
||||
|
||||
Several behaviors of :meth:`Parser.addoption <pytest.Parser.addoption>` are now
|
||||
scheduled for removal in pytest 8 (deprecated since pytest 2.4.0):
|
||||
|
||||
- ``parser.addoption(..., help=".. %default ..")`` - use ``%(default)s`` instead.
|
||||
- ``parser.addoption(..., type="int/string/float/complex")`` - use ``type=int`` etc. instead.
|
||||
|
||||
|
||||
Using ``pytest.warns(None)``
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. deprecated:: 7.0
|
||||
|
||||
:func:`pytest.warns(None) <pytest.warns>` is now deprecated because it was frequently misused.
|
||||
Its correct usage was checking that the code emits at least one warning of any type - like ``pytest.warns()``
|
||||
or ``pytest.warns(Warning)``.
|
||||
|
||||
See :ref:`warns use cases` for examples.
|
||||
|
||||
|
||||
Returning non-None value in test functions
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. deprecated:: 7.2
|
||||
|
||||
A :class:`pytest.PytestReturnNotNoneWarning` is now emitted if a test function returns something other than `None`.
|
||||
|
||||
This prevents a common mistake among beginners that expect that returning a `bool` would cause a test to pass or fail, for example:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
["a", "b", "result"],
|
||||
[
|
||||
[1, 2, 5],
|
||||
[2, 3, 8],
|
||||
[5, 3, 18],
|
||||
],
|
||||
)
|
||||
def test_foo(a, b, result):
|
||||
return foo(a, b) == result
|
||||
|
||||
Given that pytest ignores the return value, this might be surprising that it will never fail.
|
||||
|
||||
The proper fix is to change the `return` to an `assert`:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
["a", "b", "result"],
|
||||
[
|
||||
[1, 2, 5],
|
||||
[2, 3, 8],
|
||||
[5, 3, 18],
|
||||
],
|
||||
)
|
||||
def test_foo(a, b, result):
|
||||
assert foo(a, b) == result
|
||||
|
||||
|
||||
The ``--strict`` command-line option
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. deprecated:: 6.2
|
||||
|
||||
The ``--strict`` command-line option has been deprecated in favor of ``--strict-markers``, which
|
||||
better conveys what the option does.
|
||||
|
||||
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).
|
||||
|
||||
|
||||
The ``yield_fixture`` function/decorator
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. deprecated:: 6.2
|
||||
|
||||
``pytest.yield_fixture`` is a deprecated alias for :func:`pytest.fixture`.
|
||||
|
||||
It has been so for a very long time, so can be search/replaced safely.
|
||||
|
||||
|
||||
Removed Features and Breaking Changes
|
||||
-------------------------------------
|
||||
|
||||
As stated in our :ref:`backwards-compatibility` policy, deprecated features are removed only in major releases after
|
||||
an appropriate period of deprecation has passed.
|
||||
|
||||
Some breaking changes which could not be deprecated are also listed.
|
||||
Code/plugins which rely on a specific shape of the collection tree might need to update.
|
||||
|
||||
|
||||
:class:`pytest.Package` is no longer a :class:`pytest.Module` or :class:`pytest.File`
|
||||
|
|
|
@ -1 +1 @@
|
|||
collect_ignore = ["nonpython"]
|
||||
collect_ignore = ["nonpython", "customdirectory"]
|
||||
|
|
|
@ -0,0 +1,77 @@
|
|||
.. _`custom directory collectors`:
|
||||
|
||||
Using a custom directory collector
|
||||
====================================================
|
||||
|
||||
By default, pytest collects directories using :class:`pytest.Package`, for directories with ``__init__.py`` files,
|
||||
and :class:`pytest.Dir` for other directories.
|
||||
If you want to customize how a directory is collected, you can write your own :class:`pytest.Directory` collector,
|
||||
and use :hook:`pytest_collect_directory` to hook it up.
|
||||
|
||||
.. _`directory manifest plugin`:
|
||||
|
||||
A basic example for a directory manifest file
|
||||
--------------------------------------------------------------
|
||||
|
||||
Suppose you want to customize how collection is done on a per-directory basis.
|
||||
Here is an example ``conftest.py`` plugin that allows directories to contain a ``manifest.json`` file,
|
||||
which defines how the collection should be done for the directory.
|
||||
In this example, only a simple list of files is supported,
|
||||
however you can imagine adding other keys, such as exclusions and globs.
|
||||
|
||||
.. include:: customdirectory/conftest.py
|
||||
:literal:
|
||||
|
||||
You can create a ``manifest.json`` file and some test files:
|
||||
|
||||
.. include:: customdirectory/tests/manifest.json
|
||||
:literal:
|
||||
|
||||
.. include:: customdirectory/tests/test_first.py
|
||||
:literal:
|
||||
|
||||
.. include:: customdirectory/tests/test_second.py
|
||||
:literal:
|
||||
|
||||
.. include:: customdirectory/tests/test_third.py
|
||||
:literal:
|
||||
|
||||
An you can now execute the test specification:
|
||||
|
||||
.. code-block:: pytest
|
||||
|
||||
customdirectory $ pytest
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project/customdirectory
|
||||
configfile: pytest.ini
|
||||
collected 2 items
|
||||
|
||||
tests/test_first.py . [ 50%]
|
||||
tests/test_second.py . [100%]
|
||||
|
||||
============================ 2 passed in 0.12s =============================
|
||||
|
||||
.. regendoc:wipe
|
||||
|
||||
Notice how ``test_three.py`` was not executed, because it is not listed in the manifest.
|
||||
|
||||
You can verify that your custom collector appears in the collection tree:
|
||||
|
||||
.. code-block:: pytest
|
||||
|
||||
customdirectory $ pytest --collect-only
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project/customdirectory
|
||||
configfile: pytest.ini
|
||||
collected 2 items
|
||||
|
||||
<Dir customdirectory>
|
||||
<ManifestDirectory tests>
|
||||
<Module test_first.py>
|
||||
<Function test_1>
|
||||
<Module test_second.py>
|
||||
<Function test_2>
|
||||
|
||||
======================== 2 tests collected in 0.12s ========================
|
|
@ -0,0 +1,28 @@
|
|||
# content of conftest.py
|
||||
import json
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
class ManifestDirectory(pytest.Directory):
|
||||
def collect(self):
|
||||
# The standard pytest behavior is to loop over all `test_*.py` files and
|
||||
# call `pytest_collect_file` on each file. This collector instead reads
|
||||
# the `manifest.json` file and only calls `pytest_collect_file` for the
|
||||
# files defined there.
|
||||
manifest_path = self.path / "manifest.json"
|
||||
manifest = json.loads(manifest_path.read_text(encoding="utf-8"))
|
||||
ihook = self.ihook
|
||||
for file in manifest["files"]:
|
||||
yield from ihook.pytest_collect_file(
|
||||
file_path=self.path / file, parent=self
|
||||
)
|
||||
|
||||
|
||||
@pytest.hookimpl
|
||||
def pytest_collect_directory(path, parent):
|
||||
# Use our custom collector for directories containing a `mainfest.json` file.
|
||||
if path.joinpath("manifest.json").is_file():
|
||||
return ManifestDirectory.from_parent(parent=parent, path=path)
|
||||
# Otherwise fallback to the standard behavior.
|
||||
return None
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"files": [
|
||||
"test_first.py",
|
||||
"test_second.py"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
# content of test_first.py
|
||||
def test_1():
|
||||
pass
|
|
@ -0,0 +1,3 @@
|
|||
# content of test_second.py
|
||||
def test_2():
|
||||
pass
|
|
@ -0,0 +1,3 @@
|
|||
# content of test_third.py
|
||||
def test_3():
|
||||
pass
|
|
@ -18,7 +18,6 @@ For basic examples, see
|
|||
- :ref:`Fixtures <fixtures>` for basic fixture/setup examples
|
||||
- :ref:`parametrize` for basic test function parametrization
|
||||
- :ref:`unittest` for basic unittest integration
|
||||
- :ref:`noseintegration` for basic nosetests integration
|
||||
|
||||
The following examples aim at various use cases you might encounter.
|
||||
|
||||
|
@ -32,3 +31,4 @@ The following examples aim at various use cases you might encounter.
|
|||
special
|
||||
pythoncollection
|
||||
nonpython
|
||||
customdirectory
|
||||
|
|
|
@ -45,7 +45,7 @@ You can then restrict a test run to only run tests marked with ``webtest``:
|
|||
|
||||
$ pytest -v -m webtest
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python
|
||||
cachedir: .pytest_cache
|
||||
rootdir: /home/sweet/project
|
||||
collecting ... collected 4 items / 3 deselected / 1 selected
|
||||
|
@ -60,7 +60,7 @@ Or the inverse, running all tests except the webtest ones:
|
|||
|
||||
$ pytest -v -m "not webtest"
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python
|
||||
cachedir: .pytest_cache
|
||||
rootdir: /home/sweet/project
|
||||
collecting ... collected 4 items / 1 deselected / 3 selected
|
||||
|
@ -82,7 +82,7 @@ tests based on their module, class, method, or function name:
|
|||
|
||||
$ pytest -v test_server.py::TestClass::test_method
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python
|
||||
cachedir: .pytest_cache
|
||||
rootdir: /home/sweet/project
|
||||
collecting ... collected 1 item
|
||||
|
@ -97,7 +97,7 @@ You can also select on the class:
|
|||
|
||||
$ pytest -v test_server.py::TestClass
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python
|
||||
cachedir: .pytest_cache
|
||||
rootdir: /home/sweet/project
|
||||
collecting ... collected 1 item
|
||||
|
@ -112,7 +112,7 @@ Or select multiple nodes:
|
|||
|
||||
$ pytest -v test_server.py::TestClass test_server.py::test_send_http
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python
|
||||
cachedir: .pytest_cache
|
||||
rootdir: /home/sweet/project
|
||||
collecting ... collected 2 items
|
||||
|
@ -156,7 +156,7 @@ The expression matching is now case-insensitive.
|
|||
|
||||
$ pytest -v -k http # running with the above defined example module
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python
|
||||
cachedir: .pytest_cache
|
||||
rootdir: /home/sweet/project
|
||||
collecting ... collected 4 items / 3 deselected / 1 selected
|
||||
|
@ -171,7 +171,7 @@ And you can also run all tests except the ones that match the keyword:
|
|||
|
||||
$ pytest -k "not send_http" -v
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python
|
||||
cachedir: .pytest_cache
|
||||
rootdir: /home/sweet/project
|
||||
collecting ... collected 4 items / 1 deselected / 3 selected
|
||||
|
@ -188,7 +188,7 @@ Or to select "http" and "quick" tests:
|
|||
|
||||
$ pytest -k "http or quick" -v
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python
|
||||
cachedir: .pytest_cache
|
||||
rootdir: /home/sweet/project
|
||||
collecting ... collected 4 items / 2 deselected / 2 selected
|
||||
|
@ -397,7 +397,7 @@ the test needs:
|
|||
|
||||
$ pytest -E stage2
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project
|
||||
collected 1 item
|
||||
|
||||
|
@ -411,7 +411,7 @@ and here is one that specifies exactly the environment needed:
|
|||
|
||||
$ pytest -E stage1
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project
|
||||
collected 1 item
|
||||
|
||||
|
@ -604,7 +604,7 @@ then you will see two tests skipped and two executed tests as expected:
|
|||
|
||||
$ pytest -rs # this option reports skip reasons
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project
|
||||
collected 4 items
|
||||
|
||||
|
@ -620,7 +620,7 @@ Note that if you specify a platform via the marker-command line option like this
|
|||
|
||||
$ pytest -m linux
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project
|
||||
collected 4 items / 3 deselected / 1 selected
|
||||
|
||||
|
@ -683,7 +683,7 @@ We can now use the ``-m option`` to select one set:
|
|||
|
||||
$ pytest -m interface --tb=short
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project
|
||||
collected 4 items / 2 deselected / 2 selected
|
||||
|
||||
|
@ -709,7 +709,7 @@ or to select both "event" and "interface" tests:
|
|||
|
||||
$ pytest -m "interface or event" --tb=short
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project
|
||||
collected 4 items / 1 deselected / 3 selected
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ now execute the test specification:
|
|||
|
||||
nonpython $ pytest test_simple.yaml
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project/nonpython
|
||||
collected 2 items
|
||||
|
||||
|
@ -64,7 +64,7 @@ consulted when reporting in ``verbose`` mode:
|
|||
|
||||
nonpython $ pytest -v
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python
|
||||
cachedir: .pytest_cache
|
||||
rootdir: /home/sweet/project/nonpython
|
||||
collecting ... collected 2 items
|
||||
|
@ -90,7 +90,7 @@ interesting to just look at the collection tree:
|
|||
|
||||
nonpython $ pytest --collect-only
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project/nonpython
|
||||
collected 2 items
|
||||
|
||||
|
|
|
@ -158,19 +158,20 @@ objects, they are still using the default pytest representation:
|
|||
|
||||
$ pytest test_time.py --collect-only
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project
|
||||
collected 8 items
|
||||
|
||||
<Module test_time.py>
|
||||
<Function test_timedistance_v0[a0-b0-expected0]>
|
||||
<Function test_timedistance_v0[a1-b1-expected1]>
|
||||
<Function test_timedistance_v1[forward]>
|
||||
<Function test_timedistance_v1[backward]>
|
||||
<Function test_timedistance_v2[20011212-20011211-expected0]>
|
||||
<Function test_timedistance_v2[20011211-20011212-expected1]>
|
||||
<Function test_timedistance_v3[forward]>
|
||||
<Function test_timedistance_v3[backward]>
|
||||
<Dir parametrize.rst-189>
|
||||
<Module test_time.py>
|
||||
<Function test_timedistance_v0[a0-b0-expected0]>
|
||||
<Function test_timedistance_v0[a1-b1-expected1]>
|
||||
<Function test_timedistance_v1[forward]>
|
||||
<Function test_timedistance_v1[backward]>
|
||||
<Function test_timedistance_v2[20011212-20011211-expected0]>
|
||||
<Function test_timedistance_v2[20011211-20011212-expected1]>
|
||||
<Function test_timedistance_v3[forward]>
|
||||
<Function test_timedistance_v3[backward]>
|
||||
|
||||
======================== 8 tests collected in 0.12s ========================
|
||||
|
||||
|
@ -220,7 +221,7 @@ this is a fully self-contained example which you can run with:
|
|||
|
||||
$ pytest test_scenarios.py
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project
|
||||
collected 4 items
|
||||
|
||||
|
@ -234,16 +235,17 @@ If you just collect tests you'll also nicely see 'advanced' and 'basic' as varia
|
|||
|
||||
$ pytest --collect-only test_scenarios.py
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project
|
||||
collected 4 items
|
||||
|
||||
<Module test_scenarios.py>
|
||||
<Class TestSampleWithScenarios>
|
||||
<Function test_demo1[basic]>
|
||||
<Function test_demo2[basic]>
|
||||
<Function test_demo1[advanced]>
|
||||
<Function test_demo2[advanced]>
|
||||
<Dir parametrize.rst-189>
|
||||
<Module test_scenarios.py>
|
||||
<Class TestSampleWithScenarios>
|
||||
<Function test_demo1[basic]>
|
||||
<Function test_demo2[basic]>
|
||||
<Function test_demo1[advanced]>
|
||||
<Function test_demo2[advanced]>
|
||||
|
||||
======================== 4 tests collected in 0.12s ========================
|
||||
|
||||
|
@ -312,13 +314,14 @@ Let's first see how it looks like at collection time:
|
|||
|
||||
$ pytest test_backends.py --collect-only
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project
|
||||
collected 2 items
|
||||
|
||||
<Module test_backends.py>
|
||||
<Function test_db_initialized[d1]>
|
||||
<Function test_db_initialized[d2]>
|
||||
<Dir parametrize.rst-189>
|
||||
<Module test_backends.py>
|
||||
<Function test_db_initialized[d1]>
|
||||
<Function test_db_initialized[d2]>
|
||||
|
||||
======================== 2 tests collected in 0.12s ========================
|
||||
|
||||
|
@ -410,7 +413,7 @@ The result of this test will be successful:
|
|||
|
||||
$ pytest -v test_indirect_list.py
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python
|
||||
cachedir: .pytest_cache
|
||||
rootdir: /home/sweet/project
|
||||
collecting ... collected 1 item
|
||||
|
@ -500,12 +503,11 @@ Running it results in some skips if we don't have all the python interpreters in
|
|||
.. code-block:: pytest
|
||||
|
||||
. $ pytest -rs -q multipython.py
|
||||
sssssssssssssssssssssssssss [100%]
|
||||
ssssssssssss...ssssssssssss [100%]
|
||||
========================= short test summary info ==========================
|
||||
SKIPPED [9] multipython.py:69: 'python3.5' not found
|
||||
SKIPPED [9] multipython.py:69: 'python3.6' not found
|
||||
SKIPPED [9] multipython.py:69: 'python3.7' not found
|
||||
27 skipped in 0.12s
|
||||
SKIPPED [12] multipython.py:68: 'python3.9' not found
|
||||
SKIPPED [12] multipython.py:68: 'python3.11' not found
|
||||
3 passed, 24 skipped in 0.12s
|
||||
|
||||
Parametrization of optional implementations/imports
|
||||
---------------------------------------------------
|
||||
|
@ -565,7 +567,7 @@ If you run this with reporting for skips enabled:
|
|||
|
||||
$ pytest -rs test_module.py
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project
|
||||
collected 2 items
|
||||
|
||||
|
@ -626,7 +628,7 @@ Then run ``pytest`` with verbose mode and with only the ``basic`` marker:
|
|||
|
||||
$ pytest -v -m basic
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python
|
||||
cachedir: .pytest_cache
|
||||
rootdir: /home/sweet/project
|
||||
collecting ... collected 24 items / 21 deselected / 3 selected
|
||||
|
|
|
@ -147,15 +147,16 @@ The test collection would look like this:
|
|||
|
||||
$ pytest --collect-only
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project
|
||||
configfile: pytest.ini
|
||||
collected 2 items
|
||||
|
||||
<Module check_myapp.py>
|
||||
<Class CheckMyApp>
|
||||
<Function simple_check>
|
||||
<Function complex_check>
|
||||
<Dir pythoncollection.rst-190>
|
||||
<Module check_myapp.py>
|
||||
<Class CheckMyApp>
|
||||
<Function simple_check>
|
||||
<Function complex_check>
|
||||
|
||||
======================== 2 tests collected in 0.12s ========================
|
||||
|
||||
|
@ -209,16 +210,18 @@ You can always peek at the collection tree without running tests like this:
|
|||
|
||||
. $ pytest --collect-only pythoncollection.py
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project
|
||||
configfile: pytest.ini
|
||||
collected 3 items
|
||||
|
||||
<Module CWD/pythoncollection.py>
|
||||
<Function test_function>
|
||||
<Class TestClass>
|
||||
<Function test_method>
|
||||
<Function test_anothermethod>
|
||||
<Dir pythoncollection.rst-190>
|
||||
<Dir CWD>
|
||||
<Module pythoncollection.py>
|
||||
<Function test_function>
|
||||
<Class TestClass>
|
||||
<Function test_method>
|
||||
<Function test_anothermethod>
|
||||
|
||||
======================== 3 tests collected in 0.12s ========================
|
||||
|
||||
|
@ -291,7 +294,7 @@ file will be left out:
|
|||
|
||||
$ pytest --collect-only
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project
|
||||
configfile: pytest.ini
|
||||
collected 0 items
|
||||
|
|
|
@ -9,7 +9,7 @@ Here is a nice run of several failures and how ``pytest`` presents things:
|
|||
|
||||
assertion $ pytest failure_demo.py
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project/assertion
|
||||
collected 44 items
|
||||
|
||||
|
@ -80,6 +80,7 @@ Here is a nice run of several failures and how ``pytest`` presents things:
|
|||
def test_eq_text(self):
|
||||
> assert "spam" == "eggs"
|
||||
E AssertionError: assert 'spam' == 'eggs'
|
||||
E
|
||||
E - eggs
|
||||
E + spam
|
||||
|
||||
|
@ -91,6 +92,7 @@ Here is a nice run of several failures and how ``pytest`` presents things:
|
|||
def test_eq_similar_text(self):
|
||||
> assert "foo 1 bar" == "foo 2 bar"
|
||||
E AssertionError: assert 'foo 1 bar' == 'foo 2 bar'
|
||||
E
|
||||
E - foo 2 bar
|
||||
E ? ^
|
||||
E + foo 1 bar
|
||||
|
@ -104,6 +106,7 @@ Here is a nice run of several failures and how ``pytest`` presents things:
|
|||
def test_eq_multiline_text(self):
|
||||
> assert "foo\nspam\nbar" == "foo\neggs\nbar"
|
||||
E AssertionError: assert 'foo\nspam\nbar' == 'foo\neggs\nbar'
|
||||
E
|
||||
E foo
|
||||
E - eggs
|
||||
E + spam
|
||||
|
@ -119,6 +122,7 @@ Here is a nice run of several failures and how ``pytest`` presents things:
|
|||
b = "1" * 100 + "b" + "2" * 100
|
||||
> assert a == b
|
||||
E AssertionError: assert '111111111111...2222222222222' == '111111111111...2222222222222'
|
||||
E
|
||||
E Skipping 90 identical leading characters in diff, use -v to show
|
||||
E Skipping 91 identical trailing characters in diff, use -v to show
|
||||
E - 1111111111b222222222
|
||||
|
@ -136,15 +140,15 @@ Here is a nice run of several failures and how ``pytest`` presents things:
|
|||
b = "1\n" * 100 + "b" + "2\n" * 100
|
||||
> assert a == b
|
||||
E AssertionError: assert '1\n1\n1\n1\n...n2\n2\n2\n2\n' == '1\n1\n1\n1\n...n2\n2\n2\n2\n'
|
||||
E
|
||||
E Skipping 190 identical leading characters in diff, use -v to show
|
||||
E Skipping 191 identical trailing characters in diff, use -v to show
|
||||
E 1
|
||||
E 1
|
||||
E 1
|
||||
E 1
|
||||
E 1...
|
||||
E
|
||||
E ...Full output truncated (6 lines hidden), use '-vv' to show
|
||||
E ...Full output truncated (7 lines hidden), use '-vv' to show
|
||||
|
||||
failure_demo.py:60: AssertionError
|
||||
_________________ TestSpecialisedExplanations.test_eq_list _________________
|
||||
|
@ -154,6 +158,7 @@ Here is a nice run of several failures and how ``pytest`` presents things:
|
|||
def test_eq_list(self):
|
||||
> assert [0, 1, 2] == [0, 1, 3]
|
||||
E assert [0, 1, 2] == [0, 1, 3]
|
||||
E
|
||||
E At index 2 diff: 2 != 3
|
||||
E Use -v to get more diff
|
||||
|
||||
|
@ -167,6 +172,7 @@ Here is a nice run of several failures and how ``pytest`` presents things:
|
|||
b = [0] * 100 + [2] + [3] * 100
|
||||
> assert a == b
|
||||
E assert [0, 0, 0, 0, 0, 0, ...] == [0, 0, 0, 0, 0, 0, ...]
|
||||
E
|
||||
E At index 100 diff: 1 != 2
|
||||
E Use -v to get more diff
|
||||
|
||||
|
@ -178,6 +184,7 @@ Here is a nice run of several failures and how ``pytest`` presents things:
|
|||
def test_eq_dict(self):
|
||||
> assert {"a": 0, "b": 1, "c": 0} == {"a": 0, "b": 2, "d": 0}
|
||||
E AssertionError: assert {'a': 0, 'b': 1, 'c': 0} == {'a': 0, 'b': 2, 'd': 0}
|
||||
E
|
||||
E Omitting 1 identical items, use -vv to show
|
||||
E Differing items:
|
||||
E {'b': 1} != {'b': 2}
|
||||
|
@ -195,6 +202,7 @@ Here is a nice run of several failures and how ``pytest`` presents things:
|
|||
def test_eq_set(self):
|
||||
> assert {0, 10, 11, 12} == {0, 20, 21}
|
||||
E assert {0, 10, 11, 12} == {0, 20, 21}
|
||||
E
|
||||
E Extra items in the left set:
|
||||
E 10
|
||||
E 11
|
||||
|
@ -212,6 +220,7 @@ Here is a nice run of several failures and how ``pytest`` presents things:
|
|||
def test_eq_longer_list(self):
|
||||
> assert [1, 2] == [1, 2, 3]
|
||||
E assert [1, 2] == [1, 2, 3]
|
||||
E
|
||||
E Right contains one more item: 3
|
||||
E Use -v to get more diff
|
||||
|
||||
|
@ -233,6 +242,7 @@ Here is a nice run of several failures and how ``pytest`` presents things:
|
|||
text = "some multiline\ntext\nwhich\nincludes foo\nand a\ntail"
|
||||
> assert "foo" not in text
|
||||
E AssertionError: assert 'foo' not in 'some multil...nand a\ntail'
|
||||
E
|
||||
E 'foo' is contained here:
|
||||
E some multiline
|
||||
E text
|
||||
|
@ -251,6 +261,7 @@ Here is a nice run of several failures and how ``pytest`` presents things:
|
|||
text = "single foo line"
|
||||
> assert "foo" not in text
|
||||
E AssertionError: assert 'foo' not in 'single foo line'
|
||||
E
|
||||
E 'foo' is contained here:
|
||||
E single foo line
|
||||
E ? +++
|
||||
|
@ -264,6 +275,7 @@ Here is a nice run of several failures and how ``pytest`` presents things:
|
|||
text = "head " * 50 + "foo " + "tail " * 20
|
||||
> assert "foo" not in text
|
||||
E AssertionError: assert 'foo' not in 'head head h...l tail tail '
|
||||
E
|
||||
E 'foo' is contained here:
|
||||
E head head foo tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail
|
||||
E ? +++
|
||||
|
@ -277,6 +289,7 @@ Here is a nice run of several failures and how ``pytest`` presents things:
|
|||
text = "head " * 50 + "f" * 70 + "tail " * 20
|
||||
> assert "f" * 70 not in text
|
||||
E AssertionError: assert 'fffffffffff...ffffffffffff' not in 'head head h...l tail tail '
|
||||
E
|
||||
E 'ffffffffffffffffff...fffffffffffffffffff' is contained here:
|
||||
E head head fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffftail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail
|
||||
E ? ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
|
|
@ -232,7 +232,7 @@ directory with the above conftest.py:
|
|||
|
||||
$ pytest
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project
|
||||
collected 0 items
|
||||
|
||||
|
@ -296,7 +296,7 @@ and when running it will see a skipped "slow" test:
|
|||
|
||||
$ pytest -rs # "-rs" means report details on the little 's'
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project
|
||||
collected 2 items
|
||||
|
||||
|
@ -312,7 +312,7 @@ Or run it including the ``slow`` marked test:
|
|||
|
||||
$ pytest --runslow
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project
|
||||
collected 2 items
|
||||
|
||||
|
@ -456,7 +456,7 @@ which will add the string to the test header accordingly:
|
|||
|
||||
$ pytest
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
project deps: mylib-1.1
|
||||
rootdir: /home/sweet/project
|
||||
collected 0 items
|
||||
|
@ -484,7 +484,7 @@ which will add info only when run with "--v":
|
|||
|
||||
$ pytest -v
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python
|
||||
cachedir: .pytest_cache
|
||||
info1: did you know that ...
|
||||
did you?
|
||||
|
@ -499,7 +499,7 @@ and nothing when run plainly:
|
|||
|
||||
$ pytest
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project
|
||||
collected 0 items
|
||||
|
||||
|
@ -538,7 +538,7 @@ Now we can profile which test functions execute the slowest:
|
|||
|
||||
$ pytest --durations=3
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project
|
||||
collected 3 items
|
||||
|
||||
|
@ -644,7 +644,7 @@ If we run this:
|
|||
|
||||
$ pytest -rx
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project
|
||||
collected 4 items
|
||||
|
||||
|
@ -726,14 +726,14 @@ We can run this:
|
|||
|
||||
$ pytest
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project
|
||||
collected 7 items
|
||||
|
||||
test_step.py .Fx. [ 57%]
|
||||
a/test_db.py F [ 71%]
|
||||
a/test_db2.py F [ 85%]
|
||||
b/test_error.py E [100%]
|
||||
a/test_db.py F [ 14%]
|
||||
a/test_db2.py F [ 28%]
|
||||
b/test_error.py E [ 42%]
|
||||
test_step.py .Fx. [100%]
|
||||
|
||||
================================== ERRORS ==================================
|
||||
_______________________ ERROR at setup of test_root ________________________
|
||||
|
@ -745,39 +745,39 @@ We can run this:
|
|||
|
||||
/home/sweet/project/b/test_error.py:1
|
||||
================================= FAILURES =================================
|
||||
_________________________________ test_a1 __________________________________
|
||||
|
||||
db = <conftest.DB object at 0xdeadbeef0002>
|
||||
|
||||
def test_a1(db):
|
||||
> assert 0, db # to show value
|
||||
E AssertionError: <conftest.DB object at 0xdeadbeef0002>
|
||||
E assert 0
|
||||
|
||||
a/test_db.py:2: AssertionError
|
||||
_________________________________ test_a2 __________________________________
|
||||
|
||||
db = <conftest.DB object at 0xdeadbeef0002>
|
||||
|
||||
def test_a2(db):
|
||||
> assert 0, db # to show value
|
||||
E AssertionError: <conftest.DB object at 0xdeadbeef0002>
|
||||
E assert 0
|
||||
|
||||
a/test_db2.py:2: AssertionError
|
||||
____________________ TestUserHandling.test_modification ____________________
|
||||
|
||||
self = <test_step.TestUserHandling object at 0xdeadbeef0002>
|
||||
self = <test_step.TestUserHandling object at 0xdeadbeef0003>
|
||||
|
||||
def test_modification(self):
|
||||
> assert 0
|
||||
E assert 0
|
||||
|
||||
test_step.py:11: AssertionError
|
||||
_________________________________ test_a1 __________________________________
|
||||
|
||||
db = <conftest.DB object at 0xdeadbeef0003>
|
||||
|
||||
def test_a1(db):
|
||||
> assert 0, db # to show value
|
||||
E AssertionError: <conftest.DB object at 0xdeadbeef0003>
|
||||
E assert 0
|
||||
|
||||
a/test_db.py:2: AssertionError
|
||||
_________________________________ test_a2 __________________________________
|
||||
|
||||
db = <conftest.DB object at 0xdeadbeef0003>
|
||||
|
||||
def test_a2(db):
|
||||
> assert 0, db # to show value
|
||||
E AssertionError: <conftest.DB object at 0xdeadbeef0003>
|
||||
E assert 0
|
||||
|
||||
a/test_db2.py:2: AssertionError
|
||||
========================= short test summary info ==========================
|
||||
FAILED test_step.py::TestUserHandling::test_modification - assert 0
|
||||
FAILED a/test_db.py::test_a1 - AssertionError: <conftest.DB object at 0x7...
|
||||
FAILED a/test_db2.py::test_a2 - AssertionError: <conftest.DB object at 0x...
|
||||
FAILED test_step.py::TestUserHandling::test_modification - assert 0
|
||||
ERROR b/test_error.py::test_root
|
||||
============= 3 failed, 2 passed, 1 xfailed, 1 error in 0.12s ==============
|
||||
|
||||
|
@ -846,7 +846,7 @@ and run them:
|
|||
|
||||
$ pytest test_module.py
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project
|
||||
collected 2 items
|
||||
|
||||
|
@ -955,7 +955,7 @@ and run it:
|
|||
|
||||
$ pytest -s test_module.py
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project
|
||||
collected 3 items
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ style of setup/teardown functions:
|
|||
In addition, pytest continues to support :ref:`xunitsetup`. You can mix
|
||||
both styles, moving incrementally from classic to new style, as you
|
||||
prefer. You can also start out from existing :ref:`unittest.TestCase
|
||||
style <unittest.TestCase>` or :ref:`nose based <nosestyle>` projects.
|
||||
style <unittest.TestCase>`.
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ Install ``pytest``
|
|||
.. code-block:: bash
|
||||
|
||||
$ pytest --version
|
||||
pytest 7.4.3
|
||||
pytest 8.0.0rc1
|
||||
|
||||
.. _`simpletest`:
|
||||
|
||||
|
@ -47,7 +47,7 @@ The test
|
|||
|
||||
$ pytest
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project
|
||||
collected 1 item
|
||||
|
||||
|
@ -98,7 +98,7 @@ Use the :ref:`raises <assertraises>` helper to assert that some code raises an e
|
|||
f()
|
||||
|
||||
You can also use the context provided by :ref:`raises <assertraises>` to
|
||||
assert that an expected exception is part of a raised ``ExceptionGroup``:
|
||||
assert that an expected exception is part of a raised :class:`ExceptionGroup`:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ you will see the return value of the function call:
|
|||
|
||||
$ pytest test_assert1.py
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project
|
||||
collected 1 item
|
||||
|
||||
|
@ -143,11 +143,13 @@ Notes:
|
|||
* The ``match`` parameter also matches against `PEP-678 <https://peps.python.org/pep-0678/>`__ ``__notes__``.
|
||||
|
||||
|
||||
.. _`assert-matching-exception-groups`:
|
||||
|
||||
Matching exception groups
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
You can also use the :func:`excinfo.group_contains() <pytest.ExceptionInfo.group_contains>`
|
||||
method to test for exceptions returned as part of an ``ExceptionGroup``:
|
||||
method to test for exceptions returned as part of an :class:`ExceptionGroup`:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
|
@ -278,7 +280,7 @@ if you run this module:
|
|||
|
||||
$ pytest test_assert2.py
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project
|
||||
collected 1 item
|
||||
|
||||
|
@ -292,6 +294,7 @@ if you run this module:
|
|||
set2 = set("8035")
|
||||
> assert set1 == set2
|
||||
E AssertionError: assert {'0', '1', '3', '8'} == {'0', '3', '5', '8'}
|
||||
E
|
||||
E Extra items in the left set:
|
||||
E '1'
|
||||
E Extra items in the right set:
|
||||
|
|
|
@ -86,7 +86,7 @@ If you then run it with ``--lf``:
|
|||
|
||||
$ pytest --lf
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project
|
||||
collected 2 items
|
||||
run-last-failure: rerun previous 2 failures
|
||||
|
@ -132,7 +132,7 @@ of ``FF`` and dots):
|
|||
|
||||
$ pytest --ff
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project
|
||||
collected 50 items
|
||||
run-last-failure: rerun previous 2 failures first
|
||||
|
@ -281,7 +281,7 @@ You can always peek at the content of the cache using the
|
|||
|
||||
$ pytest --cache-show
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project
|
||||
cachedir: /home/sweet/project/.pytest_cache
|
||||
--------------------------- cache values for '*' ---------------------------
|
||||
|
@ -303,7 +303,7 @@ filtering:
|
|||
|
||||
$ pytest --cache-show example/*
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project
|
||||
cachedir: /home/sweet/project/.pytest_cache
|
||||
----------------------- cache values for 'example/*' -----------------------
|
||||
|
|
|
@ -83,7 +83,7 @@ of the failing function and hide the other one:
|
|||
|
||||
$ pytest
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project
|
||||
collected 2 items
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ Running pytest now produces this output:
|
|||
|
||||
$ pytest test_show_warnings.py
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project
|
||||
collected 1 item
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ then you can just invoke ``pytest`` directly:
|
|||
|
||||
$ pytest
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project
|
||||
collected 1 item
|
||||
|
||||
|
@ -58,7 +58,7 @@ and functions, including from test modules:
|
|||
|
||||
$ pytest --doctest-modules
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project
|
||||
collected 2 items
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ How to use pytest with an existing test suite
|
|||
==============================================
|
||||
|
||||
Pytest can be used with most existing test suites, but its
|
||||
behavior differs from other test runners such as :ref:`nose <noseintegration>` or
|
||||
Python's default unittest framework.
|
||||
behavior differs from other test runners such as Python's
|
||||
default unittest framework.
|
||||
|
||||
Before using this section you will want to :ref:`install pytest <getstarted>`.
|
||||
|
||||
|
|
|
@ -433,7 +433,7 @@ marked ``smtp_connection`` fixture function. Running the test looks like this:
|
|||
|
||||
$ pytest test_module.py
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project
|
||||
collected 2 items
|
||||
|
||||
|
@ -771,7 +771,7 @@ For yield fixtures, the first teardown code to run is from the right-most fixtur
|
|||
|
||||
$ pytest -s test_finalizers.py
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project
|
||||
collected 1 item
|
||||
|
||||
|
@ -805,7 +805,7 @@ For finalizers, the first fixture to run is last call to `request.addfinalizer`.
|
|||
|
||||
$ pytest -s test_finalizers.py
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project
|
||||
collected 1 item
|
||||
|
||||
|
@ -1414,27 +1414,28 @@ Running the above tests results in the following test IDs being used:
|
|||
|
||||
$ pytest --collect-only
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project
|
||||
collected 12 items
|
||||
|
||||
<Module test_anothersmtp.py>
|
||||
<Function test_showhelo[smtp.gmail.com]>
|
||||
<Function test_showhelo[mail.python.org]>
|
||||
<Module test_emaillib.py>
|
||||
<Function test_email_received>
|
||||
<Module test_finalizers.py>
|
||||
<Function test_bar>
|
||||
<Module test_ids.py>
|
||||
<Function test_a[spam]>
|
||||
<Function test_a[ham]>
|
||||
<Function test_b[eggs]>
|
||||
<Function test_b[1]>
|
||||
<Module test_module.py>
|
||||
<Function test_ehlo[smtp.gmail.com]>
|
||||
<Function test_noop[smtp.gmail.com]>
|
||||
<Function test_ehlo[mail.python.org]>
|
||||
<Function test_noop[mail.python.org]>
|
||||
<Dir fixtures.rst-208>
|
||||
<Module test_anothersmtp.py>
|
||||
<Function test_showhelo[smtp.gmail.com]>
|
||||
<Function test_showhelo[mail.python.org]>
|
||||
<Module test_emaillib.py>
|
||||
<Function test_email_received>
|
||||
<Module test_finalizers.py>
|
||||
<Function test_bar>
|
||||
<Module test_ids.py>
|
||||
<Function test_a[spam]>
|
||||
<Function test_a[ham]>
|
||||
<Function test_b[eggs]>
|
||||
<Function test_b[1]>
|
||||
<Module test_module.py>
|
||||
<Function test_ehlo[smtp.gmail.com]>
|
||||
<Function test_noop[smtp.gmail.com]>
|
||||
<Function test_ehlo[mail.python.org]>
|
||||
<Function test_noop[mail.python.org]>
|
||||
|
||||
======================= 12 tests collected in 0.12s ========================
|
||||
|
||||
|
@ -1468,7 +1469,7 @@ Running this test will *skip* the invocation of ``data_set`` with value ``2``:
|
|||
|
||||
$ pytest test_fixture_marks.py -v
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python
|
||||
cachedir: .pytest_cache
|
||||
rootdir: /home/sweet/project
|
||||
collecting ... collected 3 items
|
||||
|
@ -1518,7 +1519,7 @@ Here we declare an ``app`` fixture which receives the previously defined
|
|||
|
||||
$ pytest -v test_appsetup.py
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python
|
||||
cachedir: .pytest_cache
|
||||
rootdir: /home/sweet/project
|
||||
collecting ... collected 2 items
|
||||
|
@ -1598,7 +1599,7 @@ Let's run the tests in verbose mode and with looking at the print-output:
|
|||
|
||||
$ pytest -v -s test_module.py
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python
|
||||
cachedir: .pytest_cache
|
||||
rootdir: /home/sweet/project
|
||||
collecting ... collected 8 items
|
||||
|
|
|
@ -52,7 +52,6 @@ pytest and other test systems
|
|||
|
||||
existingtestsuite
|
||||
unittest
|
||||
nose
|
||||
xunit_setup
|
||||
|
||||
pytest development environment
|
||||
|
|
|
@ -1,99 +0,0 @@
|
|||
.. _`noseintegration`:
|
||||
|
||||
How to run tests written for nose
|
||||
=======================================
|
||||
|
||||
``pytest`` has basic support for running tests written for nose_.
|
||||
|
||||
.. warning::
|
||||
This functionality has been deprecated and is likely to be removed in ``pytest 8.x``.
|
||||
|
||||
.. _nosestyle:
|
||||
|
||||
Usage
|
||||
-------------
|
||||
|
||||
After :ref:`installation` type:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
python setup.py develop # make sure tests can import our package
|
||||
pytest # instead of 'nosetests'
|
||||
|
||||
and you should be able to run your nose style tests and
|
||||
make use of pytest's capabilities.
|
||||
|
||||
Supported nose Idioms
|
||||
----------------------
|
||||
|
||||
* ``setup()`` and ``teardown()`` at module/class/method level: any function or method called ``setup`` will be called during the setup phase for each test, same for ``teardown``.
|
||||
* ``SkipTest`` exceptions and markers
|
||||
* setup/teardown decorators
|
||||
* ``__test__`` attribute on modules/classes/functions
|
||||
* general usage of nose utilities
|
||||
|
||||
Unsupported idioms / known issues
|
||||
----------------------------------
|
||||
|
||||
- unittest-style ``setUp, tearDown, setUpClass, tearDownClass``
|
||||
are recognized only on ``unittest.TestCase`` classes but not
|
||||
on plain classes. ``nose`` supports these methods also on plain
|
||||
classes but pytest deliberately does not. As nose and pytest already
|
||||
both support ``setup_class, teardown_class, setup_method, teardown_method``
|
||||
it doesn't seem useful to duplicate the unittest-API like nose does.
|
||||
If you however rather think pytest should support the unittest-spelling on
|
||||
plain classes please post to :issue:`377`.
|
||||
|
||||
- nose imports test modules with the same import path (e.g.
|
||||
``tests.test_mode``) but different file system paths
|
||||
(e.g. ``tests/test_mode.py`` and ``other/tests/test_mode.py``)
|
||||
by extending sys.path/import semantics. pytest does not do that. Note that
|
||||
`nose2 choose to avoid this sys.path/import hackery <https://nose2.readthedocs.io/en/latest/differences.html#test-discovery-and-loading>`_.
|
||||
|
||||
If you place a conftest.py file in the root directory of your project
|
||||
(as determined by pytest) pytest will run tests "nose style" against
|
||||
the code below that directory by adding it to your ``sys.path`` instead of
|
||||
running against your installed code.
|
||||
|
||||
You may find yourself wanting to do this if you ran ``python setup.py install``
|
||||
to set up your project, as opposed to ``python setup.py develop`` or any of
|
||||
the package manager equivalents. Installing with develop in a
|
||||
virtual environment like tox is recommended over this pattern.
|
||||
|
||||
- nose-style doctests are not collected and executed correctly,
|
||||
also doctest fixtures don't work.
|
||||
|
||||
- no nose-configuration is recognized.
|
||||
|
||||
- ``yield``-based methods are
|
||||
fundamentally incompatible with pytest because they don't support fixtures
|
||||
properly since collection and test execution are separated.
|
||||
|
||||
Here is a table comparing the default supported naming conventions for both
|
||||
nose and pytest.
|
||||
|
||||
========= ========================== ======= =====
|
||||
what default naming convention pytest nose
|
||||
========= ========================== ======= =====
|
||||
module ``test*.py`` ✅
|
||||
module ``test_*.py`` ✅ ✅
|
||||
module ``*_test.py`` ✅
|
||||
module ``*_tests.py``
|
||||
class ``*(unittest.TestCase)`` ✅ ✅
|
||||
method ``test_*`` ✅ ✅
|
||||
class ``Test*`` ✅
|
||||
method ``test_*`` ✅
|
||||
function ``test_*`` ✅
|
||||
========= ========================== ======= =====
|
||||
|
||||
|
||||
Migrating from nose to pytest
|
||||
------------------------------
|
||||
|
||||
`nose2pytest <https://github.com/pytest-dev/nose2pytest>`_ is a Python script
|
||||
and pytest plugin to help convert Nose-based tests into pytest-based tests.
|
||||
Specifically, the script transforms ``nose.tools.assert_*`` function calls into
|
||||
raw assert statements, while preserving format of original arguments
|
||||
as much as possible.
|
||||
|
||||
.. _nose: https://nose.readthedocs.io/en/latest/
|
|
@ -100,6 +100,7 @@ Executing pytest normally gives us this output (we are skipping the header to fo
|
|||
fruits2 = ["banana", "apple", "orange", "melon", "kiwi"]
|
||||
> assert fruits1 == fruits2
|
||||
E AssertionError: assert ['banana', 'a...elon', 'kiwi'] == ['banana', 'a...elon', 'kiwi']
|
||||
E
|
||||
E At index 2 diff: 'grapes' != 'orange'
|
||||
E Use -v to get more diff
|
||||
|
||||
|
@ -111,6 +112,7 @@ Executing pytest normally gives us this output (we are skipping the header to fo
|
|||
number_to_text2 = {str(x * 10): x * 10 for x in range(5)}
|
||||
> assert number_to_text1 == number_to_text2
|
||||
E AssertionError: assert {'0': 0, '1':..., '3': 3, ...} == {'0': 0, '10'...'30': 30, ...}
|
||||
E
|
||||
E Omitting 1 identical items, use -vv to show
|
||||
E Left contains 4 more items:
|
||||
E {'1': 1, '2': 2, '3': 3, '4': 4}
|
||||
|
@ -162,12 +164,15 @@ Now we can increase pytest's verbosity:
|
|||
fruits2 = ["banana", "apple", "orange", "melon", "kiwi"]
|
||||
> assert fruits1 == fruits2
|
||||
E AssertionError: assert ['banana', 'a...elon', 'kiwi'] == ['banana', 'a...elon', 'kiwi']
|
||||
E
|
||||
E At index 2 diff: 'grapes' != 'orange'
|
||||
E
|
||||
E Full diff:
|
||||
E - ['banana', 'apple', 'orange', 'melon', 'kiwi']
|
||||
E ? ^ ^^
|
||||
E + ['banana', 'apple', 'grapes', 'melon', 'kiwi']
|
||||
E ? ^ ^ +
|
||||
E [
|
||||
E 'banana',
|
||||
E 'apple',...
|
||||
E
|
||||
E ...Full output truncated (7 lines hidden), use '-vv' to show
|
||||
|
||||
test_verbosity_example.py:8: AssertionError
|
||||
____________________________ test_numbers_fail _____________________________
|
||||
|
@ -177,15 +182,15 @@ Now we can increase pytest's verbosity:
|
|||
number_to_text2 = {str(x * 10): x * 10 for x in range(5)}
|
||||
> assert number_to_text1 == number_to_text2
|
||||
E AssertionError: assert {'0': 0, '1':..., '3': 3, ...} == {'0': 0, '10'...'30': 30, ...}
|
||||
E
|
||||
E Omitting 1 identical items, use -vv to show
|
||||
E Left contains 4 more items:
|
||||
E {'1': 1, '2': 2, '3': 3, '4': 4}
|
||||
E Right contains 4 more items:
|
||||
E {'10': 10, '20': 20, '30': 30, '40': 40}
|
||||
E Full diff:
|
||||
E - {'0': 0, '10': 10, '20': 20, '30': 30, '40': 40}
|
||||
E ? - - - - - - - -
|
||||
E + {'0': 0, '1': 1, '2': 2, '3': 3, '4': 4}
|
||||
E ...
|
||||
E
|
||||
E ...Full output truncated (16 lines hidden), use '-vv' to show
|
||||
|
||||
test_verbosity_example.py:14: AssertionError
|
||||
___________________________ test_long_text_fail ____________________________
|
||||
|
@ -231,12 +236,20 @@ Now if we increase verbosity even more:
|
|||
fruits2 = ["banana", "apple", "orange", "melon", "kiwi"]
|
||||
> assert fruits1 == fruits2
|
||||
E AssertionError: assert ['banana', 'apple', 'grapes', 'melon', 'kiwi'] == ['banana', 'apple', 'orange', 'melon', 'kiwi']
|
||||
E
|
||||
E At index 2 diff: 'grapes' != 'orange'
|
||||
E
|
||||
E Full diff:
|
||||
E - ['banana', 'apple', 'orange', 'melon', 'kiwi']
|
||||
E ? ^ ^^
|
||||
E + ['banana', 'apple', 'grapes', 'melon', 'kiwi']
|
||||
E ? ^ ^ +
|
||||
E [
|
||||
E 'banana',
|
||||
E 'apple',
|
||||
E - 'orange',
|
||||
E ? ^ ^^
|
||||
E + 'grapes',
|
||||
E ? ^ ^ +
|
||||
E 'melon',
|
||||
E 'kiwi',
|
||||
E ]
|
||||
|
||||
test_verbosity_example.py:8: AssertionError
|
||||
____________________________ test_numbers_fail _____________________________
|
||||
|
@ -246,16 +259,30 @@ Now if we increase verbosity even more:
|
|||
number_to_text2 = {str(x * 10): x * 10 for x in range(5)}
|
||||
> assert number_to_text1 == number_to_text2
|
||||
E AssertionError: assert {'0': 0, '1': 1, '2': 2, '3': 3, '4': 4} == {'0': 0, '10': 10, '20': 20, '30': 30, '40': 40}
|
||||
E
|
||||
E Common items:
|
||||
E {'0': 0}
|
||||
E Left contains 4 more items:
|
||||
E {'1': 1, '2': 2, '3': 3, '4': 4}
|
||||
E Right contains 4 more items:
|
||||
E {'10': 10, '20': 20, '30': 30, '40': 40}
|
||||
E
|
||||
E Full diff:
|
||||
E - {'0': 0, '10': 10, '20': 20, '30': 30, '40': 40}
|
||||
E ? - - - - - - - -
|
||||
E + {'0': 0, '1': 1, '2': 2, '3': 3, '4': 4}
|
||||
E {
|
||||
E '0': 0,
|
||||
E - '10': 10,
|
||||
E ? - -
|
||||
E + '1': 1,
|
||||
E - '20': 20,
|
||||
E ? - -
|
||||
E + '2': 2,
|
||||
E - '30': 30,
|
||||
E ? - -
|
||||
E + '3': 3,
|
||||
E - '40': 40,
|
||||
E ? - -
|
||||
E + '4': 4,
|
||||
E }
|
||||
|
||||
test_verbosity_example.py:14: AssertionError
|
||||
___________________________ test_long_text_fail ____________________________
|
||||
|
@ -354,7 +381,7 @@ Example:
|
|||
|
||||
$ pytest -ra
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project
|
||||
collected 6 items
|
||||
|
||||
|
@ -410,7 +437,7 @@ More than one character can be used, so for example to only see failed and skipp
|
|||
|
||||
$ pytest -rfs
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project
|
||||
collected 6 items
|
||||
|
||||
|
@ -445,7 +472,7 @@ captured output:
|
|||
|
||||
$ pytest -rpP
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project
|
||||
collected 6 items
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ them in turn:
|
|||
|
||||
$ pytest
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project
|
||||
collected 3 items
|
||||
|
||||
|
@ -167,7 +167,7 @@ Let's run this:
|
|||
|
||||
$ pytest
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project
|
||||
collected 3 items
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ Running this would result in a passed test except for the last
|
|||
|
||||
$ pytest test_tmp_path.py
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project
|
||||
collected 1 item
|
||||
|
||||
|
|
|
@ -140,7 +140,7 @@ the ``self.db`` values in the traceback:
|
|||
|
||||
$ pytest test_unittest_db.py
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project
|
||||
collected 2 items
|
||||
|
||||
|
|
|
@ -448,7 +448,7 @@ in our ``pytest.ini`` to tell pytest where to look for example files.
|
|||
|
||||
$ pytest
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project
|
||||
configfile: pytest.ini
|
||||
collected 2 items
|
||||
|
|
|
@ -42,7 +42,7 @@ To execute it:
|
|||
|
||||
$ pytest
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
|
||||
rootdir: /home/sweet/project
|
||||
collected 1 item
|
||||
|
||||
|
@ -74,7 +74,7 @@ Features
|
|||
|
||||
- :ref:`Modular fixtures <fixture>` for managing small or parametrized long-lived test resources
|
||||
|
||||
- Can run :ref:`unittest <unittest>` (including trial) and :ref:`nose <noseintegration>` test suites out of the box
|
||||
- Can run :ref:`unittest <unittest>` (including trial) test suites out of the box
|
||||
|
||||
- Python 3.8+ or PyPy 3
|
||||
|
||||
|
|
|
@ -27,12 +27,12 @@ please refer to `the update script <https://github.com/pytest-dev/pytest/blob/ma
|
|||
creating a PDF, because otherwise the table gets far too wide for the
|
||||
page.
|
||||
|
||||
This list contains 1355 plugins.
|
||||
This list contains 1359 plugins.
|
||||
|
||||
.. only:: not latex
|
||||
|
||||
=============================================== ======================================================================================================================================================================================================== ============== ===================== ================================================
|
||||
name summary last release status requires
|
||||
name summary last_release status requires
|
||||
=============================================== ======================================================================================================================================================================================================== ============== ===================== ================================================
|
||||
:pypi:`logassert` Simple but powerful assertion and verification of logged lines. May 20, 2022 5 - Production/Stable N/A
|
||||
:pypi:`nuts` Network Unit Testing System Aug 11, 2023 N/A pytest (>=7.3.0,<8.0.0)
|
||||
|
@ -87,11 +87,11 @@ This list contains 1355 plugins.
|
|||
:pypi:`pytest-appium` Pytest plugin for appium Dec 05, 2019 N/A N/A
|
||||
:pypi:`pytest-approvaltests` A plugin to use approvaltests with pytest May 08, 2022 4 - Beta pytest (>=7.0.1)
|
||||
:pypi:`pytest-approvaltests-geo` Extension for ApprovalTests.Python specific to geo data verification Dec 12, 2023 5 - Production/Stable pytest
|
||||
:pypi:`pytest-archon` Rule your architecture like a real developer Jul 11, 2023 5 - Production/Stable pytest (>=7.2)
|
||||
:pypi:`pytest-archon` Rule your architecture like a real developer Dec 18, 2023 5 - Production/Stable pytest >=7.2
|
||||
:pypi:`pytest-argus` pyest results colection plugin Jun 24, 2021 5 - Production/Stable pytest (>=6.2.4)
|
||||
:pypi:`pytest-arraydiff` pytest plugin to help with comparing array output from tests Nov 27, 2023 4 - Beta pytest >=4.6
|
||||
:pypi:`pytest-asgi-server` Convenient ASGI client/server fixtures for Pytest Dec 12, 2020 N/A pytest (>=5.4.1)
|
||||
:pypi:`pytest-aspec` A rspec format reporter for pytest Oct 23, 2023 4 - Beta N/A
|
||||
:pypi:`pytest-aspec` A rspec format reporter for pytest Dec 20, 2023 4 - Beta N/A
|
||||
:pypi:`pytest-asptest` test Answer Set Programming programs Apr 28, 2018 4 - Beta N/A
|
||||
:pypi:`pytest-assertcount` Plugin to count actual number of asserts in pytest Oct 23, 2022 N/A pytest (>=5.0.0)
|
||||
:pypi:`pytest-assertions` Pytest Assertions Apr 27, 2022 N/A N/A
|
||||
|
@ -105,7 +105,7 @@ This list contains 1355 plugins.
|
|||
:pypi:`pytest-astropy-header` pytest plugin to add diagnostic information to the header of the test output Sep 06, 2022 3 - Alpha pytest (>=4.6)
|
||||
:pypi:`pytest-ast-transformer` May 04, 2019 3 - Alpha pytest
|
||||
:pypi:`pytest-async-generators` Pytest fixtures for async generators Jul 05, 2023 N/A N/A
|
||||
:pypi:`pytest-asyncio` Pytest support for asyncio Dec 09, 2023 4 - Beta pytest >=7.0.0
|
||||
:pypi:`pytest-asyncio` Pytest support for asyncio Jan 01, 2024 4 - Beta pytest >=7.0.0
|
||||
:pypi:`pytest-asyncio-cooperative` Run all your asynchronous tests cooperatively. Nov 30, 2023 N/A N/A
|
||||
:pypi:`pytest-asyncio-network-simulator` pytest-asyncio-network-simulator: Plugin for pytest for simulator the network in tests Jul 31, 2018 3 - Alpha pytest (<3.7.0,>=3.3.2)
|
||||
:pypi:`pytest-async-mongodb` pytest plugin for async MongoDB Oct 18, 2017 5 - Production/Stable pytest (>=2.5.2)
|
||||
|
@ -134,7 +134,7 @@ This list contains 1355 plugins.
|
|||
:pypi:`pytest-base-url` pytest plugin for URL based testing Mar 27, 2022 5 - Production/Stable pytest (>=3.0.0,<8.0.0)
|
||||
:pypi:`pytest-bdd` BDD for pytest Dec 02, 2023 6 - Mature pytest (>=6.2.0)
|
||||
:pypi:`pytest-bdd-html` pytest plugin to display BDD info in HTML test report Nov 22, 2022 3 - Alpha pytest (!=6.0.0,>=5.0)
|
||||
:pypi:`pytest-bdd-ng` BDD for pytest Jul 01, 2023 4 - Beta pytest (>=5.0)
|
||||
:pypi:`pytest-bdd-ng` BDD for pytest Dec 31, 2023 4 - Beta pytest >=5.0
|
||||
:pypi:`pytest-bdd-report` A pytest-bdd plugin for generating useful and informative BDD test reports Nov 15, 2023 N/A pytest >=7.1.3
|
||||
:pypi:`pytest-bdd-splinter` Common steps for pytest bdd and splinter integration Aug 12, 2019 5 - Production/Stable pytest (>=4.0.0)
|
||||
:pypi:`pytest-bdd-web` A simple plugin to use with pytest Jan 02, 2020 4 - Beta pytest (>=3.5.0)
|
||||
|
@ -190,7 +190,7 @@ This list contains 1355 plugins.
|
|||
:pypi:`pytest-cassandra` Cassandra CCM Test Fixtures for pytest Nov 04, 2017 1 - Planning N/A
|
||||
:pypi:`pytest-catchlog` py.test plugin to catch log messages. This is a fork of pytest-capturelog. Jan 24, 2016 4 - Beta pytest (>=2.6)
|
||||
:pypi:`pytest-catch-server` Pytest plugin with server for catching HTTP requests. Dec 12, 2019 5 - Production/Stable N/A
|
||||
:pypi:`pytest-celery` pytest-celery a shim pytest plugin to enable celery.contrib.pytest Dec 07, 2023 N/A N/A
|
||||
:pypi:`pytest-celery` pytest-celery a shim pytest plugin to enable celery.contrib.pytest Jan 03, 2024 N/A N/A
|
||||
:pypi:`pytest-chainmaker` pytest plugin for chainmaker Oct 15, 2021 N/A N/A
|
||||
:pypi:`pytest-chalice` A set of py.test fixtures for AWS Chalice Jul 01, 2020 4 - Beta N/A
|
||||
:pypi:`pytest-change-assert` 修改报错中文为英文 Oct 19, 2022 N/A N/A
|
||||
|
@ -198,7 +198,7 @@ This list contains 1355 plugins.
|
|||
:pypi:`pytest-change-report` turn . into √,turn F into x Sep 14, 2020 N/A pytest
|
||||
:pypi:`pytest-change-xds` turn . into √,turn F into x Apr 16, 2022 N/A pytest
|
||||
:pypi:`pytest-chdir` A pytest fixture for changing current working directory Jan 28, 2020 N/A pytest (>=5.0.0,<6.0.0)
|
||||
:pypi:`pytest-check` A pytest plugin that allows multiple failures per test. Sep 22, 2023 N/A pytest
|
||||
:pypi:`pytest-check` A pytest plugin that allows multiple failures per test. Dec 31, 2023 N/A pytest
|
||||
:pypi:`pytest-checkdocs` check the README when running tests Jul 30, 2023 5 - Production/Stable pytest (>=6) ; extra == 'testing'
|
||||
:pypi:`pytest-checkipdb` plugin to check if there are ipdb debugs left Dec 04, 2023 5 - Production/Stable pytest >=2.9.2
|
||||
:pypi:`pytest-check-library` check your missing library Jul 17, 2022 N/A N/A
|
||||
|
@ -207,7 +207,7 @@ This list contains 1355 plugins.
|
|||
:pypi:`pytest-check-mk` pytest plugin to test Check_MK checks Nov 19, 2015 4 - Beta pytest
|
||||
:pypi:`pytest-check-requirements` A package to prevent Dependency Confusion attacks against Yandex. Feb 10, 2023 N/A N/A
|
||||
:pypi:`pytest-chic-report` A pytest plugin to send a report and printing summary of tests. Jan 31, 2023 5 - Production/Stable N/A
|
||||
:pypi:`pytest-choose` Provide the pytest with the ability to collect use cases based on rules in text files Nov 30, 2023 N/A pytest >=7.0.0
|
||||
:pypi:`pytest-choose` Provide the pytest with the ability to collect use cases based on rules in text files Dec 26, 2023 N/A pytest >=7.0.0
|
||||
:pypi:`pytest-chunks` Run only a chunk of your test suite Jul 05, 2022 N/A pytest (>=6.0.0)
|
||||
:pypi:`pytest-circleci` py.test plugin for CircleCI May 03, 2019 N/A N/A
|
||||
:pypi:`pytest-circleci-parallelized` Parallelize pytest across CircleCI workers. Oct 20, 2022 N/A N/A
|
||||
|
@ -306,6 +306,7 @@ This list contains 1355 plugins.
|
|||
:pypi:`pytest-dbt-adapter` A pytest plugin for testing dbt adapter plugins Nov 24, 2021 N/A pytest (<7,>=6)
|
||||
:pypi:`pytest-dbt-conventions` A pytest plugin for linting a dbt project's conventions Mar 02, 2022 N/A pytest (>=6.2.5,<7.0.0)
|
||||
:pypi:`pytest-dbt-core` Pytest extension for dbt. Aug 25, 2023 N/A pytest >=6.2.5 ; extra == 'test'
|
||||
:pypi:`pytest-dbt-postgres` Pytest tooling to unittest DBT & Postgres models Jan 02, 2024 N/A pytest (>=7.4.3,<8.0.0)
|
||||
:pypi:`pytest-dbus-notification` D-BUS notifications for pytest results. Mar 05, 2014 5 - Production/Stable N/A
|
||||
:pypi:`pytest-dbx` Pytest plugin to run unit tests for dbx (Databricks CLI extensions) related code Nov 29, 2022 N/A pytest (>=7.1.3,<8.0.0)
|
||||
:pypi:`pytest-dc` Manages Docker containers during your integration tests Aug 16, 2023 5 - Production/Stable pytest >=3.3
|
||||
|
@ -314,7 +315,7 @@ This list contains 1355 plugins.
|
|||
:pypi:`pytest-deepcov` deepcov Mar 30, 2021 N/A N/A
|
||||
:pypi:`pytest-defer` Aug 24, 2021 N/A N/A
|
||||
:pypi:`pytest-demo-plugin` pytest示例插件 May 15, 2021 N/A N/A
|
||||
:pypi:`pytest-dependency` Manage dependencies of tests Feb 14, 2020 4 - Beta N/A
|
||||
:pypi:`pytest-dependency` Manage dependencies of tests Dec 31, 2023 4 - Beta N/A
|
||||
:pypi:`pytest-depends` Tests that depend on other tests Apr 05, 2020 5 - Production/Stable pytest (>=3)
|
||||
:pypi:`pytest-deprecate` Mark tests as testing a deprecated feature with a warning note. Jul 01, 2019 N/A N/A
|
||||
:pypi:`pytest-describe` Describe-style plugin for pytest Apr 09, 2023 5 - Production/Stable pytest (<8,>=4.6)
|
||||
|
@ -338,6 +339,7 @@ This list contains 1355 plugins.
|
|||
:pypi:`pytest-django-cache-xdist` A djangocachexdist plugin for pytest May 12, 2020 4 - Beta N/A
|
||||
:pypi:`pytest-django-casperjs` Integrate CasperJS with your django tests as a pytest fixture. Mar 15, 2015 2 - Pre-Alpha N/A
|
||||
:pypi:`pytest-django-class` A pytest plugin for running django in class-scoped fixtures Aug 08, 2023 4 - Beta N/A
|
||||
:pypi:`pytest-django-docker-pg` Jan 05, 2024 5 - Production/Stable pytest >=7.0.0
|
||||
:pypi:`pytest-django-dotenv` Pytest plugin used to setup environment variables with django-dotenv Nov 26, 2019 4 - Beta pytest (>=2.6.0)
|
||||
:pypi:`pytest-django-factories` Factories for your Django models that can be used as Pytest fixtures. Nov 12, 2020 4 - Beta N/A
|
||||
:pypi:`pytest-django-filefield` Replaces FileField.storage with something you can patch globally. May 09, 2022 5 - Production/Stable pytest >= 5.2
|
||||
|
@ -369,7 +371,7 @@ This list contains 1355 plugins.
|
|||
:pypi:`pytest-docker-postgresql` A simple plugin to use with pytest Sep 24, 2019 4 - Beta pytest (>=3.5.0)
|
||||
:pypi:`pytest-docker-py` Easy to use, simple to extend, pytest plugin that minimally leverages docker-py. Nov 27, 2018 N/A pytest (==4.0.0)
|
||||
:pypi:`pytest-docker-registry-fixtures` Pytest fixtures for testing with docker registries. Apr 08, 2022 4 - Beta pytest
|
||||
:pypi:`pytest-docker-service` pytest plugin to start docker container Feb 22, 2023 3 - Alpha pytest (>=7.1.3)
|
||||
:pypi:`pytest-docker-service` pytest plugin to start docker container Jan 03, 2024 3 - Alpha pytest (>=7.1.3)
|
||||
:pypi:`pytest-docker-squid-fixtures` Pytest fixtures for testing with squid. Feb 09, 2022 4 - Beta pytest
|
||||
:pypi:`pytest-docker-tools` Docker integration tests for pytest Feb 17, 2022 4 - Beta pytest (>=6.0.1)
|
||||
:pypi:`pytest-docs` Documentation tool for pytest Nov 11, 2018 4 - Beta pytest (>=3.5.0)
|
||||
|
@ -410,18 +412,18 @@ This list contains 1355 plugins.
|
|||
:pypi:`pytest-eliot` An eliot plugin for pytest. Aug 31, 2022 1 - Planning pytest (>=5.4.0)
|
||||
:pypi:`pytest-elk-reporter` A simple plugin to use with pytest Jan 24, 2021 4 - Beta pytest (>=3.5.0)
|
||||
:pypi:`pytest-email` Send execution result email Jul 08, 2020 N/A pytest
|
||||
:pypi:`pytest-embedded` A pytest plugin that designed for embedded testing. Dec 04, 2023 5 - Production/Stable pytest>=7.0
|
||||
:pypi:`pytest-embedded-arduino` Make pytest-embedded plugin work with Arduino. Dec 04, 2023 5 - Production/Stable N/A
|
||||
:pypi:`pytest-embedded-idf` Make pytest-embedded plugin work with ESP-IDF. Dec 04, 2023 5 - Production/Stable N/A
|
||||
:pypi:`pytest-embedded-jtag` Make pytest-embedded plugin work with JTAG. Dec 04, 2023 5 - Production/Stable N/A
|
||||
:pypi:`pytest-embedded-qemu` Make pytest-embedded plugin work with QEMU. Dec 04, 2023 5 - Production/Stable N/A
|
||||
:pypi:`pytest-embedded-serial` Make pytest-embedded plugin work with Serial. Dec 04, 2023 5 - Production/Stable N/A
|
||||
:pypi:`pytest-embedded-serial-esp` Make pytest-embedded plugin work with Espressif target boards. Dec 04, 2023 5 - Production/Stable N/A
|
||||
:pypi:`pytest-embedded-wokwi` Make pytest-embedded plugin work with the Wokwi CLI. Dec 04, 2023 5 - Production/Stable N/A
|
||||
:pypi:`pytest-embedded` A pytest plugin that designed for embedded testing. Jan 04, 2024 5 - Production/Stable pytest>=7.0
|
||||
:pypi:`pytest-embedded-arduino` Make pytest-embedded plugin work with Arduino. Jan 04, 2024 5 - Production/Stable N/A
|
||||
:pypi:`pytest-embedded-idf` Make pytest-embedded plugin work with ESP-IDF. Jan 04, 2024 5 - Production/Stable N/A
|
||||
:pypi:`pytest-embedded-jtag` Make pytest-embedded plugin work with JTAG. Jan 04, 2024 5 - Production/Stable N/A
|
||||
:pypi:`pytest-embedded-qemu` Make pytest-embedded plugin work with QEMU. Jan 04, 2024 5 - Production/Stable N/A
|
||||
:pypi:`pytest-embedded-serial` Make pytest-embedded plugin work with Serial. Jan 04, 2024 5 - Production/Stable N/A
|
||||
:pypi:`pytest-embedded-serial-esp` Make pytest-embedded plugin work with Espressif target boards. Jan 04, 2024 5 - Production/Stable N/A
|
||||
:pypi:`pytest-embedded-wokwi` Make pytest-embedded plugin work with the Wokwi CLI. Jan 04, 2024 5 - Production/Stable N/A
|
||||
:pypi:`pytest-embrace` 💝 Dataclasses-as-tests. Describe the runtime once and multiply coverage with no boilerplate. Mar 25, 2023 N/A pytest (>=7.0,<8.0)
|
||||
:pypi:`pytest-emoji` A pytest plugin that adds emojis to your test result report Feb 19, 2019 4 - Beta pytest (>=4.2.1)
|
||||
:pypi:`pytest-emoji-output` Pytest plugin to represent test output with emoji support Apr 09, 2023 4 - Beta pytest (==7.0.1)
|
||||
:pypi:`pytest-enabler` Enable installed pytest plugins Jul 14, 2023 5 - Production/Stable pytest (>=6) ; extra == 'testing'
|
||||
:pypi:`pytest-enabler` Enable installed pytest plugins Dec 23, 2023 5 - Production/Stable pytest >=6 ; extra == 'testing'
|
||||
:pypi:`pytest-encode` set your encoding and logger Nov 06, 2021 N/A N/A
|
||||
:pypi:`pytest-encode-kane` set your encoding and logger Nov 16, 2021 N/A pytest
|
||||
:pypi:`pytest-encoding` set your encoding and logger Aug 11, 2023 N/A pytest
|
||||
|
@ -531,12 +533,12 @@ This list contains 1355 plugins.
|
|||
:pypi:`pytest-gather-fixtures` set up asynchronous pytest fixtures concurrently Apr 12, 2022 N/A pytest (>=6.0.0)
|
||||
:pypi:`pytest-gc` The garbage collector plugin for py.test Feb 01, 2018 N/A N/A
|
||||
:pypi:`pytest-gcov` Uses gcov to measure test coverage of a C library Feb 01, 2018 3 - Alpha N/A
|
||||
:pypi:`pytest-gee` The Python plugin for your GEE based packages. Dec 04, 2023 3 - Alpha pytest
|
||||
:pypi:`pytest-gee` The Python plugin for your GEE based packages. Dec 18, 2023 3 - Alpha pytest
|
||||
:pypi:`pytest-gevent` Ensure that gevent is properly patched when invoking pytest Feb 25, 2020 N/A pytest
|
||||
:pypi:`pytest-gherkin` A flexible framework for executing BDD gherkin tests Jul 27, 2019 3 - Alpha pytest (>=5.0.0)
|
||||
:pypi:`pytest-gh-log-group` pytest plugin for gh actions Jan 11, 2022 3 - Alpha pytest
|
||||
:pypi:`pytest-ghostinspector` For finding/executing Ghost Inspector tests May 17, 2016 3 - Alpha N/A
|
||||
:pypi:`pytest-girder` A set of pytest fixtures for testing Girder applications. Dec 14, 2023 N/A N/A
|
||||
:pypi:`pytest-girder` A set of pytest fixtures for testing Girder applications. Dec 20, 2023 N/A N/A
|
||||
:pypi:`pytest-git` Git repository fixture for py.test May 28, 2019 5 - Production/Stable pytest
|
||||
:pypi:`pytest-gitconfig` Provide a gitconfig sandbox for testing Oct 15, 2023 4 - Beta pytest>=7.1.2
|
||||
:pypi:`pytest-gitcov` Pytest plugin for reporting on coverage of the last git commit. Jan 11, 2020 2 - Pre-Alpha N/A
|
||||
|
@ -546,7 +548,7 @@ This list contains 1355 plugins.
|
|||
:pypi:`pytest-github-report` Generate a GitHub report using pytest in GitHub Workflows Jun 03, 2022 4 - Beta N/A
|
||||
:pypi:`pytest-gitignore` py.test plugin to ignore the same files as git Jul 17, 2015 4 - Beta N/A
|
||||
:pypi:`pytest-gitlabci-parallelized` Parallelize pytest across GitLab CI workers. Mar 08, 2023 N/A N/A
|
||||
:pypi:`pytest-gitlab-fold` Folds output sections in GitLab CI build log Sep 15, 2023 4 - Beta pytest >=2.6.0
|
||||
:pypi:`pytest-gitlab-fold` Folds output sections in GitLab CI build log Dec 31, 2023 4 - Beta pytest >=2.6.0
|
||||
:pypi:`pytest-git-selector` Utility to select tests that have had its dependencies modified (as identified by git diff) Nov 17, 2022 N/A N/A
|
||||
:pypi:`pytest-glamor-allure` Extends allure-pytest functionality Jul 22, 2022 4 - Beta pytest
|
||||
:pypi:`pytest-gnupg-fixtures` Pytest fixtures for testing with gnupg. Mar 04, 2021 4 - Beta pytest
|
||||
|
@ -577,9 +579,9 @@ This list contains 1355 plugins.
|
|||
:pypi:`pytest-homeassistant-custom-component` Experimental package to automatically extract test plugins for Home Assistant custom components Dec 15, 2023 3 - Alpha pytest ==7.4.3
|
||||
:pypi:`pytest-honey` A simple plugin to use with pytest Jan 07, 2022 4 - Beta pytest (>=3.5.0)
|
||||
:pypi:`pytest-honors` Report on tests that honor constraints, and guard against regressions Mar 06, 2020 4 - Beta N/A
|
||||
:pypi:`pytest-hot-reloading` Dec 13, 2023 N/A N/A
|
||||
:pypi:`pytest-hot-reloading` Jan 06, 2024 N/A N/A
|
||||
:pypi:`pytest-hot-test` A plugin that tracks test changes Dec 10, 2022 4 - Beta pytest (>=3.5.0)
|
||||
:pypi:`pytest-houdini` pytest plugin for testing code in Houdini. Nov 10, 2023 N/A pytest
|
||||
:pypi:`pytest-houdini` pytest plugin for testing code in Houdini. Dec 25, 2023 N/A pytest
|
||||
:pypi:`pytest-hoverfly` Simplify working with Hoverfly from pytest Jan 30, 2023 N/A pytest (>=5.0)
|
||||
:pypi:`pytest-hoverfly-wrapper` Integrates the Hoverfly HTTP proxy into Pytest Feb 27, 2023 5 - Production/Stable pytest (>=3.7.0)
|
||||
:pypi:`pytest-hpfeeds` Helpers for testing hpfeeds in your python project Feb 28, 2023 4 - Beta pytest (>=6.2.4,<7.0.0)
|
||||
|
@ -587,7 +589,7 @@ This list contains 1355 plugins.
|
|||
:pypi:`pytest-html-cn` pytest plugin for generating HTML reports Aug 01, 2023 5 - Production/Stable N/A
|
||||
:pypi:`pytest-html-lee` optimized pytest plugin for generating HTML reports Jun 30, 2020 5 - Production/Stable pytest (>=5.0)
|
||||
:pypi:`pytest-html-merger` Pytest HTML reports merging utility Nov 11, 2023 N/A N/A
|
||||
:pypi:`pytest-html-object-storage` Pytest report plugin for send HTML report on object-storage Mar 04, 2022 5 - Production/Stable N/A
|
||||
:pypi:`pytest-html-object-storage` Pytest report plugin for send HTML report on object-storage Jan 05, 2024 5 - Production/Stable N/A
|
||||
:pypi:`pytest-html-profiling` Pytest plugin for generating HTML reports with per-test profiling and optionally call graph visualizations. Based on pytest-html by Dave Hunt. Feb 11, 2020 5 - Production/Stable pytest (>=3.0)
|
||||
:pypi:`pytest-html-reporter` Generates a static html report based on pytest framework Feb 13, 2022 N/A N/A
|
||||
:pypi:`pytest-html-report-merger` Oct 23, 2023 N/A N/A
|
||||
|
@ -599,12 +601,13 @@ This list contains 1355 plugins.
|
|||
:pypi:`pytest-httpretty` A thin wrapper of HTTPretty for pytest Feb 16, 2014 3 - Alpha N/A
|
||||
:pypi:`pytest-httpserver` pytest-httpserver is a httpserver for pytest May 22, 2023 3 - Alpha N/A
|
||||
:pypi:`pytest-httptesting` http_testing framework on top of pytest Jul 24, 2023 N/A pytest (>=7.2.0,<8.0.0)
|
||||
:pypi:`pytest-httpx` Send responses to httpx. Nov 13, 2023 5 - Production/Stable pytest ==7.*
|
||||
:pypi:`pytest-httpx` Send responses to httpx. Dec 21, 2023 5 - Production/Stable pytest ==7.*
|
||||
:pypi:`pytest-httpx-blockage` Disable httpx requests during a test run Feb 16, 2023 N/A pytest (>=7.2.1)
|
||||
:pypi:`pytest-httpx-recorder` Recorder feature based on pytest_httpx, like recorder feature in responses. Jan 04, 2024 5 - Production/Stable pytest
|
||||
:pypi:`pytest-hue` Visualise PyTest status via your Phillips Hue lights May 09, 2019 N/A N/A
|
||||
:pypi:`pytest-hylang` Pytest plugin to allow running tests written in hylang Mar 28, 2021 N/A pytest
|
||||
:pypi:`pytest-hypo-25` help hypo module for pytest Jan 12, 2020 3 - Alpha N/A
|
||||
:pypi:`pytest-iam` A fully functional OAUTH2 / OpenID Connect (OIDC) server to be used in your testsuite Dec 15, 2023 3 - Alpha pytest (>=7.0.0,<8.0.0)
|
||||
:pypi:`pytest-iam` A fully functional OAUTH2 / OpenID Connect (OIDC) server to be used in your testsuite Dec 22, 2023 3 - Alpha pytest (>=7.0.0,<8.0.0)
|
||||
:pypi:`pytest-ibutsu` A plugin to sent pytest results to an Ibutsu server Aug 05, 2022 4 - Beta pytest>=7.1
|
||||
:pypi:`pytest-icdiff` use icdiff for better error messages in pytest assertions Dec 05, 2023 4 - Beta pytest
|
||||
:pypi:`pytest-idapro` A pytest plugin for idapython. Allows a pytest setup to run tests outside and inside IDA in an automated manner by runnig pytest inside IDA and by mocking idapython api Nov 03, 2018 N/A N/A
|
||||
|
@ -623,7 +626,7 @@ This list contains 1355 plugins.
|
|||
:pypi:`pytest-ini` Reuse pytest.ini to store env variables Apr 26, 2022 N/A N/A
|
||||
:pypi:`pytest-inline` A pytest plugin for writing inline tests. Oct 19, 2023 4 - Beta pytest >=7.0.0
|
||||
:pypi:`pytest-inmanta` A py.test plugin providing fixtures to simplify inmanta modules testing. Dec 13, 2023 5 - Production/Stable pytest
|
||||
:pypi:`pytest-inmanta-extensions` Inmanta tests package Dec 11, 2023 5 - Production/Stable N/A
|
||||
:pypi:`pytest-inmanta-extensions` Inmanta tests package Jan 04, 2024 5 - Production/Stable N/A
|
||||
:pypi:`pytest-inmanta-lsm` Common fixtures for inmanta LSM related modules Nov 29, 2023 5 - Production/Stable N/A
|
||||
:pypi:`pytest-inmanta-yang` Common fixtures used in inmanta yang related modules Jun 16, 2022 4 - Beta N/A
|
||||
:pypi:`pytest-Inomaly` A simple image diff plugin for pytest Feb 13, 2018 4 - Beta N/A
|
||||
|
@ -634,14 +637,13 @@ This list contains 1355 plugins.
|
|||
:pypi:`pytest-integration-mark` Automatic integration test marking and excluding plugin for pytest May 22, 2023 N/A pytest (>=5.2)
|
||||
:pypi:`pytest-interactive` A pytest plugin for console based interactive test selection just after the collection phase Nov 30, 2017 3 - Alpha N/A
|
||||
:pypi:`pytest-intercept-remote` Pytest plugin for intercepting outgoing connection requests during pytest run. May 24, 2021 4 - Beta pytest (>=4.6)
|
||||
:pypi:`pytest-interface-tester` Pytest plugin for checking charm relation interface protocol compliance. Dec 05, 2023 4 - Beta pytest
|
||||
:pypi:`pytest-interface-tester` Pytest plugin for checking charm relation interface protocol compliance. Jan 03, 2024 4 - Beta pytest
|
||||
:pypi:`pytest-invenio` Pytest fixtures for Invenio. Oct 31, 2023 5 - Production/Stable pytest <7.2.0,>=6
|
||||
:pypi:`pytest-involve` Run tests covering a specific file or changeset Feb 02, 2020 4 - Beta pytest (>=3.5.0)
|
||||
:pypi:`pytest-ipdb` A py.test plug-in to enable drop to ipdb debugger on test failure. Mar 20, 2013 2 - Pre-Alpha N/A
|
||||
:pypi:`pytest-ipynb` THIS PROJECT IS ABANDONED Jan 29, 2019 3 - Alpha N/A
|
||||
:pypi:`pytest-isolate` Feb 20, 2023 4 - Beta pytest
|
||||
:pypi:`pytest-isort` py.test plugin to check import ordering using isort Oct 31, 2022 5 - Production/Stable pytest (>=5.0)
|
||||
:pypi:`pytest-is-running` pytest plugin providing a function to check if pytest is running. Jul 10, 2023 5 - Production/Stable N/A
|
||||
:pypi:`pytest-it` Pytest plugin to display test reports as a plaintext spec, inspired by Rspec: https://github.com/mattduck/pytest-it. Jan 22, 2020 4 - Beta N/A
|
||||
:pypi:`pytest-iterassert` Nicer list and iterable assertion messages for pytest May 11, 2020 3 - Alpha N/A
|
||||
:pypi:`pytest-iters` A contextmanager pytest fixture for handling multiple mock iters May 24, 2022 N/A N/A
|
||||
|
@ -690,7 +692,7 @@ This list contains 1355 plugins.
|
|||
:pypi:`pytest-leaks` A pytest plugin to trace resource leaks. Nov 27, 2019 1 - Planning N/A
|
||||
:pypi:`pytest-level` Select tests of a given level or lower Oct 21, 2019 N/A pytest
|
||||
:pypi:`pytest-libfaketime` A python-libfaketime plugin for pytest. Dec 22, 2018 4 - Beta pytest (>=3.0.0)
|
||||
:pypi:`pytest-libiio` A pytest plugin to manage interfacing with libiio contexts Dec 06, 2023 4 - Beta N/A
|
||||
:pypi:`pytest-libiio` A pytest plugin to manage interfacing with libiio contexts Dec 22, 2023 4 - Beta N/A
|
||||
:pypi:`pytest-libnotify` Pytest plugin that shows notifications about the test run Apr 02, 2021 3 - Alpha pytest
|
||||
:pypi:`pytest-ligo` Jan 16, 2020 4 - Beta N/A
|
||||
:pypi:`pytest-lineno` A pytest plugin to show the line numbers of test functions Dec 04, 2020 N/A pytest
|
||||
|
@ -753,7 +755,7 @@ This list contains 1355 plugins.
|
|||
:pypi:`pytest-mimesis` Mimesis integration with the pytest test runner Mar 21, 2020 5 - Production/Stable pytest (>=4.2)
|
||||
:pypi:`pytest-minecraft` A pytest plugin for running tests against Minecraft releases Apr 06, 2022 N/A pytest (>=6.0.1)
|
||||
:pypi:`pytest-mini` A plugin to test mp Feb 06, 2023 N/A pytest (>=7.2.0,<8.0.0)
|
||||
:pypi:`pytest-minio-mock` A pytest plugin for mocking Minio S3 interactions Dec 06, 2023 N/A pytest >=5.0.0
|
||||
:pypi:`pytest-minio-mock` A pytest plugin for mocking Minio S3 interactions Jan 04, 2024 N/A pytest >=5.0.0
|
||||
:pypi:`pytest-missing-fixtures` Pytest plugin that creates missing fixtures Oct 14, 2020 4 - Beta pytest (>=3.5.0)
|
||||
:pypi:`pytest-ml` Test your machine learning! May 04, 2019 4 - Beta N/A
|
||||
:pypi:`pytest-mocha` pytest plugin to display test execution output like a mochajs Apr 02, 2020 4 - Beta pytest (>=5.4.0)
|
||||
|
@ -911,6 +913,7 @@ This list contains 1355 plugins.
|
|||
:pypi:`pytest-ponyorm` PonyORM in Pytest Oct 31, 2018 N/A pytest (>=3.1.1)
|
||||
:pypi:`pytest-poo` Visualize your crappy tests Mar 25, 2021 5 - Production/Stable pytest (>=2.3.4)
|
||||
:pypi:`pytest-poo-fail` Visualize your failed tests with poo Feb 12, 2015 5 - Production/Stable N/A
|
||||
:pypi:`pytest-pook` Pytest plugin for pook Dec 23, 2023 4 - Beta pytest
|
||||
:pypi:`pytest-pop` A pytest plugin to help with testing pop projects May 09, 2023 5 - Production/Stable pytest
|
||||
:pypi:`pytest-porringer` Oct 03, 2023 N/A pytest>=7.4.0
|
||||
:pypi:`pytest-portion` Select a portion of the collected tests Jan 28, 2021 4 - Beta pytest (>=3.5.0)
|
||||
|
@ -929,7 +932,7 @@ This list contains 1355 plugins.
|
|||
:pypi:`pytest-prometheus` Report test pass / failures to a Prometheus PushGateway Oct 03, 2017 N/A N/A
|
||||
:pypi:`pytest-prometheus-pushgateway` Pytest report plugin for Zulip Sep 27, 2022 5 - Production/Stable pytest
|
||||
:pypi:`pytest-prosper` Test helpers for Prosper projects Sep 24, 2018 N/A N/A
|
||||
:pypi:`pytest-prysk` Pytest plugin for prysk Jul 18, 2023 4 - Beta pytest (>=7.3.2,<8.0.0)
|
||||
:pypi:`pytest-prysk` Pytest plugin for prysk Dec 30, 2023 4 - Beta pytest (>=7.3.2,<8.0.0)
|
||||
:pypi:`pytest-pspec` A rspec format reporter for Python ptest Jun 02, 2020 4 - Beta pytest (>=3.0.0)
|
||||
:pypi:`pytest-psqlgraph` pytest plugin for testing applications that use psqlgraph Oct 19, 2021 4 - Beta pytest (>=6.0)
|
||||
:pypi:`pytest-ptera` Use ptera probes in tests Mar 01, 2022 N/A pytest (>=6.2.4,<7.0.0)
|
||||
|
@ -953,8 +956,8 @@ This list contains 1355 plugins.
|
|||
:pypi:`pytest-pyramid-server` Pyramid server fixture for py.test May 28, 2019 5 - Production/Stable pytest
|
||||
:pypi:`pytest-pyreport` PyReport is a lightweight reporting plugin for Pytest that provides concise HTML report Nov 03, 2023 N/A pytest
|
||||
:pypi:`pytest-pyright` Pytest plugin for type checking code with Pyright Aug 20, 2023 4 - Beta pytest >=7.0.0
|
||||
:pypi:`pytest-pyspec` A plugin that transforms the pytest output into a result similar to the RSpec. It enables the use of docstrings to display results and also enables the use of the prefixes "describe", "with" and "it". Mar 12, 2023 5 - Production/Stable pytest (>=7.2.1,<8.0.0)
|
||||
:pypi:`pytest-pystack` Plugin to run pystack after a timeout for a test suite. May 07, 2023 N/A pytest (>=3.5.0)
|
||||
:pypi:`pytest-pyspec` A plugin that transforms the pytest output into a result similar to the RSpec. It enables the use of docstrings to display results and also enables the use of the prefixes "describe", "with" and "it". Jan 02, 2024 N/A pytest (>=7.2.1,<8.0.0)
|
||||
:pypi:`pytest-pystack` Plugin to run pystack after a timeout for a test suite. Jan 04, 2024 N/A pytest >=3.5.0
|
||||
:pypi:`pytest-pytestrail` Pytest plugin for interaction with TestRail Aug 27, 2020 4 - Beta pytest (>=3.8.0)
|
||||
:pypi:`pytest-pythonpath` pytest plugin for adding to the PYTHONPATH from command line or configs. Feb 10, 2022 5 - Production/Stable pytest (<7,>=2.5.2)
|
||||
:pypi:`pytest-pytorch` pytest plugin for a better developer experience when working with the PyTorch test suite May 25, 2021 4 - Beta pytest
|
||||
|
@ -965,7 +968,7 @@ This list contains 1355 plugins.
|
|||
:pypi:`pytest-qgis` A pytest plugin for testing QGIS python plugins Nov 29, 2023 5 - Production/Stable pytest >=6.0
|
||||
:pypi:`pytest-qml` Run QML Tests with pytest Dec 02, 2020 4 - Beta pytest (>=6.0.0)
|
||||
:pypi:`pytest-qr` pytest plugin to generate test result QR codes Nov 25, 2021 4 - Beta N/A
|
||||
:pypi:`pytest-qt` pytest support for PyQt and PySide applications Oct 25, 2022 5 - Production/Stable pytest (>=3.0.0)
|
||||
:pypi:`pytest-qt` pytest support for PyQt and PySide applications Dec 22, 2023 5 - Production/Stable pytest >=3.0.0
|
||||
:pypi:`pytest-qt-app` QT app fixture for py.test Dec 23, 2015 5 - Production/Stable N/A
|
||||
:pypi:`pytest-quarantine` A plugin for pytest to manage expected test failures Nov 24, 2019 5 - Production/Stable pytest (>=4.6)
|
||||
:pypi:`pytest-quickcheck` pytest plugin to generate random data inspired by QuickCheck Nov 05, 2022 4 - Beta pytest (>=4.0)
|
||||
|
@ -1040,7 +1043,7 @@ This list contains 1355 plugins.
|
|||
:pypi:`pytest-result-sender` Apr 20, 2023 N/A pytest>=7.3.1
|
||||
:pypi:`pytest-resume` A Pytest plugin to resuming from the last run test Apr 22, 2023 4 - Beta pytest (>=7.0)
|
||||
:pypi:`pytest-rethinkdb` A RethinkDB plugin for pytest. Jul 24, 2016 4 - Beta N/A
|
||||
:pypi:`pytest-retry` Adds the ability to retry flaky tests in CI environments Oct 04, 2023 N/A pytest >=7.0.0
|
||||
:pypi:`pytest-retry` Adds the ability to retry flaky tests in CI environments Jan 04, 2024 N/A pytest >=7.0.0
|
||||
:pypi:`pytest-retry-class` A pytest plugin to rerun entire class on failure Mar 25, 2023 N/A pytest (>=5.3)
|
||||
:pypi:`pytest-reusable-testcases` Apr 28, 2023 N/A N/A
|
||||
:pypi:`pytest-reverse` Pytest plugin to reverse test order. Jul 10, 2023 5 - Production/Stable pytest
|
||||
|
@ -1074,7 +1077,7 @@ This list contains 1355 plugins.
|
|||
:pypi:`pytest-sanic` a pytest plugin for Sanic Oct 25, 2021 N/A pytest (>=5.2)
|
||||
:pypi:`pytest-sanity` Dec 07, 2020 N/A N/A
|
||||
:pypi:`pytest-sa-pg` May 14, 2019 N/A N/A
|
||||
:pypi:`pytest-sbase` A complete web automation framework for end-to-end testing. Dec 08, 2023 5 - Production/Stable N/A
|
||||
:pypi:`pytest-sbase` A complete web automation framework for end-to-end testing. Jan 04, 2024 5 - Production/Stable N/A
|
||||
:pypi:`pytest-scenario` pytest plugin for test scenarios Feb 06, 2017 3 - Alpha N/A
|
||||
:pypi:`pytest-schedule` The job of test scheduling for humans. Jan 07, 2023 5 - Production/Stable N/A
|
||||
:pypi:`pytest-schema` 👍 Validate return values against a schema-like object in testing Mar 14, 2022 5 - Production/Stable pytest (>=3.5.0)
|
||||
|
@ -1083,15 +1086,15 @@ This list contains 1355 plugins.
|
|||
:pypi:`pytest-select` A pytest plugin which allows to (de-)select tests from a file. Jan 18, 2019 3 - Alpha pytest (>=3.0)
|
||||
:pypi:`pytest-selenium` pytest plugin for Selenium Nov 20, 2023 5 - Production/Stable pytest>=6.0.0
|
||||
:pypi:`pytest-selenium-auto` pytest plugin to automatically capture screenshots upon selenium webdriver events Nov 07, 2023 N/A pytest >= 7.0.0
|
||||
:pypi:`pytest-seleniumbase` A complete web automation framework for end-to-end testing. Dec 08, 2023 5 - Production/Stable N/A
|
||||
:pypi:`pytest-seleniumbase` A complete web automation framework for end-to-end testing. Jan 04, 2024 5 - Production/Stable N/A
|
||||
:pypi:`pytest-selenium-enhancer` pytest plugin for Selenium Apr 29, 2022 5 - Production/Stable N/A
|
||||
:pypi:`pytest-selenium-pdiff` A pytest package implementing perceptualdiff for Selenium tests. Apr 06, 2017 2 - Pre-Alpha N/A
|
||||
:pypi:`pytest-send-email` Send pytest execution result email Dec 04, 2019 N/A N/A
|
||||
:pypi:`pytest-sentry` A pytest plugin to send testrun information to Sentry.io Jan 05, 2023 N/A N/A
|
||||
:pypi:`pytest-sequence-markers` Pytest plugin for sequencing markers for execution of tests May 23, 2023 5 - Production/Stable N/A
|
||||
:pypi:`pytest-server-fixtures` Extensible server fixures for py.test May 28, 2019 5 - Production/Stable pytest
|
||||
:pypi:`pytest-server-fixtures` Extensible server fixures for py.test Dec 19, 2023 5 - Production/Stable pytest
|
||||
:pypi:`pytest-serverless` Automatically mocks resources from serverless.yml in pytest using moto. May 09, 2022 4 - Beta N/A
|
||||
:pypi:`pytest-servers` pytest servers Dec 15, 2023 3 - Alpha pytest >=6.2
|
||||
:pypi:`pytest-servers` pytest servers Dec 19, 2023 3 - Alpha pytest >=6.2
|
||||
:pypi:`pytest-services` Services plugin for pytest testing framework Oct 30, 2020 6 - Mature N/A
|
||||
:pypi:`pytest-session2file` pytest-session2file (aka: pytest-session_to_file for v0.1.0 - v0.1.2) is a py.test plugin for capturing and saving to file the stdout of py.test. Jan 26, 2021 3 - Alpha pytest
|
||||
:pypi:`pytest-session-fixture-globalize` py.test plugin to make session fixtures behave as if written in conftest, even if it is written in some modules May 15, 2018 4 - Beta N/A
|
||||
|
@ -1111,7 +1114,7 @@ This list contains 1355 plugins.
|
|||
:pypi:`pytest-simple-plugin` Simple pytest plugin Nov 27, 2019 N/A N/A
|
||||
:pypi:`pytest-simple-settings` simple-settings plugin for pytest Nov 17, 2020 4 - Beta pytest
|
||||
:pypi:`pytest-single-file-logging` Allow for multiple processes to log to a single file May 05, 2016 4 - Beta pytest (>=2.8.1)
|
||||
:pypi:`pytest-skip-markers` Pytest Salt Plugin Oct 20, 2023 5 - Production/Stable pytest >=7.1.0
|
||||
:pypi:`pytest-skip-markers` Pytest Salt Plugin Jan 04, 2024 5 - Production/Stable pytest >=7.1.0
|
||||
:pypi:`pytest-skipper` A plugin that selects only tests with changes in execution path Mar 26, 2017 3 - Alpha pytest (>=3.0.6)
|
||||
:pypi:`pytest-skippy` Automatically skip tests that don't need to run! Jan 27, 2018 3 - Alpha pytest (>=2.3.4)
|
||||
:pypi:`pytest-skip-slow` A pytest plugin to skip \`@pytest.mark.slow\` tests by default. Feb 09, 2023 N/A pytest>=6.2.0
|
||||
|
@ -1138,7 +1141,7 @@ This list contains 1355 plugins.
|
|||
:pypi:`pytest-soft-assertions` May 05, 2020 3 - Alpha pytest
|
||||
:pypi:`pytest-solidity` A PyTest library plugin for Solidity language. Jan 15, 2022 1 - Planning pytest (<7,>=6.0.1) ; extra == 'tests'
|
||||
:pypi:`pytest-solr` Solr process and client fixtures for py.test. May 11, 2020 3 - Alpha pytest (>=3.0.0)
|
||||
:pypi:`pytest-sort` Tools for sorting test cases Oct 06, 2023 N/A pytest >=7.4.0
|
||||
:pypi:`pytest-sort` Tools for sorting test cases Dec 22, 2023 N/A pytest >=7.4.0
|
||||
:pypi:`pytest-sorter` A simple plugin to first execute tests that historically failed more Apr 20, 2021 4 - Beta pytest (>=3.1.1)
|
||||
:pypi:`pytest-sosu` Unofficial PyTest plugin for Sauce Labs Aug 04, 2023 2 - Pre-Alpha pytest
|
||||
:pypi:`pytest-sourceorder` Test-ordering plugin for pytest Sep 01, 2021 4 - Beta pytest
|
||||
|
@ -1148,7 +1151,7 @@ This list contains 1355 plugins.
|
|||
:pypi:`pytest-spec2md` Library pytest-spec2md is a pytest plugin to create a markdown specification while running pytest. Nov 21, 2023 N/A pytest (>7.0)
|
||||
:pypi:`pytest-speed` Modern benchmarking library for python with pytest integration. Jan 22, 2023 3 - Alpha pytest>=7
|
||||
:pypi:`pytest-sphinx` Doctest plugin for pytest with support for Sphinx-specific doctest-directives Sep 06, 2022 4 - Beta pytest (>=7.0.0)
|
||||
:pypi:`pytest-spiratest` Exports unit tests as test runs in SpiraTest/Team/Plan Feb 08, 2022 N/A N/A
|
||||
:pypi:`pytest-spiratest` Exports unit tests as test runs in Spira (SpiraTest/Team/Plan) Jan 01, 2024 N/A N/A
|
||||
:pypi:`pytest-splinter` Splinter plugin for pytest testing framework Sep 09, 2022 6 - Mature pytest (>=3.0.0)
|
||||
:pypi:`pytest-splinter4` Pytest plugin for the splinter automation library Jun 11, 2022 6 - Mature pytest (<8.0,>=7.1.2)
|
||||
:pypi:`pytest-split` Pytest plugin which splits the test suite to equally sized sub suites based on test execution time. Apr 12, 2023 4 - Beta pytest (>=5,<8)
|
||||
|
@ -1156,7 +1159,7 @@ This list contains 1355 plugins.
|
|||
:pypi:`pytest-splitio` Split.io SDK integration for e2e tests Sep 22, 2020 N/A pytest (<7,>=5.0)
|
||||
:pypi:`pytest-split-tests` A Pytest plugin for running a subset of your tests by splitting them in to equally sized groups. Forked from Mark Adams' original project pytest-test-groups. Jul 30, 2021 5 - Production/Stable pytest (>=2.5)
|
||||
:pypi:`pytest-split-tests-tresorit` Feb 22, 2021 1 - Planning N/A
|
||||
:pypi:`pytest-splunk-addon` A Dynamic test tool for Splunk Apps and Add-ons Dec 14, 2023 N/A pytest (>5.4.0,<8)
|
||||
:pypi:`pytest-splunk-addon` A Dynamic test tool for Splunk Apps and Add-ons Dec 21, 2023 N/A pytest (>5.4.0,<8)
|
||||
:pypi:`pytest-splunk-addon-ui-smartx` Library to support testing Splunk Add-on UX Dec 01, 2023 N/A N/A
|
||||
:pypi:`pytest-splunk-env` pytest fixtures for interaction with Splunk Enterprise and Splunk Cloud Oct 22, 2020 N/A pytest (>=6.1.1,<7.0.0)
|
||||
:pypi:`pytest-sqitch` sqitch for pytest Apr 06, 2020 4 - Beta N/A
|
||||
|
@ -1255,13 +1258,14 @@ This list contains 1355 plugins.
|
|||
:pypi:`pytest-threadleak` Detects thread leaks Jul 03, 2022 4 - Beta pytest (>=3.1.1)
|
||||
:pypi:`pytest-tick` Ticking on tests Aug 31, 2021 5 - Production/Stable pytest (>=6.2.5,<7.0.0)
|
||||
:pypi:`pytest-time` Jun 24, 2023 3 - Alpha pytest
|
||||
:pypi:`pytest-timeassert-ethan` execution duration Dec 12, 2023 N/A pytest
|
||||
:pypi:`pytest-timeassert-ethan` execution duration Dec 25, 2023 N/A pytest
|
||||
:pypi:`pytest-timeit` A pytest plugin to time test function runs Oct 13, 2016 4 - Beta N/A
|
||||
:pypi:`pytest-timeout` pytest plugin to abort hanging tests Oct 08, 2023 5 - Production/Stable pytest >=5.0.0
|
||||
:pypi:`pytest-timeouts` Linux-only Pytest plugin to control durations of various test case execution phases Sep 21, 2019 5 - Production/Stable N/A
|
||||
:pypi:`pytest-timer` A timer plugin for pytest Jun 02, 2021 N/A N/A
|
||||
:pypi:`pytest-timer` A timer plugin for pytest Dec 26, 2023 N/A pytest
|
||||
:pypi:`pytest-timestamper` Pytest plugin to add a timestamp prefix to the pytest output Jun 06, 2021 N/A N/A
|
||||
:pypi:`pytest-timestamps` A simple plugin to view timestamps for each test Sep 11, 2023 N/A pytest (>=7.3,<8.0)
|
||||
:pypi:`pytest-tiny-api-client` The companion pytest plugin for tiny-api-client Jan 04, 2024 5 - Production/Stable pytest
|
||||
:pypi:`pytest-tinybird` A pytest plugin to report test results to tinybird Jun 26, 2023 4 - Beta pytest (>=3.8.0)
|
||||
:pypi:`pytest-tipsi-django` Nov 17, 2021 4 - Beta pytest (>=6.0.0)
|
||||
:pypi:`pytest-tipsi-testing` Better fixtures management. Various helpers Nov 04, 2020 4 - Beta pytest (>=3.3.0)
|
||||
|
@ -1325,7 +1329,7 @@ This list contains 1355 plugins.
|
|||
:pypi:`pytest-vcrpandas` Test from HTTP interactions to dataframe processed. Jan 12, 2019 4 - Beta pytest
|
||||
:pypi:`pytest-vcs` Sep 22, 2022 4 - Beta N/A
|
||||
:pypi:`pytest-venv` py.test fixture for creating a virtual environment Nov 23, 2023 4 - Beta pytest
|
||||
:pypi:`pytest-ver` Pytest module with Verification Protocol, Verification Report and Trace Matrix Dec 12, 2023 4 - Beta pytest
|
||||
:pypi:`pytest-ver` Pytest module with Verification Protocol, Verification Report and Trace Matrix Dec 19, 2023 4 - Beta pytest
|
||||
:pypi:`pytest-verbose-parametrize` More descriptive output for parametrized py.test tests May 28, 2019 5 - Production/Stable pytest
|
||||
:pypi:`pytest-vimqf` A simple pytest plugin that will shrink pytest output when specified, to fit vim quickfix window. Feb 08, 2021 4 - Beta pytest (>=6.2.2,<7.0.0)
|
||||
:pypi:`pytest-virtualenv` Virtualenv fixture for py.test May 28, 2019 5 - Production/Stable pytest
|
||||
|
@ -1364,7 +1368,7 @@ This list contains 1355 plugins.
|
|||
:pypi:`pytest-xfiles` Pytest fixtures providing data read from function, module or package related (x)files. Feb 27, 2018 N/A N/A
|
||||
:pypi:`pytest-xiuyu` This is a pytest plugin Jul 25, 2023 5 - Production/Stable N/A
|
||||
:pypi:`pytest-xlog` Extended logging for test and decorators May 31, 2020 4 - Beta N/A
|
||||
:pypi:`pytest-xlsx` pytest plugin for generating test cases by xlsx(excel) Jul 03, 2023 N/A pytest<8,>=7.4.0
|
||||
:pypi:`pytest-xlsx` pytest plugin for generating test cases by xlsx(excel) Dec 28, 2023 N/A pytest<8,>=7.4.0
|
||||
:pypi:`pytest-xpara` An extended parametrizing plugin of pytest. Oct 30, 2017 3 - Alpha pytest
|
||||
:pypi:`pytest-xprocess` A pytest plugin for managing processes across test runs. Sep 23, 2023 4 - Beta pytest (>=2.8)
|
||||
:pypi:`pytest-xray` May 30, 2019 3 - Alpha N/A
|
||||
|
@ -1374,7 +1378,7 @@ This list contains 1355 plugins.
|
|||
:pypi:`pytest-xvfb` A pytest plugin to run Xvfb (or Xephyr/Xvnc) for tests. May 29, 2023 4 - Beta pytest (>=2.8.1)
|
||||
:pypi:`pytest-xvirt` A pytest plugin to virtualize test. For example to transparently running them on a remote box. Oct 01, 2023 4 - Beta pytest >=7.1.0
|
||||
:pypi:`pytest-yaml` This plugin is used to load yaml output to your test using pytest framework. Oct 05, 2018 N/A pytest
|
||||
:pypi:`pytest-yaml-sanmu` pytest plugin for generating test cases by yaml Nov 30, 2023 N/A pytest>=7.4.0
|
||||
:pypi:`pytest-yaml-sanmu` pytest plugin for generating test cases by yaml Dec 18, 2023 N/A pytest>=7.4.0
|
||||
:pypi:`pytest-yamltree` Create or check file/directory trees described by YAML Mar 02, 2020 4 - Beta pytest (>=3.1.1)
|
||||
:pypi:`pytest-yamlwsgi` Run tests against wsgi apps defined in yaml May 11, 2010 N/A N/A
|
||||
:pypi:`pytest-yaml-yoyo` http/https API run by yaml Jun 19, 2023 N/A pytest (>=7.2.0)
|
||||
|
@ -1766,9 +1770,9 @@ This list contains 1355 plugins.
|
|||
Extension for ApprovalTests.Python specific to geo data verification
|
||||
|
||||
:pypi:`pytest-archon`
|
||||
*last release*: Jul 11, 2023,
|
||||
*last release*: Dec 18, 2023,
|
||||
*status*: 5 - Production/Stable,
|
||||
*requires*: pytest (>=7.2)
|
||||
*requires*: pytest >=7.2
|
||||
|
||||
Rule your architecture like a real developer
|
||||
|
||||
|
@ -1794,7 +1798,7 @@ This list contains 1355 plugins.
|
|||
Convenient ASGI client/server fixtures for Pytest
|
||||
|
||||
:pypi:`pytest-aspec`
|
||||
*last release*: Oct 23, 2023,
|
||||
*last release*: Dec 20, 2023,
|
||||
*status*: 4 - Beta,
|
||||
*requires*: N/A
|
||||
|
||||
|
@ -1892,7 +1896,7 @@ This list contains 1355 plugins.
|
|||
Pytest fixtures for async generators
|
||||
|
||||
:pypi:`pytest-asyncio`
|
||||
*last release*: Dec 09, 2023,
|
||||
*last release*: Jan 01, 2024,
|
||||
*status*: 4 - Beta,
|
||||
*requires*: pytest >=7.0.0
|
||||
|
||||
|
@ -2095,9 +2099,9 @@ This list contains 1355 plugins.
|
|||
pytest plugin to display BDD info in HTML test report
|
||||
|
||||
:pypi:`pytest-bdd-ng`
|
||||
*last release*: Jul 01, 2023,
|
||||
*last release*: Dec 31, 2023,
|
||||
*status*: 4 - Beta,
|
||||
*requires*: pytest (>=5.0)
|
||||
*requires*: pytest >=5.0
|
||||
|
||||
BDD for pytest
|
||||
|
||||
|
@ -2487,7 +2491,7 @@ This list contains 1355 plugins.
|
|||
Pytest plugin with server for catching HTTP requests.
|
||||
|
||||
:pypi:`pytest-celery`
|
||||
*last release*: Dec 07, 2023,
|
||||
*last release*: Jan 03, 2024,
|
||||
*status*: N/A,
|
||||
*requires*: N/A
|
||||
|
||||
|
@ -2543,7 +2547,7 @@ This list contains 1355 plugins.
|
|||
A pytest fixture for changing current working directory
|
||||
|
||||
:pypi:`pytest-check`
|
||||
*last release*: Sep 22, 2023,
|
||||
*last release*: Dec 31, 2023,
|
||||
*status*: N/A,
|
||||
*requires*: pytest
|
||||
|
||||
|
@ -2606,7 +2610,7 @@ This list contains 1355 plugins.
|
|||
A pytest plugin to send a report and printing summary of tests.
|
||||
|
||||
:pypi:`pytest-choose`
|
||||
*last release*: Nov 30, 2023,
|
||||
*last release*: Dec 26, 2023,
|
||||
*status*: N/A,
|
||||
*requires*: pytest >=7.0.0
|
||||
|
||||
|
@ -3298,6 +3302,13 @@ This list contains 1355 plugins.
|
|||
|
||||
Pytest extension for dbt.
|
||||
|
||||
:pypi:`pytest-dbt-postgres`
|
||||
*last release*: Jan 02, 2024,
|
||||
*status*: N/A,
|
||||
*requires*: pytest (>=7.4.3,<8.0.0)
|
||||
|
||||
Pytest tooling to unittest DBT & Postgres models
|
||||
|
||||
:pypi:`pytest-dbus-notification`
|
||||
*last release*: Mar 05, 2014,
|
||||
*status*: 5 - Production/Stable,
|
||||
|
@ -3355,7 +3366,7 @@ This list contains 1355 plugins.
|
|||
pytest示例插件
|
||||
|
||||
:pypi:`pytest-dependency`
|
||||
*last release*: Feb 14, 2020,
|
||||
*last release*: Dec 31, 2023,
|
||||
*status*: 4 - Beta,
|
||||
*requires*: N/A
|
||||
|
||||
|
@ -3522,6 +3533,13 @@ This list contains 1355 plugins.
|
|||
|
||||
A pytest plugin for running django in class-scoped fixtures
|
||||
|
||||
:pypi:`pytest-django-docker-pg`
|
||||
*last release*: Jan 05, 2024,
|
||||
*status*: 5 - Production/Stable,
|
||||
*requires*: pytest >=7.0.0
|
||||
|
||||
|
||||
|
||||
:pypi:`pytest-django-dotenv`
|
||||
*last release*: Nov 26, 2019,
|
||||
*status*: 4 - Beta,
|
||||
|
@ -3740,7 +3758,7 @@ This list contains 1355 plugins.
|
|||
Pytest fixtures for testing with docker registries.
|
||||
|
||||
:pypi:`pytest-docker-service`
|
||||
*last release*: Feb 22, 2023,
|
||||
*last release*: Jan 03, 2024,
|
||||
*status*: 3 - Alpha,
|
||||
*requires*: pytest (>=7.1.3)
|
||||
|
||||
|
@ -4027,56 +4045,56 @@ This list contains 1355 plugins.
|
|||
Send execution result email
|
||||
|
||||
:pypi:`pytest-embedded`
|
||||
*last release*: Dec 04, 2023,
|
||||
*last release*: Jan 04, 2024,
|
||||
*status*: 5 - Production/Stable,
|
||||
*requires*: pytest>=7.0
|
||||
|
||||
A pytest plugin that designed for embedded testing.
|
||||
|
||||
:pypi:`pytest-embedded-arduino`
|
||||
*last release*: Dec 04, 2023,
|
||||
*last release*: Jan 04, 2024,
|
||||
*status*: 5 - Production/Stable,
|
||||
*requires*: N/A
|
||||
|
||||
Make pytest-embedded plugin work with Arduino.
|
||||
|
||||
:pypi:`pytest-embedded-idf`
|
||||
*last release*: Dec 04, 2023,
|
||||
*last release*: Jan 04, 2024,
|
||||
*status*: 5 - Production/Stable,
|
||||
*requires*: N/A
|
||||
|
||||
Make pytest-embedded plugin work with ESP-IDF.
|
||||
|
||||
:pypi:`pytest-embedded-jtag`
|
||||
*last release*: Dec 04, 2023,
|
||||
*last release*: Jan 04, 2024,
|
||||
*status*: 5 - Production/Stable,
|
||||
*requires*: N/A
|
||||
|
||||
Make pytest-embedded plugin work with JTAG.
|
||||
|
||||
:pypi:`pytest-embedded-qemu`
|
||||
*last release*: Dec 04, 2023,
|
||||
*last release*: Jan 04, 2024,
|
||||
*status*: 5 - Production/Stable,
|
||||
*requires*: N/A
|
||||
|
||||
Make pytest-embedded plugin work with QEMU.
|
||||
|
||||
:pypi:`pytest-embedded-serial`
|
||||
*last release*: Dec 04, 2023,
|
||||
*last release*: Jan 04, 2024,
|
||||
*status*: 5 - Production/Stable,
|
||||
*requires*: N/A
|
||||
|
||||
Make pytest-embedded plugin work with Serial.
|
||||
|
||||
:pypi:`pytest-embedded-serial-esp`
|
||||
*last release*: Dec 04, 2023,
|
||||
*last release*: Jan 04, 2024,
|
||||
*status*: 5 - Production/Stable,
|
||||
*requires*: N/A
|
||||
|
||||
Make pytest-embedded plugin work with Espressif target boards.
|
||||
|
||||
:pypi:`pytest-embedded-wokwi`
|
||||
*last release*: Dec 04, 2023,
|
||||
*last release*: Jan 04, 2024,
|
||||
*status*: 5 - Production/Stable,
|
||||
*requires*: N/A
|
||||
|
||||
|
@ -4104,9 +4122,9 @@ This list contains 1355 plugins.
|
|||
Pytest plugin to represent test output with emoji support
|
||||
|
||||
:pypi:`pytest-enabler`
|
||||
*last release*: Jul 14, 2023,
|
||||
*last release*: Dec 23, 2023,
|
||||
*status*: 5 - Production/Stable,
|
||||
*requires*: pytest (>=6) ; extra == 'testing'
|
||||
*requires*: pytest >=6 ; extra == 'testing'
|
||||
|
||||
Enable installed pytest plugins
|
||||
|
||||
|
@ -4874,7 +4892,7 @@ This list contains 1355 plugins.
|
|||
Uses gcov to measure test coverage of a C library
|
||||
|
||||
:pypi:`pytest-gee`
|
||||
*last release*: Dec 04, 2023,
|
||||
*last release*: Dec 18, 2023,
|
||||
*status*: 3 - Alpha,
|
||||
*requires*: pytest
|
||||
|
||||
|
@ -4909,7 +4927,7 @@ This list contains 1355 plugins.
|
|||
For finding/executing Ghost Inspector tests
|
||||
|
||||
:pypi:`pytest-girder`
|
||||
*last release*: Dec 14, 2023,
|
||||
*last release*: Dec 20, 2023,
|
||||
*status*: N/A,
|
||||
*requires*: N/A
|
||||
|
||||
|
@ -4979,7 +4997,7 @@ This list contains 1355 plugins.
|
|||
Parallelize pytest across GitLab CI workers.
|
||||
|
||||
:pypi:`pytest-gitlab-fold`
|
||||
*last release*: Sep 15, 2023,
|
||||
*last release*: Dec 31, 2023,
|
||||
*status*: 4 - Beta,
|
||||
*requires*: pytest >=2.6.0
|
||||
|
||||
|
@ -5196,7 +5214,7 @@ This list contains 1355 plugins.
|
|||
Report on tests that honor constraints, and guard against regressions
|
||||
|
||||
:pypi:`pytest-hot-reloading`
|
||||
*last release*: Dec 13, 2023,
|
||||
*last release*: Jan 06, 2024,
|
||||
*status*: N/A,
|
||||
*requires*: N/A
|
||||
|
||||
|
@ -5210,7 +5228,7 @@ This list contains 1355 plugins.
|
|||
A plugin that tracks test changes
|
||||
|
||||
:pypi:`pytest-houdini`
|
||||
*last release*: Nov 10, 2023,
|
||||
*last release*: Dec 25, 2023,
|
||||
*status*: N/A,
|
||||
*requires*: pytest
|
||||
|
||||
|
@ -5266,7 +5284,7 @@ This list contains 1355 plugins.
|
|||
Pytest HTML reports merging utility
|
||||
|
||||
:pypi:`pytest-html-object-storage`
|
||||
*last release*: Mar 04, 2022,
|
||||
*last release*: Jan 05, 2024,
|
||||
*status*: 5 - Production/Stable,
|
||||
*requires*: N/A
|
||||
|
||||
|
@ -5350,7 +5368,7 @@ This list contains 1355 plugins.
|
|||
http_testing framework on top of pytest
|
||||
|
||||
:pypi:`pytest-httpx`
|
||||
*last release*: Nov 13, 2023,
|
||||
*last release*: Dec 21, 2023,
|
||||
*status*: 5 - Production/Stable,
|
||||
*requires*: pytest ==7.*
|
||||
|
||||
|
@ -5363,6 +5381,13 @@ This list contains 1355 plugins.
|
|||
|
||||
Disable httpx requests during a test run
|
||||
|
||||
:pypi:`pytest-httpx-recorder`
|
||||
*last release*: Jan 04, 2024,
|
||||
*status*: 5 - Production/Stable,
|
||||
*requires*: pytest
|
||||
|
||||
Recorder feature based on pytest_httpx, like recorder feature in responses.
|
||||
|
||||
:pypi:`pytest-hue`
|
||||
*last release*: May 09, 2019,
|
||||
*status*: N/A,
|
||||
|
@ -5385,7 +5410,7 @@ This list contains 1355 plugins.
|
|||
help hypo module for pytest
|
||||
|
||||
:pypi:`pytest-iam`
|
||||
*last release*: Dec 15, 2023,
|
||||
*last release*: Dec 22, 2023,
|
||||
*status*: 3 - Alpha,
|
||||
*requires*: pytest (>=7.0.0,<8.0.0)
|
||||
|
||||
|
@ -5518,7 +5543,7 @@ This list contains 1355 plugins.
|
|||
A py.test plugin providing fixtures to simplify inmanta modules testing.
|
||||
|
||||
:pypi:`pytest-inmanta-extensions`
|
||||
*last release*: Dec 11, 2023,
|
||||
*last release*: Jan 04, 2024,
|
||||
*status*: 5 - Production/Stable,
|
||||
*requires*: N/A
|
||||
|
||||
|
@ -5595,7 +5620,7 @@ This list contains 1355 plugins.
|
|||
Pytest plugin for intercepting outgoing connection requests during pytest run.
|
||||
|
||||
:pypi:`pytest-interface-tester`
|
||||
*last release*: Dec 05, 2023,
|
||||
*last release*: Jan 03, 2024,
|
||||
*status*: 4 - Beta,
|
||||
*requires*: pytest
|
||||
|
||||
|
@ -5643,13 +5668,6 @@ This list contains 1355 plugins.
|
|||
|
||||
py.test plugin to check import ordering using isort
|
||||
|
||||
:pypi:`pytest-is-running`
|
||||
*last release*: Jul 10, 2023,
|
||||
*status*: 5 - Production/Stable,
|
||||
*requires*: N/A
|
||||
|
||||
pytest plugin providing a function to check if pytest is running.
|
||||
|
||||
:pypi:`pytest-it`
|
||||
*last release*: Jan 22, 2020,
|
||||
*status*: 4 - Beta,
|
||||
|
@ -5987,7 +6005,7 @@ This list contains 1355 plugins.
|
|||
A python-libfaketime plugin for pytest.
|
||||
|
||||
:pypi:`pytest-libiio`
|
||||
*last release*: Dec 06, 2023,
|
||||
*last release*: Dec 22, 2023,
|
||||
*status*: 4 - Beta,
|
||||
*requires*: N/A
|
||||
|
||||
|
@ -6428,7 +6446,7 @@ This list contains 1355 plugins.
|
|||
A plugin to test mp
|
||||
|
||||
:pypi:`pytest-minio-mock`
|
||||
*last release*: Dec 06, 2023,
|
||||
*last release*: Jan 04, 2024,
|
||||
*status*: N/A,
|
||||
*requires*: pytest >=5.0.0
|
||||
|
||||
|
@ -7533,6 +7551,13 @@ This list contains 1355 plugins.
|
|||
|
||||
Visualize your failed tests with poo
|
||||
|
||||
:pypi:`pytest-pook`
|
||||
*last release*: Dec 23, 2023,
|
||||
*status*: 4 - Beta,
|
||||
*requires*: pytest
|
||||
|
||||
Pytest plugin for pook
|
||||
|
||||
:pypi:`pytest-pop`
|
||||
*last release*: May 09, 2023,
|
||||
*status*: 5 - Production/Stable,
|
||||
|
@ -7660,7 +7685,7 @@ This list contains 1355 plugins.
|
|||
Test helpers for Prosper projects
|
||||
|
||||
:pypi:`pytest-prysk`
|
||||
*last release*: Jul 18, 2023,
|
||||
*last release*: Dec 30, 2023,
|
||||
*status*: 4 - Beta,
|
||||
*requires*: pytest (>=7.3.2,<8.0.0)
|
||||
|
||||
|
@ -7828,16 +7853,16 @@ This list contains 1355 plugins.
|
|||
Pytest plugin for type checking code with Pyright
|
||||
|
||||
:pypi:`pytest-pyspec`
|
||||
*last release*: Mar 12, 2023,
|
||||
*status*: 5 - Production/Stable,
|
||||
*last release*: Jan 02, 2024,
|
||||
*status*: N/A,
|
||||
*requires*: pytest (>=7.2.1,<8.0.0)
|
||||
|
||||
A plugin that transforms the pytest output into a result similar to the RSpec. It enables the use of docstrings to display results and also enables the use of the prefixes "describe", "with" and "it".
|
||||
|
||||
:pypi:`pytest-pystack`
|
||||
*last release*: May 07, 2023,
|
||||
*last release*: Jan 04, 2024,
|
||||
*status*: N/A,
|
||||
*requires*: pytest (>=3.5.0)
|
||||
*requires*: pytest >=3.5.0
|
||||
|
||||
Plugin to run pystack after a timeout for a test suite.
|
||||
|
||||
|
@ -7912,9 +7937,9 @@ This list contains 1355 plugins.
|
|||
pytest plugin to generate test result QR codes
|
||||
|
||||
:pypi:`pytest-qt`
|
||||
*last release*: Oct 25, 2022,
|
||||
*last release*: Dec 22, 2023,
|
||||
*status*: 5 - Production/Stable,
|
||||
*requires*: pytest (>=3.0.0)
|
||||
*requires*: pytest >=3.0.0
|
||||
|
||||
pytest support for PyQt and PySide applications
|
||||
|
||||
|
@ -8437,7 +8462,7 @@ This list contains 1355 plugins.
|
|||
A RethinkDB plugin for pytest.
|
||||
|
||||
:pypi:`pytest-retry`
|
||||
*last release*: Oct 04, 2023,
|
||||
*last release*: Jan 04, 2024,
|
||||
*status*: N/A,
|
||||
*requires*: pytest >=7.0.0
|
||||
|
||||
|
@ -8675,7 +8700,7 @@ This list contains 1355 plugins.
|
|||
|
||||
|
||||
:pypi:`pytest-sbase`
|
||||
*last release*: Dec 08, 2023,
|
||||
*last release*: Jan 04, 2024,
|
||||
*status*: 5 - Production/Stable,
|
||||
*requires*: N/A
|
||||
|
||||
|
@ -8738,7 +8763,7 @@ This list contains 1355 plugins.
|
|||
pytest plugin to automatically capture screenshots upon selenium webdriver events
|
||||
|
||||
:pypi:`pytest-seleniumbase`
|
||||
*last release*: Dec 08, 2023,
|
||||
*last release*: Jan 04, 2024,
|
||||
*status*: 5 - Production/Stable,
|
||||
*requires*: N/A
|
||||
|
||||
|
@ -8780,7 +8805,7 @@ This list contains 1355 plugins.
|
|||
Pytest plugin for sequencing markers for execution of tests
|
||||
|
||||
:pypi:`pytest-server-fixtures`
|
||||
*last release*: May 28, 2019,
|
||||
*last release*: Dec 19, 2023,
|
||||
*status*: 5 - Production/Stable,
|
||||
*requires*: pytest
|
||||
|
||||
|
@ -8794,7 +8819,7 @@ This list contains 1355 plugins.
|
|||
Automatically mocks resources from serverless.yml in pytest using moto.
|
||||
|
||||
:pypi:`pytest-servers`
|
||||
*last release*: Dec 15, 2023,
|
||||
*last release*: Dec 19, 2023,
|
||||
*status*: 3 - Alpha,
|
||||
*requires*: pytest >=6.2
|
||||
|
||||
|
@ -8934,7 +8959,7 @@ This list contains 1355 plugins.
|
|||
Allow for multiple processes to log to a single file
|
||||
|
||||
:pypi:`pytest-skip-markers`
|
||||
*last release*: Oct 20, 2023,
|
||||
*last release*: Jan 04, 2024,
|
||||
*status*: 5 - Production/Stable,
|
||||
*requires*: pytest >=7.1.0
|
||||
|
||||
|
@ -9123,7 +9148,7 @@ This list contains 1355 plugins.
|
|||
Solr process and client fixtures for py.test.
|
||||
|
||||
:pypi:`pytest-sort`
|
||||
*last release*: Oct 06, 2023,
|
||||
*last release*: Dec 22, 2023,
|
||||
*status*: N/A,
|
||||
*requires*: pytest >=7.4.0
|
||||
|
||||
|
@ -9193,11 +9218,11 @@ This list contains 1355 plugins.
|
|||
Doctest plugin for pytest with support for Sphinx-specific doctest-directives
|
||||
|
||||
:pypi:`pytest-spiratest`
|
||||
*last release*: Feb 08, 2022,
|
||||
*last release*: Jan 01, 2024,
|
||||
*status*: N/A,
|
||||
*requires*: N/A
|
||||
|
||||
Exports unit tests as test runs in SpiraTest/Team/Plan
|
||||
Exports unit tests as test runs in Spira (SpiraTest/Team/Plan)
|
||||
|
||||
:pypi:`pytest-splinter`
|
||||
*last release*: Sep 09, 2022,
|
||||
|
@ -9249,7 +9274,7 @@ This list contains 1355 plugins.
|
|||
|
||||
|
||||
:pypi:`pytest-splunk-addon`
|
||||
*last release*: Dec 14, 2023,
|
||||
*last release*: Dec 21, 2023,
|
||||
*status*: N/A,
|
||||
*requires*: pytest (>5.4.0,<8)
|
||||
|
||||
|
@ -9942,7 +9967,7 @@ This list contains 1355 plugins.
|
|||
|
||||
|
||||
:pypi:`pytest-timeassert-ethan`
|
||||
*last release*: Dec 12, 2023,
|
||||
*last release*: Dec 25, 2023,
|
||||
*status*: N/A,
|
||||
*requires*: pytest
|
||||
|
||||
|
@ -9970,9 +9995,9 @@ This list contains 1355 plugins.
|
|||
Linux-only Pytest plugin to control durations of various test case execution phases
|
||||
|
||||
:pypi:`pytest-timer`
|
||||
*last release*: Jun 02, 2021,
|
||||
*last release*: Dec 26, 2023,
|
||||
*status*: N/A,
|
||||
*requires*: N/A
|
||||
*requires*: pytest
|
||||
|
||||
A timer plugin for pytest
|
||||
|
||||
|
@ -9990,6 +10015,13 @@ This list contains 1355 plugins.
|
|||
|
||||
A simple plugin to view timestamps for each test
|
||||
|
||||
:pypi:`pytest-tiny-api-client`
|
||||
*last release*: Jan 04, 2024,
|
||||
*status*: 5 - Production/Stable,
|
||||
*requires*: pytest
|
||||
|
||||
The companion pytest plugin for tiny-api-client
|
||||
|
||||
:pypi:`pytest-tinybird`
|
||||
*last release*: Jun 26, 2023,
|
||||
*status*: 4 - Beta,
|
||||
|
@ -10432,7 +10464,7 @@ This list contains 1355 plugins.
|
|||
py.test fixture for creating a virtual environment
|
||||
|
||||
:pypi:`pytest-ver`
|
||||
*last release*: Dec 12, 2023,
|
||||
*last release*: Dec 19, 2023,
|
||||
*status*: 4 - Beta,
|
||||
*requires*: pytest
|
||||
|
||||
|
@ -10705,7 +10737,7 @@ This list contains 1355 plugins.
|
|||
Extended logging for test and decorators
|
||||
|
||||
:pypi:`pytest-xlsx`
|
||||
*last release*: Jul 03, 2023,
|
||||
*last release*: Dec 28, 2023,
|
||||
*status*: N/A,
|
||||
*requires*: pytest<8,>=7.4.0
|
||||
|
||||
|
@ -10775,7 +10807,7 @@ This list contains 1355 plugins.
|
|||
This plugin is used to load yaml output to your test using pytest framework.
|
||||
|
||||
:pypi:`pytest-yaml-sanmu`
|
||||
*last release*: Nov 30, 2023,
|
||||
*last release*: Dec 18, 2023,
|
||||
*status*: N/A,
|
||||
*requires*: pytest>=7.4.0
|
||||
|
||||
|
|
|
@ -643,8 +643,6 @@ Bootstrapping hooks called for plugins registered early enough (internal and set
|
|||
|
||||
.. hook:: pytest_load_initial_conftests
|
||||
.. autofunction:: pytest_load_initial_conftests
|
||||
.. hook:: pytest_cmdline_preparse
|
||||
.. autofunction:: pytest_cmdline_preparse
|
||||
.. hook:: pytest_cmdline_parse
|
||||
.. autofunction:: pytest_cmdline_parse
|
||||
.. hook:: pytest_cmdline_main
|
||||
|
@ -682,6 +680,8 @@ Collection hooks
|
|||
.. autofunction:: pytest_collection
|
||||
.. hook:: pytest_ignore_collect
|
||||
.. autofunction:: pytest_ignore_collect
|
||||
.. hook:: pytest_collect_directory
|
||||
.. autofunction:: pytest_collect_directory
|
||||
.. hook:: pytest_collect_file
|
||||
.. autofunction:: pytest_collect_file
|
||||
.. hook:: pytest_pycollect_makemodule
|
||||
|
@ -921,6 +921,18 @@ Config
|
|||
.. autoclass:: pytest.Config()
|
||||
:members:
|
||||
|
||||
Dir
|
||||
~~~
|
||||
|
||||
.. autoclass:: pytest.Dir()
|
||||
:members:
|
||||
|
||||
Directory
|
||||
~~~~~~~~~
|
||||
|
||||
.. autoclass:: pytest.Directory()
|
||||
:members:
|
||||
|
||||
ExceptionInfo
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
|
@ -1195,9 +1207,6 @@ Custom warnings generated in some situations such as improper usage or deprecate
|
|||
.. autoclass:: pytest.PytestReturnNotNoneWarning
|
||||
:show-inheritance:
|
||||
|
||||
.. autoclass:: pytest.PytestRemovedIn8Warning
|
||||
:show-inheritance:
|
||||
|
||||
.. autoclass:: pytest.PytestRemovedIn9Warning
|
||||
:show-inheritance:
|
||||
|
||||
|
@ -2086,7 +2095,7 @@ All the command-line flags can be obtained by running ``pytest --help``::
|
|||
|
||||
[pytest] ini-options in the first pytest.ini|tox.ini|setup.cfg|pyproject.toml file found:
|
||||
|
||||
markers (linelist): Markers for test functions
|
||||
markers (linelist): Register new markers for test functions
|
||||
empty_parameter_set_mark (string):
|
||||
Default marker for empty parametersets
|
||||
norecursedirs (args): Directory patterns to avoid for recursion
|
||||
|
@ -2127,6 +2136,10 @@ All the command-line flags can be obtained by running ``pytest --help``::
|
|||
enable_assertion_pass_hook (bool):
|
||||
Enables the pytest_assertion_pass hook. Make sure to
|
||||
delete any previously generated pyc cache files.
|
||||
verbosity_assertions (string):
|
||||
Specify a verbosity level for assertions, overriding
|
||||
the main level. Higher levels will provide more
|
||||
detailed explanation when an assertion fails.
|
||||
junit_suite_name (string):
|
||||
Test suite name for JUnit report
|
||||
junit_logging (string):
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
latest-release-notes.md
|
|
@ -0,0 +1,66 @@
|
|||
# mypy: disallow-untyped-defs
|
||||
"""
|
||||
Script used to generate a Markdown file containing only the changelog entries of a specific pytest release, which
|
||||
is then published as a GitHub Release during deploy (see workflows/deploy.yml).
|
||||
|
||||
The script requires ``pandoc`` to be previously installed in the system -- we need to convert from RST (the format of
|
||||
our CHANGELOG) into Markdown (which is required by GitHub Releases).
|
||||
|
||||
Requires Python3.6+.
|
||||
"""
|
||||
import re
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from typing import Sequence
|
||||
|
||||
import pypandoc
|
||||
|
||||
|
||||
def extract_changelog_entries_for(version: str) -> str:
|
||||
p = Path(__file__).parent.parent / "doc/en/changelog.rst"
|
||||
changelog_lines = p.read_text(encoding="UTF-8").splitlines()
|
||||
|
||||
title_regex = re.compile(r"pytest (\d\.\d+\.\d+\w*) \(\d{4}-\d{2}-\d{2}\)")
|
||||
consuming_version = False
|
||||
version_lines = []
|
||||
for line in changelog_lines:
|
||||
m = title_regex.match(line)
|
||||
if m:
|
||||
# Found the version we want: start to consume lines until we find the next version title.
|
||||
if m.group(1) == version:
|
||||
consuming_version = True
|
||||
# Found a new version title while parsing the version we want: break out.
|
||||
elif consuming_version:
|
||||
break
|
||||
if consuming_version:
|
||||
version_lines.append(line)
|
||||
|
||||
return "\n".join(version_lines)
|
||||
|
||||
|
||||
def convert_rst_to_md(text: str) -> str:
|
||||
result = pypandoc.convert_text(
|
||||
text, "md", format="rst", extra_args=["--wrap=preserve"]
|
||||
)
|
||||
assert isinstance(result, str), repr(result)
|
||||
return result
|
||||
|
||||
|
||||
def main(argv: Sequence[str]) -> int:
|
||||
if len(argv) != 3:
|
||||
print("Usage: generate-gh-release-notes VERSION FILE")
|
||||
return 2
|
||||
|
||||
version, filename = argv[1:3]
|
||||
print(f"Generating GitHub release notes for version {version}")
|
||||
rst_body = extract_changelog_entries_for(version)
|
||||
md_body = convert_rst_to_md(rst_body)
|
||||
Path(filename).write_text(md_body, encoding="UTF-8")
|
||||
print()
|
||||
print(f"Done: {filename}")
|
||||
print()
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main(sys.argv))
|
|
@ -1,3 +1,4 @@
|
|||
# mypy: disallow-untyped-defs
|
||||
"""
|
||||
This script is part of the pytest release process which is triggered manually in the Actions
|
||||
tab of the repository.
|
||||
|
|
|
@ -1,102 +0,0 @@
|
|||
"""
|
||||
Script used to publish GitHub release notes extracted from CHANGELOG.rst.
|
||||
|
||||
This script is meant to be executed after a successful deployment in GitHub actions.
|
||||
|
||||
Uses the following environment variables:
|
||||
|
||||
* GIT_TAG: the name of the tag of the current commit.
|
||||
* GH_RELEASE_NOTES_TOKEN: a personal access token with 'repo' permissions.
|
||||
|
||||
Create one at:
|
||||
|
||||
https://github.com/settings/tokens
|
||||
|
||||
This token should be set in a secret in the repository, which is exposed as an
|
||||
environment variable in the main.yml workflow file.
|
||||
|
||||
The script also requires ``pandoc`` to be previously installed in the system.
|
||||
|
||||
Requires Python3.6+.
|
||||
"""
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import github3
|
||||
import pypandoc
|
||||
|
||||
|
||||
def publish_github_release(slug, token, tag_name, body):
|
||||
github = github3.login(token=token)
|
||||
owner, repo = slug.split("/")
|
||||
repo = github.repository(owner, repo)
|
||||
return repo.create_release(tag_name=tag_name, body=body)
|
||||
|
||||
|
||||
def parse_changelog(tag_name):
|
||||
p = Path(__file__).parent.parent / "doc/en/changelog.rst"
|
||||
changelog_lines = p.read_text(encoding="UTF-8").splitlines()
|
||||
|
||||
title_regex = re.compile(r"pytest (\d\.\d+\.\d+) \(\d{4}-\d{2}-\d{2}\)")
|
||||
consuming_version = False
|
||||
version_lines = []
|
||||
for line in changelog_lines:
|
||||
m = title_regex.match(line)
|
||||
if m:
|
||||
# found the version we want: start to consume lines until we find the next version title
|
||||
if m.group(1) == tag_name:
|
||||
consuming_version = True
|
||||
# found a new version title while parsing the version we want: break out
|
||||
elif consuming_version:
|
||||
break
|
||||
if consuming_version:
|
||||
version_lines.append(line)
|
||||
|
||||
return "\n".join(version_lines)
|
||||
|
||||
|
||||
def convert_rst_to_md(text):
|
||||
return pypandoc.convert_text(
|
||||
text, "md", format="rst", extra_args=["--wrap=preserve"]
|
||||
)
|
||||
|
||||
|
||||
def main(argv):
|
||||
if len(argv) > 1:
|
||||
tag_name = argv[1]
|
||||
else:
|
||||
tag_name = os.environ.get("GITHUB_REF")
|
||||
if not tag_name:
|
||||
print("tag_name not given and $GITHUB_REF not set", file=sys.stderr)
|
||||
return 1
|
||||
if tag_name.startswith("refs/tags/"):
|
||||
tag_name = tag_name[len("refs/tags/") :]
|
||||
|
||||
token = os.environ.get("GH_RELEASE_NOTES_TOKEN")
|
||||
if not token:
|
||||
print("GH_RELEASE_NOTES_TOKEN not set", file=sys.stderr)
|
||||
return 1
|
||||
|
||||
slug = os.environ.get("GITHUB_REPOSITORY")
|
||||
if not slug:
|
||||
print("GITHUB_REPOSITORY not set", file=sys.stderr)
|
||||
return 1
|
||||
|
||||
rst_body = parse_changelog(tag_name)
|
||||
md_body = convert_rst_to_md(rst_body)
|
||||
if not publish_github_release(slug, token, tag_name, md_body):
|
||||
print("Could not publish release notes:", file=sys.stderr)
|
||||
print(md_body, file=sys.stderr)
|
||||
return 5
|
||||
|
||||
print()
|
||||
print(f"Release notes for {tag_name} published successfully:")
|
||||
print(f"https://github.com/{slug}/releases/tag/{tag_name}")
|
||||
print()
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main(sys.argv))
|
|
@ -1,3 +1,4 @@
|
|||
# mypy: disallow-untyped-defs
|
||||
"""Invoke development tasks."""
|
||||
import argparse
|
||||
import os
|
||||
|
@ -10,15 +11,15 @@ from colorama import Fore
|
|||
from colorama import init
|
||||
|
||||
|
||||
def announce(version, template_name, doc_version):
|
||||
def announce(version: str, template_name: str, doc_version: str) -> None:
|
||||
"""Generates a new release announcement entry in the docs."""
|
||||
# Get our list of authors
|
||||
stdout = check_output(["git", "describe", "--abbrev=0", "--tags"])
|
||||
stdout = stdout.decode("utf-8")
|
||||
stdout = check_output(["git", "describe", "--abbrev=0", "--tags"], encoding="UTF-8")
|
||||
last_version = stdout.strip()
|
||||
|
||||
stdout = check_output(["git", "log", f"{last_version}..HEAD", "--format=%aN"])
|
||||
stdout = stdout.decode("utf-8")
|
||||
stdout = check_output(
|
||||
["git", "log", f"{last_version}..HEAD", "--format=%aN"], encoding="UTF-8"
|
||||
)
|
||||
|
||||
contributors = {
|
||||
name
|
||||
|
@ -61,7 +62,7 @@ def announce(version, template_name, doc_version):
|
|||
check_call(["git", "add", str(target)])
|
||||
|
||||
|
||||
def regen(version):
|
||||
def regen(version: str) -> None:
|
||||
"""Call regendoc tool to update examples and pytest output in the docs."""
|
||||
print(f"{Fore.CYAN}[generate.regen] {Fore.RESET}Updating docs")
|
||||
check_call(
|
||||
|
@ -70,7 +71,7 @@ def regen(version):
|
|||
)
|
||||
|
||||
|
||||
def fix_formatting():
|
||||
def fix_formatting() -> None:
|
||||
"""Runs pre-commit in all files to ensure they are formatted correctly"""
|
||||
print(
|
||||
f"{Fore.CYAN}[generate.fix linting] {Fore.RESET}Fixing formatting using pre-commit"
|
||||
|
@ -78,13 +79,15 @@ def fix_formatting():
|
|||
call(["pre-commit", "run", "--all-files"])
|
||||
|
||||
|
||||
def check_links():
|
||||
def check_links() -> None:
|
||||
"""Runs sphinx-build to check links"""
|
||||
print(f"{Fore.CYAN}[generate.check_links] {Fore.RESET}Checking links")
|
||||
check_call(["tox", "-e", "docs-checklinks"])
|
||||
|
||||
|
||||
def pre_release(version, template_name, doc_version, *, skip_check_links):
|
||||
def pre_release(
|
||||
version: str, template_name: str, doc_version: str, *, skip_check_links: bool
|
||||
) -> None:
|
||||
"""Generates new docs, release announcements and creates a local tag."""
|
||||
announce(version, template_name, doc_version)
|
||||
regen(version)
|
||||
|
@ -102,12 +105,12 @@ def pre_release(version, template_name, doc_version, *, skip_check_links):
|
|||
print("Please push your branch and open a PR.")
|
||||
|
||||
|
||||
def changelog(version, write_out=False):
|
||||
def changelog(version: str, write_out: bool = False) -> None:
|
||||
addopts = [] if write_out else ["--draft"]
|
||||
check_call(["towncrier", "--yes", "--version", version] + addopts)
|
||||
|
||||
|
||||
def main():
|
||||
def main() -> None:
|
||||
init(autoreset=True)
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("version", help="Release version")
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
# mypy: disallow-untyped-defs
|
||||
import sys
|
||||
from subprocess import call
|
||||
|
||||
|
||||
def main():
|
||||
def main() -> int:
|
||||
"""
|
||||
Platform agnostic wrapper script for towncrier.
|
||||
Fixes the issue (#7251) where windows users are unable to natively run tox -e docs to build pytest docs.
|
||||
Platform-agnostic wrapper script for towncrier.
|
||||
Fixes the issue (#7251) where Windows users are unable to natively run tox -e docs to build pytest docs.
|
||||
"""
|
||||
with open(
|
||||
"doc/en/_changelog_towncrier_draft.rst", "w", encoding="utf-8"
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
# mypy: disallow-untyped-defs
|
||||
import datetime
|
||||
import pathlib
|
||||
import re
|
||||
from textwrap import dedent
|
||||
from textwrap import indent
|
||||
from typing import Any
|
||||
from typing import Iterable
|
||||
from typing import Iterator
|
||||
from typing import TypedDict
|
||||
|
||||
import packaging.version
|
||||
import platformdirs
|
||||
|
@ -109,7 +114,17 @@ def pytest_plugin_projects_from_pypi(session: CachedSession) -> dict[str, int]:
|
|||
}
|
||||
|
||||
|
||||
def iter_plugins():
|
||||
class PluginInfo(TypedDict):
|
||||
"""Relevant information about a plugin to generate the summary."""
|
||||
|
||||
name: str
|
||||
summary: str
|
||||
last_release: str
|
||||
status: str
|
||||
requires: str
|
||||
|
||||
|
||||
def iter_plugins() -> Iterator[PluginInfo]:
|
||||
session = get_session()
|
||||
name_2_serial = pytest_plugin_projects_from_pypi(session)
|
||||
|
||||
|
@ -136,7 +151,7 @@ def iter_plugins():
|
|||
requires = requirement
|
||||
break
|
||||
|
||||
def version_sort_key(version_string):
|
||||
def version_sort_key(version_string: str) -> Any:
|
||||
"""
|
||||
Return the sort key for the given version string
|
||||
returned by the API.
|
||||
|
@ -162,20 +177,20 @@ def iter_plugins():
|
|||
yield {
|
||||
"name": name,
|
||||
"summary": summary.strip(),
|
||||
"last release": last_release,
|
||||
"last_release": last_release,
|
||||
"status": status,
|
||||
"requires": requires,
|
||||
}
|
||||
|
||||
|
||||
def plugin_definitions(plugins):
|
||||
def plugin_definitions(plugins: Iterable[PluginInfo]) -> Iterator[str]:
|
||||
"""Return RST for the plugin list that fits better on a vertical page."""
|
||||
|
||||
for plugin in plugins:
|
||||
yield dedent(
|
||||
f"""
|
||||
{plugin['name']}
|
||||
*last release*: {plugin["last release"]},
|
||||
*last release*: {plugin["last_release"]},
|
||||
*status*: {plugin["status"]},
|
||||
*requires*: {plugin["requires"]}
|
||||
|
||||
|
@ -184,7 +199,7 @@ def plugin_definitions(plugins):
|
|||
)
|
||||
|
||||
|
||||
def main():
|
||||
def main() -> None:
|
||||
plugins = [*iter_plugins()]
|
||||
|
||||
reference_dir = pathlib.Path("doc", "en", "reference")
|
||||
|
|
|
@ -69,7 +69,6 @@ testing =
|
|||
attrs>=19.2.0
|
||||
hypothesis>=3.56
|
||||
mock
|
||||
nose
|
||||
pygments>=2.7.2
|
||||
requests
|
||||
setuptools
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue