diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 5f2d1cf09c8..88049407b45 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,5 +1,7 @@ # info: # * https://help.github.com/en/articles/displaying-a-sponsor-button-in-your-repository # * https://tidelift.com/subscription/how-to-connect-tidelift-with-github +github: pytest-dev tidelift: pypi/pytest open_collective: pytest +thanks_dev: u/gh/pytest-dev diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3741df6f51b..a9d59e15551 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.11.2" + rev: "v0.11.5" hooks: - id: ruff args: ["--fix"] diff --git a/AUTHORS b/AUTHORS index 95e6b13f11e..e19a0ae5871 100644 --- a/AUTHORS +++ b/AUTHORS @@ -58,6 +58,7 @@ Ashley Whetter Aviral Verma Aviv Palivoda Babak Keyvani +Bahram Farahmand Barney Gale Ben Brown Ben Gartner @@ -345,6 +346,7 @@ Pavel Karateev Pavel Zhukov Paweł Adamczak Pedro Algarvio +Peter Gessler Petter Strandmark Philipp Loose Pierre Sassoulas diff --git a/changelog/11067.bugfix.rst b/changelog/11067.bugfix.rst new file mode 100644 index 00000000000..4e3cb8e7dd7 --- /dev/null +++ b/changelog/11067.bugfix.rst @@ -0,0 +1,3 @@ +The test report is now consistent regardless if the test xfailed via :ref:`pytest.mark.xfail ` or :func:`pytest.fail`. + +Previously, *xfailed* tests via the marker would have the string ``"reason: "`` prefixed to the message, while those *xfailed* via the function did not. The prefix has been removed. diff --git a/changelog/12647.contrib.rst b/changelog/12647.contrib.rst new file mode 100644 index 00000000000..1d7a3181778 --- /dev/null +++ b/changelog/12647.contrib.rst @@ -0,0 +1 @@ +Fixed running the test suite with the ``hypothesis`` pytest plugin. diff --git a/changelog/13047.bugfix.rst b/changelog/13047.bugfix.rst new file mode 100644 index 00000000000..399e860505c --- /dev/null +++ b/changelog/13047.bugfix.rst @@ -0,0 +1,17 @@ +Restore :func:`pytest.approx` handling of equality checks between `bool` and `numpy.bool_` types. + +Comparing `bool` and `numpy.bool_` using :func:`pytest.approx` accidentally changed in version `8.3.4` and `8.3.5` to no longer match: + +.. code-block:: pycon + + >>> import numpy as np + >>> from pytest import approx + >>> [np.True_, np.True_] == pytest.approx([True, True]) + False + +This has now been fixed: + +.. code-block:: pycon + + >>> [np.True_, np.True_] == pytest.approx([True, True]) + True diff --git a/changelog/13218.doc.rst b/changelog/13218.doc.rst new file mode 100644 index 00000000000..907a817e895 --- /dev/null +++ b/changelog/13218.doc.rst @@ -0,0 +1 @@ +Pointed out in the :func:`pytest.approx` documentation that it considers booleans unequal to numeric zero or one. diff --git a/changelog/13345.bugfix.rst b/changelog/13345.bugfix.rst new file mode 100644 index 00000000000..5010888aa08 --- /dev/null +++ b/changelog/13345.bugfix.rst @@ -0,0 +1 @@ +Fix type hints for :attr:`pytest.TestReport.when` and :attr:`pytest.TestReport.location`. diff --git a/changelog/8612.doc.rst b/changelog/8612.doc.rst new file mode 100644 index 00000000000..6ab4102ace4 --- /dev/null +++ b/changelog/8612.doc.rst @@ -0,0 +1,5 @@ +Add a recipe for handling abstract test classes in the documentation. + +A new example has been added to the documentation to demonstrate how to use a mixin class to handle abstract +test classes without manually setting the ``__test__`` attribute for subclasses. +This ensures that subclasses of abstract test classes are automatically collected by pytest. diff --git a/doc/en/example/pythoncollection.rst b/doc/en/example/pythoncollection.rst index 89d7ee42614..6a3b143d580 100644 --- a/doc/en/example/pythoncollection.rst +++ b/doc/en/example/pythoncollection.rst @@ -325,3 +325,30 @@ with ``Test`` by setting a boolean ``__test__`` attribute to ``False``. # Will not be discovered as a test class TestClass: __test__ = False + +.. note:: + + If you are working with abstract test classes and want to avoid manually setting + the ``__test__`` attribute for subclasses, you can use a mixin class to handle + this automatically. For example: + + .. code-block:: python + + # Mixin to handle abstract test classes + class NotATest: + def __init_subclass__(cls): + cls.__test__ = NotATest not in cls.__bases__ + + + # Abstract test class + class AbstractTest(NotATest): + pass + + + # Subclass that will be collected as a test + class RealTest(AbstractTest): + def test_example(self): + assert 1 + 1 == 2 + + This approach ensures that subclasses of abstract test classes are automatically + collected without needing to explicitly set the ``__test__`` attribute. diff --git a/doc/en/reference/plugin_list.rst b/doc/en/reference/plugin_list.rst index de1ae7f7595..6690ad5196a 100644 --- a/doc/en/reference/plugin_list.rst +++ b/doc/en/reference/plugin_list.rst @@ -27,7 +27,7 @@ please refer to `the update script =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-annotated` Pytest plugin to allow use of Annotated in tests to resolve fixtures Sep 30, 2024 N/A pytest>=8.3.3 - :pypi:`pytest-ansible` Plugin for pytest to simplify calling ansible modules from tests or fixtures Jan 21, 2025 5 - Production/Stable pytest>=6 + :pypi:`pytest-ansible` Plugin for pytest to simplify calling ansible modules from tests or fixtures Apr 01, 2025 5 - Production/Stable pytest>=6 :pypi:`pytest-ansible-playbook` Pytest fixture which runs given ansible playbook file. Mar 08, 2019 4 - Beta N/A :pypi:`pytest-ansible-playbook-runner` Pytest fixture which runs given ansible playbook file. Dec 02, 2020 4 - Beta pytest (>=3.1.0) :pypi:`pytest-ansible-units` A pytest plugin for running unit tests within an ansible collection Apr 14, 2022 N/A N/A @@ -142,7 +142,7 @@ This list contains 1613 plugins. :pypi:`pytest-aws` pytest plugin for testing AWS resource configurations Oct 04, 2017 4 - Beta N/A :pypi:`pytest-aws-apigateway` pytest plugin for AWS ApiGateway May 24, 2024 4 - Beta pytest :pypi:`pytest-aws-config` Protect your AWS credentials in unit tests May 28, 2021 N/A N/A - :pypi:`pytest-aws-fixtures` A series of fixtures to use in integration tests involving actual AWS services. Oct 07, 2024 N/A pytest<9.0.0,>=8.0.0 + :pypi:`pytest-aws-fixtures` A series of fixtures to use in integration tests involving actual AWS services. Apr 06, 2025 N/A pytest<9.0.0,>=8.0.0 :pypi:`pytest-axe` pytest plugin for axe-selenium-python Nov 12, 2018 N/A pytest (>=3.0.0) :pypi:`pytest-axe-playwright-snapshot` A pytest plugin that runs Axe-core on Playwright pages and takes snapshots of the results. Jul 25, 2023 N/A pytest :pypi:`pytest-azure` Pytest utilities and mocks for Azure Jan 18, 2023 3 - Alpha pytest @@ -162,7 +162,7 @@ This list contains 1613 plugins. :pypi:`pytest-bdd-wrappers` Feb 11, 2020 2 - Pre-Alpha N/A :pypi:`pytest-beakerlib` A pytest plugin that reports test results to the BeakerLib framework Mar 17, 2017 5 - Production/Stable pytest :pypi:`pytest-beartype` Pytest plugin to run your tests with beartype checking enabled. Oct 31, 2024 N/A pytest - :pypi:`pytest-bec-e2e` BEC pytest plugin for end-to-end tests Mar 27, 2025 3 - Alpha pytest + :pypi:`pytest-bec-e2e` BEC pytest plugin for end-to-end tests Apr 01, 2025 3 - Alpha pytest :pypi:`pytest-beds` Fixtures for testing Google Appengine (GAE) apps Jun 07, 2016 4 - Beta N/A :pypi:`pytest-beeprint` use icdiff for better error messages in pytest assertions Jul 04, 2023 4 - Beta N/A :pypi:`pytest-bench` Benchmark utility that plugs into pytest. Jul 21, 2014 3 - Alpha N/A @@ -184,6 +184,7 @@ This list contains 1613 plugins. :pypi:`pytest-blue` A pytest plugin that adds a \`blue\` fixture for printing stuff in blue. Sep 05, 2022 N/A N/A :pypi:`pytest-board` Local continuous test runner with pytest and watchdog. Jan 20, 2019 N/A N/A :pypi:`pytest-boilerplate` The pytest plugin for your Django Boilerplate. Sep 12, 2024 5 - Production/Stable pytest>=4.0.0 + :pypi:`pytest-bonsai` Apr 08, 2025 N/A pytest>=6 :pypi:`pytest-boost-xml` Plugin for pytest to generate boost xml reports Nov 30, 2022 4 - Beta N/A :pypi:`pytest-bootstrap` Mar 04, 2022 N/A N/A :pypi:`pytest-boto-mock` Thin-wrapper around the mock package for easier use with pytest Jul 16, 2024 5 - Production/Stable pytest>=8.2.0 @@ -232,7 +233,7 @@ This list contains 1613 plugins. :pypi:`pytest-change-report` turn . into √,turn F into x Sep 14, 2020 N/A pytest :pypi:`pytest-change-xds` turn . into √,turn F into x Apr 16, 2022 N/A pytest :pypi:`pytest-chdir` A pytest fixture for changing current working directory Jan 28, 2020 N/A pytest (>=5.0.0,<6.0.0) - :pypi:`pytest-check` A pytest plugin that allows multiple failures per test. Mar 18, 2025 5 - Production/Stable pytest>=7.0.0 + :pypi:`pytest-check` A pytest plugin that allows multiple failures per test. Apr 04, 2025 5 - Production/Stable pytest>=7.0.0 :pypi:`pytest-checkdocs` check the README when running tests Apr 30, 2024 5 - Production/Stable pytest!=8.1.*,>=6; extra == "testing" :pypi:`pytest-checkipdb` plugin to check if there are ipdb debugs left Dec 04, 2023 5 - Production/Stable pytest >=2.9.2 :pypi:`pytest-check-library` check your missing library Jul 17, 2022 N/A N/A @@ -240,7 +241,7 @@ This list contains 1613 plugins. :pypi:`pytest-check-links` Check links in files Jul 29, 2020 N/A pytest<9,>=7.0 :pypi:`pytest-checklist` Pytest plugin to track and report unit/function coverage. Jun 10, 2024 N/A N/A :pypi:`pytest-check-mk` pytest plugin to test Check_MK checks Nov 19, 2015 4 - Beta pytest - :pypi:`pytest-checkpoint` Restore a checkpoint in pytest Mar 22, 2025 N/A pytest>=8.3.5 + :pypi:`pytest-checkpoint` Restore a checkpoint in pytest Mar 30, 2025 N/A pytest>=8.0.0 :pypi:`pytest-check-requirements` A package to prevent Dependency Confusion attacks against Yandex. Feb 20, 2024 N/A N/A :pypi:`pytest-ch-framework` My pytest framework Apr 17, 2024 N/A pytest==8.0.1 :pypi:`pytest-chic-report` Simple pytest plugin for generating and sending report to messengers. Nov 01, 2024 N/A pytest>=6.0 @@ -256,7 +257,7 @@ This list contains 1613 plugins. :pypi:`pytest-class-fixtures` Class as PyTest fixtures (and BDD steps) Nov 15, 2024 N/A pytest<9.0.0,>=8.3.3 :pypi:`pytest-cldf` Easy quality control for CLDF datasets using pytest Nov 07, 2022 N/A pytest (>=3.6) :pypi:`pytest-clean-database` A pytest plugin that cleans your database up after every test. Mar 14, 2025 3 - Alpha pytest<9,>=7.0 - :pypi:`pytest-cleanslate` Collects and executes pytest tests separately Sep 04, 2024 N/A pytest + :pypi:`pytest-cleanslate` Collects and executes pytest tests separately Apr 10, 2025 N/A pytest :pypi:`pytest_cleanup` Automated, comprehensive and well-organised pytest test cases. Jan 28, 2020 N/A N/A :pypi:`pytest-cleanuptotal` A cleanup plugin for pytest Nov 08, 2024 5 - Production/Stable N/A :pypi:`pytest-clerk` A set of pytest fixtures to help with integration testing with Clerk. Jan 30, 2025 N/A pytest<9.0.0,>=8.0.0 @@ -300,11 +301,11 @@ This list contains 1613 plugins. :pypi:`pytest-contexts` A plugin to run tests written with the Contexts framework using pytest May 19, 2021 4 - Beta N/A :pypi:`pytest-continuous` A pytest plugin to run tests continuously until failure or interruption. Apr 23, 2024 N/A N/A :pypi:`pytest-cookies` The pytest plugin for your Cookiecutter templates. 🍪 Mar 22, 2023 5 - Production/Stable pytest (>=3.9.0) - :pypi:`pytest-copie` The pytest plugin for your copier templates 📒 Jan 31, 2025 3 - Alpha pytest + :pypi:`pytest-copie` The pytest plugin for your copier templates 📒 Apr 09, 2025 3 - Alpha pytest :pypi:`pytest-copier` A pytest plugin to help testing Copier templates Dec 11, 2023 4 - Beta pytest>=7.3.2 :pypi:`pytest-couchdbkit` py.test extension for per-test couchdb databases using couchdbkit Apr 17, 2012 N/A N/A :pypi:`pytest-count` count erros and send email Jan 12, 2018 4 - Beta N/A - :pypi:`pytest-cov` Pytest plugin for measuring coverage. Oct 29, 2024 5 - Production/Stable pytest>=4.6 + :pypi:`pytest-cov` Pytest plugin for measuring coverage. Apr 05, 2025 5 - Production/Stable pytest>=4.6 :pypi:`pytest-cover` Pytest plugin for measuring coverage. Forked from \`pytest-cov\`. Aug 01, 2015 5 - Production/Stable N/A :pypi:`pytest-coverage` Jun 17, 2015 N/A N/A :pypi:`pytest-coverage-context` Coverage dynamic context support for PyTest, including sub-processes Jun 28, 2023 4 - Beta N/A @@ -338,7 +339,7 @@ This list contains 1613 plugins. :pypi:`pytest-dash` pytest fixtures to run dash applications. Mar 18, 2019 N/A N/A :pypi:`pytest-dashboard` May 30, 2024 N/A pytest<8.0.0,>=7.4.3 :pypi:`pytest-data` Useful functions for managing data for pytest fixtures Nov 01, 2016 5 - Production/Stable N/A - :pypi:`pytest-databases` Reusable database fixtures for any and all databases. Mar 23, 2025 4 - Beta pytest + :pypi:`pytest-databases` Reusable database fixtures for any and all databases. Apr 06, 2025 4 - Beta pytest :pypi:`pytest-databricks` Pytest plugin for remote Databricks notebooks testing Jul 29, 2020 N/A pytest :pypi:`pytest-datadir` pytest plugin for test data directories and files Feb 07, 2025 5 - Production/Stable pytest>=7.0 :pypi:`pytest-datadir-mgr` Manager for test data: downloads, artifact caching, and a tmpdir context. Apr 06, 2023 5 - Production/Stable pytest (>=7.1) @@ -396,7 +397,7 @@ This list contains 1613 plugins. :pypi:`pytest-ditto` Snapshot testing pytest plugin with minimal ceremony and flexible persistence formats. Jun 09, 2024 4 - Beta pytest>=3.5.0 :pypi:`pytest-ditto-pandas` pytest-ditto plugin for pandas snapshots. May 29, 2024 4 - Beta pytest>=3.5.0 :pypi:`pytest-ditto-pyarrow` pytest-ditto plugin for pyarrow tables. Jun 09, 2024 4 - Beta pytest>=3.5.0 - :pypi:`pytest-django` A Django plugin for pytest. Feb 10, 2025 5 - Production/Stable pytest>=7.0.0 + :pypi:`pytest-django` A Django plugin for pytest. Apr 03, 2025 5 - Production/Stable pytest>=7.0.0 :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-django-cache-xdist` A djangocachexdist plugin for pytest May 12, 2020 4 - Beta N/A @@ -421,7 +422,7 @@ This list contains 1613 plugins. :pypi:`pytest-doc` A documentation plugin for py.test. Jun 28, 2015 5 - Production/Stable N/A :pypi:`pytest-docfiles` pytest plugin to test codeblocks in your documentation. Dec 22, 2021 4 - Beta pytest (>=3.7.0) :pypi:`pytest-docgen` An RST Documentation Generator for pytest-based test suites Apr 17, 2020 N/A N/A - :pypi:`pytest-docker` Simple pytest fixtures for Docker and Docker Compose based tests Feb 06, 2025 N/A pytest<9.0,>=4.0 + :pypi:`pytest-docker` Simple pytest fixtures for Docker and Docker Compose based tests Apr 07, 2025 N/A pytest<9.0,>=4.0 :pypi:`pytest-docker-apache-fixtures` Pytest fixtures for testing with apache2 (httpd). Aug 12, 2024 4 - Beta pytest :pypi:`pytest-docker-butla` Jun 16, 2019 3 - Alpha N/A :pypi:`pytest-dockerc` Run, manage and stop Docker Compose project from Docker API Oct 09, 2020 5 - Production/Stable pytest (>=3.0) @@ -466,7 +467,7 @@ This list contains 1613 plugins. :pypi:`pytest-duration-insights` Jul 15, 2024 N/A N/A :pypi:`pytest-durations` Pytest plugin reporting fixtures and test functions execution time. Mar 18, 2025 5 - Production/Stable pytest>=4.6 :pypi:`pytest-dynamicrerun` A pytest plugin to rerun tests dynamically based off of test outcome and output. Aug 15, 2020 4 - Beta N/A - :pypi:`pytest-dynamodb` DynamoDB fixtures for pytest Mar 23, 2025 5 - Production/Stable pytest + :pypi:`pytest-dynamodb` DynamoDB fixtures for pytest Apr 04, 2025 5 - Production/Stable pytest :pypi:`pytest-easy-addoption` pytest-easy-addoption: Easy way to work with pytest addoption Jan 22, 2020 N/A N/A :pypi:`pytest-easy-api` A package to prevent Dependency Confusion attacks against Yandex. Feb 16, 2024 N/A N/A :pypi:`pytest-easyMPI` Package that supports mpi tests in pytest Oct 21, 2020 N/A N/A @@ -474,7 +475,7 @@ This list contains 1613 plugins. :pypi:`pytest-easy-server` Pytest plugin for easy testing against servers May 01, 2021 4 - Beta pytest (<5.0.0,>=4.3.1) ; python_version < "3.5" :pypi:`pytest-ebics-sandbox` A pytest plugin for testing against an EBICS sandbox server. Requires docker. Aug 15, 2022 N/A N/A :pypi:`pytest-ec2` Pytest execution on EC2 instance Oct 22, 2019 3 - Alpha N/A - :pypi:`pytest-echo` pytest plugin with mechanisms for echoing environment variables, package version and generic attributes Feb 22, 2025 5 - Production/Stable pytest>=6.0 + :pypi:`pytest-echo` pytest plugin that allows to dump environment variables, package version and generic attributes Apr 01, 2025 5 - Production/Stable pytest>=8.3.3 :pypi:`pytest-edit` Edit the source code of a failed test with \`pytest --edit\`. Nov 17, 2024 N/A pytest :pypi:`pytest-ekstazi` Pytest plugin to select test using Ekstazi algorithm Sep 10, 2022 N/A pytest :pypi:`pytest-elasticsearch` Elasticsearch fixtures and fixture factories for Pytest. Dec 03, 2024 5 - Production/Stable pytest>=7.0 @@ -634,6 +635,7 @@ This list contains 1613 plugins. :pypi:`pytest-fxtest` Oct 27, 2020 N/A N/A :pypi:`pytest-fzf` fzf-based test selector for pytest Jan 06, 2025 4 - Beta pytest>=6.0.0 :pypi:`pytest_gae` pytest plugin for apps written with Google's AppEngine Aug 03, 2016 3 - Alpha N/A + :pypi:`pytest-gak` A Pytest plugin and command line tool for interactive testing with Pytest Apr 10, 2025 N/A N/A :pypi:`pytest-gather-fixtures` set up asynchronous pytest fixtures concurrently Aug 18, 2024 N/A pytest>=7.0.0 :pypi:`pytest-gc` The garbage collector plugin for py.test Feb 01, 2018 N/A N/A :pypi:`pytest-gcov` Uses gcov to measure test coverage of a C library Feb 01, 2018 3 - Alpha N/A @@ -643,7 +645,7 @@ This list contains 1613 plugins. :pypi:`pytest-gherkin` A flexible framework for executing BDD gherkin tests Jul 27, 2019 3 - Alpha pytest (>=5.0.0) :pypi:`pytest-gh-log-group` pytest plugin for gh actions Jan 11, 2022 3 - Alpha pytest :pypi:`pytest-ghostinspector` For finding/executing Ghost Inspector tests May 17, 2016 3 - Alpha N/A - :pypi:`pytest-girder` A set of pytest fixtures for testing Girder applications. Mar 28, 2025 N/A pytest>=3.6 + :pypi:`pytest-girder` A set of pytest fixtures for testing Girder applications. Apr 08, 2025 N/A pytest>=3.6 :pypi:`pytest-git` Git repository fixture for py.test Oct 17, 2024 5 - Production/Stable pytest :pypi:`pytest-gitconfig` Provide a Git config sandbox for testing Aug 11, 2024 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 @@ -687,7 +689,7 @@ This list contains 1613 plugins. :pypi:`pytest-history` Pytest plugin to keep a history of your pytest runs Jan 14, 2024 N/A pytest (>=7.4.3,<8.0.0) :pypi:`pytest-home` Home directory fixtures Jul 28, 2024 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-custom-component` Experimental package to automatically extract test plugins for Home Assistant custom components Mar 29, 2025 3 - Alpha pytest==8.3.5 + :pypi:`pytest-homeassistant-custom-component` Experimental package to automatically extract test plugins for Home Assistant custom components Apr 05, 2025 3 - Alpha pytest==8.3.5 :pypi:`pytest-honey` A simple plugin to use with pytest Jan 07, 2022 4 - Beta pytest (>=3.5.0) :pypi:`pytest-honors` Report on tests that honor constraints, and guard against regressions Mar 06, 2020 4 - Beta N/A :pypi:`pytest-hot-reloading` Sep 23, 2024 N/A N/A @@ -710,7 +712,7 @@ This list contains 1613 plugins. :pypi:`pytest-httpdbg` A pytest plugin to record HTTP(S) requests with stack trace. Feb 11, 2025 4 - Beta pytest>=7.0.0 :pypi:`pytest-http-mocker` Pytest plugin for http mocking (via https://github.com/vilus/mocker) Oct 20, 2019 N/A N/A :pypi:`pytest-httpretty` A thin wrapper of HTTPretty for pytest Feb 16, 2014 3 - Alpha N/A - :pypi:`pytest_httpserver` pytest-httpserver is a httpserver for pytest Feb 24, 2025 3 - Alpha N/A + :pypi:`pytest_httpserver` pytest-httpserver is a httpserver for pytest Apr 10, 2025 3 - Alpha N/A :pypi:`pytest-httptesting` http_testing framework on top of pytest Dec 19, 2024 N/A pytest>=8.2.0 :pypi:`pytest-httpx` Send responses to httpx. Nov 28, 2024 5 - Production/Stable pytest==8.* :pypi:`pytest-httpx-blockage` Disable httpx requests during a test run Feb 16, 2023 N/A pytest (>=7.2.1) @@ -718,7 +720,7 @@ This list contains 1613 plugins. :pypi:`pytest-hue` Visualise PyTest status via your Phillips Hue lights May 09, 2019 N/A N/A :pypi:`pytest-hylang` Pytest plugin to allow running tests written in hylang Mar 28, 2021 N/A pytest :pypi:`pytest-hypo-25` help hypo module for pytest Jan 12, 2020 3 - Alpha N/A - :pypi:`pytest-iam` A fully functional OAUTH2 / OpenID Connect (OIDC) server to be used in your testsuite Jul 25, 2024 4 - Beta pytest>=7.0.0 + :pypi:`pytest-iam` A fully functional OAUTH2 / OpenID Connect (OIDC) server to be used in your testsuite Apr 04, 2025 4 - Beta pytest>=7.0.0 :pypi:`pytest-ibutsu` A plugin to sent pytest results to an Ibutsu server Feb 06, 2025 4 - Beta pytest>=7.1 :pypi:`pytest-icdiff` use icdiff for better error messages in pytest assertions Dec 05, 2023 4 - Beta pytest :pypi:`pytest-idapro` A pytest plugin for idapython. Allows a pytest setup to run tests outside and inside IDA in an automated manner by runnig pytest inside IDA and by mocking idapython api Nov 03, 2018 N/A N/A @@ -741,9 +743,9 @@ This list contains 1613 plugins. :pypi:`pytest-ini` Reuse pytest.ini to store env variables Apr 26, 2022 N/A N/A :pypi:`pytest-initry` Plugin for sending automation test data from Pytest to the initry Apr 30, 2024 N/A pytest<9.0.0,>=8.1.1 :pypi:`pytest-inline` A pytest plugin for writing inline tests Oct 24, 2024 4 - Beta pytest<9.0,>=7.0 - :pypi:`pytest-inmanta` A py.test plugin providing fixtures to simplify inmanta modules testing. Oct 10, 2024 5 - Production/Stable pytest - :pypi:`pytest-inmanta-extensions` Inmanta tests package Jan 17, 2025 5 - Production/Stable N/A - :pypi:`pytest-inmanta-lsm` Common fixtures for inmanta LSM related modules Dec 13, 2024 5 - Production/Stable N/A + :pypi:`pytest-inmanta` A py.test plugin providing fixtures to simplify inmanta modules testing. Apr 09, 2025 5 - Production/Stable pytest + :pypi:`pytest-inmanta-extensions` Inmanta tests package Apr 10, 2025 5 - Production/Stable N/A + :pypi:`pytest-inmanta-lsm` Common fixtures for inmanta LSM related modules Apr 09, 2025 5 - Production/Stable N/A :pypi:`pytest-inmanta-yang` Common fixtures used in inmanta yang related modules Feb 22, 2024 4 - Beta pytest :pypi:`pytest-Inomaly` A simple image diff plugin for pytest Feb 13, 2018 4 - Beta N/A :pypi:`pytest-in-robotframework` The extension enables easy execution of pytest tests within the Robot Framework environment. Nov 23, 2024 N/A pytest @@ -756,7 +758,7 @@ This list contains 1613 plugins. :pypi:`pytest-interactive` A pytest plugin for console based interactive test selection just after the collection phase Nov 30, 2017 3 - Alpha N/A :pypi:`pytest-intercept-remote` Pytest plugin for intercepting outgoing connection requests during pytest run. May 24, 2021 4 - Beta pytest (>=4.6) :pypi:`pytest-interface-tester` Pytest plugin for checking charm relation interface protocol compliance. Feb 13, 2025 4 - Beta pytest - :pypi:`pytest-invenio` Pytest fixtures for Invenio. Mar 07, 2025 5 - Production/Stable pytest<9.0.0,>=6 + :pypi:`pytest-invenio` Pytest fixtures for Invenio. Apr 02, 2025 5 - Production/Stable pytest<9.0.0,>=6 :pypi:`pytest-involve` Run tests covering a specific file or changeset Feb 02, 2020 4 - Beta pytest (>=3.5.0) :pypi:`pytest-iovis` A Pytest plugin to enable Jupyter Notebook testing with Papermill Nov 06, 2024 4 - Beta pytest>=7.1.0 :pypi:`pytest-ipdb` A py.test plug-in to enable drop to ipdb debugger on test failure. Mar 20, 2013 2 - Pre-Alpha N/A @@ -852,21 +854,21 @@ This list contains 1613 plugins. :pypi:`pytest-logger` Plugin configuring handlers for loggers from Python logging module. Mar 10, 2024 5 - Production/Stable pytest (>=3.2) :pypi:`pytest-logging` Configures logging and allows tweaking the log level with a py.test flag Nov 04, 2015 4 - Beta N/A :pypi:`pytest-logging-end-to-end-test-tool` Sep 23, 2022 N/A pytest (>=7.1.2,<8.0.0) - :pypi:`pytest-logging-strict` pytest fixture logging configured from packaged YAML Mar 23, 2025 3 - Alpha pytest - :pypi:`pytest-logikal` Common testing environment Mar 02, 2025 5 - Production/Stable pytest==8.3.4 + :pypi:`pytest-logging-strict` pytest fixture logging configured from packaged YAML Apr 09, 2025 3 - Alpha pytest + :pypi:`pytest-logikal` Common testing environment Apr 02, 2025 5 - Production/Stable pytest==8.3.5 :pypi:`pytest-log-report` Package for creating a pytest test run reprot Dec 26, 2019 N/A N/A :pypi:`pytest-logscanner` Pytest plugin for logscanner (A logger for python logging outputting to easily viewable (and filterable) html files. Good for people not grep savey, and color higlighting and quickly changing filters might even bye useful for commandline wizards.) Sep 30, 2024 4 - Beta pytest>=8.2.2 :pypi:`pytest-loguru` Pytest Loguru Mar 20, 2024 5 - Production/Stable pytest; extra == "test" :pypi:`pytest-loop` pytest plugin for looping tests Oct 17, 2024 5 - Production/Stable pytest :pypi:`pytest-lsp` A pytest plugin for end-to-end testing of language servers Nov 23, 2024 3 - Alpha pytest :pypi:`pytest-lw-realtime-result` Pytest plugin to generate realtime test results to a file Mar 13, 2025 N/A pytest>=3.5.0 - :pypi:`pytest-manifest` PyTest plugin for recording and asserting against a manifest file Mar 18, 2025 N/A pytest + :pypi:`pytest-manifest` PyTest plugin for recording and asserting against a manifest file Apr 07, 2025 N/A pytest :pypi:`pytest-manual-marker` pytest marker for marking manual tests Aug 04, 2022 3 - Alpha pytest>=7 :pypi:`pytest-mark-count` Get a count of the number of tests marked, unmarked, and unique tests if tests have multiple markers Nov 13, 2024 4 - Beta pytest>=8.0.0 :pypi:`pytest-markdoctest` A pytest plugin to doctest your markdown files Jul 22, 2022 4 - Beta pytest (>=6) :pypi:`pytest-markdown` Test your markdown docs with pytest Jan 15, 2021 4 - Beta pytest (>=6.0.1,<7.0.0) - :pypi:`pytest-markdown-docs` Run markdown code fences through pytest Mar 13, 2025 N/A pytest>=7.0.0 - :pypi:`pytest-marker-bugzilla` py.test bugzilla integration plugin, using markers Jan 09, 2020 N/A N/A + :pypi:`pytest-markdown-docs` Run markdown code fences through pytest Apr 09, 2025 N/A pytest>=7.0.0 + :pypi:`pytest-marker-bugzilla` py.test bugzilla integration plugin, using markers Apr 02, 2025 5 - Production/Stable pytest>=2.2.4 :pypi:`pytest-markers-presence` A simple plugin to detect missed pytest tags and markers" Oct 30, 2024 4 - Beta pytest>=6.0 :pypi:`pytest-markfiltration` UNKNOWN Nov 08, 2011 3 - Alpha N/A :pypi:`pytest-mark-manage` 用例标签化管理 Aug 15, 2024 N/A pytest @@ -891,7 +893,7 @@ This list contains 1613 plugins. :pypi:`pytest-memray` A simple plugin to use with pytest Jul 25, 2024 N/A pytest>=7.2 :pypi:`pytest-menu` A pytest plugin for console based interactive test selection just after the collection phase Oct 04, 2017 3 - Alpha pytest (>=2.4.2) :pypi:`pytest-mercurial` pytest plugin to write integration tests for projects using Mercurial Python internals Nov 21, 2020 1 - Planning N/A - :pypi:`pytest-mergify` Pytest plugin for Mergify Mar 27, 2025 N/A N/A + :pypi:`pytest-mergify` Pytest plugin for Mergify Apr 10, 2025 N/A N/A :pypi:`pytest-mesh` pytest_mesh插件 Aug 05, 2022 N/A pytest (==7.1.2) :pypi:`pytest-message` Pytest plugin for sending report message of marked tests execution Aug 04, 2022 N/A pytest (>=6.2.5) :pypi:`pytest-messenger` Pytest to Slack reporting plugin Nov 24, 2022 5 - Production/Stable N/A @@ -899,12 +901,14 @@ This list contains 1613 plugins. :pypi:`pytest-metrics` Custom metrics report for pytest Apr 04, 2020 N/A pytest :pypi:`pytest-mh` Pytest multihost plugin Mar 06, 2025 N/A pytest :pypi:`pytest-mimesis` Mimesis integration with the pytest test runner Mar 21, 2020 5 - Production/Stable pytest (>=4.2) + :pypi:`pytest-mimic` Easily record function calls while testing Apr 11, 2025 4 - Beta pytest>=6.2.0 :pypi:`pytest-minecraft` A pytest plugin for running tests against Minecraft releases Apr 06, 2022 N/A pytest (>=6.0.1) :pypi:`pytest-mini` A plugin to test mp Feb 06, 2023 N/A pytest (>=7.2.0,<8.0.0) :pypi:`pytest-minio-mock` A pytest plugin for mocking Minio S3 interactions Aug 27, 2024 N/A pytest>=5.0.0 :pypi:`pytest-missing-fixtures` Pytest plugin that creates missing fixtures Oct 14, 2020 4 - Beta pytest (>=3.5.0) :pypi:`pytest-missing-modules` Pytest plugin to easily fake missing modules Sep 03, 2024 N/A pytest>=8.3.2 :pypi:`pytest-mitmproxy` pytest plugin for mitmproxy tests Nov 13, 2024 N/A pytest>=7.0 + :pypi:`pytest-mitmproxy-plugin` Use MITM Proxy in autotests with full control from code Apr 10, 2025 4 - Beta pytest>=7.2.0 :pypi:`pytest-ml` Test your machine learning! May 04, 2019 4 - Beta N/A :pypi:`pytest-mocha` pytest plugin to display test execution output like a mochajs Apr 02, 2020 4 - Beta pytest (>=5.4.0) :pypi:`pytest-mock` Thin-wrapper around the mock package for easier use with pytest Mar 21, 2024 5 - Production/Stable pytest>=6.2.5 @@ -945,7 +949,7 @@ This list contains 1613 plugins. :pypi:`pytest-mutagen` Add the mutation testing feature to pytest Jul 24, 2020 N/A pytest (>=5.4) :pypi:`pytest-my-cool-lib` Nov 02, 2023 N/A pytest (>=7.1.3,<8.0.0) :pypi:`pytest-my-plugin` A pytest plugin that does awesome things Jan 27, 2025 N/A pytest>=6.0 - :pypi:`pytest-mypy` A Pytest Plugin for Mypy Mar 28, 2025 5 - Production/Stable pytest>=7.0 + :pypi:`pytest-mypy` A Pytest Plugin for Mypy Apr 02, 2025 5 - Production/Stable pytest>=7.0 :pypi:`pytest-mypyd` Mypy static type checker plugin for Pytest Aug 20, 2019 4 - Beta pytest (<4.7,>=2.8) ; python_version < "3.5" :pypi:`pytest-mypy-plugins` pytest plugin for writing tests for mypy plugins Dec 21, 2024 4 - Beta pytest>=7.0.0 :pypi:`pytest-mypy-plugins-shim` Substitute for "pytest-mypy-plugins" for Python implementations which aren't supported by mypy. Feb 14, 2025 N/A pytest>=6.0.0 @@ -957,7 +961,7 @@ This list contains 1613 plugins. :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-neos` Pytest plugin for neos Sep 10, 2024 5 - Production/Stable pytest<8.0,>=7.2; extra == "dev" :pypi:`pytest-netconf` A pytest plugin that provides a mock NETCONF (RFC6241/RFC6242) server for local testing. Jan 06, 2025 N/A N/A - :pypi:`pytest-netdut` "Automated software testing for switches using pytest" Jul 05, 2024 N/A pytest<7.3,>=3.5.0 + :pypi:`pytest-netdut` "Automated software testing for switches using pytest" Apr 11, 2025 N/A pytest>=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-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) @@ -965,7 +969,7 @@ This list contains 1613 plugins. :pypi:`pytest-nginx-iplweb` nginx fixture for pytest - iplweb temporary fork Mar 01, 2019 5 - Production/Stable N/A :pypi:`pytest-ngrok` Jan 20, 2022 3 - Alpha pytest :pypi:`pytest-ngsfixtures` pytest ngs fixtures Sep 06, 2019 2 - Pre-Alpha pytest (>=5.0.0) - :pypi:`pytest-nhsd-apim` Pytest plugin accessing NHSDigital's APIM proxies Mar 21, 2025 N/A pytest<9.0.0,>=8.2.0 + :pypi:`pytest-nhsd-apim` Pytest plugin accessing NHSDigital's APIM proxies Apr 01, 2025 N/A pytest<9.0.0,>=8.2.0 :pypi:`pytest-nice` A pytest plugin that alerts user of failed test cases with screen notifications May 04, 2019 4 - Beta pytest :pypi:`pytest-nice-parametrize` A small snippet for nicer PyTest's Parametrize Apr 17, 2021 5 - Production/Stable N/A :pypi:`pytest_nlcov` Pytest plugin to get the coverage of the new lines (based on git diff) only Aug 05, 2024 N/A N/A @@ -973,6 +977,7 @@ This list contains 1613 plugins. :pypi:`pytest-node-dependency` pytest plugin for controlling execution flow Apr 10, 2024 5 - Production/Stable N/A :pypi:`pytest-nodev` Test-driven source code search for Python. Jul 21, 2016 4 - Beta pytest (>=2.8.1) :pypi:`pytest-nogarbage` Ensure a test produces no garbage Feb 24, 2025 5 - Production/Stable pytest>=4.6.0 + :pypi:`pytest-no-problem` Pytest plugin to tell you when there's no problem Apr 05, 2025 N/A pytest>=7.0 :pypi:`pytest-nose-attrib` pytest plugin to use nose @attrib marks decorators and pick tests based on attributes and partially uses nose-attrib plugin approach Aug 13, 2023 N/A N/A :pypi:`pytest_notebook` A pytest plugin for testing Jupyter Notebooks. Nov 28, 2023 4 - Beta pytest>=3.5.0 :pypi:`pytest-notice` Send pytest execution result email Nov 05, 2020 N/A N/A @@ -997,6 +1002,7 @@ This list contains 1613 plugins. :pypi:`pytest-oof` A Pytest plugin providing structured, programmatic access to a test run's results Dec 11, 2023 4 - Beta N/A :pypi:`pytest-oot` Run object-oriented tests in a simple format Sep 18, 2016 4 - Beta N/A :pypi:`pytest-openfiles` Pytest plugin for detecting inadvertent open file handles Jun 05, 2024 3 - Alpha pytest>=4.6 + :pypi:`pytest-open-html` Auto-open HTML reports after pytest runs Mar 31, 2025 N/A pytest>=6.0 :pypi:`pytest-opentelemetry` A pytest plugin for instrumenting test runs via OpenTelemetry Nov 22, 2024 N/A pytest :pypi:`pytest-opentmi` pytest plugin for publish results to opentmi Mar 22, 2025 5 - Production/Stable pytest>=5.0 :pypi:`pytest-operator` Fixtures for Operators Sep 28, 2022 N/A pytest @@ -1019,7 +1025,6 @@ This list contains 1613 plugins. :pypi:`pytest-parallel-39` a pytest plugin for parallel and concurrent testing Jul 12, 2021 3 - Alpha pytest (>=3.0.0) :pypi:`pytest-parallelize-tests` pytest plugin that parallelizes test execution across multiple hosts Jan 27, 2023 4 - Beta N/A :pypi:`pytest-param` pytest plugin to test all, first, last or random params Sep 11, 2016 4 - Beta pytest (>=2.6.0) - :pypi:`pytest-paramark` Configure pytest fixtures using a combination of"parametrize" and markers Jan 10, 2020 4 - Beta pytest (>=4.5.0) :pypi:`pytest-parametrization` Simpler PyTest parametrization May 22, 2022 5 - Production/Stable N/A :pypi:`pytest-parametrization-annotation` A pytest library for parametrizing tests using type hints. Dec 10, 2024 5 - Production/Stable pytest>=7 :pypi:`pytest-parametrize` pytest decorator for parametrizing test cases in a dict-way Nov 10, 2024 5 - Production/Stable pytest<9.0.0,>=8.3.0 @@ -1047,7 +1052,7 @@ This list contains 1613 plugins. :pypi:`pytest-performancetotal` A performance plugin for pytest Feb 01, 2025 5 - Production/Stable N/A :pypi:`pytest-persistence` Pytest tool for persistent objects Aug 21, 2024 N/A N/A :pypi:`pytest-pexpect` Pytest pexpect plugin. Aug 13, 2024 4 - Beta pytest>=6.2.0 - :pypi:`pytest-pg` A tiny plugin for pytest which runs PostgreSQL in Docker May 21, 2024 5 - Production/Stable pytest>=6.0.0 + :pypi:`pytest-pg` A tiny plugin for pytest which runs PostgreSQL in Docker Apr 11, 2025 5 - Production/Stable pytest>=8.0.0 :pypi:`pytest-pgsql` Pytest plugins and helpers for tests using a Postgres database. May 13, 2020 5 - Production/Stable pytest (>=3.0.0) :pypi:`pytest-phmdoctest` pytest plugin to test Python examples in Markdown using phmdoctest. Apr 15, 2022 4 - Beta pytest (>=5.4.3) :pypi:`pytest-phoenix-interface` Pytest extension tool for phoenix projects. Mar 19, 2025 N/A N/A @@ -1172,10 +1177,10 @@ This list contains 1613 plugins. :pypi:`pytest-randomness` Pytest plugin about random seed management May 30, 2019 3 - Alpha N/A :pypi:`pytest-random-num` Randomise the order in which pytest tests are run with some control over the randomness Oct 19, 2020 5 - Production/Stable N/A :pypi:`pytest-random-order` Randomise the order in which pytest tests are run with some control over the randomness Jan 20, 2024 5 - Production/Stable pytest >=3.0.0 - :pypi:`pytest-ranking` A Pytest plugin for automatically prioritizing/ranking tests to speed up failure detection Jan 14, 2025 4 - Beta pytest>=7.4.3 + :pypi:`pytest-ranking` A Pytest plugin for faster fault detection via regression test prioritization Apr 08, 2025 4 - Beta pytest>=7.4.3 :pypi:`pytest-readme` Test your README.md file Sep 02, 2022 5 - Production/Stable N/A :pypi:`pytest-reana` Pytest fixtures for REANA. Sep 04, 2024 3 - Alpha N/A - :pypi:`pytest-recorder` Pytest plugin, meant to facilitate unit tests writing for tools consumming Web APIs. Jan 09, 2025 N/A N/A + :pypi:`pytest-recorder` Pytest plugin, meant to facilitate unit tests writing for tools consumming Web APIs. Mar 31, 2025 N/A N/A :pypi:`pytest-recording` A pytest plugin that allows you recording of network interactions via VCR.py Jul 09, 2024 4 - Beta pytest>=3.5.0 :pypi:`pytest-recordings` Provides pytest plugins for reporting request/response traffic, screenshots, and more to ReportPortal Aug 13, 2020 N/A N/A :pypi:`pytest-record-video` 用例执行过程中录制视频 Oct 31, 2024 N/A N/A @@ -1196,7 +1201,7 @@ This list contains 1613 plugins. :pypi:`pytest-remote-response` Pytest plugin for capturing and mocking connection requests. Apr 26, 2023 5 - Production/Stable pytest (>=4.6) :pypi:`pytest-remove-stale-bytecode` py.test plugin to remove stale byte code files. Jul 07, 2023 4 - Beta pytest :pypi:`pytest-reorder` Reorder tests depending on their paths and names. May 31, 2018 4 - Beta pytest - :pypi:`pytest-repeat` pytest plugin for repeating tests Oct 09, 2023 5 - Production/Stable pytest + :pypi:`pytest-repeat` pytest plugin for repeating tests Apr 07, 2025 5 - Production/Stable pytest :pypi:`pytest_repeater` py.test plugin for repeating single test multiple times. Feb 09, 2018 1 - Planning N/A :pypi:`pytest-replay` Saves previous test runs and allow re-execute previous pytest runs to reproduce crashes or flaky tests Feb 05, 2025 5 - Production/Stable pytest :pypi:`pytest-repo-health` A pytest plugin to report on repository standards conformance Mar 12, 2025 3 - Alpha pytest @@ -1204,7 +1209,7 @@ This list contains 1613 plugins. :pypi:`pytest-reporter` Generate Pytest reports with templates Feb 28, 2024 4 - Beta pytest :pypi:`pytest-reporter-html1` A basic HTML report template for Pytest Oct 11, 2024 4 - Beta N/A :pypi:`pytest-reporter-html-dots` A basic HTML report for pytest using Jinja2 template engine. Jan 22, 2023 N/A N/A - :pypi:`pytest-report-extras` Pytest plugin to enhance pytest-html and allure reports by adding comments, screenshots, webpage sources and attachments. Mar 20, 2025 N/A pytest>=8.0.0 + :pypi:`pytest-report-extras` Pytest plugin to enhance pytest-html and allure reports by adding comments, screenshots, webpage sources and attachments. Apr 04, 2025 N/A pytest>=8.0.0 :pypi:`pytest-reportinfra` Pytest plugin for reportinfra Aug 11, 2019 3 - Alpha N/A :pypi:`pytest-reporting` A plugin to report summarized results in a table format Oct 25, 2019 4 - Beta pytest (>=3.5.0) :pypi:`pytest-reportlog` Replacement for the --resultlog option, focused in simplicity and extensibility May 22, 2023 3 - Alpha pytest @@ -1283,7 +1288,7 @@ This list contains 1613 plugins. :pypi:`pytest-sanity` Dec 07, 2020 N/A N/A :pypi:`pytest-sa-pg` May 14, 2019 N/A N/A :pypi:`pytest_sauce` pytest_sauce provides sane and helpful methods worked out in clearcode to run py.test tests with selenium/saucelabs Jul 14, 2014 3 - Alpha N/A - :pypi:`pytest-sbase` A complete web automation framework for end-to-end testing. Mar 29, 2025 5 - Production/Stable N/A + :pypi:`pytest-sbase` A complete web automation framework for end-to-end testing. Apr 10, 2025 5 - Production/Stable N/A :pypi:`pytest-scenario` pytest plugin for test scenarios Feb 06, 2017 3 - Alpha N/A :pypi:`pytest-scenario-files` A pytest plugin that generates unit test scenarios from data files. Nov 21, 2024 5 - Production/Stable pytest>=7.0 :pypi:`pytest-schedule` Automate and customize test scheduling effortlessly on local machines. Oct 31, 2024 N/A N/A @@ -1295,7 +1300,7 @@ This list contains 1613 plugins. :pypi:`pytest-select` A pytest plugin which allows to (de-)select tests from a file. Jan 18, 2019 3 - Alpha pytest (>=3.0) :pypi:`pytest-selenium` pytest plugin for Selenium Feb 01, 2024 5 - Production/Stable pytest>=6.0.0 :pypi:`pytest-selenium-auto` pytest plugin to automatically capture screenshots upon selenium webdriver events Nov 07, 2023 N/A pytest >= 7.0.0 - :pypi:`pytest-seleniumbase` A complete web automation framework for end-to-end testing. Mar 29, 2025 5 - Production/Stable N/A + :pypi:`pytest-seleniumbase` A complete web automation framework for end-to-end testing. Apr 10, 2025 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-selfie` A pytest plugin for selfie snapshot testing. Dec 16, 2024 N/A pytest>=8.0.0 @@ -1328,6 +1333,7 @@ This list contains 1613 plugins. :pypi:`pytest-simple-plugin` Simple pytest plugin Nov 27, 2019 N/A N/A :pypi:`pytest-simple-settings` simple-settings plugin for pytest Nov 17, 2020 4 - Beta pytest :pypi:`pytest-single-file-logging` Allow for multiple processes to log to a single file May 05, 2016 4 - Beta pytest (>=2.8.1) + :pypi:`pytest-skip` A pytest plugin which allows to (de-)select or skip tests from a file. Apr 04, 2025 3 - Alpha pytest :pypi:`pytest-skip-markers` Pytest Salt Plugin Aug 09, 2024 5 - Production/Stable pytest>=7.1.0 :pypi:`pytest-skipper` A plugin that selects only tests with changes in execution path Mar 26, 2017 3 - Alpha pytest (>=3.0.6) :pypi:`pytest-skippy` Automatically skip tests that don't need to run! Jan 27, 2018 3 - Alpha pytest (>=2.3.4) @@ -1429,7 +1435,7 @@ This list contains 1613 plugins. :pypi:`pytest-tap` Test Anything Protocol (TAP) reporting plugin for pytest Jan 30, 2025 5 - Production/Stable pytest>=3.0 :pypi:`pytest-tape` easy assertion with expected results saved to yaml files Mar 17, 2021 4 - Beta N/A :pypi:`pytest-target` Pytest plugin for remote target orchestration. Jan 21, 2021 3 - Alpha pytest (>=6.1.2,<7.0.0) - :pypi:`pytest-taskgraph` Add your description here Dec 12, 2024 N/A pytest + :pypi:`pytest-taskgraph` Add your description here Apr 09, 2025 N/A pytest :pypi:`pytest-tblineinfo` tblineinfo is a py.test plugin that insert the node id in the final py.test report when --tb=line option is used Dec 01, 2015 3 - Alpha pytest (>=2.0) :pypi:`pytest-tcpclient` A pytest plugin for testing TCP clients Nov 16, 2022 N/A pytest (<8,>=7.1.3) :pypi:`pytest-tdd` run pytest on a python module Aug 18, 2023 4 - Beta N/A @@ -1448,7 +1454,7 @@ This list contains 1613 plugins. :pypi:`pytest-testdox` A testdox format reporter for pytest Jul 22, 2023 5 - Production/Stable pytest (>=4.6.0) :pypi:`pytest-test-grouping` A Pytest plugin for running a subset of your tests by splitting them in to equally sized groups. Feb 01, 2023 5 - Production/Stable pytest (>=2.5) :pypi:`pytest-test-groups` A Pytest plugin for running a subset of your tests by splitting them in to equally sized groups. Mar 28, 2025 5 - Production/Stable pytest>=7.0.0 - :pypi:`pytest-testinfra` Test infrastructures May 26, 2024 5 - Production/Stable pytest>=6 + :pypi:`pytest-testinfra` Test infrastructures Mar 30, 2025 5 - Production/Stable pytest>=6 :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-testit-parametrize` A pytest plugin for uploading parameterized tests parameters into TMS TestIT Dec 04, 2024 4 - Beta pytest>=8.3.3 @@ -1530,6 +1536,7 @@ This list contains 1613 plugins. :pypi:`pytest-tst` Customize pytest options, output and exit code to make it compatible with tst Apr 27, 2022 N/A pytest (>=5.0.0) :pypi:`pytest-tstcls` Test Class Base Mar 23, 2020 5 - Production/Stable N/A :pypi:`pytest-tui` Text User Interface (TUI) and HTML report for Pytest test runs Dec 08, 2023 4 - Beta N/A + :pypi:`pytest-tuitest` pytest plugin for testing TUI and regular command-line applications. Apr 11, 2025 N/A pytest>=7.4.0 :pypi:`pytest-tutorials` Mar 11, 2023 N/A N/A :pypi:`pytest-twilio-conversations-client-mock` Aug 02, 2022 N/A N/A :pypi:`pytest-twisted` A twisted plugin for pytest. Sep 10, 2024 5 - Production/Stable pytest>=2.3 @@ -1631,7 +1638,7 @@ This list contains 1613 plugins. :pypi:`pytest-yapf` Run yapf Jul 06, 2017 4 - Beta pytest (>=3.1.1) :pypi:`pytest-yapf3` Validate your Python file format with yapf Mar 29, 2023 5 - Production/Stable pytest (>=7) :pypi:`pytest-yield` PyTest plugin to run tests concurrently, each \`yield\` switch context to other one Jan 23, 2019 N/A N/A - :pypi:`pytest-yls` Pytest plugin to test the YLS as a whole. Oct 18, 2024 N/A pytest<9.0.0,>=8.3.3 + :pypi:`pytest-yls` Pytest plugin to test the YLS as a whole. Apr 09, 2025 N/A pytest<9.0.0,>=8.3.3 :pypi:`pytest-youqu-playwright` pytest-youqu-playwright Jun 12, 2024 N/A pytest :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) @@ -1646,7 +1653,7 @@ This list contains 1613 plugins. :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-zy` 接口自动化测试框架 Mar 24, 2024 N/A pytest~=7.2.0 - :pypi:`tursu` 🎬 A pytest plugin that transpiles Gherkin feature files to Python using AST, enforcing typing for ease of use and debugging. Mar 22, 2025 4 - Beta pytest>=8.3.5 + :pypi:`tursu` 🎬 A pytest plugin that transpiles Gherkin feature files to Python using AST, enforcing typing for ease of use and debugging. Apr 10, 2025 4 - Beta pytest>=8.3.5 =============================================== ====================================================================================================================================================================================================================================================================================================================================================================================== ============== ===================== ================================================ .. only:: latex @@ -1975,7 +1982,7 @@ This list contains 1613 plugins. Pytest plugin to allow use of Annotated in tests to resolve fixtures :pypi:`pytest-ansible` - *last release*: Jan 21, 2025, + *last release*: Apr 01, 2025, *status*: 5 - Production/Stable, *requires*: pytest>=6 @@ -2409,7 +2416,7 @@ This list contains 1613 plugins. Protect your AWS credentials in unit tests :pypi:`pytest-aws-fixtures` - *last release*: Oct 07, 2024, + *last release*: Apr 06, 2025, *status*: N/A, *requires*: pytest<9.0.0,>=8.0.0 @@ -2549,7 +2556,7 @@ This list contains 1613 plugins. Pytest plugin to run your tests with beartype checking enabled. :pypi:`pytest-bec-e2e` - *last release*: Mar 27, 2025, + *last release*: Apr 01, 2025, *status*: 3 - Alpha, *requires*: pytest @@ -2702,6 +2709,13 @@ This list contains 1613 plugins. The pytest plugin for your Django Boilerplate. + :pypi:`pytest-bonsai` + *last release*: Apr 08, 2025, + *status*: N/A, + *requires*: pytest>=6 + + + :pypi:`pytest-boost-xml` *last release*: Nov 30, 2022, *status*: 4 - Beta, @@ -3039,7 +3053,7 @@ This list contains 1613 plugins. A pytest fixture for changing current working directory :pypi:`pytest-check` - *last release*: Mar 18, 2025, + *last release*: Apr 04, 2025, *status*: 5 - Production/Stable, *requires*: pytest>=7.0.0 @@ -3095,9 +3109,9 @@ This list contains 1613 plugins. pytest plugin to test Check_MK checks :pypi:`pytest-checkpoint` - *last release*: Mar 22, 2025, + *last release*: Mar 30, 2025, *status*: N/A, - *requires*: pytest>=8.3.5 + *requires*: pytest>=8.0.0 Restore a checkpoint in pytest @@ -3207,7 +3221,7 @@ This list contains 1613 plugins. A pytest plugin that cleans your database up after every test. :pypi:`pytest-cleanslate` - *last release*: Sep 04, 2024, + *last release*: Apr 10, 2025, *status*: N/A, *requires*: pytest @@ -3515,7 +3529,7 @@ This list contains 1613 plugins. The pytest plugin for your Cookiecutter templates. 🍪 :pypi:`pytest-copie` - *last release*: Jan 31, 2025, + *last release*: Apr 09, 2025, *status*: 3 - Alpha, *requires*: pytest @@ -3543,7 +3557,7 @@ This list contains 1613 plugins. count erros and send email :pypi:`pytest-cov` - *last release*: Oct 29, 2024, + *last release*: Apr 05, 2025, *status*: 5 - Production/Stable, *requires*: pytest>=4.6 @@ -3781,7 +3795,7 @@ This list contains 1613 plugins. Useful functions for managing data for pytest fixtures :pypi:`pytest-databases` - *last release*: Mar 23, 2025, + *last release*: Apr 06, 2025, *status*: 4 - Beta, *requires*: pytest @@ -4187,7 +4201,7 @@ This list contains 1613 plugins. pytest-ditto plugin for pyarrow tables. :pypi:`pytest-django` - *last release*: Feb 10, 2025, + *last release*: Apr 03, 2025, *status*: 5 - Production/Stable, *requires*: pytest>=7.0.0 @@ -4362,7 +4376,7 @@ This list contains 1613 plugins. An RST Documentation Generator for pytest-based test suites :pypi:`pytest-docker` - *last release*: Feb 06, 2025, + *last release*: Apr 07, 2025, *status*: N/A, *requires*: pytest<9.0,>=4.0 @@ -4677,7 +4691,7 @@ This list contains 1613 plugins. A pytest plugin to rerun tests dynamically based off of test outcome and output. :pypi:`pytest-dynamodb` - *last release*: Mar 23, 2025, + *last release*: Apr 04, 2025, *status*: 5 - Production/Stable, *requires*: pytest @@ -4733,11 +4747,11 @@ This list contains 1613 plugins. Pytest execution on EC2 instance :pypi:`pytest-echo` - *last release*: Feb 22, 2025, + *last release*: Apr 01, 2025, *status*: 5 - Production/Stable, - *requires*: pytest>=6.0 + *requires*: pytest>=8.3.3 - pytest plugin with mechanisms for echoing environment variables, package version and generic attributes + pytest plugin that allows to dump environment variables, package version and generic attributes :pypi:`pytest-edit` *last release*: Nov 17, 2024, @@ -5852,6 +5866,13 @@ This list contains 1613 plugins. pytest plugin for apps written with Google's AppEngine + :pypi:`pytest-gak` + *last release*: Apr 10, 2025, + *status*: N/A, + *requires*: N/A + + A Pytest plugin and command line tool for interactive testing with Pytest + :pypi:`pytest-gather-fixtures` *last release*: Aug 18, 2024, *status*: N/A, @@ -5916,7 +5937,7 @@ This list contains 1613 plugins. For finding/executing Ghost Inspector tests :pypi:`pytest-girder` - *last release*: Mar 28, 2025, + *last release*: Apr 08, 2025, *status*: N/A, *requires*: pytest>=3.6 @@ -6224,7 +6245,7 @@ This list contains 1613 plugins. A pytest plugin for use with homeassistant custom components. :pypi:`pytest-homeassistant-custom-component` - *last release*: Mar 29, 2025, + *last release*: Apr 05, 2025, *status*: 3 - Alpha, *requires*: pytest==8.3.5 @@ -6385,7 +6406,7 @@ This list contains 1613 plugins. A thin wrapper of HTTPretty for pytest :pypi:`pytest_httpserver` - *last release*: Feb 24, 2025, + *last release*: Apr 10, 2025, *status*: 3 - Alpha, *requires*: N/A @@ -6441,7 +6462,7 @@ This list contains 1613 plugins. help hypo module for pytest :pypi:`pytest-iam` - *last release*: Jul 25, 2024, + *last release*: Apr 04, 2025, *status*: 4 - Beta, *requires*: pytest>=7.0.0 @@ -6602,21 +6623,21 @@ This list contains 1613 plugins. A pytest plugin for writing inline tests :pypi:`pytest-inmanta` - *last release*: Oct 10, 2024, + *last release*: Apr 09, 2025, *status*: 5 - Production/Stable, *requires*: pytest A py.test plugin providing fixtures to simplify inmanta modules testing. :pypi:`pytest-inmanta-extensions` - *last release*: Jan 17, 2025, + *last release*: Apr 10, 2025, *status*: 5 - Production/Stable, *requires*: N/A Inmanta tests package :pypi:`pytest-inmanta-lsm` - *last release*: Dec 13, 2024, + *last release*: Apr 09, 2025, *status*: 5 - Production/Stable, *requires*: N/A @@ -6707,7 +6728,7 @@ This list contains 1613 plugins. Pytest plugin for checking charm relation interface protocol compliance. :pypi:`pytest-invenio` - *last release*: Mar 07, 2025, + *last release*: Apr 02, 2025, *status*: 5 - Production/Stable, *requires*: pytest<9.0.0,>=6 @@ -7379,16 +7400,16 @@ This list contains 1613 plugins. :pypi:`pytest-logging-strict` - *last release*: Mar 23, 2025, + *last release*: Apr 09, 2025, *status*: 3 - Alpha, *requires*: pytest pytest fixture logging configured from packaged YAML :pypi:`pytest-logikal` - *last release*: Mar 02, 2025, + *last release*: Apr 02, 2025, *status*: 5 - Production/Stable, - *requires*: pytest==8.3.4 + *requires*: pytest==8.3.5 Common testing environment @@ -7435,7 +7456,7 @@ This list contains 1613 plugins. Pytest plugin to generate realtime test results to a file :pypi:`pytest-manifest` - *last release*: Mar 18, 2025, + *last release*: Apr 07, 2025, *status*: N/A, *requires*: pytest @@ -7470,16 +7491,16 @@ This list contains 1613 plugins. Test your markdown docs with pytest :pypi:`pytest-markdown-docs` - *last release*: Mar 13, 2025, + *last release*: Apr 09, 2025, *status*: N/A, *requires*: pytest>=7.0.0 Run markdown code fences through pytest :pypi:`pytest-marker-bugzilla` - *last release*: Jan 09, 2020, - *status*: N/A, - *requires*: N/A + *last release*: Apr 02, 2025, + *status*: 5 - Production/Stable, + *requires*: pytest>=2.2.4 py.test bugzilla integration plugin, using markers @@ -7652,7 +7673,7 @@ This list contains 1613 plugins. pytest plugin to write integration tests for projects using Mercurial Python internals :pypi:`pytest-mergify` - *last release*: Mar 27, 2025, + *last release*: Apr 10, 2025, *status*: N/A, *requires*: N/A @@ -7707,6 +7728,13 @@ This list contains 1613 plugins. Mimesis integration with the pytest test runner + :pypi:`pytest-mimic` + *last release*: Apr 11, 2025, + *status*: 4 - Beta, + *requires*: pytest>=6.2.0 + + Easily record function calls while testing + :pypi:`pytest-minecraft` *last release*: Apr 06, 2022, *status*: N/A, @@ -7749,6 +7777,13 @@ This list contains 1613 plugins. pytest plugin for mitmproxy tests + :pypi:`pytest-mitmproxy-plugin` + *last release*: Apr 10, 2025, + *status*: 4 - Beta, + *requires*: pytest>=7.2.0 + + Use MITM Proxy in autotests with full control from code + :pypi:`pytest-ml` *last release*: May 04, 2019, *status*: 4 - Beta, @@ -8030,7 +8065,7 @@ This list contains 1613 plugins. A pytest plugin that does awesome things :pypi:`pytest-mypy` - *last release*: Mar 28, 2025, + *last release*: Apr 02, 2025, *status*: 5 - Production/Stable, *requires*: pytest>=7.0 @@ -8114,9 +8149,9 @@ This list contains 1613 plugins. A pytest plugin that provides a mock NETCONF (RFC6241/RFC6242) server for local testing. :pypi:`pytest-netdut` - *last release*: Jul 05, 2024, + *last release*: Apr 11, 2025, *status*: N/A, - *requires*: pytest<7.3,>=3.5.0 + *requires*: pytest>=3.5.0 "Automated software testing for switches using pytest" @@ -8170,7 +8205,7 @@ This list contains 1613 plugins. pytest ngs fixtures :pypi:`pytest-nhsd-apim` - *last release*: Mar 21, 2025, + *last release*: Apr 01, 2025, *status*: N/A, *requires*: pytest<9.0.0,>=8.2.0 @@ -8225,6 +8260,13 @@ This list contains 1613 plugins. Ensure a test produces no garbage + :pypi:`pytest-no-problem` + *last release*: Apr 05, 2025, + *status*: N/A, + *requires*: pytest>=7.0 + + Pytest plugin to tell you when there's no problem + :pypi:`pytest-nose-attrib` *last release*: Aug 13, 2023, *status*: N/A, @@ -8393,6 +8435,13 @@ This list contains 1613 plugins. Pytest plugin for detecting inadvertent open file handles + :pypi:`pytest-open-html` + *last release*: Mar 31, 2025, + *status*: N/A, + *requires*: pytest>=6.0 + + Auto-open HTML reports after pytest runs + :pypi:`pytest-opentelemetry` *last release*: Nov 22, 2024, *status*: N/A, @@ -8547,13 +8596,6 @@ This list contains 1613 plugins. pytest plugin to test all, first, last or random params - :pypi:`pytest-paramark` - *last release*: Jan 10, 2020, - *status*: 4 - Beta, - *requires*: pytest (>=4.5.0) - - Configure pytest fixtures using a combination of"parametrize" and markers - :pypi:`pytest-parametrization` *last release*: May 22, 2022, *status*: 5 - Production/Stable, @@ -8744,9 +8786,9 @@ This list contains 1613 plugins. Pytest pexpect plugin. :pypi:`pytest-pg` - *last release*: May 21, 2024, + *last release*: Apr 11, 2025, *status*: 5 - Production/Stable, - *requires*: pytest>=6.0.0 + *requires*: pytest>=8.0.0 A tiny plugin for pytest which runs PostgreSQL in Docker @@ -9619,11 +9661,11 @@ This list contains 1613 plugins. Randomise the order in which pytest tests are run with some control over the randomness :pypi:`pytest-ranking` - *last release*: Jan 14, 2025, + *last release*: Apr 08, 2025, *status*: 4 - Beta, *requires*: pytest>=7.4.3 - A Pytest plugin for automatically prioritizing/ranking tests to speed up failure detection + A Pytest plugin for faster fault detection via regression test prioritization :pypi:`pytest-readme` *last release*: Sep 02, 2022, @@ -9640,7 +9682,7 @@ This list contains 1613 plugins. Pytest fixtures for REANA. :pypi:`pytest-recorder` - *last release*: Jan 09, 2025, + *last release*: Mar 31, 2025, *status*: N/A, *requires*: N/A @@ -9787,7 +9829,7 @@ This list contains 1613 plugins. Reorder tests depending on their paths and names. :pypi:`pytest-repeat` - *last release*: Oct 09, 2023, + *last release*: Apr 07, 2025, *status*: 5 - Production/Stable, *requires*: pytest @@ -9843,7 +9885,7 @@ This list contains 1613 plugins. A basic HTML report for pytest using Jinja2 template engine. :pypi:`pytest-report-extras` - *last release*: Mar 20, 2025, + *last release*: Apr 04, 2025, *status*: N/A, *requires*: pytest>=8.0.0 @@ -10396,7 +10438,7 @@ This list contains 1613 plugins. pytest_sauce provides sane and helpful methods worked out in clearcode to run py.test tests with selenium/saucelabs :pypi:`pytest-sbase` - *last release*: Mar 29, 2025, + *last release*: Apr 10, 2025, *status*: 5 - Production/Stable, *requires*: N/A @@ -10480,7 +10522,7 @@ This list contains 1613 plugins. pytest plugin to automatically capture screenshots upon selenium webdriver events :pypi:`pytest-seleniumbase` - *last release*: Mar 29, 2025, + *last release*: Apr 10, 2025, *status*: 5 - Production/Stable, *requires*: N/A @@ -10710,6 +10752,13 @@ This list contains 1613 plugins. Allow for multiple processes to log to a single file + :pypi:`pytest-skip` + *last release*: Apr 04, 2025, + *status*: 3 - Alpha, + *requires*: pytest + + A pytest plugin which allows to (de-)select or skip tests from a file. + :pypi:`pytest-skip-markers` *last release*: Aug 09, 2024, *status*: 5 - Production/Stable, @@ -11418,7 +11467,7 @@ This list contains 1613 plugins. Pytest plugin for remote target orchestration. :pypi:`pytest-taskgraph` - *last release*: Dec 12, 2024, + *last release*: Apr 09, 2025, *status*: N/A, *requires*: pytest @@ -11551,7 +11600,7 @@ This list contains 1613 plugins. A Pytest plugin for running a subset of your tests by splitting them in to equally sized groups. :pypi:`pytest-testinfra` - *last release*: May 26, 2024, + *last release*: Mar 30, 2025, *status*: 5 - Production/Stable, *requires*: pytest>=6 @@ -12124,6 +12173,13 @@ This list contains 1613 plugins. Text User Interface (TUI) and HTML report for Pytest test runs + :pypi:`pytest-tuitest` + *last release*: Apr 11, 2025, + *status*: N/A, + *requires*: pytest>=7.4.0 + + pytest plugin for testing TUI and regular command-line applications. + :pypi:`pytest-tutorials` *last release*: Mar 11, 2023, *status*: N/A, @@ -12832,7 +12888,7 @@ This list contains 1613 plugins. PyTest plugin to run tests concurrently, each \`yield\` switch context to other one :pypi:`pytest-yls` - *last release*: Oct 18, 2024, + *last release*: Apr 09, 2025, *status*: N/A, *requires*: pytest<9.0.0,>=8.3.3 @@ -12937,7 +12993,7 @@ This list contains 1613 plugins. 接口自动化测试框架 :pypi:`tursu` - *last release*: Mar 22, 2025, + *last release*: Apr 10, 2025, *status*: 4 - Beta, *requires*: pytest>=8.3.5 diff --git a/src/_pytest/_code/code.py b/src/_pytest/_code/code.py index 2c872df3008..107fe116f99 100644 --- a/src/_pytest/_code/code.py +++ b/src/_pytest/_code/code.py @@ -1099,35 +1099,51 @@ def _makepath(self, path: Path | str) -> str: return np return str(path) - def repr_traceback(self, excinfo: ExceptionInfo[BaseException]) -> ReprTraceback: - traceback = excinfo.traceback + def _filtered_traceback(self, excinfo: ExceptionInfo[BaseException]) -> Traceback: + traceback_ = excinfo.traceback if callable(self.tbfilter): - traceback = self.tbfilter(excinfo) + traceback_ = self.tbfilter(excinfo) elif self.tbfilter: - traceback = traceback.filter(excinfo) + traceback_ = traceback_.filter(excinfo) + return traceback_ + + def _repr_traceback(self, excinfo: ExceptionInfo[BaseException]) -> ReprTraceback: + traceback_ = self._filtered_traceback(excinfo) if isinstance(excinfo.value, RecursionError): - traceback, extraline = self._truncate_recursive_traceback(traceback) + traceback_, extraline = self._truncate_recursive_traceback(traceback_) else: extraline = None - if not traceback: + if not traceback_: if extraline is None: extraline = "All traceback entries are hidden. Pass `--full-trace` to see hidden and internal frames." entries = [self.repr_traceback_entry(None, excinfo)] return ReprTraceback(entries, extraline, style=self.style) - last = traceback[-1] + last = traceback_[-1] if self.style == "value": entries = [self.repr_traceback_entry(last, excinfo)] return ReprTraceback(entries, None, style=self.style) entries = [ self.repr_traceback_entry(entry, excinfo if last == entry else None) - for entry in traceback + for entry in traceback_ ] return ReprTraceback(entries, extraline, style=self.style) + def _repr_exception_group_traceback( + self, excinfo: ExceptionInfo[BaseExceptionGroup] + ) -> ReprTracebackNative: + traceback_ = self._filtered_traceback(excinfo) + return ReprTracebackNative( + traceback.format_exception( + type(excinfo.value), + excinfo.value, + traceback_[0]._rawentry, + ) + ) + def _truncate_recursive_traceback( self, traceback: Traceback ) -> tuple[Traceback, str | None]: @@ -1179,17 +1195,9 @@ def repr_excinfo(self, excinfo: ExceptionInfo[BaseException]) -> ExceptionChainR # full support for exception groups added to ExceptionInfo. # See https://github.com/pytest-dev/pytest/issues/9159 if isinstance(e, BaseExceptionGroup): - reprtraceback: ReprTracebackNative | ReprTraceback = ( - ReprTracebackNative( - traceback.format_exception( - type(excinfo_.value), - excinfo_.value, - excinfo_.traceback[0]._rawentry, - ) - ) - ) + reprtraceback = self._repr_exception_group_traceback(excinfo_) else: - reprtraceback = self.repr_traceback(excinfo_) + reprtraceback = self._repr_traceback(excinfo_) reprcrash = excinfo_._getreprcrash() else: # Fallback to native repr if the exception doesn't have a traceback: diff --git a/src/_pytest/python_api.py b/src/_pytest/python_api.py index af078e25256..77b0edc0ac5 100644 --- a/src/_pytest/python_api.py +++ b/src/_pytest/python_api.py @@ -421,14 +421,26 @@ def __repr__(self) -> str: def __eq__(self, actual) -> bool: """Return whether the given value is equal to the expected value within the pre-specified tolerance.""" + + def is_bool(val: Any) -> bool: + # Check if `val` is a native bool or numpy bool. + if isinstance(val, bool): + return True + try: + import numpy as np + + return isinstance(val, np.bool_) + except ImportError: + return False + asarray = _as_numpy_array(actual) if asarray is not None: # Call ``__eq__()`` manually to prevent infinite-recursion with # numpy<1.13. See #3748. return all(self.__eq__(a) for a in asarray.flat) - # Short-circuit exact equality, except for bool - if isinstance(self.expected, bool) and not isinstance(actual, bool): + # Short-circuit exact equality, except for bool and np.bool_ + if is_bool(self.expected) and not is_bool(actual): return False elif actual == self.expected: return True @@ -436,8 +448,8 @@ def __eq__(self, actual) -> bool: # If either type is non-numeric, fall back to strict equality. # NB: we need Complex, rather than just Number, to ensure that __abs__, # __sub__, and __float__ are defined. Also, consider bool to be - # nonnumeric, even though it has the required arithmetic. - if isinstance(self.expected, bool) or not ( + # non-numeric, even though it has the required arithmetic. + if is_bool(self.expected) or not ( isinstance(self.expected, (Complex, Decimal)) and isinstance(actual, (Complex, Decimal)) ): @@ -620,8 +632,10 @@ def approx(expected, rel=None, abs=None, nan_ok: bool = False) -> ApproxBase: >>> 1 + 1e-8 == approx(1, rel=1e-6, abs=1e-12) True - You can also use ``approx`` to compare nonnumeric types, or dicts and - sequences containing nonnumeric types, in which case it falls back to + **Non-numeric types** + + You can also use ``approx`` to compare non-numeric types, or dicts and + sequences containing non-numeric types, in which case it falls back to strict equality. This can be useful for comparing dicts and sequences that can contain optional values:: @@ -678,6 +692,15 @@ def approx(expected, rel=None, abs=None, nan_ok: bool = False) -> ApproxBase: from the `re_assert package `_. + + .. note:: + + Unlike built-in equality, this function considers + booleans unequal to numeric zero or one. For example:: + + >>> 1 == approx(True) + False + .. warning:: .. versionchanged:: 3.2 @@ -696,10 +719,10 @@ def approx(expected, rel=None, abs=None, nan_ok: bool = False) -> ApproxBase: .. versionchanged:: 3.7.1 ``approx`` raises ``TypeError`` when it encounters a dict value or - sequence element of nonnumeric type. + sequence element of non-numeric type. .. versionchanged:: 6.1.0 - ``approx`` falls back to strict equality for nonnumeric types instead + ``approx`` falls back to strict equality for non-numeric types instead of raising ``TypeError``. """ # Delegate the comparison to a class that knows how to deal with the type diff --git a/src/_pytest/reports.py b/src/_pytest/reports.py index 746512285b4..480ffae1f9c 100644 --- a/src/_pytest/reports.py +++ b/src/_pytest/reports.py @@ -260,6 +260,7 @@ class TestReport(BaseReport): """ __test__ = False + # Defined by skipping plugin. # xfail reason if xfailed, otherwise not defined. Use hasattr to distinguish. wasxfail: str @@ -304,7 +305,7 @@ def __init__( self.longrepr = longrepr #: One of 'setup', 'call', 'teardown' to indicate runtest phase. - self.when = when + self.when: Literal["setup", "call", "teardown"] = when #: User properties is a list of tuples (name, value) that holds user #: defined properties of the test. diff --git a/src/_pytest/skipping.py b/src/_pytest/skipping.py index 96281faec97..ec118f2c92f 100644 --- a/src/_pytest/skipping.py +++ b/src/_pytest/skipping.py @@ -278,7 +278,7 @@ def pytest_runtest_makereport( pass # don't interfere elif call.excinfo and isinstance(call.excinfo.value, xfail.Exception): assert call.excinfo.value.msg is not None - rep.wasxfail = "reason: " + call.excinfo.value.msg + rep.wasxfail = call.excinfo.value.msg rep.outcome = "skipped" elif not rep.skipped and xfailed: if call.excinfo: diff --git a/testing/code/test_excinfo.py b/testing/code/test_excinfo.py index 89088576980..c728c0ef5bb 100644 --- a/testing/code/test_excinfo.py +++ b/testing/code/test_excinfo.py @@ -1797,6 +1797,9 @@ def test(): rf"FAILED test_excgroup.py::test - {pre_catch}BaseExceptionGroup: Oops \(2.*" ) result.stdout.re_match_lines(match_lines) + # check for traceback filtering of pytest internals + result.stdout.no_fnmatch_line("*, line *, in pytest_pyfunc_call") + result.stdout.no_fnmatch_line("*, line *, in pytest_runtest_call") @pytest.mark.skipif( diff --git a/testing/plugins_integration/requirements.txt b/testing/plugins_integration/requirements.txt index 66ed13a4b8a..93e3dc7d0b1 100644 --- a/testing/plugins_integration/requirements.txt +++ b/testing/plugins_integration/requirements.txt @@ -1,9 +1,9 @@ anyio[trio]==4.9.0 django==5.1.7 -pytest-asyncio==0.25.3 +pytest-asyncio==0.26.0 pytest-bdd==8.1.0 -pytest-cov==6.0.0 -pytest-django==4.10.0 +pytest-cov==6.1.1 +pytest-django==4.11.1 pytest-flakes==4.0.5 pytest-html==4.1.1 pytest-mock==3.14.0 diff --git a/testing/python/approx.py b/testing/python/approx.py index 7eba4755c01..75b57b6965c 100644 --- a/testing/python/approx.py +++ b/testing/python/approx.py @@ -647,6 +647,15 @@ def test_expecting_bool(self) -> None: assert True != approx(False, abs=2) # noqa: E712 assert 1 != approx(True) + def test_expecting_bool_numpy(self) -> None: + """Check approx comparing with numpy.bool (#13047).""" + np = pytest.importorskip("numpy") + assert np.False_ != approx(True) + assert np.True_ != approx(False) + assert np.True_ == approx(True) + assert np.False_ == approx(False) + assert np.True_ != approx(False, abs=2) + def test_list(self): actual = [1 + 1e-7, 2 + 1e-8] expected = [1, 2] @@ -930,7 +939,7 @@ def test_nonnumeric_okay_if_equal(self, x): ], ) def test_nonnumeric_false_if_unequal(self, x): - """For nonnumeric types, x != pytest.approx(y) reduces to x != y""" + """For non-numeric types, x != pytest.approx(y) reduces to x != y""" assert "ab" != approx("abc") assert ["ab"] != approx(["abc"]) # in particular, both of these should return False diff --git a/testing/test_helpconfig.py b/testing/test_helpconfig.py index 7fcf5804ace..dc7e709b65d 100644 --- a/testing/test_helpconfig.py +++ b/testing/test_helpconfig.py @@ -8,6 +8,7 @@ def test_version_verbose(pytester: Pytester, pytestconfig, monkeypatch) -> None: monkeypatch.delenv("PYTEST_DISABLE_PLUGIN_AUTOLOAD") + monkeypatch.delenv("PYTEST_PLUGINS", raising=False) result = pytester.runpytest("--version", "--version") assert result.ret == 0 result.stdout.fnmatch_lines([f"*pytest*{pytest.__version__}*imported from*"]) @@ -17,6 +18,7 @@ def test_version_verbose(pytester: Pytester, pytestconfig, monkeypatch) -> None: def test_version_less_verbose(pytester: Pytester, pytestconfig, monkeypatch) -> None: monkeypatch.delenv("PYTEST_DISABLE_PLUGIN_AUTOLOAD") + monkeypatch.delenv("PYTEST_PLUGINS", raising=False) result = pytester.runpytest("--version") assert result.ret == 0 result.stdout.fnmatch_lines([f"pytest {pytest.__version__}"]) diff --git a/testing/test_skipping.py b/testing/test_skipping.py index 57113ba93d5..9a6c2c4b6aa 100644 --- a/testing/test_skipping.py +++ b/testing/test_skipping.py @@ -448,8 +448,8 @@ def test_this_false(): result = pytester.runpytest(p, "-rx") result.stdout.fnmatch_lines( [ - "*test_one*test_this - reason: *NOTRUN* noway", - "*test_one*test_this_true - reason: *NOTRUN* condition: True", + "*test_one*test_this - *NOTRUN* noway", + "*test_one*test_this_true - *NOTRUN* condition: True", "*1 passed*", ] ) @@ -492,7 +492,7 @@ def test_this(): result = pytester.runpytest(p) result.stdout.fnmatch_lines(["*1 xfailed*"]) result = pytester.runpytest(p, "-rx") - result.stdout.fnmatch_lines(["*XFAIL*test_this*reason:*hello*"]) + result.stdout.fnmatch_lines(["*XFAIL*test_this*hello*"]) result = pytester.runpytest(p, "--runxfail") result.stdout.fnmatch_lines(["*1 pass*"]) @@ -510,7 +510,7 @@ def test_this(): result = pytester.runpytest(p) result.stdout.fnmatch_lines(["*1 xfailed*"]) result = pytester.runpytest(p, "-rx") - result.stdout.fnmatch_lines(["*XFAIL*test_this*reason:*hello*"]) + result.stdout.fnmatch_lines(["*XFAIL*test_this*hello*"]) result = pytester.runpytest(p, "--runxfail") result.stdout.fnmatch_lines( """ diff --git a/testing/test_terminal.py b/testing/test_terminal.py index 42638f2edd7..86feb33b3ec 100644 --- a/testing/test_terminal.py +++ b/testing/test_terminal.py @@ -859,6 +859,7 @@ def test_header_trailer_info( self, monkeypatch: MonkeyPatch, pytester: Pytester, request ) -> None: monkeypatch.delenv("PYTEST_DISABLE_PLUGIN_AUTOLOAD") + monkeypatch.delenv("PYTEST_PLUGINS", raising=False) pytester.makepyfile( """ def test_passes(): diff --git a/testing/typing_checks.py b/testing/typing_checks.py index d4d6a97aea6..8a316580a25 100644 --- a/testing/typing_checks.py +++ b/testing/typing_checks.py @@ -8,12 +8,14 @@ from __future__ import annotations import contextlib +from typing import Literal from typing import Optional from typing_extensions import assert_type import pytest from pytest import MonkeyPatch +from pytest import TestReport # Issue #7488. @@ -51,3 +53,9 @@ def check_raises_is_a_context_manager(val: bool) -> None: with pytest.raises(RuntimeError) if val else contextlib.nullcontext() as excinfo: pass assert_type(excinfo, Optional[pytest.ExceptionInfo[RuntimeError]]) + + +# Issue #12941. +def check_testreport_attributes(report: TestReport) -> None: + assert_type(report.when, Literal["setup", "call", "teardown"]) + assert_type(report.location, tuple[str, Optional[int], str])