Merge branch 'main' into fine-grain-verbosity

This commit is contained in:
Patrick Lannigan 2023-11-05 15:17:49 -05:00
commit 855f5797a6
No known key found for this signature in database
GPG Key ID: BBF5D9DED1E4AAF9
34 changed files with 477 additions and 155 deletions

View File

@ -26,7 +26,7 @@ jobs:
persist-credentials: false persist-credentials: false
- name: Build and Check Package - name: Build and Check Package
uses: hynek/build-and-inspect-python-package@v1.5 uses: hynek/build-and-inspect-python-package@v1.5.3
deploy: deploy:
if: github.repository == 'pytest-dev/pytest' if: github.repository == 'pytest-dev/pytest'
@ -53,8 +53,8 @@ jobs:
run: | run: |
git config user.name "pytest bot" git config user.name "pytest bot"
git config user.email "pytestbot@gmail.com" git config user.email "pytestbot@gmail.com"
git tag --annotate --message=v${{ github.event.inputs.version }} v${{ github.event.inputs.version }} ${{ github.sha }} git tag --annotate --message=v${{ github.event.inputs.version }} ${{ github.event.inputs.version }} ${{ github.sha }}
git push origin v${{ github.event.inputs.version }} git push origin ${{ github.event.inputs.version }}
release-notes: release-notes:

View File

@ -35,7 +35,7 @@ jobs:
fetch-depth: 0 fetch-depth: 0
persist-credentials: false persist-credentials: false
- name: Build and Check Package - name: Build and Check Package
uses: hynek/build-and-inspect-python-package@v1.5 uses: hynek/build-and-inspect-python-package@v1.5.3
build: build:
needs: [package] needs: [package]

View File

@ -1,6 +1,6 @@
repos: repos:
- repo: https://github.com/psf/black - repo: https://github.com/psf/black
rev: 23.9.1 rev: 23.10.1
hooks: hooks:
- id: black - id: black
args: [--safe, --quiet] args: [--safe, --quiet]
@ -56,7 +56,7 @@ repos:
hooks: hooks:
- id: python-use-type-annotations - id: python-use-type-annotations
- repo: https://github.com/pre-commit/mirrors-mypy - repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.5.1 rev: v1.6.1
hooks: hooks:
- id: mypy - id: mypy
files: ^(src/|testing/) files: ^(src/|testing/)

View File

@ -9,6 +9,10 @@ python:
path: . path: .
- requirements: doc/en/requirements.txt - requirements: doc/en/requirements.txt
sphinx:
configuration: doc/en/conf.py
fail_on_warning: true
build: build:
os: ubuntu-20.04 os: ubuntu-20.04
tools: tools:

View File

@ -56,6 +56,7 @@ Barney Gale
Ben Gartner Ben Gartner
Ben Webb Ben Webb
Benjamin Peterson Benjamin Peterson
Benjamin Schubert
Bernard Pratz Bernard Pratz
Bo Wu Bo Wu
Bob Ippolito Bob Ippolito
@ -274,6 +275,7 @@ Miro Hrončok
Nathaniel Compton Nathaniel Compton
Nathaniel Waisbrot Nathaniel Waisbrot
Ned Batchelder Ned Batchelder
Neil Martin
Neven Mundar Neven Mundar
Nicholas Devenish Nicholas Devenish
Nicholas Murphy Nicholas Murphy

View File

@ -199,7 +199,7 @@ Short version
#. Fork the repository. #. Fork the repository.
#. Fetch tags from upstream if necessary (if you cloned only main `git fetch --tags https://github.com/pytest-dev/pytest`). #. Fetch tags from upstream if necessary (if you cloned only main `git fetch --tags https://github.com/pytest-dev/pytest`).
#. Enable and install `pre-commit <https://pre-commit.com>`_ to ensure style-guides and code checks are followed. #. Enable and install `pre-commit <https://pre-commit.com>`_ to ensure style-guides and code checks are followed.
#. Follow **PEP-8** for naming and `black <https://github.com/psf/black>`_ for formatting. #. Follow `PEP-8 <https://www.python.org/dev/peps/pep-0008/>`_ for naming.
#. Tests are run using ``tox``:: #. Tests are run using ``tox``::
tox -e linting,py39 tox -e linting,py39
@ -282,7 +282,7 @@ Here is a simple overview, with pytest-specific bits:
This command will run tests via the "tox" tool against Python 3.9 This command will run tests via the "tox" tool against Python 3.9
and also perform "lint" coding-style checks. and also perform "lint" coding-style checks.
#. You can now edit your local working copy and run the tests again as necessary. Please follow PEP-8 for naming. #. You can now edit your local working copy and run the tests again as necessary. Please follow `PEP-8 <https://www.python.org/dev/peps/pep-0008/>`_ for naming.
You can pass different options to ``tox``. For example, to run tests on Python 3.9 and pass options to pytest You can pass different options to ``tox``. For example, to run tests on Python 3.9 and pass options to pytest
(e.g. enter pdb on failure) to pytest you can do:: (e.g. enter pdb on failure) to pytest you can do::

View File

@ -1,2 +0,0 @@
markers are now considered in the reverse mro order to ensure base class markers are considered first
this resolves a regression.

3
changelog/11065.doc.rst Normal file
View File

@ -0,0 +1,3 @@
Use pytestconfig instead of request.config in cache example
to be consistent with the API documentation.

View File

@ -1 +0,0 @@
Fixed ``:=`` in asserts impacting unrelated test cases.

View File

@ -1 +0,0 @@
Handle an edge case where :data:`sys.stderr` might already be closed when :ref:`faulthandler` is tearing down.

View File

@ -0,0 +1 @@
Improved very verbose diff output to color it as a diff instead of only red.

View File

@ -0,0 +1 @@
Fixed crash when using an empty string for the same parametrized value more than once.

View File

@ -6,6 +6,7 @@ Release announcements
:maxdepth: 2 :maxdepth: 2
release-7.4.3
release-7.4.2 release-7.4.2
release-7.4.1 release-7.4.1
release-7.4.0 release-7.4.0

View File

@ -0,0 +1,19 @@
pytest-7.4.3
=======================================
pytest 7.4.3 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
* Marc Mueller
Happy testing,
The pytest Development Team

View File

@ -28,6 +28,21 @@ with advance notice in the **Deprecations** section of releases.
.. towncrier release notes start .. towncrier release notes start
pytest 7.4.3 (2023-10-24)
=========================
Bug Fixes
---------
- `#10447 <https://github.com/pytest-dev/pytest/issues/10447>`_: Markers are now considered in the reverse mro order to ensure base class markers are considered first -- this resolves a regression.
- `#11239 <https://github.com/pytest-dev/pytest/issues/11239>`_: Fixed ``:=`` in asserts impacting unrelated test cases.
- `#11439 <https://github.com/pytest-dev/pytest/issues/11439>`_: Handled an edge case where :data:`sys.stderr` might already be closed when :ref:`faulthandler` is tearing down.
pytest 7.4.2 (2023-09-07) pytest 7.4.2 (2023-09-07)
========================= =========================

View File

@ -22,7 +22,7 @@ Install ``pytest``
.. code-block:: bash .. code-block:: bash
$ pytest --version $ pytest --version
pytest 7.4.2 pytest 7.4.3
.. _`simpletest`: .. _`simpletest`:

View File

@ -98,6 +98,27 @@ and if you need to have access to the actual exception info you may use:
the actual exception raised. The main attributes of interest are the actual exception raised. The main attributes of interest are
``.type``, ``.value`` and ``.traceback``. ``.type``, ``.value`` and ``.traceback``.
Note that ``pytest.raises`` will match the exception type or any subclasses (like the standard ``except`` statement).
If you want to check if a block of code is raising an exact exception type, you need to check that explicitly:
.. code-block:: python
def test_foo_not_implemented():
def foo():
raise NotImplementedError
with pytest.raises(RuntimeError) as excinfo:
foo()
assert excinfo.type is RuntimeError
The :func:`pytest.raises` call will succeed, even though the function raises :class:`NotImplementedError`, because
:class:`NotImplementedError` is a subclass of :class:`RuntimeError`; however the following `assert` statement will
catch the problem.
Matching exception messages
~~~~~~~~~~~~~~~~~~~~~~~~~~~
You can pass a ``match`` keyword parameter to the context-manager to test You can pass a ``match`` keyword parameter to the context-manager to test
that a regular expression matches on the string representation of an exception that a regular expression matches on the string representation of an exception
(similar to the ``TestCase.assertRaisesRegex`` method from ``unittest``): (similar to the ``TestCase.assertRaisesRegex`` method from ``unittest``):
@ -115,9 +136,15 @@ that a regular expression matches on the string representation of an exception
with pytest.raises(ValueError, match=r".* 123 .*"): with pytest.raises(ValueError, match=r".* 123 .*"):
myfunc() myfunc()
The regexp parameter of the ``match`` parameter is matched with the ``re.search`` Notes:
function, so in the above example ``match='123'`` would have worked as
well. * The ``match`` parameter is matched with the :func:`re.search`
function, so in the above example ``match='123'`` would have worked as well.
* The ``match`` parameter also matches against `PEP-678 <https://peps.python.org/pep-0678/>`__ ``__notes__``.
Matching exception groups
~~~~~~~~~~~~~~~~~~~~~~~~~
You can also use the :func:`excinfo.group_contains() <pytest.ExceptionInfo.group_contains>` 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 ``ExceptionGroup``:
@ -165,32 +192,55 @@ exception at a specific level; exceptions contained directly in the top
assert not excinfo.group_contains(RuntimeError, depth=2) assert not excinfo.group_contains(RuntimeError, depth=2)
assert not excinfo.group_contains(TypeError, depth=1) assert not excinfo.group_contains(TypeError, depth=1)
There's an alternate form of the :func:`pytest.raises` function where you pass Alternate form (legacy)
a function that will be executed with the given ``*args`` and ``**kwargs`` and ~~~~~~~~~~~~~~~~~~~~~~~
assert that the given exception is raised:
There is an alternate form where you pass
a function that will be executed, along ``*args`` and ``**kwargs``, and :func:`pytest.raises`
will execute the function with the arguments and assert that the given exception is raised:
.. code-block:: python .. code-block:: python
pytest.raises(ExpectedException, func, *args, **kwargs) def func(x):
if x <= 0:
raise ValueError("x needs to be larger than zero")
pytest.raises(ValueError, func, x=-1)
The reporter will provide you with helpful output in case of failures such as *no The reporter will provide you with helpful output in case of failures such as *no
exception* or *wrong exception*. exception* or *wrong exception*.
Note that it is also possible to specify a "raises" argument to This form was the original :func:`pytest.raises` API, developed before the ``with`` statement was
``pytest.mark.xfail``, which checks that the test is failing in a more added to the Python language. Nowadays, this form is rarely used, with the context-manager form (using ``with``)
being considered more readable.
Nonetheless, this form is fully supported and not deprecated in any way.
xfail mark and pytest.raises
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
It is also possible to specify a ``raises`` argument to
:ref:`pytest.mark.xfail <pytest.mark.xfail ref>`, which checks that the test is failing in a more
specific way than just having any exception raised: specific way than just having any exception raised:
.. code-block:: python .. code-block:: python
def f():
raise IndexError()
@pytest.mark.xfail(raises=IndexError) @pytest.mark.xfail(raises=IndexError)
def test_f(): def test_f():
f() f()
Using :func:`pytest.raises` is likely to be better for cases where you are
testing exceptions your own code is deliberately raising, whereas using This will only "xfail" if the test fails by raising ``IndexError`` or subclasses.
``@pytest.mark.xfail`` with a check function is probably better for something
like documenting unfixed bugs (where the test describes what "should" happen) * Using :ref:`pytest.mark.xfail <pytest.mark.xfail ref>` with the ``raises`` parameter is probably better for something
or bugs in dependencies. like documenting unfixed bugs (where the test describes what "should" happen) or bugs in dependencies.
* Using :func:`pytest.raises` is likely to be better for cases where you are
testing exceptions your own code is deliberately raising, which is the majority of cases.
.. _`assertwarns`: .. _`assertwarns`:

View File

@ -213,12 +213,12 @@ across pytest invocations:
@pytest.fixture @pytest.fixture
def mydata(request): def mydata(pytestconfig):
val = request.config.cache.get("example/value", None) val = pytestconfig.cache.get("example/value", None)
if val is None: if val is None:
expensive_computation() expensive_computation()
val = 42 val = 42
request.config.cache.set("example/value", val) pytestconfig.cache.set("example/value", val)
return val return val

View File

@ -16,6 +16,12 @@ Examples for modifying traceback printing:
pytest -l # show local variables (shortcut) pytest -l # show local variables (shortcut)
pytest --no-showlocals # hide local variables (if addopts enables them) pytest --no-showlocals # hide local variables (if addopts enables them)
pytest --capture=fd # default, capture at the file descriptor level
pytest --capture=sys # capture at the sys level
pytest --capture=no # don't capture
pytest -s # don't capture (shortcut)
pytest --capture=tee-sys # capture to logs but also output to sys level streams
pytest --tb=auto # (default) 'long' tracebacks for the first and last pytest --tb=auto # (default) 'long' tracebacks for the first and last
# entry, but 'short' style for the other entries # entry, but 'short' style for the other entries
pytest --tb=long # exhaustive, informative traceback formatting pytest --tb=long # exhaustive, informative traceback formatting
@ -36,6 +42,16 @@ option you make sure a trace is shown.
Verbosity Verbosity
-------------------------------------------------- --------------------------------------------------
Examples for modifying printing verbosity:
.. code-block:: bash
pytest --quiet # quiet - less verbose - mode
pytest -q # quiet - less verbose - mode (shortcut)
pytest -v # increase verbosity, display individual test names
pytest -vv # more verbose, display more details from the test output
pytest -vvv # not a standard , but may be used for even more detail in certain setups
The ``-v`` flag controls the verbosity of pytest output in various aspects: test session progress, assertion The ``-v`` flag controls the verbosity of pytest output in various aspects: test session progress, assertion
details when tests fail, fixtures details with ``--fixtures``, etc. details when tests fail, fixtures details with ``--fixtures``, etc.

View File

@ -90,7 +90,7 @@ and can also be used to hold pytest configuration if they have a ``[pytest]`` se
setup.cfg setup.cfg
~~~~~~~~~ ~~~~~~~~~
``setup.cfg`` files are general purpose configuration files, used originally by :doc:`distutils <python:distutils/configfile>`, and can also be used to hold pytest configuration ``setup.cfg`` files are general purpose configuration files, used originally by ``distutils`` (now deprecated) and `setuptools <https://setuptools.pypa.io/en/latest/userguide/declarative_config.html>`__, and can also be used to hold pytest configuration
if they have a ``[tool:pytest]`` section. if they have a ``[tool:pytest]`` section.
.. code-block:: ini .. code-block:: ini

View File

@ -27,7 +27,7 @@ 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 creating a PDF, because otherwise the table gets far too wide for the
page. page.
This list contains 1329 plugins. This list contains 1337 plugins.
.. only:: not latex .. only:: not latex
@ -67,7 +67,7 @@ This list contains 1329 plugins.
:pypi:`pytest-allure-intersection` Oct 27, 2022 N/A pytest (<5) :pypi:`pytest-allure-intersection` Oct 27, 2022 N/A pytest (<5)
:pypi:`pytest-allure-spec-coverage` The pytest plugin aimed to display test coverage of the specs(requirements) in Allure Oct 26, 2021 N/A pytest :pypi:`pytest-allure-spec-coverage` The pytest plugin aimed to display test coverage of the specs(requirements) in Allure Oct 26, 2021 N/A pytest
:pypi:`pytest-alphamoon` Static code checks used at Alphamoon Dec 30, 2021 5 - Production/Stable pytest (>=3.5.0) :pypi:`pytest-alphamoon` Static code checks used at Alphamoon Dec 30, 2021 5 - Production/Stable pytest (>=3.5.0)
:pypi:`pytest-analyzer` this plugin allows to analyze tests in pytest project, collect test metadata and sync it with testomat.io TCM system Sep 05, 2023 N/A pytest >=7.3.1 :pypi:`pytest-analyzer` this plugin allows to analyze tests in pytest project, collect test metadata and sync it with testomat.io TCM system Oct 21, 2023 N/A pytest >=7.3.1
:pypi:`pytest-android` This fixture provides a configured "driver" for Android Automated Testing, using uiautomator2. Feb 21, 2019 3 - Alpha pytest :pypi:`pytest-android` This fixture provides a configured "driver" for Android Automated Testing, using uiautomator2. Feb 21, 2019 3 - Alpha pytest
:pypi:`pytest-anki` A pytest plugin for testing Anki add-ons Jul 31, 2022 4 - Beta pytest (>=3.5.0) :pypi:`pytest-anki` A pytest plugin for testing Anki add-ons Jul 31, 2022 4 - Beta pytest (>=3.5.0)
:pypi:`pytest-annotate` pytest-annotate: Generate PyAnnotate annotations from your pytest tests. Jun 07, 2022 3 - Alpha pytest (<8.0.0,>=3.2.0) :pypi:`pytest-annotate` pytest-annotate: Generate PyAnnotate annotations from your pytest tests. Jun 07, 2022 3 - Alpha pytest (<8.0.0,>=3.2.0)
@ -91,6 +91,7 @@ This list contains 1329 plugins.
:pypi:`pytest-argus` pyest results colection plugin Jun 24, 2021 5 - Production/Stable pytest (>=6.2.4) :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 Jan 13, 2022 4 - Beta pytest (>=4.6) :pypi:`pytest-arraydiff` pytest plugin to help with comparing array output from tests Jan 13, 2022 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-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-asptest` test Answer Set Programming programs Apr 28, 2018 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-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 :pypi:`pytest-assertions` Pytest Assertions Apr 27, 2022 N/A N/A
@ -109,7 +110,7 @@ This list contains 1329 plugins.
: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-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) :pypi:`pytest-async-mongodb` pytest plugin for async MongoDB Oct 18, 2017 5 - Production/Stable pytest (>=2.5.2)
:pypi:`pytest-async-sqlalchemy` Database testing fixtures using the SQLAlchemy asyncio API Oct 07, 2021 4 - Beta pytest (>=6.0.0) :pypi:`pytest-async-sqlalchemy` Database testing fixtures using the SQLAlchemy asyncio API Oct 07, 2021 4 - Beta pytest (>=6.0.0)
:pypi:`pytest-atf-allure` 基于allure-pytest进行自定义 Sep 14, 2023 N/A pytest (>=7.4.2,<8.0.0) :pypi:`pytest-atf-allure` 基于allure-pytest进行自定义 Oct 22, 2023 N/A pytest (>=7.4.2,<8.0.0)
:pypi:`pytest-atomic` Skip rest of tests if previous test failed. Nov 24, 2018 4 - Beta N/A :pypi:`pytest-atomic` Skip rest of tests if previous test failed. Nov 24, 2018 4 - Beta N/A
:pypi:`pytest-attrib` pytest plugin to select tests based on attributes similar to the nose-attrib plugin May 24, 2016 4 - Beta N/A :pypi:`pytest-attrib` pytest plugin to select tests based on attributes similar to the nose-attrib plugin May 24, 2016 4 - Beta N/A
:pypi:`pytest-austin` Austin plugin for pytest Oct 11, 2020 4 - Beta N/A :pypi:`pytest-austin` Austin plugin for pytest Oct 11, 2020 4 - Beta N/A
@ -206,6 +207,7 @@ This list contains 1329 plugins.
:pypi:`pytest-check-mk` pytest plugin to test Check_MK checks Nov 19, 2015 4 - Beta pytest :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-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-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 Oct 17, 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-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` 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 :pypi:`pytest-circleci-parallelized` Parallelize pytest across CircleCI workers. Oct 20, 2022 N/A N/A
@ -329,7 +331,7 @@ This list contains 1329 plugins.
:pypi:`pytest-dir-equal` pytest-dir-equals is a pytest plugin providing helpers to assert directories equality allowing golden testing Jun 23, 2023 4 - Beta pytest>=7.1.2 :pypi:`pytest-dir-equal` pytest-dir-equals is a pytest plugin providing helpers to assert directories equality allowing golden testing Jun 23, 2023 4 - Beta pytest>=7.1.2
:pypi:`pytest-disable` pytest plugin to disable a test and skip it from testrun Sep 10, 2015 4 - Beta N/A :pypi:`pytest-disable` pytest plugin to disable a test and skip it from testrun Sep 10, 2015 4 - Beta N/A
:pypi:`pytest-disable-plugin` Disable plugins per test Feb 28, 2019 4 - Beta pytest (>=3.5.0) :pypi:`pytest-disable-plugin` Disable plugins per test Feb 28, 2019 4 - Beta pytest (>=3.5.0)
:pypi:`pytest-discord` A pytest plugin to notify test results to a Discord channel. Jul 16, 2023 4 - Beta pytest (!=6.0.0,<8,>=3.3.2) :pypi:`pytest-discord` A pytest plugin to notify test results to a Discord channel. Oct 18, 2023 4 - Beta pytest !=6.0.0,<8,>=3.3.2
:pypi:`pytest-django` A Django plugin for pytest. Dec 07, 2021 5 - Production/Stable pytest (>=5.4.0) :pypi:`pytest-django` A Django plugin for pytest. Dec 07, 2021 5 - Production/Stable pytest (>=5.4.0)
:pypi:`pytest-django-ahead` A Django plugin for pytest. Oct 27, 2016 5 - Production/Stable pytest (>=2.9) :pypi:`pytest-django-ahead` A Django plugin for pytest. Oct 27, 2016 5 - Production/Stable pytest (>=2.9)
:pypi:`pytest-djangoapp` Nice pytest plugin to help you with Django pluggable application testing. May 19, 2023 4 - Beta pytest :pypi:`pytest-djangoapp` Nice pytest plugin to help you with Django pluggable application testing. May 19, 2023 4 - Beta pytest
@ -382,6 +384,7 @@ This list contains 1329 plugins.
:pypi:`pytest-donde` record pytest session characteristics per test item (coverage and duration) into a persistent file and use them in your own plugin or script. Oct 01, 2023 4 - Beta pytest >=7.3.1 :pypi:`pytest-donde` record pytest session characteristics per test item (coverage and duration) into a persistent file and use them in your own plugin or script. Oct 01, 2023 4 - Beta pytest >=7.3.1
:pypi:`pytest-doorstop` A pytest plugin for adding test results into doorstop items. Jun 09, 2020 4 - Beta pytest (>=3.5.0) :pypi:`pytest-doorstop` A pytest plugin for adding test results into doorstop items. Jun 09, 2020 4 - Beta pytest (>=3.5.0)
:pypi:`pytest-dotenv` A py.test plugin that parses environment files before running tests Jun 16, 2020 4 - Beta pytest (>=5.0.0) :pypi:`pytest-dotenv` A py.test plugin that parses environment files before running tests Jun 16, 2020 4 - Beta pytest (>=5.0.0)
:pypi:`pytest-dot-only-pkcopley` A Pytest marker for only running a single test Oct 27, 2023 N/A N/A
:pypi:`pytest-draw` Pytest plugin for randomly selecting a specific number of tests Mar 21, 2023 3 - Alpha pytest :pypi:`pytest-draw` Pytest plugin for randomly selecting a specific number of tests Mar 21, 2023 3 - Alpha pytest
:pypi:`pytest-drf` A Django REST framework plugin for pytest. Jul 12, 2022 5 - Production/Stable pytest (>=3.7) :pypi:`pytest-drf` A Django REST framework plugin for pytest. Jul 12, 2022 5 - Production/Stable pytest (>=3.7)
:pypi:`pytest-drivings` Tool to allow webdriver automation to be ran locally or remotely Jan 13, 2021 N/A N/A :pypi:`pytest-drivings` Tool to allow webdriver automation to be ran locally or remotely Jan 13, 2021 N/A N/A
@ -423,7 +426,7 @@ This list contains 1329 plugins.
:pypi:`pytest-encoding` set your encoding and logger Aug 11, 2023 N/A pytest :pypi:`pytest-encoding` set your encoding and logger Aug 11, 2023 N/A pytest
:pypi:`pytest-enhanced-reports` Enhanced test reports for pytest Dec 15, 2022 N/A N/A :pypi:`pytest-enhanced-reports` Enhanced test reports for pytest Dec 15, 2022 N/A N/A
:pypi:`pytest-enhancements` Improvements for pytest (rejected upstream) Oct 30, 2019 4 - Beta N/A :pypi:`pytest-enhancements` Improvements for pytest (rejected upstream) Oct 30, 2019 4 - Beta N/A
:pypi:`pytest-env` py.test plugin that allows you to add environment variables. Aug 24, 2023 5 - Production/Stable pytest>=7.3.1 :pypi:`pytest-env` pytest plugin that allows you to add environment variables. Oct 24, 2023 5 - Production/Stable pytest>=7.4.2
:pypi:`pytest-envfiles` A py.test plugin that parses environment files before running tests Oct 08, 2015 3 - Alpha N/A :pypi:`pytest-envfiles` A py.test plugin that parses environment files before running tests Oct 08, 2015 3 - Alpha N/A
:pypi:`pytest-env-info` Push information about the running pytest into envvars Nov 25, 2017 4 - Beta pytest (>=3.1.1) :pypi:`pytest-env-info` Push information about the running pytest into envvars Nov 25, 2017 4 - Beta pytest (>=3.1.1)
:pypi:`pytest-envraw` py.test plugin that allows you to add environment variables. Aug 27, 2020 4 - Beta pytest (>=2.6.0) :pypi:`pytest-envraw` py.test plugin that allows you to add environment variables. Aug 27, 2020 4 - Beta pytest (>=2.6.0)
@ -463,7 +466,7 @@ This list contains 1329 plugins.
:pypi:`pytest-failed-screen-record` Create a video of the screen when pytest fails Jan 05, 2023 4 - Beta pytest (>=7.1.2d,<8.0.0) :pypi:`pytest-failed-screen-record` Create a video of the screen when pytest fails Jan 05, 2023 4 - Beta pytest (>=7.1.2d,<8.0.0)
:pypi:`pytest-failed-screenshot` Test case fails,take a screenshot,save it,attach it to the allure Apr 21, 2021 N/A N/A :pypi:`pytest-failed-screenshot` Test case fails,take a screenshot,save it,attach it to the allure Apr 21, 2021 N/A N/A
:pypi:`pytest-failed-to-verify` A pytest plugin that helps better distinguishing real test failures from setup flakiness. Aug 08, 2019 5 - Production/Stable pytest (>=4.1.0) :pypi:`pytest-failed-to-verify` A pytest plugin that helps better distinguishing real test failures from setup flakiness. Aug 08, 2019 5 - Production/Stable pytest (>=4.1.0)
:pypi:`pytest-fail-slow` Fail tests that take too long to run Aug 13, 2022 4 - Beta pytest (>=6.0) :pypi:`pytest-fail-slow` Fail tests that take too long to run Oct 21, 2023 N/A pytest >=6.0
:pypi:`pytest-faker` Faker integration with the pytest framework. Dec 19, 2016 6 - Mature N/A :pypi:`pytest-faker` Faker integration with the pytest framework. Dec 19, 2016 6 - Mature N/A
:pypi:`pytest-falcon` Pytest helpers for Falcon. Sep 07, 2016 4 - Beta N/A :pypi:`pytest-falcon` Pytest helpers for Falcon. Sep 07, 2016 4 - Beta N/A
:pypi:`pytest-falcon-client` Pytest \`client\` fixture for the Falcon Framework Mar 19, 2019 N/A N/A :pypi:`pytest-falcon-client` Pytest \`client\` fixture for the Falcon Framework Mar 19, 2019 N/A N/A
@ -500,7 +503,7 @@ This list contains 1329 plugins.
:pypi:`pytest-flakefinder` Runs tests multiple times to expose flakiness. Oct 26, 2022 4 - Beta pytest (>=2.7.1) :pypi:`pytest-flakefinder` Runs tests multiple times to expose flakiness. Oct 26, 2022 4 - Beta pytest (>=2.7.1)
:pypi:`pytest-flakes` pytest plugin to check source code with pyflakes Dec 02, 2021 5 - Production/Stable pytest (>=5) :pypi:`pytest-flakes` pytest plugin to check source code with pyflakes Dec 02, 2021 5 - Production/Stable pytest (>=5)
:pypi:`pytest-flaptastic` Flaptastic py.test plugin Mar 17, 2019 N/A N/A :pypi:`pytest-flaptastic` Flaptastic py.test plugin Mar 17, 2019 N/A N/A
:pypi:`pytest-flask` A set of py.test fixtures to test Flask applications. Feb 27, 2021 5 - Production/Stable pytest (>=5.2) :pypi:`pytest-flask` A set of py.test fixtures to test Flask applications. Oct 23, 2023 5 - Production/Stable pytest >=5.2
:pypi:`pytest-flask-ligand` Pytest fixtures and helper functions to use for testing flask-ligand microservices. Apr 25, 2023 4 - Beta pytest (~=7.3) :pypi:`pytest-flask-ligand` Pytest fixtures and helper functions to use for testing flask-ligand microservices. Apr 25, 2023 4 - Beta pytest (~=7.3)
:pypi:`pytest-flask-sqlalchemy` A pytest plugin for preserving test isolation in Flask-SQlAlchemy using database transactions. Apr 30, 2022 4 - Beta pytest (>=3.2.1) :pypi:`pytest-flask-sqlalchemy` A pytest plugin for preserving test isolation in Flask-SQlAlchemy using database transactions. Apr 30, 2022 4 - Beta pytest (>=3.2.1)
:pypi:`pytest-flask-sqlalchemy-transactions` Run tests in transactions using pytest, Flask, and SQLalchemy. Aug 02, 2018 4 - Beta pytest (>=3.2.1) :pypi:`pytest-flask-sqlalchemy-transactions` Run tests in transactions using pytest, Flask, and SQLalchemy. Aug 02, 2018 4 - Beta pytest (>=3.2.1)
@ -530,9 +533,9 @@ This list contains 1329 plugins.
:pypi:`pytest-gherkin` A flexible framework for executing BDD gherkin tests Jul 27, 2019 3 - Alpha pytest (>=5.0.0) :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-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-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. Oct 09, 2023 N/A N/A :pypi:`pytest-girder` A set of pytest fixtures for testing Girder applications. Oct 26, 2023 N/A N/A
:pypi:`pytest-git` Git repository fixture for py.test May 28, 2019 5 - Production/Stable pytest :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 14, 2023 4 - Beta pytest>=7.1.2 :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 :pypi:`pytest-gitcov` Pytest plugin for reporting on coverage of the last git commit. Jan 11, 2020 2 - Pre-Alpha N/A
:pypi:`pytest-git-fixtures` Pytest fixtures for testing with git. Mar 11, 2021 4 - Beta pytest :pypi:`pytest-git-fixtures` Pytest fixtures for testing with git. Mar 11, 2021 4 - Beta pytest
:pypi:`pytest-github` Plugin for py.test that associates tests with github issues using a marker. Mar 07, 2019 5 - Production/Stable N/A :pypi:`pytest-github` Plugin for py.test that associates tests with github issues using a marker. Mar 07, 2019 5 - Production/Stable N/A
@ -567,7 +570,7 @@ This list contains 1329 plugins.
:pypi:`pytest-historic-hook` Custom listener to store execution results into MYSQL DB, which is used for pytest-historic report Apr 08, 2020 N/A pytest :pypi:`pytest-historic-hook` Custom listener to store execution results into MYSQL DB, which is used for pytest-historic report Apr 08, 2020 N/A pytest
:pypi:`pytest-home` Home directory fixtures Oct 09, 2023 5 - Production/Stable pytest :pypi:`pytest-home` Home directory fixtures Oct 09, 2023 5 - Production/Stable pytest
:pypi:`pytest-homeassistant` A pytest plugin for use with homeassistant custom components. Aug 12, 2020 4 - Beta N/A :pypi:`pytest-homeassistant` A pytest plugin for use with homeassistant custom components. Aug 12, 2020 4 - Beta N/A
:pypi:`pytest-homeassistant-custom-component` Experimental package to automatically extract test plugins for Home Assistant custom components Oct 14, 2023 3 - Alpha pytest ==7.3.1 :pypi:`pytest-homeassistant-custom-component` Experimental package to automatically extract test plugins for Home Assistant custom components Oct 28, 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-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-honors` Report on tests that honor constraints, and guard against regressions Mar 06, 2020 4 - Beta N/A
:pypi:`pytest-hot-reloading` Jun 23, 2023 N/A N/A :pypi:`pytest-hot-reloading` Jun 23, 2023 N/A N/A
@ -583,7 +586,7 @@ This list contains 1329 plugins.
: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 Mar 04, 2022 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-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-reporter` Generates a static html report based on pytest framework Feb 13, 2022 N/A N/A
:pypi:`pytest-html-report-merger` Aug 31, 2022 N/A N/A :pypi:`pytest-html-report-merger` Oct 23, 2023 N/A N/A
:pypi:`pytest-html-thread` pytest plugin for generating HTML reports Dec 29, 2020 5 - Production/Stable N/A :pypi:`pytest-html-thread` pytest plugin for generating HTML reports Dec 29, 2020 5 - Production/Stable N/A
:pypi:`pytest-http` Fixture "http" for http requests Dec 05, 2019 N/A N/A :pypi:`pytest-http` Fixture "http" for http requests Dec 05, 2019 N/A N/A
:pypi:`pytest-httpbin` Easily test your HTTP library against a local copy of httpbin May 08, 2023 5 - Production/Stable pytest ; extra == 'test' :pypi:`pytest-httpbin` Easily test your HTTP library against a local copy of httpbin May 08, 2023 5 - Production/Stable pytest ; extra == 'test'
@ -613,7 +616,7 @@ This list contains 1329 plugins.
:pypi:`pytest-informative-node` display more node ininformation. Apr 25, 2019 4 - Beta N/A :pypi:`pytest-informative-node` display more node ininformation. Apr 25, 2019 4 - Beta N/A
:pypi:`pytest-infrastructure` pytest stack validation prior to testing executing Apr 12, 2020 4 - Beta N/A :pypi:`pytest-infrastructure` pytest stack validation prior to testing executing Apr 12, 2020 4 - Beta N/A
:pypi:`pytest-ini` Reuse pytest.ini to store env variables Apr 26, 2022 N/A N/A :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 10, 2023 4 - Beta pytest >=7.0.0 :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. Aug 03, 2023 5 - Production/Stable N/A :pypi:`pytest-inmanta` A py.test plugin providing fixtures to simplify inmanta modules testing. Aug 03, 2023 5 - Production/Stable N/A
:pypi:`pytest-inmanta-extensions` Inmanta tests package Oct 13, 2023 5 - Production/Stable N/A :pypi:`pytest-inmanta-extensions` Inmanta tests package Oct 13, 2023 5 - Production/Stable N/A
:pypi:`pytest-inmanta-lsm` Common fixtures for inmanta LSM related modules May 17, 2023 5 - Production/Stable N/A :pypi:`pytest-inmanta-lsm` Common fixtures for inmanta LSM related modules May 17, 2023 5 - Production/Stable N/A
@ -692,7 +695,7 @@ This list contains 1329 plugins.
:pypi:`pytest-litter` Pytest plugin which verifies that tests do not modify file trees. Aug 08, 2023 4 - Beta pytest >=6.1 :pypi:`pytest-litter` Pytest plugin which verifies that tests do not modify file trees. Aug 08, 2023 4 - Beta pytest >=6.1
:pypi:`pytest-live` Live results for pytest Mar 08, 2020 N/A pytest :pypi:`pytest-live` Live results for pytest Mar 08, 2020 N/A pytest
:pypi:`pytest-local-badge` Generate local badges (shields) reporting your test suite status. Jan 15, 2023 N/A pytest (>=6.1.0) :pypi:`pytest-local-badge` Generate local badges (shields) reporting your test suite status. Jan 15, 2023 N/A pytest (>=6.1.0)
:pypi:`pytest-localftpserver` A PyTest plugin which provides an FTP fixture for your tests Oct 04, 2022 5 - Production/Stable pytest :pypi:`pytest-localftpserver` A PyTest plugin which provides an FTP fixture for your tests Oct 14, 2023 5 - Production/Stable pytest
:pypi:`pytest-localserver` pytest plugin to test server connections locally. Oct 12, 2023 4 - Beta N/A :pypi:`pytest-localserver` pytest plugin to test server connections locally. Oct 12, 2023 4 - Beta N/A
:pypi:`pytest-localstack` Pytest plugin for AWS integration tests Jun 07, 2023 4 - Beta pytest (>=6.0.0,<7.0.0) :pypi:`pytest-localstack` Pytest plugin for AWS integration tests Jun 07, 2023 4 - Beta pytest (>=6.0.0,<7.0.0)
:pypi:`pytest-lockable` lockable resource plugin for pytest Aug 09, 2023 5 - Production/Stable pytest :pypi:`pytest-lockable` lockable resource plugin for pytest Aug 09, 2023 5 - Production/Stable pytest
@ -745,7 +748,7 @@ This list contains 1329 plugins.
:pypi:`pytest-missing-fixtures` Pytest plugin that creates missing fixtures Oct 14, 2020 4 - Beta pytest (>=3.5.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-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) :pypi:`pytest-mocha` pytest plugin to display test execution output like a mochajs Apr 02, 2020 4 - Beta pytest (>=5.4.0)
:pypi:`pytest-mock` Thin-wrapper around the mock package for easier use with pytest Jun 15, 2023 5 - Production/Stable pytest (>=5.0) :pypi:`pytest-mock` Thin-wrapper around the mock package for easier use with pytest Oct 19, 2023 5 - Production/Stable pytest >=5.0
:pypi:`pytest-mock-api` A mock API server with configurable routes and responses available as a fixture. Feb 13, 2019 1 - Planning pytest (>=4.0.0) :pypi:`pytest-mock-api` A mock API server with configurable routes and responses available as a fixture. Feb 13, 2019 1 - Planning pytest (>=4.0.0)
:pypi:`pytest-mock-generator` A pytest fixture wrapper for https://pypi.org/project/mock-generator May 16, 2022 5 - Production/Stable N/A :pypi:`pytest-mock-generator` A pytest fixture wrapper for https://pypi.org/project/mock-generator May 16, 2022 5 - Production/Stable N/A
:pypi:`pytest-mock-helper` Help you mock HTTP call and generate mock code Jan 24, 2018 N/A pytest :pypi:`pytest-mock-helper` Help you mock HTTP call and generate mock code Jan 24, 2018 N/A pytest
@ -784,10 +787,10 @@ This list contains 1329 plugins.
:pypi:`pytest-mypy-plugins-shim` Substitute for "pytest-mypy-plugins" for Python implementations which aren't supported by mypy. Apr 12, 2021 N/A pytest>=6.0.0 :pypi:`pytest-mypy-plugins-shim` Substitute for "pytest-mypy-plugins" for Python implementations which aren't supported by mypy. Apr 12, 2021 N/A pytest>=6.0.0
:pypi:`pytest-mypy-testing` Pytest plugin to check mypy output. Feb 25, 2023 N/A pytest>=7,<8 :pypi:`pytest-mypy-testing` Pytest plugin to check mypy output. Feb 25, 2023 N/A pytest>=7,<8
:pypi:`pytest-mysql` MySQL process and client fixtures for pytest Mar 27, 2023 5 - Production/Stable pytest (>=6.2) :pypi:`pytest-mysql` MySQL process and client fixtures for pytest Mar 27, 2023 5 - Production/Stable pytest (>=6.2)
:pypi:`pytest-ndb` Open Source Software Health Report Jul 19, 2023 N/A pytest :pypi:`pytest-ndb` pytest notebook debugger Oct 15, 2023 N/A pytest
:pypi:`pytest-needle` pytest plugin for visual testing websites using selenium Dec 10, 2018 4 - Beta pytest (<5.0.0,>=3.0.0) :pypi:`pytest-needle` pytest plugin for visual testing websites using selenium Dec 10, 2018 4 - Beta pytest (<5.0.0,>=3.0.0)
:pypi:`pytest-neo` pytest-neo is a plugin for pytest that shows tests like screen of Matrix. Jan 08, 2022 3 - Alpha pytest (>=6.2.0) :pypi:`pytest-neo` pytest-neo is a plugin for pytest that shows tests like screen of Matrix. Jan 08, 2022 3 - Alpha pytest (>=6.2.0)
:pypi:`pytest-netdut` "Automated software testing for switches using pytest" Sep 21, 2023 N/A pytest <7.3,>=3.5.0 :pypi:`pytest-netdut` "Automated software testing for switches using pytest" Oct 26, 2023 N/A pytest <7.3,>=3.5.0
:pypi:`pytest-network` A simple plugin to disable network on socket level. May 07, 2020 N/A N/A :pypi:`pytest-network` A simple plugin to disable network on socket level. May 07, 2020 N/A N/A
:pypi:`pytest-network-endpoints` Network endpoints plugin for pytest Mar 06, 2022 N/A pytest :pypi:`pytest-network-endpoints` Network endpoints plugin for pytest Mar 06, 2022 N/A pytest
:pypi:`pytest-never-sleep` pytest plugin helps to avoid adding tests without mock \`time.sleep\` May 05, 2021 3 - Alpha pytest (>=3.5.1) :pypi:`pytest-never-sleep` pytest plugin helps to avoid adding tests without mock \`time.sleep\` May 05, 2021 3 - Alpha pytest (>=3.5.1)
@ -846,6 +849,7 @@ This list contains 1329 plugins.
:pypi:`pytest-parametrize-cases` A more user-friendly way to write parametrized tests. Mar 13, 2022 N/A pytest (>=6.1.2) :pypi:`pytest-parametrize-cases` A more user-friendly way to write parametrized tests. Mar 13, 2022 N/A pytest (>=6.1.2)
:pypi:`pytest-parametrized` Pytest decorator for parametrizing tests with default iterables. Sep 13, 2022 5 - Production/Stable pytest :pypi:`pytest-parametrized` Pytest decorator for parametrizing tests with default iterables. Sep 13, 2022 5 - Production/Stable pytest
:pypi:`pytest-parametrize-suite` A simple pytest extension for creating a named test suite. Jan 19, 2023 5 - Production/Stable pytest :pypi:`pytest-parametrize-suite` A simple pytest extension for creating a named test suite. Jan 19, 2023 5 - Production/Stable pytest
:pypi:`pytest-param-scope` pytest parametrize scope fixture workaround Oct 18, 2023 N/A pytest
:pypi:`pytest-parawtf` Finally spell paramete?ri[sz]e correctly Dec 03, 2018 4 - Beta pytest (>=3.6.0) :pypi:`pytest-parawtf` Finally spell paramete?ri[sz]e correctly Dec 03, 2018 4 - Beta pytest (>=3.6.0)
:pypi:`pytest-pass` Check out https://github.com/elilutsky/pytest-pass Dec 04, 2019 N/A N/A :pypi:`pytest-pass` Check out https://github.com/elilutsky/pytest-pass Dec 04, 2019 N/A N/A
:pypi:`pytest-passrunner` Pytest plugin providing the 'run_on_pass' marker Feb 10, 2021 5 - Production/Stable pytest (>=4.6.0) :pypi:`pytest-passrunner` Pytest plugin providing the 'run_on_pass' marker Feb 10, 2021 5 - Production/Stable pytest (>=4.6.0)
@ -885,10 +889,10 @@ This list contains 1329 plugins.
:pypi:`pytest-plone` Pytest plugin to test Plone addons Jan 05, 2023 3 - Alpha pytest :pypi:`pytest-plone` Pytest plugin to test Plone addons Jan 05, 2023 3 - Alpha pytest
:pypi:`pytest-plt` Fixtures for quickly making Matplotlib plots in tests Aug 17, 2020 5 - Production/Stable pytest :pypi:`pytest-plt` Fixtures for quickly making Matplotlib plots in tests Aug 17, 2020 5 - Production/Stable pytest
:pypi:`pytest-plugin-helpers` A plugin to help developing and testing other plugins Nov 23, 2019 4 - Beta pytest (>=3.5.0) :pypi:`pytest-plugin-helpers` A plugin to help developing and testing other plugins Nov 23, 2019 4 - Beta pytest (>=3.5.0)
:pypi:`pytest-plus` PyTest Plus Plugin :: extends pytest functionality Dec 24, 2022 5 - Production/Stable pytest (>=6.0.1) :pypi:`pytest-plus` PyTest Plus Plugin :: extends pytest functionality Oct 18, 2023 5 - Production/Stable pytest >=7.4.2
:pypi:`pytest-pmisc` Mar 21, 2019 5 - Production/Stable N/A :pypi:`pytest-pmisc` Mar 21, 2019 5 - Production/Stable N/A
:pypi:`pytest-pointers` Pytest plugin to define functions you test with special marks for better navigation and reports Dec 26, 2022 N/A N/A :pypi:`pytest-pointers` Pytest plugin to define functions you test with special marks for better navigation and reports Dec 26, 2022 N/A N/A
:pypi:`pytest-pokie` Pokie plugin for pytest May 22, 2023 5 - Production/Stable N/A :pypi:`pytest-pokie` Pokie plugin for pytest Oct 19, 2023 5 - Production/Stable N/A
:pypi:`pytest-polarion-cfme` pytest plugin for collecting test cases and recording test results Nov 13, 2017 3 - Alpha N/A :pypi:`pytest-polarion-cfme` pytest plugin for collecting test cases and recording test results Nov 13, 2017 3 - Alpha N/A
:pypi:`pytest-polarion-collect` pytest plugin for collecting polarion test cases data Jun 18, 2020 3 - Alpha pytest :pypi:`pytest-polarion-collect` pytest plugin for collecting polarion test cases data Jun 18, 2020 3 - Alpha pytest
:pypi:`pytest-polecat` Provides Polecat pytest fixtures Aug 12, 2019 4 - Beta N/A :pypi:`pytest-polecat` Provides Polecat pytest fixtures Aug 12, 2019 4 - Beta N/A
@ -935,7 +939,7 @@ This list contains 1329 plugins.
:pypi:`pytest-pyq` Pytest fixture "q" for pyq Mar 10, 2020 5 - Production/Stable N/A :pypi:`pytest-pyq` Pytest fixture "q" for pyq Mar 10, 2020 5 - Production/Stable N/A
:pypi:`pytest-pyramid` pytest_pyramid - provides fixtures for testing pyramid applications with pytest test suite Oct 11, 2023 5 - Production/Stable pytest :pypi:`pytest-pyramid` pytest_pyramid - provides fixtures for testing pyramid applications with pytest test suite Oct 11, 2023 5 - Production/Stable pytest
:pypi:`pytest-pyramid-server` Pyramid server fixture for py.test May 28, 2019 5 - Production/Stable pytest :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 Aug 27, 2023 N/A pytest :pypi:`pytest-pyreport` PyReport is a lightweight reporting plugin for Pytest that provides concise HTML report Oct 21, 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-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-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-pystack` Plugin to run pystack after a timeout for a test suite. May 07, 2023 N/A pytest (>=3.5.0)
@ -999,8 +1003,9 @@ This list contains 1329 plugins.
:pypi:`pytest-reportlog` Replacement for the --resultlog option, focused in simplicity and extensibility May 22, 2023 3 - Alpha pytest :pypi:`pytest-reportlog` Replacement for the --resultlog option, focused in simplicity and extensibility May 22, 2023 3 - Alpha pytest
:pypi:`pytest-report-me` A pytest plugin to generate report. Dec 31, 2020 N/A pytest :pypi:`pytest-report-me` A pytest plugin to generate report. Dec 31, 2020 N/A pytest
:pypi:`pytest-report-parameters` pytest plugin for adding tests' parameters to junit report Jun 18, 2020 3 - Alpha pytest (>=2.4.2) :pypi:`pytest-report-parameters` pytest plugin for adding tests' parameters to junit report Jun 18, 2020 3 - Alpha pytest (>=2.4.2)
:pypi:`pytest-reportportal` Agent for Reporting results of tests to the Report Portal Sep 25, 2023 N/A pytest >=3.8.0 :pypi:`pytest-reportportal` Agent for Reporting results of tests to the Report Portal Oct 17, 2023 N/A pytest >=3.8.0
:pypi:`pytest-reports` An interesting python package Jun 07, 2023 N/A N/A :pypi:`pytest-reports` An interesting python package Jun 07, 2023 N/A N/A
:pypi:`pytest-report-stream` A pytest plugin which allows to stream test reports at runtime Oct 22, 2023 4 - Beta N/A
:pypi:`pytest-reqs` pytest plugin to check pinned requirements May 12, 2019 N/A pytest (>=2.4.2) :pypi:`pytest-reqs` pytest plugin to check pinned requirements May 12, 2019 N/A pytest (>=2.4.2)
:pypi:`pytest-requests` A simple plugin to use with pytest Jun 24, 2019 4 - Beta pytest (>=3.5.0) :pypi:`pytest-requests` A simple plugin to use with pytest Jun 24, 2019 4 - Beta pytest (>=3.5.0)
:pypi:`pytest-requestselapsed` collect and show http requests elapsed time Aug 14, 2022 N/A N/A :pypi:`pytest-requestselapsed` collect and show http requests elapsed time Aug 14, 2022 N/A N/A
@ -1019,7 +1024,7 @@ This list contains 1329 plugins.
:pypi:`pytest-responses` py.test integration for responses Oct 11, 2022 N/A pytest (>=2.5) :pypi:`pytest-responses` py.test integration for responses Oct 11, 2022 N/A pytest (>=2.5)
:pypi:`pytest-rest-api` Aug 08, 2022 N/A pytest (>=7.1.2,<8.0.0) :pypi:`pytest-rest-api` Aug 08, 2022 N/A pytest (>=7.1.2,<8.0.0)
:pypi:`pytest-restrict` Pytest plugin to restrict the test types allowed Jul 10, 2023 5 - Production/Stable pytest :pypi:`pytest-restrict` Pytest plugin to restrict the test types allowed Jul 10, 2023 5 - Production/Stable pytest
:pypi:`pytest-result-log` Write the execution result of the case to the log Apr 17, 2023 N/A pytest>=7.2.0 :pypi:`pytest-result-log` A pytest plugin that records the start, end, and result information of each use case in a log file Oct 15, 2023 N/A pytest>=7.2.0
:pypi:`pytest-result-sender` Apr 20, 2023 N/A pytest>=7.3.1 :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-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-rethinkdb` A RethinkDB plugin for pytest. Jul 24, 2016 4 - Beta N/A
@ -1028,6 +1033,7 @@ This list contains 1329 plugins.
:pypi:`pytest-reusable-testcases` Apr 28, 2023 N/A N/A :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 :pypi:`pytest-reverse` Pytest plugin to reverse test order. Jul 10, 2023 5 - Production/Stable pytest
:pypi:`pytest-rich` Leverage rich for richer test session output Mar 03, 2022 4 - Beta pytest (>=7.0) :pypi:`pytest-rich` Leverage rich for richer test session output Mar 03, 2022 4 - Beta pytest (>=7.0)
:pypi:`pytest-richer` Pytest plugin providing a Rich based reporter. Oct 27, 2023 3 - Alpha pytest
:pypi:`pytest-rich-reporter` A pytest plugin using Rich for beautiful test result formatting. Feb 17, 2022 1 - Planning pytest (>=5.0.0) :pypi:`pytest-rich-reporter` A pytest plugin using Rich for beautiful test result formatting. Feb 17, 2022 1 - Planning pytest (>=5.0.0)
:pypi:`pytest-richtrace` A pytest plugin that displays the names and information of the pytest hook functions as they are executed. Jun 20, 2023 N/A N/A :pypi:`pytest-richtrace` A pytest plugin that displays the names and information of the pytest hook functions as they are executed. Jun 20, 2023 N/A N/A
:pypi:`pytest-ringo` pytest plugin to test webapplications using the Ringo webframework Sep 27, 2017 3 - Alpha N/A :pypi:`pytest-ringo` pytest plugin to test webapplications using the Ringo webframework Sep 27, 2017 3 - Alpha N/A
@ -1057,7 +1063,7 @@ This list contains 1329 plugins.
:pypi:`pytest-sanic` a pytest plugin for Sanic Oct 25, 2021 N/A pytest (>=5.2) :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-sanity` Dec 07, 2020 N/A N/A
:pypi:`pytest-sa-pg` May 14, 2019 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. Oct 13, 2023 5 - Production/Stable N/A :pypi:`pytest-sbase` A complete web automation framework for end-to-end testing. Oct 27, 2023 5 - Production/Stable N/A
:pypi:`pytest-scenario` pytest plugin for test scenarios Feb 06, 2017 3 - Alpha 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-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) :pypi:`pytest-schema` 👍 Validate return values against a schema-like object in testing Mar 14, 2022 5 - Production/Stable pytest (>=3.5.0)
@ -1065,8 +1071,8 @@ This list contains 1329 plugins.
:pypi:`pytest-securestore` An encrypted password store for use within pytest cases Nov 08, 2021 4 - Beta N/A :pypi:`pytest-securestore` An encrypted password store for use within pytest cases Nov 08, 2021 4 - Beta N/A
: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-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 May 28, 2023 5 - Production/Stable pytest>=6.0.0 :pypi:`pytest-selenium` pytest plugin for Selenium May 28, 2023 5 - Production/Stable pytest>=6.0.0
:pypi:`pytest-selenium-auto` pytest plugin to automatically capture screenshots upon selenium webdriver events Oct 03, 2023 N/A pytest >= 7.0.0 :pypi:`pytest-selenium-auto` pytest plugin to automatically capture screenshots upon selenium webdriver events Oct 18, 2023 N/A pytest >= 7.0.0
:pypi:`pytest-seleniumbase` A complete web automation framework for end-to-end testing. Oct 13, 2023 5 - Production/Stable N/A :pypi:`pytest-seleniumbase` A complete web automation framework for end-to-end testing. Oct 27, 2023 5 - Production/Stable N/A
:pypi:`pytest-selenium-enhancer` pytest plugin for Selenium Apr 29, 2022 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-selenium-pdiff` A pytest package implementing perceptualdiff for Selenium tests. Apr 06, 2017 2 - Pre-Alpha N/A
:pypi:`pytest-selenium-screenshot` pytest plugin to automatically capture screenshots upon selenium webdriver events Aug 22, 2023 N/A pytest >= 7.0.0 :pypi:`pytest-selenium-screenshot` pytest plugin to automatically capture screenshots upon selenium webdriver events Aug 22, 2023 N/A pytest >= 7.0.0
@ -1095,7 +1101,7 @@ This list contains 1329 plugins.
:pypi:`pytest-simple-plugin` Simple pytest plugin Nov 27, 2019 N/A N/A :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-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-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 Jul 31, 2023 5 - Production/Stable pytest (>=7.1.0) :pypi:`pytest-skip-markers` Pytest Salt Plugin Oct 20, 2023 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-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-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 :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,8 +1144,8 @@ This list contains 1329 plugins.
:pypi:`pytest-splitio` Split.io SDK integration for e2e tests Sep 22, 2020 N/A pytest (<7,>=5.0) :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` 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-split-tests-tresorit` Feb 22, 2021 1 - Planning N/A
:pypi:`pytest-splunk-addon` A Dynamic test tool for Splunk Apps and Add-ons Sep 06, 2023 N/A pytest (>5.4.0,<8) :pypi:`pytest-splunk-addon` A Dynamic test tool for Splunk Apps and Add-ons Oct 23, 2023 N/A pytest (>5.4.0,<8)
:pypi:`pytest-splunk-addon-ui-smartx` Library to support testing Splunk Add-on UX Oct 02, 2023 N/A N/A :pypi:`pytest-splunk-addon-ui-smartx` Library to support testing Splunk Add-on UX Oct 27, 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-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 :pypi:`pytest-sqitch` sqitch for pytest Apr 06, 2020 4 - Beta N/A
:pypi:`pytest-sqlalchemy` pytest plugin with sqlalchemy related fixtures Mar 13, 2018 3 - Alpha N/A :pypi:`pytest-sqlalchemy` pytest plugin with sqlalchemy related fixtures Mar 13, 2018 3 - Alpha N/A
@ -1204,7 +1210,7 @@ This list contains 1329 plugins.
:pypi:`pytest-testinfra-jpic` Test infrastructures Sep 21, 2023 5 - Production/Stable N/A :pypi:`pytest-testinfra-jpic` Test infrastructures Sep 21, 2023 5 - Production/Stable N/A
:pypi:`pytest-testinfra-winrm-transport` Test infrastructures Sep 21, 2023 5 - Production/Stable N/A :pypi:`pytest-testinfra-winrm-transport` Test infrastructures Sep 21, 2023 5 - Production/Stable N/A
:pypi:`pytest-testlink-adaptor` pytest reporting plugin for testlink Dec 20, 2018 4 - Beta pytest (>=2.6) :pypi:`pytest-testlink-adaptor` pytest reporting plugin for testlink Dec 20, 2018 4 - Beta pytest (>=2.6)
:pypi:`pytest-testmon` selects tests affected by changed files and methods Jul 13, 2023 4 - Beta pytest (<8,>=5) :pypi:`pytest-testmon` selects tests affected by changed files and methods Oct 17, 2023 4 - Beta pytest <8,>=5
:pypi:`pytest-testmon-dev` selects tests affected by changed files and methods Mar 30, 2023 4 - Beta pytest (<8,>=5) :pypi:`pytest-testmon-dev` selects tests affected by changed files and methods Mar 30, 2023 4 - Beta pytest (<8,>=5)
:pypi:`pytest-testmon-oc` nOly selects tests affected by changed files and methods Jun 01, 2022 4 - Beta pytest (<8,>=5) :pypi:`pytest-testmon-oc` nOly selects tests affected by changed files and methods Jun 01, 2022 4 - Beta pytest (<8,>=5)
:pypi:`pytest-testmon-skip-libraries` selects tests affected by changed files and methods Mar 03, 2023 4 - Beta pytest (<8,>=5) :pypi:`pytest-testmon-skip-libraries` selects tests affected by changed files and methods Mar 03, 2023 4 - Beta pytest (<8,>=5)
@ -1306,6 +1312,7 @@ This list contains 1329 plugins.
:pypi:`pytest-verbose-parametrize` More descriptive output for parametrized py.test tests May 28, 2019 5 - Production/Stable 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-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 :pypi:`pytest-virtualenv` Virtualenv fixture for py.test May 28, 2019 5 - Production/Stable pytest
:pypi:`pytest-visual` Oct 24, 2023 3 - Alpha pytest >=7.0.0
:pypi:`pytest-vnc` VNC client for Pytest Feb 25, 2023 N/A pytest :pypi:`pytest-vnc` VNC client for Pytest Feb 25, 2023 N/A pytest
:pypi:`pytest-voluptuous` Pytest plugin for asserting data against voluptuous schema. Jun 09, 2020 N/A pytest :pypi:`pytest-voluptuous` Pytest plugin for asserting data against voluptuous schema. Jun 09, 2020 N/A pytest
:pypi:`pytest-vscodedebug` A pytest plugin to easily enable debugging tests within Visual Studio Code Dec 04, 2020 4 - Beta N/A :pypi:`pytest-vscodedebug` A pytest plugin to easily enable debugging tests within Visual Studio Code Dec 04, 2020 4 - Beta N/A
@ -1322,6 +1329,7 @@ This list contains 1329 plugins.
:pypi:`pytest-web3-data` A pytest plugin to fetch test data from IPFS HTTP gateways during pytest execution. Oct 04, 2023 4 - Beta pytest :pypi:`pytest-web3-data` A pytest plugin to fetch test data from IPFS HTTP gateways during pytest execution. Oct 04, 2023 4 - Beta pytest
:pypi:`pytest-webdriver` Selenium webdriver fixture for py.test May 28, 2019 5 - Production/Stable pytest :pypi:`pytest-webdriver` Selenium webdriver fixture for py.test May 28, 2019 5 - Production/Stable pytest
:pypi:`pytest-wetest` Welian API Automation test framework pytest plugin Nov 10, 2018 4 - Beta N/A :pypi:`pytest-wetest` Welian API Automation test framework pytest plugin Nov 10, 2018 4 - Beta N/A
:pypi:`pytest-when` Utility which makes mocking more readable and controllable Oct 18, 2023 N/A pytest>=7.3.1
:pypi:`pytest-whirlwind` Testing Tornado. Jun 12, 2020 N/A N/A :pypi:`pytest-whirlwind` Testing Tornado. Jun 12, 2020 N/A N/A
:pypi:`pytest-wholenodeid` pytest addon for displaying the whole node id for failures Aug 26, 2015 4 - Beta pytest (>=2.0) :pypi:`pytest-wholenodeid` pytest addon for displaying the whole node id for failures Aug 26, 2015 4 - Beta pytest (>=2.0)
:pypi:`pytest-win32consoletitle` Pytest progress in console title (Win32 only) Aug 08, 2021 N/A N/A :pypi:`pytest-win32consoletitle` Pytest progress in console title (Win32 only) Aug 08, 2021 N/A N/A
@ -1359,7 +1367,7 @@ This list contains 1329 plugins.
:pypi:`pytest-yuk` Display tests you are uneasy with, using 🤢/🤮 for pass/fail of tests marked with yuk. Mar 26, 2021 N/A pytest>=5.0.0 :pypi:`pytest-yuk` Display tests you are uneasy with, using 🤢/🤮 for pass/fail of tests marked with yuk. Mar 26, 2021 N/A pytest>=5.0.0
:pypi:`pytest-zafira` A Zafira plugin for pytest Sep 18, 2019 5 - Production/Stable pytest (==4.1.1) :pypi:`pytest-zafira` A Zafira plugin for pytest Sep 18, 2019 5 - Production/Stable pytest (==4.1.1)
:pypi:`pytest-zap` OWASP ZAP plugin for py.test. May 12, 2014 4 - Beta N/A :pypi:`pytest-zap` OWASP ZAP plugin for py.test. May 12, 2014 4 - Beta N/A
:pypi:`pytest-zebrunner` Pytest connector for Zebrunner reporting Dec 12, 2022 5 - Production/Stable pytest (>=4.5.0) :pypi:`pytest-zebrunner` Pytest connector for Zebrunner reporting Oct 27, 2023 5 - Production/Stable pytest (>=4.5.0)
:pypi:`pytest-zest` Zesty additions to pytest. Nov 17, 2022 N/A N/A :pypi:`pytest-zest` Zesty additions to pytest. Nov 17, 2022 N/A N/A
:pypi:`pytest-zigzag` Extend py.test for RPC OpenStack testing. Feb 27, 2019 4 - Beta pytest (~=3.6) :pypi:`pytest-zigzag` Extend py.test for RPC OpenStack testing. Feb 27, 2019 4 - Beta pytest (~=3.6)
:pypi:`pytest-zulip` Pytest report plugin for Zulip May 07, 2022 5 - Production/Stable pytest :pypi:`pytest-zulip` Pytest report plugin for Zulip May 07, 2022 5 - Production/Stable pytest
@ -1600,7 +1608,7 @@ This list contains 1329 plugins.
Static code checks used at Alphamoon Static code checks used at Alphamoon
:pypi:`pytest-analyzer` :pypi:`pytest-analyzer`
*last release*: Sep 05, 2023, *last release*: Oct 21, 2023,
*status*: N/A, *status*: N/A,
*requires*: pytest >=7.3.1 *requires*: pytest >=7.3.1
@ -1767,6 +1775,13 @@ This list contains 1329 plugins.
Convenient ASGI client/server fixtures for Pytest Convenient ASGI client/server fixtures for Pytest
:pypi:`pytest-aspec`
*last release*: Oct 23, 2023,
*status*: 4 - Beta,
*requires*: N/A
A rspec format reporter for pytest
:pypi:`pytest-asptest` :pypi:`pytest-asptest`
*last release*: Apr 28, 2018, *last release*: Apr 28, 2018,
*status*: 4 - Beta, *status*: 4 - Beta,
@ -1894,7 +1909,7 @@ This list contains 1329 plugins.
Database testing fixtures using the SQLAlchemy asyncio API Database testing fixtures using the SQLAlchemy asyncio API
:pypi:`pytest-atf-allure` :pypi:`pytest-atf-allure`
*last release*: Sep 14, 2023, *last release*: Oct 22, 2023,
*status*: N/A, *status*: N/A,
*requires*: pytest (>=7.4.2,<8.0.0) *requires*: pytest (>=7.4.2,<8.0.0)
@ -2572,6 +2587,13 @@ This list contains 1329 plugins.
A pytest plugin to send a report and printing summary of tests. A pytest plugin to send a report and printing summary of tests.
:pypi:`pytest-choose`
*last release*: Oct 17, 2023,
*status*: N/A,
*requires*: pytest >=7.0.0
Provide the pytest with the ability to collect use cases based on rules in text files
:pypi:`pytest-chunks` :pypi:`pytest-chunks`
*last release*: Jul 05, 2022, *last release*: Jul 05, 2022,
*status*: N/A, *status*: N/A,
@ -3434,9 +3456,9 @@ This list contains 1329 plugins.
Disable plugins per test Disable plugins per test
:pypi:`pytest-discord` :pypi:`pytest-discord`
*last release*: Jul 16, 2023, *last release*: Oct 18, 2023,
*status*: 4 - Beta, *status*: 4 - Beta,
*requires*: pytest (!=6.0.0,<8,>=3.3.2) *requires*: pytest !=6.0.0,<8,>=3.3.2
A pytest plugin to notify test results to a Discord channel. A pytest plugin to notify test results to a Discord channel.
@ -3804,6 +3826,13 @@ This list contains 1329 plugins.
A py.test plugin that parses environment files before running tests A py.test plugin that parses environment files before running tests
:pypi:`pytest-dot-only-pkcopley`
*last release*: Oct 27, 2023,
*status*: N/A,
*requires*: N/A
A Pytest marker for only running a single test
:pypi:`pytest-draw` :pypi:`pytest-draw`
*last release*: Mar 21, 2023, *last release*: Mar 21, 2023,
*status*: 3 - Alpha, *status*: 3 - Alpha,
@ -4092,11 +4121,11 @@ This list contains 1329 plugins.
Improvements for pytest (rejected upstream) Improvements for pytest (rejected upstream)
:pypi:`pytest-env` :pypi:`pytest-env`
*last release*: Aug 24, 2023, *last release*: Oct 24, 2023,
*status*: 5 - Production/Stable, *status*: 5 - Production/Stable,
*requires*: pytest>=7.3.1 *requires*: pytest>=7.4.2
py.test plugin that allows you to add environment variables. pytest plugin that allows you to add environment variables.
:pypi:`pytest-envfiles` :pypi:`pytest-envfiles`
*last release*: Oct 08, 2015, *last release*: Oct 08, 2015,
@ -4372,9 +4401,9 @@ This list contains 1329 plugins.
A pytest plugin that helps better distinguishing real test failures from setup flakiness. A pytest plugin that helps better distinguishing real test failures from setup flakiness.
:pypi:`pytest-fail-slow` :pypi:`pytest-fail-slow`
*last release*: Aug 13, 2022, *last release*: Oct 21, 2023,
*status*: 4 - Beta, *status*: N/A,
*requires*: pytest (>=6.0) *requires*: pytest >=6.0
Fail tests that take too long to run Fail tests that take too long to run
@ -4631,9 +4660,9 @@ This list contains 1329 plugins.
Flaptastic py.test plugin Flaptastic py.test plugin
:pypi:`pytest-flask` :pypi:`pytest-flask`
*last release*: Feb 27, 2021, *last release*: Oct 23, 2023,
*status*: 5 - Production/Stable, *status*: 5 - Production/Stable,
*requires*: pytest (>=5.2) *requires*: pytest >=5.2
A set of py.test fixtures to test Flask applications. A set of py.test fixtures to test Flask applications.
@ -4841,7 +4870,7 @@ This list contains 1329 plugins.
For finding/executing Ghost Inspector tests For finding/executing Ghost Inspector tests
:pypi:`pytest-girder` :pypi:`pytest-girder`
*last release*: Oct 09, 2023, *last release*: Oct 26, 2023,
*status*: N/A, *status*: N/A,
*requires*: N/A *requires*: N/A
@ -4855,7 +4884,7 @@ This list contains 1329 plugins.
Git repository fixture for py.test Git repository fixture for py.test
:pypi:`pytest-gitconfig` :pypi:`pytest-gitconfig`
*last release*: Oct 14, 2023, *last release*: Oct 15, 2023,
*status*: 4 - Beta, *status*: 4 - Beta,
*requires*: pytest>=7.1.2 *requires*: pytest>=7.1.2
@ -5100,9 +5129,9 @@ This list contains 1329 plugins.
A pytest plugin for use with homeassistant custom components. A pytest plugin for use with homeassistant custom components.
:pypi:`pytest-homeassistant-custom-component` :pypi:`pytest-homeassistant-custom-component`
*last release*: Oct 14, 2023, *last release*: Oct 28, 2023,
*status*: 3 - Alpha, *status*: 3 - Alpha,
*requires*: pytest ==7.3.1 *requires*: pytest ==7.4.3
Experimental package to automatically extract test plugins for Home Assistant custom components Experimental package to automatically extract test plugins for Home Assistant custom components
@ -5212,7 +5241,7 @@ This list contains 1329 plugins.
Generates a static html report based on pytest framework Generates a static html report based on pytest framework
:pypi:`pytest-html-report-merger` :pypi:`pytest-html-report-merger`
*last release*: Aug 31, 2022, *last release*: Oct 23, 2023,
*status*: N/A, *status*: N/A,
*requires*: N/A *requires*: N/A
@ -5422,7 +5451,7 @@ This list contains 1329 plugins.
Reuse pytest.ini to store env variables Reuse pytest.ini to store env variables
:pypi:`pytest-inline` :pypi:`pytest-inline`
*last release*: Oct 10, 2023, *last release*: Oct 19, 2023,
*status*: 4 - Beta, *status*: 4 - Beta,
*requires*: pytest >=7.0.0 *requires*: pytest >=7.0.0
@ -5975,7 +6004,7 @@ This list contains 1329 plugins.
Generate local badges (shields) reporting your test suite status. Generate local badges (shields) reporting your test suite status.
:pypi:`pytest-localftpserver` :pypi:`pytest-localftpserver`
*last release*: Oct 04, 2022, *last release*: Oct 14, 2023,
*status*: 5 - Production/Stable, *status*: 5 - Production/Stable,
*requires*: pytest *requires*: pytest
@ -6346,9 +6375,9 @@ This list contains 1329 plugins.
pytest plugin to display test execution output like a mochajs pytest plugin to display test execution output like a mochajs
:pypi:`pytest-mock` :pypi:`pytest-mock`
*last release*: Jun 15, 2023, *last release*: Oct 19, 2023,
*status*: 5 - Production/Stable, *status*: 5 - Production/Stable,
*requires*: pytest (>=5.0) *requires*: pytest >=5.0
Thin-wrapper around the mock package for easier use with pytest Thin-wrapper around the mock package for easier use with pytest
@ -6619,11 +6648,11 @@ This list contains 1329 plugins.
MySQL process and client fixtures for pytest MySQL process and client fixtures for pytest
:pypi:`pytest-ndb` :pypi:`pytest-ndb`
*last release*: Jul 19, 2023, *last release*: Oct 15, 2023,
*status*: N/A, *status*: N/A,
*requires*: pytest *requires*: pytest
Open Source Software Health Report pytest notebook debugger
:pypi:`pytest-needle` :pypi:`pytest-needle`
*last release*: Dec 10, 2018, *last release*: Dec 10, 2018,
@ -6640,7 +6669,7 @@ This list contains 1329 plugins.
pytest-neo is a plugin for pytest that shows tests like screen of Matrix. pytest-neo is a plugin for pytest that shows tests like screen of Matrix.
:pypi:`pytest-netdut` :pypi:`pytest-netdut`
*last release*: Sep 21, 2023, *last release*: Oct 26, 2023,
*status*: N/A, *status*: N/A,
*requires*: pytest <7.3,>=3.5.0 *requires*: pytest <7.3,>=3.5.0
@ -7052,6 +7081,13 @@ This list contains 1329 plugins.
A simple pytest extension for creating a named test suite. A simple pytest extension for creating a named test suite.
:pypi:`pytest-param-scope`
*last release*: Oct 18, 2023,
*status*: N/A,
*requires*: pytest
pytest parametrize scope fixture workaround
:pypi:`pytest-parawtf` :pypi:`pytest-parawtf`
*last release*: Dec 03, 2018, *last release*: Dec 03, 2018,
*status*: 4 - Beta, *status*: 4 - Beta,
@ -7326,9 +7362,9 @@ This list contains 1329 plugins.
A plugin to help developing and testing other plugins A plugin to help developing and testing other plugins
:pypi:`pytest-plus` :pypi:`pytest-plus`
*last release*: Dec 24, 2022, *last release*: Oct 18, 2023,
*status*: 5 - Production/Stable, *status*: 5 - Production/Stable,
*requires*: pytest (>=6.0.1) *requires*: pytest >=7.4.2
PyTest Plus Plugin :: extends pytest functionality PyTest Plus Plugin :: extends pytest functionality
@ -7347,7 +7383,7 @@ This list contains 1329 plugins.
Pytest plugin to define functions you test with special marks for better navigation and reports Pytest plugin to define functions you test with special marks for better navigation and reports
:pypi:`pytest-pokie` :pypi:`pytest-pokie`
*last release*: May 22, 2023, *last release*: Oct 19, 2023,
*status*: 5 - Production/Stable, *status*: 5 - Production/Stable,
*requires*: N/A *requires*: N/A
@ -7676,7 +7712,7 @@ This list contains 1329 plugins.
Pyramid server fixture for py.test Pyramid server fixture for py.test
:pypi:`pytest-pyreport` :pypi:`pytest-pyreport`
*last release*: Aug 27, 2023, *last release*: Oct 21, 2023,
*status*: N/A, *status*: N/A,
*requires*: pytest *requires*: pytest
@ -8124,7 +8160,7 @@ This list contains 1329 plugins.
pytest plugin for adding tests' parameters to junit report pytest plugin for adding tests' parameters to junit report
:pypi:`pytest-reportportal` :pypi:`pytest-reportportal`
*last release*: Sep 25, 2023, *last release*: Oct 17, 2023,
*status*: N/A, *status*: N/A,
*requires*: pytest >=3.8.0 *requires*: pytest >=3.8.0
@ -8137,6 +8173,13 @@ This list contains 1329 plugins.
An interesting python package An interesting python package
:pypi:`pytest-report-stream`
*last release*: Oct 22, 2023,
*status*: 4 - Beta,
*requires*: N/A
A pytest plugin which allows to stream test reports at runtime
:pypi:`pytest-reqs` :pypi:`pytest-reqs`
*last release*: May 12, 2019, *last release*: May 12, 2019,
*status*: N/A, *status*: N/A,
@ -8264,11 +8307,11 @@ This list contains 1329 plugins.
Pytest plugin to restrict the test types allowed Pytest plugin to restrict the test types allowed
:pypi:`pytest-result-log` :pypi:`pytest-result-log`
*last release*: Apr 17, 2023, *last release*: Oct 15, 2023,
*status*: N/A, *status*: N/A,
*requires*: pytest>=7.2.0 *requires*: pytest>=7.2.0
Write the execution result of the case to the log A pytest plugin that records the start, end, and result information of each use case in a log file
:pypi:`pytest-result-sender` :pypi:`pytest-result-sender`
*last release*: Apr 20, 2023, *last release*: Apr 20, 2023,
@ -8326,6 +8369,13 @@ This list contains 1329 plugins.
Leverage rich for richer test session output Leverage rich for richer test session output
:pypi:`pytest-richer`
*last release*: Oct 27, 2023,
*status*: 3 - Alpha,
*requires*: pytest
Pytest plugin providing a Rich based reporter.
:pypi:`pytest-rich-reporter` :pypi:`pytest-rich-reporter`
*last release*: Feb 17, 2022, *last release*: Feb 17, 2022,
*status*: 1 - Planning, *status*: 1 - Planning,
@ -8530,7 +8580,7 @@ This list contains 1329 plugins.
:pypi:`pytest-sbase` :pypi:`pytest-sbase`
*last release*: Oct 13, 2023, *last release*: Oct 27, 2023,
*status*: 5 - Production/Stable, *status*: 5 - Production/Stable,
*requires*: N/A *requires*: N/A
@ -8586,14 +8636,14 @@ This list contains 1329 plugins.
pytest plugin for Selenium pytest plugin for Selenium
:pypi:`pytest-selenium-auto` :pypi:`pytest-selenium-auto`
*last release*: Oct 03, 2023, *last release*: Oct 18, 2023,
*status*: N/A, *status*: N/A,
*requires*: pytest >= 7.0.0 *requires*: pytest >= 7.0.0
pytest plugin to automatically capture screenshots upon selenium webdriver events pytest plugin to automatically capture screenshots upon selenium webdriver events
:pypi:`pytest-seleniumbase` :pypi:`pytest-seleniumbase`
*last release*: Oct 13, 2023, *last release*: Oct 27, 2023,
*status*: 5 - Production/Stable, *status*: 5 - Production/Stable,
*requires*: N/A *requires*: N/A
@ -8796,9 +8846,9 @@ This list contains 1329 plugins.
Allow for multiple processes to log to a single file Allow for multiple processes to log to a single file
:pypi:`pytest-skip-markers` :pypi:`pytest-skip-markers`
*last release*: Jul 31, 2023, *last release*: Oct 20, 2023,
*status*: 5 - Production/Stable, *status*: 5 - Production/Stable,
*requires*: pytest (>=7.1.0) *requires*: pytest >=7.1.0
Pytest Salt Plugin Pytest Salt Plugin
@ -9097,14 +9147,14 @@ This list contains 1329 plugins.
:pypi:`pytest-splunk-addon` :pypi:`pytest-splunk-addon`
*last release*: Sep 06, 2023, *last release*: Oct 23, 2023,
*status*: N/A, *status*: N/A,
*requires*: pytest (>5.4.0,<8) *requires*: pytest (>5.4.0,<8)
A Dynamic test tool for Splunk Apps and Add-ons A Dynamic test tool for Splunk Apps and Add-ons
:pypi:`pytest-splunk-addon-ui-smartx` :pypi:`pytest-splunk-addon-ui-smartx`
*last release*: Oct 02, 2023, *last release*: Oct 27, 2023,
*status*: N/A, *status*: N/A,
*requires*: N/A *requires*: N/A
@ -9559,9 +9609,9 @@ This list contains 1329 plugins.
pytest reporting plugin for testlink pytest reporting plugin for testlink
:pypi:`pytest-testmon` :pypi:`pytest-testmon`
*last release*: Jul 13, 2023, *last release*: Oct 17, 2023,
*status*: 4 - Beta, *status*: 4 - Beta,
*requires*: pytest (<8,>=5) *requires*: pytest <8,>=5
selects tests affected by changed files and methods selects tests affected by changed files and methods
@ -10272,6 +10322,13 @@ This list contains 1329 plugins.
Virtualenv fixture for py.test Virtualenv fixture for py.test
:pypi:`pytest-visual`
*last release*: Oct 24, 2023,
*status*: 3 - Alpha,
*requires*: pytest >=7.0.0
:pypi:`pytest-vnc` :pypi:`pytest-vnc`
*last release*: Feb 25, 2023, *last release*: Feb 25, 2023,
*status*: N/A, *status*: N/A,
@ -10384,6 +10441,13 @@ This list contains 1329 plugins.
Welian API Automation test framework pytest plugin Welian API Automation test framework pytest plugin
:pypi:`pytest-when`
*last release*: Oct 18, 2023,
*status*: N/A,
*requires*: pytest>=7.3.1
Utility which makes mocking more readable and controllable
:pypi:`pytest-whirlwind` :pypi:`pytest-whirlwind`
*last release*: Jun 12, 2020, *last release*: Jun 12, 2020,
*status*: N/A, *status*: N/A,
@ -10644,7 +10708,7 @@ This list contains 1329 plugins.
OWASP ZAP plugin for py.test. OWASP ZAP plugin for py.test.
:pypi:`pytest-zebrunner` :pypi:`pytest-zebrunner`
*last release*: Dec 12, 2022, *last release*: Oct 27, 2023,
*status*: 5 - Production/Stable, *status*: 5 - Production/Stable,
*requires*: pytest (>=4.5.0) *requires*: pytest (>=4.5.0)

View File

@ -1,3 +1,5 @@
:tocdepth: 3
.. _`api-reference`: .. _`api-reference`:
API Reference API Reference
@ -247,7 +249,9 @@ Marks a test function as *expected to fail*.
:keyword str reason: :keyword str reason:
Reason why the test function is marked as xfail. Reason why the test function is marked as xfail.
:keyword Type[Exception] raises: :keyword Type[Exception] raises:
Exception subclass (or tuple of subclasses) expected to be raised by the test function; other exceptions will fail the test. Exception class (or tuple of classes) expected to be raised by the test function; other exceptions will fail the test.
Note that subclasses of the classes passed will also result in a match (similar to how the ``except`` statement works).
:keyword bool run: :keyword bool run:
Whether the test function should actually be executed. If ``False``, the function will always xfail and will Whether the test function should actually be executed. If ``False``, the function will always xfail and will
not be executed (useful if a function is segfaulting). not be executed (useful if a function is segfaulting).

View File

@ -2,7 +2,7 @@ pallets-sphinx-themes
pluggy>=1.2.0 pluggy>=1.2.0
pygments-pytest>=2.3.0 pygments-pytest>=2.3.0
sphinx-removed-in>=0.2.0 sphinx-removed-in>=0.2.0
sphinx>=5,<6 sphinx>=5,<8
sphinxcontrib-trio sphinxcontrib-trio
sphinxcontrib-svg2pdfconverter sphinxcontrib-svg2pdfconverter
# Pin packaging because it no longer handles 'latest' version, which # Pin packaging because it no longer handles 'latest' version, which

View File

@ -31,16 +31,22 @@ class InvalidFeatureRelease(Exception):
SLUG = "pytest-dev/pytest" SLUG = "pytest-dev/pytest"
PR_BODY = """\ PR_BODY = """\
Created by the [prepare release pr](https://github.com/pytest-dev/pytest/actions/workflows/prepare-release-pr.yml) Created by the [prepare release pr]\
workflow. (https://github.com/pytest-dev/pytest/actions/workflows/prepare-release-pr.yml) workflow.
Once all builds pass and it has been **approved** by one or more maintainers, Once all builds pass and it has been **approved** by one or more maintainers, start the \
start the [deploy](https://github.com/pytest-dev/pytest/actions/workflows/deploy.yml) workflow, using these parameters: [deploy](https://github.com/pytest-dev/pytest/actions/workflows/deploy.yml) workflow, using these parameters:
* `Use workflow from`: `release-{version}`. * `Use workflow from`: `release-{version}`.
* `Release version`: `{version}`. * `Release version`: `{version}`.
After the `deploy` workflow has been approved by a core maintainer, the package will be uploaded to PyPI automatically. Or execute on the command line:
```console
gh workflow run deploy.yml -r release-{version} -f version={version}
```
After the workflow has been approved by a core maintainer, the package will be uploaded to PyPI automatically.
""" """

View File

@ -3,6 +3,7 @@ import os
import shutil import shutil
import sys import sys
from typing import final from typing import final
from typing import Literal
from typing import Optional from typing import Optional
from typing import Sequence from typing import Sequence
from typing import TextIO from typing import TextIO
@ -193,15 +194,21 @@ class TerminalWriter:
for indent, new_line in zip(indents, new_lines): for indent, new_line in zip(indents, new_lines):
self.line(indent + new_line) self.line(indent + new_line)
def _highlight(self, source: str) -> str: def _highlight(
"""Highlight the given source code if we have markup support.""" self, source: str, lexer: Literal["diff", "python"] = "python"
) -> str:
"""Highlight the given source if we have markup support."""
from _pytest.config.exceptions import UsageError from _pytest.config.exceptions import UsageError
if not self.hasmarkup or not self.code_highlight: if not self.hasmarkup or not self.code_highlight:
return source return source
try: try:
from pygments.formatters.terminal import TerminalFormatter from pygments.formatters.terminal import TerminalFormatter
from pygments.lexers.python import PythonLexer
if lexer == "python":
from pygments.lexers.python import PythonLexer as Lexer
elif lexer == "diff":
from pygments.lexers.diff import DiffLexer as Lexer
from pygments import highlight from pygments import highlight
import pygments.util import pygments.util
except ImportError: except ImportError:
@ -210,7 +217,7 @@ class TerminalWriter:
try: try:
highlighted: str = highlight( highlighted: str = highlight(
source, source,
PythonLexer(), Lexer(),
TerminalFormatter( TerminalFormatter(
bg=os.getenv("PYTEST_THEME_MODE", "dark"), bg=os.getenv("PYTEST_THEME_MODE", "dark"),
style=os.getenv("PYTEST_THEME"), style=os.getenv("PYTEST_THEME"),

View File

@ -755,7 +755,13 @@ class LocalPath:
if ensure: if ensure:
self.dirpath().ensure(dir=1) self.dirpath().ensure(dir=1)
if encoding: if encoding:
return error.checked_call(io.open, self.strpath, mode, encoding=encoding) # Using type ignore here because of this error:
# error: Argument 1 has incompatible type overloaded function;
# expected "Callable[[str, Any, Any], TextIOWrapper]" [arg-type]
# Which seems incorrect, given io.open supports the given argument types.
return error.checked_call(
io.open, self.strpath, mode, encoding=encoding # type:ignore[arg-type]
)
return error.checked_call(open, self.strpath, mode) return error.checked_call(open, self.strpath, mode)
def _fastjoin(self, name): def _fastjoin(self, name):
@ -1261,13 +1267,19 @@ class LocalPath:
@classmethod @classmethod
def mkdtemp(cls, rootdir=None): def mkdtemp(cls, rootdir=None):
"""Return a Path object pointing to a fresh new temporary directory """Return a Path object pointing to a fresh new temporary directory
(which we created ourself). (which we created ourselves).
""" """
import tempfile import tempfile
if rootdir is None: if rootdir is None:
rootdir = cls.get_temproot() rootdir = cls.get_temproot()
return cls(error.checked_call(tempfile.mkdtemp, dir=str(rootdir))) # Using type ignore here because of this error:
# error: Argument 1 has incompatible type overloaded function; expected "Callable[[str], str]" [arg-type]
# Which seems incorrect, given tempfile.mkdtemp supports the given argument types.
path = error.checked_call(
tempfile.mkdtemp, dir=str(rootdir) # type:ignore[arg-type]
)
return cls(path)
@classmethod @classmethod
def make_numbered_dir( def make_numbered_dir(

View File

@ -7,8 +7,10 @@ from typing import Any
from typing import Callable from typing import Callable
from typing import Iterable from typing import Iterable
from typing import List from typing import List
from typing import Literal
from typing import Mapping from typing import Mapping
from typing import Optional from typing import Optional
from typing import Protocol
from typing import Sequence from typing import Sequence
from unicodedata import normalize from unicodedata import normalize
@ -34,6 +36,11 @@ _assertion_pass: Optional[Callable[[int, str, str], None]] = None
_config: Optional[Config] = None _config: Optional[Config] = None
class _HighlightFunc(Protocol):
def __call__(self, source: str, lexer: Literal["diff", "python"] = "python") -> str:
"""Apply highlighting to the given source."""
def format_explanation(explanation: str) -> str: def format_explanation(explanation: str) -> str:
r"""Format an explanation. r"""Format an explanation.
@ -190,7 +197,8 @@ def assertrepr_compare(
explanation = None explanation = None
try: try:
if op == "==": if op == "==":
explanation = _compare_eq_any(left, right, verbose) writer = config.get_terminal_writer()
explanation = _compare_eq_any(left, right, writer._highlight, verbose)
elif op == "not in": elif op == "not in":
if istext(left) and istext(right): if istext(left) and istext(right):
explanation = _notin_text(left, right, verbose) explanation = _notin_text(left, right, verbose)
@ -226,7 +234,9 @@ def assertrepr_compare(
return [summary] + explanation return [summary] + explanation
def _compare_eq_any(left: Any, right: Any, verbose: int = 0) -> List[str]: def _compare_eq_any(
left: Any, right: Any, highlighter: _HighlightFunc, verbose: int = 0
) -> List[str]:
explanation = [] explanation = []
if istext(left) and istext(right): if istext(left) and istext(right):
explanation = _diff_text(left, right, verbose) explanation = _diff_text(left, right, verbose)
@ -246,7 +256,7 @@ def _compare_eq_any(left: Any, right: Any, verbose: int = 0) -> List[str]:
# field values, not the type or field names. But this branch # field values, not the type or field names. But this branch
# intentionally only handles the same-type case, which was often # intentionally only handles the same-type case, which was often
# used in older code bases before dataclasses/attrs were available. # used in older code bases before dataclasses/attrs were available.
explanation = _compare_eq_cls(left, right, verbose) explanation = _compare_eq_cls(left, right, highlighter, verbose)
elif issequence(left) and issequence(right): elif issequence(left) and issequence(right):
explanation = _compare_eq_sequence(left, right, verbose) explanation = _compare_eq_sequence(left, right, verbose)
elif isset(left) and isset(right): elif isset(left) and isset(right):
@ -255,7 +265,7 @@ def _compare_eq_any(left: Any, right: Any, verbose: int = 0) -> List[str]:
explanation = _compare_eq_dict(left, right, verbose) explanation = _compare_eq_dict(left, right, verbose)
if isiterable(left) and isiterable(right): if isiterable(left) and isiterable(right):
expl = _compare_eq_iterable(left, right, verbose) expl = _compare_eq_iterable(left, right, highlighter, verbose)
explanation.extend(expl) explanation.extend(expl)
return explanation return explanation
@ -322,7 +332,10 @@ def _surrounding_parens_on_own_lines(lines: List[str]) -> None:
def _compare_eq_iterable( def _compare_eq_iterable(
left: Iterable[Any], right: Iterable[Any], verbose: int = 0 left: Iterable[Any],
right: Iterable[Any],
highligher: _HighlightFunc,
verbose: int = 0,
) -> List[str]: ) -> List[str]:
if verbose <= 0 and not running_on_ci(): if verbose <= 0 and not running_on_ci():
return ["Use -v to get more diff"] return ["Use -v to get more diff"]
@ -347,7 +360,13 @@ def _compare_eq_iterable(
# "right" is the expected base against which we compare "left", # "right" is the expected base against which we compare "left",
# see https://github.com/pytest-dev/pytest/issues/3333 # see https://github.com/pytest-dev/pytest/issues/3333
explanation.extend( explanation.extend(
line.rstrip() for line in difflib.ndiff(right_formatting, left_formatting) highligher(
"\n".join(
line.rstrip()
for line in difflib.ndiff(right_formatting, left_formatting)
),
lexer="diff",
).splitlines()
) )
return explanation return explanation
@ -497,7 +516,9 @@ def _compare_eq_dict(
return explanation return explanation
def _compare_eq_cls(left: Any, right: Any, verbose: int) -> List[str]: def _compare_eq_cls(
left: Any, right: Any, highlighter: _HighlightFunc, verbose: int
) -> List[str]:
if not has_default_eq(left): if not has_default_eq(left):
return [] return []
if isdatacls(left): if isdatacls(left):
@ -543,7 +564,9 @@ def _compare_eq_cls(left: Any, right: Any, verbose: int) -> List[str]:
] ]
explanation += [ explanation += [
indent + line indent + line
for line in _compare_eq_any(field_left, field_right, verbose) for line in _compare_eq_any(
field_left, field_right, highlighter, verbose
)
] ]
return explanation return explanation

View File

@ -1003,7 +1003,7 @@ class IdMaker:
for index, id in enumerate(resolved_ids): for index, id in enumerate(resolved_ids):
if id_counts[id] > 1: if id_counts[id] > 1:
suffix = "" suffix = ""
if id[-1].isdigit(): if id and id[-1].isdigit():
suffix = "_" suffix = "_"
new_id = f"{id}{suffix}{id_suffixes[id]}" new_id = f"{id}{suffix}{id_suffixes[id]}"
while new_id in set(resolved_ids): while new_id in set(resolved_ids):

View File

@ -804,11 +804,13 @@ def raises( # noqa: F811
def raises( # noqa: F811 def raises( # noqa: F811
expected_exception: Union[Type[E], Tuple[Type[E], ...]], *args: Any, **kwargs: Any expected_exception: Union[Type[E], Tuple[Type[E], ...]], *args: Any, **kwargs: Any
) -> Union["RaisesContext[E]", _pytest._code.ExceptionInfo[E]]: ) -> Union["RaisesContext[E]", _pytest._code.ExceptionInfo[E]]:
r"""Assert that a code block/function call raises an exception. r"""Assert that a code block/function call raises an exception type, or one of its subclasses.
:param typing.Type[E] | typing.Tuple[typing.Type[E], ...] expected_exception: :param typing.Type[E] | typing.Tuple[typing.Type[E], ...] expected_exception:
The expected exception type, or a tuple if one of multiple possible The expected exception type, or a tuple if one of multiple possible
exception types are expected. exception types are expected. Note that subclasses of the passed exceptions
will also match.
:kwparam str | typing.Pattern[str] | None match: :kwparam str | typing.Pattern[str] | None match:
If specified, a string containing a regular expression, If specified, a string containing a regular expression,
or a regular expression object, that is tested against the string or a regular expression object, that is tested against the string
@ -826,13 +828,13 @@ def raises( # noqa: F811
.. currentmodule:: _pytest._code .. currentmodule:: _pytest._code
Use ``pytest.raises`` as a context manager, which will capture the exception of the given Use ``pytest.raises`` as a context manager, which will capture the exception of the given
type:: type, or any of its subclasses::
>>> import pytest >>> import pytest
>>> with pytest.raises(ZeroDivisionError): >>> with pytest.raises(ZeroDivisionError):
... 1/0 ... 1/0
If the code block does not raise the expected exception (``ZeroDivisionError`` in the example If the code block does not raise the expected exception (:class:`ZeroDivisionError` in the example
above), or no exception at all, the check will fail instead. above), or no exception at all, the check will fail instead.
You can also use the keyword argument ``match`` to assert that the You can also use the keyword argument ``match`` to assert that the
@ -845,7 +847,7 @@ def raises( # noqa: F811
... raise ValueError("value must be 42") ... raise ValueError("value must be 42")
The ``match`` argument searches the formatted exception string, which includes any The ``match`` argument searches the formatted exception string, which includes any
`PEP-678 <https://peps.python.org/pep-0678/>` ``__notes__``: `PEP-678 <https://peps.python.org/pep-0678/>`__ ``__notes__``:
>>> with pytest.raises(ValueError, match=r'had a note added'): # doctest: +SKIP >>> with pytest.raises(ValueError, match=r'had a note added'): # doctest: +SKIP
... e = ValueError("value must be 42") ... e = ValueError("value must be 42")
@ -860,6 +862,20 @@ def raises( # noqa: F811
>>> assert exc_info.type is ValueError >>> assert exc_info.type is ValueError
>>> assert exc_info.value.args[0] == "value must be 42" >>> assert exc_info.value.args[0] == "value must be 42"
.. warning::
Given that ``pytest.raises`` matches subclasses, be wary of using it to match :class:`Exception` like this::
with pytest.raises(Exception): # Careful, this will catch ANY exception raised.
some_function()
Because :class:`Exception` is the base class of almost all exceptions, it is easy for this to hide
real bugs, where the user wrote this expecting a specific exception, but some other exception is being
raised due to a bug introduced during a refactoring.
Avoid using ``pytest.raises`` to catch :class:`Exception` unless certain that you really want to catch
**any** exception raised.
.. note:: .. note::
When using ``pytest.raises`` as a context manager, it's worthwhile to When using ``pytest.raises`` as a context manager, it's worthwhile to
@ -872,7 +888,7 @@ def raises( # noqa: F811
>>> with pytest.raises(ValueError) as exc_info: >>> with pytest.raises(ValueError) as exc_info:
... if value > 10: ... if value > 10:
... raise ValueError("value must be <= 10") ... raise ValueError("value must be <= 10")
... assert exc_info.type is ValueError # this will not execute ... assert exc_info.type is ValueError # This will not execute.
Instead, the following approach must be taken (note the difference in Instead, the following approach must be taken (note the difference in
scope):: scope)::
@ -891,6 +907,10 @@ def raises( # noqa: F811
See :ref:`parametrizing_conditional_raising` for an example. See :ref:`parametrizing_conditional_raising` for an example.
.. seealso::
:ref:`assertraises` for more examples and detailed discussion.
**Legacy form** **Legacy form**
It is possible to specify a callable by passing a to-be-called lambda:: It is possible to specify a callable by passing a to-be-called lambda::

View File

@ -160,6 +160,9 @@ def color_mapping():
"red": "\x1b[31m", "red": "\x1b[31m",
"green": "\x1b[32m", "green": "\x1b[32m",
"yellow": "\x1b[33m", "yellow": "\x1b[33m",
"light-gray": "\x1b[90m",
"light-red": "\x1b[91m",
"light-green": "\x1b[92m",
"bold": "\x1b[1m", "bold": "\x1b[1m",
"reset": "\x1b[0m", "reset": "\x1b[0m",
"kw": "\x1b[94m", "kw": "\x1b[94m",
@ -171,6 +174,7 @@ def color_mapping():
"endline": "\x1b[90m\x1b[39;49;00m", "endline": "\x1b[90m\x1b[39;49;00m",
} }
RE_COLORS = {k: re.escape(v) for k, v in COLORS.items()} RE_COLORS = {k: re.escape(v) for k, v in COLORS.items()}
NO_COLORS = {k: "" for k in COLORS.keys()}
@classmethod @classmethod
def format(cls, lines: List[str]) -> List[str]: def format(cls, lines: List[str]) -> List[str]:
@ -187,6 +191,11 @@ def color_mapping():
"""Replace color names for use with LineMatcher.re_match_lines""" """Replace color names for use with LineMatcher.re_match_lines"""
return [line.format(**cls.RE_COLORS) for line in lines] return [line.format(**cls.RE_COLORS) for line in lines]
@classmethod
def strip_colors(cls, lines: List[str]) -> List[str]:
"""Entirely remove every color code"""
return [line.format(**cls.NO_COLORS) for line in lines]
return ColorMapping return ColorMapping

View File

@ -1,5 +1,7 @@
# mypy: disable-error-code="attr-defined" # mypy: disable-error-code="attr-defined"
# mypy: disallow-untyped-defs
import logging import logging
from typing import Iterator
import pytest import pytest
from _pytest.logging import caplog_records_key from _pytest.logging import caplog_records_key
@ -9,8 +11,8 @@ logger = logging.getLogger(__name__)
sublogger = logging.getLogger(__name__ + ".baz") sublogger = logging.getLogger(__name__ + ".baz")
@pytest.fixture @pytest.fixture(autouse=True)
def cleanup_disabled_logging(): def cleanup_disabled_logging() -> Iterator[None]:
"""Simple fixture that ensures that a test doesn't disable logging. """Simple fixture that ensures that a test doesn't disable logging.
This is necessary because ``logging.disable()`` is global, so a test disabling logging This is necessary because ``logging.disable()`` is global, so a test disabling logging
@ -27,7 +29,7 @@ def test_fixture_help(pytester: Pytester) -> None:
result.stdout.fnmatch_lines(["*caplog*"]) result.stdout.fnmatch_lines(["*caplog*"])
def test_change_level(caplog): def test_change_level(caplog: pytest.LogCaptureFixture) -> None:
caplog.set_level(logging.INFO) caplog.set_level(logging.INFO)
logger.debug("handler DEBUG level") logger.debug("handler DEBUG level")
logger.info("handler INFO level") logger.info("handler INFO level")
@ -42,7 +44,7 @@ def test_change_level(caplog):
assert "CRITICAL" in caplog.text assert "CRITICAL" in caplog.text
def test_change_level_logging_disabled(caplog, cleanup_disabled_logging): def test_change_level_logging_disabled(caplog: pytest.LogCaptureFixture) -> None:
logging.disable(logging.CRITICAL) logging.disable(logging.CRITICAL)
assert logging.root.manager.disable == logging.CRITICAL assert logging.root.manager.disable == logging.CRITICAL
caplog.set_level(logging.WARNING) caplog.set_level(logging.WARNING)
@ -85,9 +87,7 @@ def test_change_level_undo(pytester: Pytester) -> None:
result.stdout.no_fnmatch_line("*log from test2*") result.stdout.no_fnmatch_line("*log from test2*")
def test_change_disabled_level_undo( def test_change_disabled_level_undo(pytester: Pytester) -> None:
pytester: Pytester, cleanup_disabled_logging
) -> None:
"""Ensure that '_force_enable_logging' in 'set_level' is undone after the end of the test. """Ensure that '_force_enable_logging' in 'set_level' is undone after the end of the test.
Tests the logging output themselves (affected by disabled logging level). Tests the logging output themselves (affected by disabled logging level).
@ -144,7 +144,7 @@ def test_change_level_undos_handler_level(pytester: Pytester) -> None:
result.assert_outcomes(passed=3) result.assert_outcomes(passed=3)
def test_with_statement(caplog): def test_with_statement(caplog: pytest.LogCaptureFixture) -> None:
with caplog.at_level(logging.INFO): with caplog.at_level(logging.INFO):
logger.debug("handler DEBUG level") logger.debug("handler DEBUG level")
logger.info("handler INFO level") logger.info("handler INFO level")
@ -159,7 +159,7 @@ def test_with_statement(caplog):
assert "CRITICAL" in caplog.text assert "CRITICAL" in caplog.text
def test_with_statement_logging_disabled(caplog, cleanup_disabled_logging): def test_with_statement_logging_disabled(caplog: pytest.LogCaptureFixture) -> None:
logging.disable(logging.CRITICAL) logging.disable(logging.CRITICAL)
assert logging.root.manager.disable == logging.CRITICAL assert logging.root.manager.disable == logging.CRITICAL
with caplog.at_level(logging.WARNING): with caplog.at_level(logging.WARNING):
@ -198,8 +198,8 @@ def test_with_statement_logging_disabled(caplog, cleanup_disabled_logging):
], ],
) )
def test_force_enable_logging_level_string( def test_force_enable_logging_level_string(
caplog, cleanup_disabled_logging, level_str, expected_disable_level caplog: pytest.LogCaptureFixture, level_str: str, expected_disable_level: int
): ) -> None:
"""Test _force_enable_logging using a level string. """Test _force_enable_logging using a level string.
``expected_disable_level`` is one level below ``level_str`` because the disabled log level ``expected_disable_level`` is one level below ``level_str`` because the disabled log level
@ -218,7 +218,7 @@ def test_force_enable_logging_level_string(
assert test_logger.manager.disable == expected_disable_level assert test_logger.manager.disable == expected_disable_level
def test_log_access(caplog): def test_log_access(caplog: pytest.LogCaptureFixture) -> None:
caplog.set_level(logging.INFO) caplog.set_level(logging.INFO)
logger.info("boo %s", "arg") logger.info("boo %s", "arg")
assert caplog.records[0].levelname == "INFO" assert caplog.records[0].levelname == "INFO"
@ -226,7 +226,7 @@ def test_log_access(caplog):
assert "boo arg" in caplog.text assert "boo arg" in caplog.text
def test_messages(caplog): def test_messages(caplog: pytest.LogCaptureFixture) -> None:
caplog.set_level(logging.INFO) caplog.set_level(logging.INFO)
logger.info("boo %s", "arg") logger.info("boo %s", "arg")
logger.info("bar %s\nbaz %s", "arg1", "arg2") logger.info("bar %s\nbaz %s", "arg1", "arg2")
@ -247,14 +247,14 @@ def test_messages(caplog):
assert "Exception" not in caplog.messages[-1] assert "Exception" not in caplog.messages[-1]
def test_record_tuples(caplog): def test_record_tuples(caplog: pytest.LogCaptureFixture) -> None:
caplog.set_level(logging.INFO) caplog.set_level(logging.INFO)
logger.info("boo %s", "arg") logger.info("boo %s", "arg")
assert caplog.record_tuples == [(__name__, logging.INFO, "boo arg")] assert caplog.record_tuples == [(__name__, logging.INFO, "boo arg")]
def test_unicode(caplog): def test_unicode(caplog: pytest.LogCaptureFixture) -> None:
caplog.set_level(logging.INFO) caplog.set_level(logging.INFO)
logger.info("") logger.info("")
assert caplog.records[0].levelname == "INFO" assert caplog.records[0].levelname == "INFO"
@ -262,7 +262,7 @@ def test_unicode(caplog):
assert "" in caplog.text assert "" in caplog.text
def test_clear(caplog): def test_clear(caplog: pytest.LogCaptureFixture) -> None:
caplog.set_level(logging.INFO) caplog.set_level(logging.INFO)
logger.info("") logger.info("")
assert len(caplog.records) assert len(caplog.records)
@ -273,7 +273,9 @@ def test_clear(caplog):
@pytest.fixture @pytest.fixture
def logging_during_setup_and_teardown(caplog): def logging_during_setup_and_teardown(
caplog: pytest.LogCaptureFixture,
) -> Iterator[None]:
caplog.set_level("INFO") caplog.set_level("INFO")
logger.info("a_setup_log") logger.info("a_setup_log")
yield yield
@ -281,7 +283,9 @@ def logging_during_setup_and_teardown(caplog):
assert [x.message for x in caplog.get_records("teardown")] == ["a_teardown_log"] assert [x.message for x in caplog.get_records("teardown")] == ["a_teardown_log"]
def test_caplog_captures_for_all_stages(caplog, logging_during_setup_and_teardown): def test_caplog_captures_for_all_stages(
caplog: pytest.LogCaptureFixture, logging_during_setup_and_teardown: None
) -> None:
assert not caplog.records assert not caplog.records
assert not caplog.get_records("call") assert not caplog.get_records("call")
logger.info("a_call_log") logger.info("a_call_log")
@ -290,25 +294,31 @@ def test_caplog_captures_for_all_stages(caplog, logging_during_setup_and_teardow
assert [x.message for x in caplog.get_records("setup")] == ["a_setup_log"] assert [x.message for x in caplog.get_records("setup")] == ["a_setup_log"]
# This reaches into private API, don't use this type of thing in real tests! # This reaches into private API, don't use this type of thing in real tests!
assert set(caplog._item.stash[caplog_records_key]) == {"setup", "call"} caplog_records = caplog._item.stash[caplog_records_key]
assert set(caplog_records) == {"setup", "call"}
def test_clear_for_call_stage(caplog, logging_during_setup_and_teardown): def test_clear_for_call_stage(
caplog: pytest.LogCaptureFixture, logging_during_setup_and_teardown: None
) -> None:
logger.info("a_call_log") logger.info("a_call_log")
assert [x.message for x in caplog.get_records("call")] == ["a_call_log"] assert [x.message for x in caplog.get_records("call")] == ["a_call_log"]
assert [x.message for x in caplog.get_records("setup")] == ["a_setup_log"] assert [x.message for x in caplog.get_records("setup")] == ["a_setup_log"]
assert set(caplog._item.stash[caplog_records_key]) == {"setup", "call"} caplog_records = caplog._item.stash[caplog_records_key]
assert set(caplog_records) == {"setup", "call"}
caplog.clear() caplog.clear()
assert caplog.get_records("call") == [] assert caplog.get_records("call") == []
assert [x.message for x in caplog.get_records("setup")] == ["a_setup_log"] assert [x.message for x in caplog.get_records("setup")] == ["a_setup_log"]
assert set(caplog._item.stash[caplog_records_key]) == {"setup", "call"} caplog_records = caplog._item.stash[caplog_records_key]
assert set(caplog_records) == {"setup", "call"}
logging.info("a_call_log_after_clear") logging.info("a_call_log_after_clear")
assert [x.message for x in caplog.get_records("call")] == ["a_call_log_after_clear"] assert [x.message for x in caplog.get_records("call")] == ["a_call_log_after_clear"]
assert [x.message for x in caplog.get_records("setup")] == ["a_setup_log"] assert [x.message for x in caplog.get_records("setup")] == ["a_setup_log"]
assert set(caplog._item.stash[caplog_records_key]) == {"setup", "call"} caplog_records = caplog._item.stash[caplog_records_key]
assert set(caplog_records) == {"setup", "call"}
def test_ini_controls_global_log_level(pytester: Pytester) -> None: def test_ini_controls_global_log_level(pytester: Pytester) -> None:

View File

@ -1,12 +1,12 @@
anyio[curio,trio]==4.0.0 anyio[curio,trio]==4.0.0
django==4.2.6 django==4.2.7
pytest-asyncio==0.21.1 pytest-asyncio==0.21.1
pytest-bdd==7.0.0 pytest-bdd==7.0.0
pytest-cov==4.1.0 pytest-cov==4.1.0
pytest-django==4.5.2 pytest-django==4.5.2
pytest-flakes==4.0.5 pytest-flakes==4.0.5
pytest-html==4.0.2 pytest-html==4.0.2
pytest-mock==3.11.1 pytest-mock==3.12.0
pytest-rerunfailures==12.0 pytest-rerunfailures==12.0
pytest-sugar==0.9.7 pytest-sugar==0.9.7
pytest-trio==0.7.0 pytest-trio==0.7.0

View File

@ -626,6 +626,13 @@ class TestMetafunc:
).make_unique_parameterset_ids() ).make_unique_parameterset_ids()
assert result == [expected] assert result == [expected]
def test_idmaker_duplicated_empty_str(self) -> None:
"""Regression test for empty strings parametrized more than once (#11563)."""
result = IdMaker(
("a",), [pytest.param(""), pytest.param("")], None, None, None, None, None
).make_unique_parameterset_ids()
assert result == ["0", "1"]
def test_parametrize_ids_exception(self, pytester: Pytester) -> None: def test_parametrize_ids_exception(self, pytester: Pytester) -> None:
""" """
:param pytester: the instance of Pytester class, a temporary :param pytester: the instance of Pytester class, a temporary

View File

@ -19,6 +19,10 @@ from _pytest.pytester import Pytester
def mock_config(verbose: int = 0, assertion_override: Optional[int] = None): def mock_config(verbose: int = 0, assertion_override: Optional[int] = None):
class TerminalWriter:
def _highlight(self, source, lexer):
return source
class OutputVerbosity: class OutputVerbosity:
@property @property
def verbose(self) -> int: def verbose(self) -> int:
@ -36,6 +40,9 @@ def mock_config(verbose: int = 0, assertion_override: Optional[int] = None):
def __init__(self) -> None: def __init__(self) -> None:
self.output_verbosity = OutputVerbosity() self.output_verbosity = OutputVerbosity()
def get_terminal_writer(self):
return TerminalWriter()
return Config() return Config()
@ -1831,3 +1838,48 @@ def test_reprcompare_verbose_long() -> None:
"{'v0': 0, 'v1': 1, 'v2': 12, 'v3': 3, 'v4': 4, 'v5': 5, " "{'v0': 0, 'v1': 1, 'v2': 12, 'v3': 3, 'v4': 4, 'v5': 5, "
"'v6': 6, 'v7': 7, 'v8': 8, 'v9': 9, 'v10': 10}" "'v6': 6, 'v7': 7, 'v8': 8, 'v9': 9, 'v10': 10}"
) )
@pytest.mark.parametrize("enable_colors", [True, False])
@pytest.mark.parametrize(
("test_code", "expected_lines"),
(
(
"""
def test():
assert [0, 1] == [0, 2]
""",
[
"{bold}{red}E {light-red}- [0, 2]{hl-reset}{endline}{reset}",
"{bold}{red}E {light-green}+ [0, 1]{hl-reset}{endline}{reset}",
],
),
(
"""
def test():
assert {f"number-is-{i}": i for i in range(1, 6)} == {
f"number-is-{i}": i for i in range(5)
}
""",
[
"{bold}{red}E {light-gray} {hl-reset} {{{endline}{reset}",
"{bold}{red}E {light-gray} {hl-reset} 'number-is-1': 1,{endline}{reset}",
"{bold}{red}E {light-green}+ 'number-is-5': 5,{hl-reset}{endline}{reset}",
],
),
),
)
def test_comparisons_handle_colors(
pytester: Pytester, color_mapping, enable_colors, test_code, expected_lines
) -> None:
p = pytester.makepyfile(test_code)
result = pytester.runpytest(
f"--color={'yes' if enable_colors else 'no'}", "-vv", str(p)
)
formatter = (
color_mapping.format_for_fnmatch
if enable_colors
else color_mapping.strip_colors
)
result.stdout.fnmatch_lines(formatter(expected_lines), consecutive=False)