From e20a08565f6ecdd7953589e6da11b998e94c1948 Mon Sep 17 00:00:00 2001 From: pytest bot Date: Sun, 12 May 2024 00:21:02 +0000 Subject: [PATCH 01/53] [automated] Update plugin list --- doc/en/reference/plugin_list.rst | 126 ++++++++++++++++++++----------- 1 file changed, 83 insertions(+), 43 deletions(-) diff --git a/doc/en/reference/plugin_list.rst b/doc/en/reference/plugin_list.rst index 2a68f9e49..d03861ccf 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-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 10, 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. Feb 02, 2024 N/A pytest (>=8.0.0,<9.0.0) :pypi:`pytest-axe` pytest plugin for axe-selenium-python Nov 12, 2018 N/A pytest (>=3.0.0) @@ -136,6 +137,7 @@ This list contains 1452 plugins. :pypi:`pytest-bandit` A bandit plugin for pytest Feb 23, 2021 4 - Beta pytest (>=3.5.0) :pypi:`pytest-bandit-xayon` A bandit plugin for pytest Oct 17, 2022 4 - Beta pytest (>=3.5.0) :pypi:`pytest-base-url` pytest plugin for URL based testing Jan 31, 2024 5 - Production/Stable pytest>=7.0.0 + :pypi:`pytest-batch-regression` A pytest plugin to repeat the entire test suite in batches. May 08, 2024 N/A pytest>=6.0.0 :pypi:`pytest-bdd` BDD for pytest Mar 17, 2024 6 - Mature pytest (>=6.2.0) :pypi:`pytest-bdd-html` pytest plugin to display BDD info in HTML test report Nov 22, 2022 3 - Alpha pytest (!=6.0.0,>=5.0) :pypi:`pytest-bdd-ng` BDD for pytest Dec 31, 2023 4 - Beta pytest >=5.0 @@ -145,7 +147,7 @@ This list contains 1452 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. Jan 25, 2024 N/A pytest - :pypi:`pytest-bec-e2e` BEC pytest plugin for end-to-end tests May 03, 2024 3 - Alpha pytest + :pypi:`pytest-bec-e2e` BEC pytest plugin for end-to-end tests May 08, 2024 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 @@ -169,6 +171,7 @@ This list contains 1452 plugins. :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-bpdb` A py.test plug-in to enable drop to bpdb debugger on test failure. Jan 19, 2015 2 - Pre-Alpha N/A + :pypi:`pytest-bq` BigQuery fixtures and fixture factories for Pytest. May 08, 2024 5 - Production/Stable pytest>=6.2 :pypi:`pytest-bravado` Pytest-bravado automatically generates from OpenAPI specification client fixtures. Feb 15, 2022 N/A N/A :pypi:`pytest-breakword` Use breakword with pytest Aug 04, 2021 N/A pytest (>=6.2.4,<7.0.0) :pypi:`pytest-breed-adapter` A simple plugin to connect with breed-server Nov 07, 2018 4 - Beta pytest (>=3.5.0) @@ -238,7 +241,7 @@ This list contains 1452 plugins. :pypi:`pytest-cloud` Distributed tests planner plugin for pytest testing framework. Oct 05, 2020 6 - Mature N/A :pypi:`pytest-cloudflare-worker` pytest plugin for testing cloudflare workers Mar 30, 2021 4 - Beta pytest (>=6.0.0) :pypi:`pytest-cloudist` Distribute tests to cloud machines without fuss Sep 02, 2022 4 - Beta pytest (>=7.1.2,<8.0.0) - :pypi:`pytest-cmake` Provide CMake module for Pytest Mar 18, 2024 N/A pytest<9,>=4 + :pypi:`pytest-cmake` Provide CMake module for Pytest May 06, 2024 N/A pytest<9,>=4 :pypi:`pytest-cmake-presets` Execute CMake Presets via pytest Dec 26, 2022 N/A pytest (>=7.2.0,<8.0.0) :pypi:`pytest-cobra` PyTest plugin for testing Smart Contracts for Ethereum blockchain. Jun 29, 2019 3 - Alpha pytest (<4.0.0,>=3.7.1) :pypi:`pytest_codeblocks` Test code blocks in your READMEs Sep 17, 2023 5 - Production/Stable pytest >= 7.0.0 @@ -356,7 +359,7 @@ This list contains 1452 plugins. :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. Oct 18, 2023 4 - Beta pytest !=6.0.0,<8,>=3.3.2 :pypi:`pytest-discover` Pytest plugin to record discovered tests in a file Mar 26, 2024 N/A pytest - :pypi:`pytest-ditto` May 04, 2024 4 - Beta pytest>=3.5.0 + :pypi:`pytest-ditto` Snapshot testing pytest plugin with minimal ceremony and flexible persistence formats. May 07, 2024 4 - Beta pytest>=3.5.0 :pypi:`pytest-django` A Django plugin for pytest. Jan 30, 2024 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 @@ -479,7 +482,7 @@ This list contains 1452 plugins. :pypi:`pytest-exception-script` Walk your code through exception script to check it's resiliency to failures. Aug 04, 2020 3 - Alpha pytest :pypi:`pytest-executable` pytest plugin for testing executables Oct 07, 2023 N/A pytest <8,>=5 :pypi:`pytest-execution-timer` A timer for the phases of Pytest's execution. Dec 24, 2021 4 - Beta N/A - :pypi:`pytest-exit-code` A pytest plugin that overrides the built-in exit codes to retain more information about the test results. Feb 23, 2024 4 - Beta pytest >=6.2.0 + :pypi:`pytest-exit-code` A pytest plugin that overrides the built-in exit codes to retain more information about the test results. May 06, 2024 4 - Beta pytest>=6.2.0 :pypi:`pytest-expect` py.test plugin to store test expectations and mark tests based on them Apr 21, 2016 4 - Beta N/A :pypi:`pytest-expectdir` A pytest plugin to provide initial/expected directories, and check a test transforms the initial directory to the expected one Mar 19, 2023 5 - Production/Stable pytest (>=5.0) :pypi:`pytest-expecter` Better testing with expecter and pytest. Sep 18, 2022 5 - Production/Stable N/A @@ -612,19 +615,19 @@ This list contains 1452 plugins. :pypi:`pytest-harvest` Store data created during your pytest tests execution, and retrieve it at the end of the session, e.g. for applicative benchmarking purposes. Mar 16, 2024 5 - Production/Stable N/A :pypi:`pytest-helm-chart` A plugin to provide different types and configs of Kubernetes clusters that can be used for testing. Jun 15, 2020 4 - Beta pytest (>=5.4.2,<6.0.0) :pypi:`pytest-helm-charts` A plugin to provide different types and configs of Kubernetes clusters that can be used for testing. Feb 07, 2024 4 - Beta pytest (>=8.0.0,<9.0.0) - :pypi:`pytest-helm-templates` Pytest fixtures for unit testing the output of helm templates Apr 05, 2024 N/A pytest~=7.4.0; extra == "dev" + :pypi:`pytest-helm-templates` Pytest fixtures for unit testing the output of helm templates May 08, 2024 N/A pytest~=7.4.0; extra == "dev" :pypi:`pytest-helper` Functions to help in using the pytest testing framework May 31, 2019 5 - Production/Stable N/A :pypi:`pytest-helpers` pytest helpers May 17, 2020 N/A pytest :pypi:`pytest-helpers-namespace` Pytest Helpers Namespace Plugin Dec 29, 2021 5 - Production/Stable pytest (>=6.0.0) :pypi:`pytest-henry` Aug 29, 2023 N/A N/A :pypi:`pytest-hidecaptured` Hide captured output May 04, 2018 4 - Beta pytest (>=2.8.5) - :pypi:`pytest-himark` A plugin that will filter pytest's test collection using a json file. It will read a json file provided with a --json argument in pytest command line (or in pytest.ini), search the markers key and automatically add -m option to the command line for filtering out the tests marked with disabled markers. Apr 14, 2024 4 - Beta pytest>=6.2.0 + :pypi:`pytest-himark` This plugin aims to create markers automatically based on a json configuration. May 10, 2024 4 - Beta pytest>=6.2.0 :pypi:`pytest-historic` Custom report to display pytest historical execution records 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-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 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-custom-component` Experimental package to automatically extract test plugins for Home Assistant custom components May 04, 2024 3 - Alpha pytest==8.1.1 + :pypi:`pytest-homeassistant-custom-component` Experimental package to automatically extract test plugins for Home Assistant custom components May 11, 2024 3 - Alpha pytest==8.1.1 :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` Apr 18, 2024 N/A N/A @@ -648,7 +651,7 @@ This list contains 1452 plugins. :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, 2024 3 - Alpha N/A - :pypi:`pytest-httptesting` http_testing framework on top of pytest Jul 24, 2023 N/A pytest (>=7.2.0,<8.0.0) + :pypi:`pytest-httptesting` http_testing framework on top of pytest May 08, 2024 N/A pytest<9.0.0,>=8.2.0 :pypi:`pytest-httpx` Send responses to httpx. Feb 21, 2024 5 - Production/Stable pytest <9,>=7 :pypi:`pytest-httpx-blockage` Disable httpx requests during a test run Feb 16, 2023 N/A pytest (>=7.2.1) :pypi:`pytest-httpx-recorder` Recorder feature based on pytest_httpx, like recorder feature in responses. Jan 04, 2024 5 - Production/Stable pytest @@ -676,7 +679,7 @@ This list contains 1452 plugins. :pypi:`pytest-inline` A pytest plugin for writing inline tests. Oct 19, 2023 4 - Beta pytest >=7.0.0 :pypi:`pytest-inmanta` A py.test plugin providing fixtures to simplify inmanta modules testing. Dec 13, 2023 5 - Production/Stable pytest :pypi:`pytest-inmanta-extensions` Inmanta tests package Apr 02, 2024 5 - Production/Stable N/A - :pypi:`pytest-inmanta-lsm` Common fixtures for inmanta LSM related modules Apr 15, 2024 5 - Production/Stable N/A + :pypi:`pytest-inmanta-lsm` Common fixtures for inmanta LSM related modules May 10, 2024 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. Mar 02, 2024 N/A pytest @@ -729,6 +732,7 @@ This list contains 1452 plugins. :pypi:`pytest-kivy` Kivy GUI tests fixtures using pytest Jul 06, 2021 4 - Beta pytest (>=3.6) :pypi:`pytest-knows` A pytest plugin that can automaticly skip test case based on dependence info calculated by trace Aug 22, 2014 N/A N/A :pypi:`pytest-konira` Run Konira DSL tests with py.test Oct 09, 2011 N/A N/A + :pypi:`pytest-kookit` Your simple but kooky integration testing with pytest May 06, 2024 N/A N/A :pypi:`pytest-koopmans` A plugin for testing the koopmans package Nov 21, 2022 4 - Beta pytest (>=3.5.0) :pypi:`pytest-krtech-common` pytest krtech common library Nov 28, 2016 4 - Beta N/A :pypi:`pytest-kubernetes` Sep 14, 2023 N/A pytest (>=7.2.1,<8.0.0) @@ -845,7 +849,7 @@ This list contains 1452 plugins. :pypi:`pytest-mpiexec` pytest plugin for running individual tests with mpiexec Apr 13, 2023 3 - Alpha pytest :pypi:`pytest-mpl` pytest plugin to help with testing figures output from Matplotlib Feb 14, 2024 4 - Beta pytest :pypi:`pytest-mproc` low-startup-overhead, scalable, distributed-testing pytest plugin Nov 15, 2022 4 - Beta pytest (>=6) - :pypi:`pytest-mqtt` pytest-mqtt supports testing systems based on MQTT Mar 31, 2024 4 - Beta pytest<8; extra == "test" + :pypi:`pytest-mqtt` pytest-mqtt supports testing systems based on MQTT May 08, 2024 4 - Beta pytest<9; extra == "test" :pypi:`pytest-multihost` Utility for writing multi-host tests for pytest Apr 07, 2020 4 - Beta N/A :pypi:`pytest-multilog` Multi-process logs handling and other helpers for pytest Jan 17, 2023 N/A pytest :pypi:`pytest-multithreading` a pytest plugin for th and concurrent testing Dec 07, 2022 N/A N/A @@ -964,8 +968,8 @@ This list contains 1452 plugins. :pypi:`pytest-platform-markers` Markers for pytest to skip tests on specific platforms Sep 09, 2019 4 - Beta pytest (>=3.6.0) :pypi:`pytest-play` pytest plugin that let you automate actions and assertions with test metrics reporting executing plain YAML files Jun 12, 2019 5 - Production/Stable N/A :pypi:`pytest-playbook` Pytest plugin for reading playbooks. Jan 21, 2021 3 - Alpha pytest (>=6.1.2,<7.0.0) - :pypi:`pytest-playwright` A pytest wrapper with fixtures for Playwright to automate web browsers Feb 02, 2024 N/A pytest (<9.0.0,>=6.2.4) - :pypi:`pytest_playwright_async` ASYNC Pytest plugin for Playwright Feb 25, 2024 N/A N/A + :pypi:`pytest-playwright` A pytest wrapper with fixtures for Playwright to automate web browsers May 06, 2024 N/A N/A + :pypi:`pytest_playwright_async` ASYNC Pytest plugin for Playwright May 04, 2024 N/A N/A :pypi:`pytest-playwright-asyncio` Aug 29, 2023 N/A N/A :pypi:`pytest-playwright-enhanced` A pytest plugin for playwright python Mar 24, 2024 N/A pytest<9.0.0,>=8.0.0 :pypi:`pytest-playwrights` A pytest wrapper with fixtures for Playwright to automate web browsers Dec 02, 2021 N/A N/A @@ -1028,7 +1032,7 @@ This list contains 1452 plugins. :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-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 Feb 03, 2024 N/A pytest + :pypi:`pytest-pyreport` PyReport is a lightweight reporting plugin for Pytest that provides concise HTML report May 05, 2024 N/A pytest :pypi:`pytest-pyright` Pytest plugin for type checking code with Pyright Jan 26, 2024 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". Jan 02, 2024 N/A pytest (>=7.2.1,<8.0.0) :pypi:`pytest-pystack` Plugin to run pystack after a timeout for a test suite. Jan 04, 2024 N/A pytest >=3.5.0 @@ -1049,7 +1053,7 @@ This list contains 1452 plugins. :pypi:`pytest-quarantine` A plugin for pytest to manage expected test failures Nov 24, 2019 5 - Production/Stable pytest (>=4.6) :pypi:`pytest-quickcheck` pytest plugin to generate random data inspired by QuickCheck Nov 05, 2022 4 - Beta pytest (>=4.0) :pypi:`pytest_quickify` Run test suites with pytest-quickify. Jun 14, 2019 N/A pytest - :pypi:`pytest-rabbitmq` RabbitMQ process and client fixtures for pytest Jul 05, 2023 5 - Production/Stable pytest (>=6.2) + :pypi:`pytest-rabbitmq` RabbitMQ process and client fixtures for pytest May 08, 2024 5 - Production/Stable pytest>=6.2 :pypi:`pytest-race` Race conditions tester for pytest Jun 07, 2022 4 - Beta N/A :pypi:`pytest-rage` pytest plugin to implement PEP712 Oct 21, 2011 3 - Alpha N/A :pypi:`pytest-rail` pytest plugin for creating TestRail runs and adding results May 02, 2022 N/A pytest (>=3.6) @@ -1062,7 +1066,7 @@ This list contains 1452 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 Mar 18, 2024 4 - Beta pytest >=7.4.3 + :pypi:`pytest-ranking` A Pytest plugin for automatically prioritizing/ranking tests to speed up failure detection May 10, 2024 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. Mar 14, 2024 3 - Alpha N/A :pypi:`pytest-recorder` Pytest plugin, meant to facilitate unit tests writing for tools consumming Web APIs. Nov 21, 2023 N/A N/A @@ -1156,6 +1160,7 @@ This list contains 1452 plugins. :pypi:`pytest-salt-factories` Pytest Salt Plugin Mar 22, 2024 5 - Production/Stable pytest>=7.0.0 :pypi:`pytest-salt-from-filenames` Simple PyTest Plugin For Salt's Test Suite Specifically Jan 29, 2019 4 - Beta pytest (>=4.1) :pypi:`pytest-salt-runtests-bridge` Simple PyTest Plugin For Salt's Test Suite Specifically Dec 05, 2019 4 - Beta pytest (>=4.1) + :pypi:`pytest-sample-argvalues` A utility function to help choose a random sample from your argvalues in pytest. May 07, 2024 N/A pytest :pypi:`pytest-sanic` a pytest plugin for Sanic Oct 25, 2021 N/A pytest (>=5.2) :pypi:`pytest-sanity` Dec 07, 2020 N/A N/A :pypi:`pytest-sa-pg` May 14, 2019 N/A N/A @@ -1178,7 +1183,7 @@ This list contains 1452 plugins. :pypi:`pytest-sequence-markers` Pytest plugin for sequencing markers for execution of tests May 23, 2023 5 - Production/Stable N/A :pypi:`pytest-server-fixtures` Extensible server fixures for py.test Dec 19, 2023 5 - Production/Stable pytest :pypi:`pytest-serverless` Automatically mocks resources from serverless.yml in pytest using moto. May 09, 2022 4 - Beta N/A - :pypi:`pytest-servers` pytest servers Mar 19, 2024 3 - Alpha pytest>=6.2 + :pypi:`pytest-servers` pytest servers May 09, 2024 3 - Alpha pytest>=6.2 :pypi:`pytest-services` Services plugin for pytest testing framework Oct 30, 2020 6 - Mature N/A :pypi:`pytest-session2file` pytest-session2file (aka: pytest-session_to_file for v0.1.0 - v0.1.2) is a py.test plugin for capturing and saving to file the stdout of py.test. Jan 26, 2021 3 - Alpha pytest :pypi:`pytest-session-fixture-globalize` py.test plugin to make session fixtures behave as if written in conftest, even if it is written in some modules May 15, 2018 4 - Beta N/A @@ -1246,7 +1251,7 @@ This list contains 1452 plugins. :pypi:`pytest-split-tests` A Pytest plugin for running a subset of your tests by splitting them in to equally sized groups. Forked from Mark Adams' original project pytest-test-groups. Jul 30, 2021 5 - Production/Stable pytest (>=2.5) :pypi:`pytest-split-tests-tresorit` Feb 22, 2021 1 - Planning N/A :pypi:`pytest-splunk-addon` A Dynamic test tool for Splunk Apps and Add-ons Apr 19, 2024 N/A pytest (>5.4.0,<8) - :pypi:`pytest-splunk-addon-ui-smartx` Library to support testing Splunk Add-on UX Mar 26, 2024 N/A N/A + :pypi:`pytest-splunk-addon-ui-smartx` Library to support testing Splunk Add-on UX May 10, 2024 N/A N/A :pypi:`pytest-splunk-env` pytest fixtures for interaction with Splunk Enterprise and Splunk Cloud Oct 22, 2020 N/A pytest (>=6.1.1,<7.0.0) :pypi:`pytest-sqitch` sqitch for pytest Apr 06, 2020 4 - Beta N/A :pypi:`pytest-sqlalchemy` pytest plugin with sqlalchemy related fixtures Mar 13, 2018 3 - Alpha N/A @@ -2135,6 +2140,13 @@ This list contains 1452 plugins. pytest plugin for testing AWS resource configurations + :pypi:`pytest-aws-apigateway` + *last release*: May 10, 2024, + *status*: 4 - Beta, + *requires*: pytest + + pytest plugin for AWS ApiGateway + :pypi:`pytest-aws-config` *last release*: May 28, 2021, *status*: N/A, @@ -2205,6 +2217,13 @@ This list contains 1452 plugins. pytest plugin for URL based testing + :pypi:`pytest-batch-regression` + *last release*: May 08, 2024, + *status*: N/A, + *requires*: pytest>=6.0.0 + + A pytest plugin to repeat the entire test suite in batches. + :pypi:`pytest-bdd` *last release*: Mar 17, 2024, *status*: 6 - Mature, @@ -2269,7 +2288,7 @@ This list contains 1452 plugins. Pytest plugin to run your tests with beartype checking enabled. :pypi:`pytest-bec-e2e` - *last release*: May 03, 2024, + *last release*: May 08, 2024, *status*: 3 - Alpha, *requires*: pytest @@ -2436,6 +2455,13 @@ This list contains 1452 plugins. A py.test plug-in to enable drop to bpdb debugger on test failure. + :pypi:`pytest-bq` + *last release*: May 08, 2024, + *status*: 5 - Production/Stable, + *requires*: pytest>=6.2 + + BigQuery fixtures and fixture factories for Pytest. + :pypi:`pytest-bravado` *last release*: Feb 15, 2022, *status*: N/A, @@ -2920,7 +2946,7 @@ This list contains 1452 plugins. Distribute tests to cloud machines without fuss :pypi:`pytest-cmake` - *last release*: Mar 18, 2024, + *last release*: May 06, 2024, *status*: N/A, *requires*: pytest<9,>=4 @@ -3746,11 +3772,11 @@ This list contains 1452 plugins. Pytest plugin to record discovered tests in a file :pypi:`pytest-ditto` - *last release*: May 04, 2024, + *last release*: May 07, 2024, *status*: 4 - Beta, *requires*: pytest>=3.5.0 - + Snapshot testing pytest plugin with minimal ceremony and flexible persistence formats. :pypi:`pytest-django` *last release*: Jan 30, 2024, @@ -4607,9 +4633,9 @@ This list contains 1452 plugins. A timer for the phases of Pytest's execution. :pypi:`pytest-exit-code` - *last release*: Feb 23, 2024, + *last release*: May 06, 2024, *status*: 4 - Beta, - *requires*: pytest >=6.2.0 + *requires*: pytest>=6.2.0 A pytest plugin that overrides the built-in exit codes to retain more information about the test results. @@ -5538,7 +5564,7 @@ This list contains 1452 plugins. A plugin to provide different types and configs of Kubernetes clusters that can be used for testing. :pypi:`pytest-helm-templates` - *last release*: Apr 05, 2024, + *last release*: May 08, 2024, *status*: N/A, *requires*: pytest~=7.4.0; extra == "dev" @@ -5580,11 +5606,11 @@ This list contains 1452 plugins. Hide captured output :pypi:`pytest-himark` - *last release*: Apr 14, 2024, + *last release*: May 10, 2024, *status*: 4 - Beta, *requires*: pytest>=6.2.0 - A plugin that will filter pytest's test collection using a json file. It will read a json file provided with a --json argument in pytest command line (or in pytest.ini), search the markers key and automatically add -m option to the command line for filtering out the tests marked with disabled markers. + This plugin aims to create markers automatically based on a json configuration. :pypi:`pytest-historic` *last release*: Apr 08, 2020, @@ -5622,7 +5648,7 @@ This list contains 1452 plugins. A pytest plugin for use with homeassistant custom components. :pypi:`pytest-homeassistant-custom-component` - *last release*: May 04, 2024, + *last release*: May 11, 2024, *status*: 3 - Alpha, *requires*: pytest==8.1.1 @@ -5790,9 +5816,9 @@ This list contains 1452 plugins. pytest-httpserver is a httpserver for pytest :pypi:`pytest-httptesting` - *last release*: Jul 24, 2023, + *last release*: May 08, 2024, *status*: N/A, - *requires*: pytest (>=7.2.0,<8.0.0) + *requires*: pytest<9.0.0,>=8.2.0 http_testing framework on top of pytest @@ -5986,7 +6012,7 @@ This list contains 1452 plugins. Inmanta tests package :pypi:`pytest-inmanta-lsm` - *last release*: Apr 15, 2024, + *last release*: May 10, 2024, *status*: 5 - Production/Stable, *requires*: N/A @@ -6356,6 +6382,13 @@ This list contains 1452 plugins. Run Konira DSL tests with py.test + :pypi:`pytest-kookit` + *last release*: May 06, 2024, + *status*: N/A, + *requires*: N/A + + Your simple but kooky integration testing with pytest + :pypi:`pytest-koopmans` *last release*: Nov 21, 2022, *status*: 4 - Beta, @@ -7169,9 +7202,9 @@ This list contains 1452 plugins. low-startup-overhead, scalable, distributed-testing pytest plugin :pypi:`pytest-mqtt` - *last release*: Mar 31, 2024, + *last release*: May 08, 2024, *status*: 4 - Beta, - *requires*: pytest<8; extra == "test" + *requires*: pytest<9; extra == "test" pytest-mqtt supports testing systems based on MQTT @@ -8002,14 +8035,14 @@ This list contains 1452 plugins. Pytest plugin for reading playbooks. :pypi:`pytest-playwright` - *last release*: Feb 02, 2024, + *last release*: May 06, 2024, *status*: N/A, - *requires*: pytest (<9.0.0,>=6.2.4) + *requires*: N/A A pytest wrapper with fixtures for Playwright to automate web browsers :pypi:`pytest_playwright_async` - *last release*: Feb 25, 2024, + *last release*: May 04, 2024, *status*: N/A, *requires*: N/A @@ -8450,7 +8483,7 @@ This list contains 1452 plugins. Pyramid server fixture for py.test :pypi:`pytest-pyreport` - *last release*: Feb 03, 2024, + *last release*: May 05, 2024, *status*: N/A, *requires*: pytest @@ -8597,9 +8630,9 @@ This list contains 1452 plugins. Run test suites with pytest-quickify. :pypi:`pytest-rabbitmq` - *last release*: Jul 05, 2023, + *last release*: May 08, 2024, *status*: 5 - Production/Stable, - *requires*: pytest (>=6.2) + *requires*: pytest>=6.2 RabbitMQ process and client fixtures for pytest @@ -8688,9 +8721,9 @@ This list contains 1452 plugins. Randomise the order in which pytest tests are run with some control over the randomness :pypi:`pytest-ranking` - *last release*: Mar 18, 2024, + *last release*: May 10, 2024, *status*: 4 - Beta, - *requires*: pytest >=7.4.3 + *requires*: pytest>=7.4.3 A Pytest plugin for automatically prioritizing/ranking tests to speed up failure detection @@ -9345,6 +9378,13 @@ This list contains 1452 plugins. Simple PyTest Plugin For Salt's Test Suite Specifically + :pypi:`pytest-sample-argvalues` + *last release*: May 07, 2024, + *status*: N/A, + *requires*: pytest + + A utility function to help choose a random sample from your argvalues in pytest. + :pypi:`pytest-sanic` *last release*: Oct 25, 2021, *status*: N/A, @@ -9500,7 +9540,7 @@ This list contains 1452 plugins. Automatically mocks resources from serverless.yml in pytest using moto. :pypi:`pytest-servers` - *last release*: Mar 19, 2024, + *last release*: May 09, 2024, *status*: 3 - Alpha, *requires*: pytest>=6.2 @@ -9976,7 +10016,7 @@ This list contains 1452 plugins. A Dynamic test tool for Splunk Apps and Add-ons :pypi:`pytest-splunk-addon-ui-smartx` - *last release*: Mar 26, 2024, + *last release*: May 10, 2024, *status*: N/A, *requires*: N/A From 90a3ef2f36f6c282d1175ce0c13149ce57d1362d Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Sun, 12 May 2024 22:28:49 +0300 Subject: [PATCH 02/53] python: add workaround for permission error crashes from non-selected directories Fix #12120. --- changelog/12120.bugfix.rst | 1 + src/_pytest/python.py | 7 ++++++- testing/test_collection.py | 17 +++++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 changelog/12120.bugfix.rst diff --git a/changelog/12120.bugfix.rst b/changelog/12120.bugfix.rst new file mode 100644 index 000000000..b1ca4913b --- /dev/null +++ b/changelog/12120.bugfix.rst @@ -0,0 +1 @@ +Fix `PermissionError` crashes arising from directories which are not selected on the command-line. diff --git a/src/_pytest/python.py b/src/_pytest/python.py index 68eceb7f4..8efaf8078 100644 --- a/src/_pytest/python.py +++ b/src/_pytest/python.py @@ -176,7 +176,12 @@ def pytest_collect_directory( path: Path, parent: nodes.Collector ) -> Optional[nodes.Collector]: pkginit = path / "__init__.py" - if pkginit.is_file(): + try: + has_pkginit = pkginit.is_file() + except PermissionError: + # See https://github.com/pytest-dev/pytest/issues/12120#issuecomment-2106349096. + return None + if has_pkginit: return Package.from_parent(parent, path=path) return None diff --git a/testing/test_collection.py b/testing/test_collection.py index 995e2999b..8ff38a334 100644 --- a/testing/test_collection.py +++ b/testing/test_collection.py @@ -285,6 +285,23 @@ class TestCollectFS: items, reprec = pytester.inline_genitems() assert [x.name for x in items] == [f"test_{dirname}"] + def test_missing_permissions_on_unselected_directory_doesnt_crash( + self, pytester: Pytester + ) -> None: + """Regression test for #12120.""" + test = pytester.makepyfile(test="def test(): pass") + bad = pytester.mkdir("bad") + try: + bad.chmod(0) + + result = pytester.runpytest(test) + finally: + bad.chmod(750) + bad.rmdir() + + assert result.ret == ExitCode.OK + result.assert_outcomes(passed=1) + class TestCollectPluginHookRelay: def test_pytest_collect_file(self, pytester: Pytester) -> None: From eea04c289108749ba96ed42b410baaae5932708d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 13 May 2024 05:56:16 +0200 Subject: [PATCH 03/53] build(deps): Bump django in /testing/plugins_integration (#12314) Bumps [django](https://github.com/django/django) from 5.0.4 to 5.0.6. - [Commits](https://github.com/django/django/compare/5.0.4...5.0.6) --- updated-dependencies: - dependency-name: django dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- testing/plugins_integration/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/plugins_integration/requirements.txt b/testing/plugins_integration/requirements.txt index d60bc5d3c..d4d0fc633 100644 --- a/testing/plugins_integration/requirements.txt +++ b/testing/plugins_integration/requirements.txt @@ -1,5 +1,5 @@ anyio[curio,trio]==4.3.0 -django==5.0.4 +django==5.0.6 pytest-asyncio==0.23.6 pytest-bdd==7.1.2 pytest-cov==5.0.0 From 37489d3c6c81bc3f1badf7c50e568d4fffe6deb9 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Mon, 13 May 2024 12:27:20 +0300 Subject: [PATCH 04/53] python,unittest: don't collect abstract classes Fix #12275. --- changelog/12275.bugfix.rst | 1 + src/_pytest/python.py | 6 +++++- src/_pytest/unittest.py | 8 +++++++- testing/python/collect.py | 26 ++++++++++++++++++++++++++ testing/test_unittest.py | 28 ++++++++++++++++++++++++++++ 5 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 changelog/12275.bugfix.rst diff --git a/changelog/12275.bugfix.rst b/changelog/12275.bugfix.rst new file mode 100644 index 000000000..2d040a3a0 --- /dev/null +++ b/changelog/12275.bugfix.rst @@ -0,0 +1 @@ +Fix collection error upon encountering an :mod:`abstract ` class, including abstract `unittest.TestCase` subclasses. diff --git a/src/_pytest/python.py b/src/_pytest/python.py index 68eceb7f4..5196b9fe8 100644 --- a/src/_pytest/python.py +++ b/src/_pytest/python.py @@ -368,7 +368,11 @@ class PyCollector(PyobjMixin, nodes.Collector, abc.ABC): return False def istestclass(self, obj: object, name: str) -> bool: - return self.classnamefilter(name) or self.isnosetest(obj) + if not (self.classnamefilter(name) or self.isnosetest(obj)): + return False + if inspect.isabstract(obj): + return False + return True def _matches_prefix_or_glob_option(self, option_name: str, name: str) -> bool: """Check if the given name matches the prefix or glob-pattern defined diff --git a/src/_pytest/unittest.py b/src/_pytest/unittest.py index 8f1791bf7..919b497c2 100644 --- a/src/_pytest/unittest.py +++ b/src/_pytest/unittest.py @@ -1,6 +1,7 @@ # mypy: allow-untyped-defs """Discover and run std-library "unittest" style tests.""" +import inspect import sys import traceback import types @@ -49,14 +50,19 @@ if TYPE_CHECKING: def pytest_pycollect_makeitem( collector: Union[Module, Class], name: str, obj: object ) -> Optional["UnitTestCase"]: - # Has unittest been imported and is obj a subclass of its TestCase? try: + # Has unittest been imported? ut = sys.modules["unittest"] + # Is obj a subclass of unittest.TestCase? # Type ignored because `ut` is an opaque module. if not issubclass(obj, ut.TestCase): # type: ignore return None except Exception: return None + # Is obj a concrete class? + # Abstract classes can't be instantiated so no point collecting them. + if inspect.isabstract(obj): + return None # Yes, so let's collect it. return UnitTestCase.from_parent(collector, name=name, obj=obj) diff --git a/testing/python/collect.py b/testing/python/collect.py index a1a7dc897..843fa3c0e 100644 --- a/testing/python/collect.py +++ b/testing/python/collect.py @@ -262,6 +262,32 @@ class TestClass: result = pytester.runpytest() assert result.ret == ExitCode.NO_TESTS_COLLECTED + def test_abstract_class_is_not_collected(self, pytester: Pytester) -> None: + """Regression test for #12275 (non-unittest version).""" + pytester.makepyfile( + """ + import abc + + class TestBase(abc.ABC): + @abc.abstractmethod + def abstract1(self): pass + + @abc.abstractmethod + def abstract2(self): pass + + def test_it(self): pass + + class TestPartial(TestBase): + def abstract1(self): pass + + class TestConcrete(TestPartial): + def abstract2(self): pass + """ + ) + result = pytester.runpytest() + assert result.ret == ExitCode.OK + result.assert_outcomes(passed=1) + class TestFunction: def test_getmodulecollector(self, pytester: Pytester) -> None: diff --git a/testing/test_unittest.py b/testing/test_unittest.py index d726e74d6..f73e083be 100644 --- a/testing/test_unittest.py +++ b/testing/test_unittest.py @@ -1640,3 +1640,31 @@ def test_raising_unittest_skiptest_during_collection( assert skipped == 1 assert failed == 0 assert reprec.ret == ExitCode.NO_TESTS_COLLECTED + + +def test_abstract_testcase_is_not_collected(pytester: Pytester) -> None: + """Regression test for #12275.""" + pytester.makepyfile( + """ + import abc + import unittest + + class TestBase(unittest.TestCase, abc.ABC): + @abc.abstractmethod + def abstract1(self): pass + + @abc.abstractmethod + def abstract2(self): pass + + def test_it(self): pass + + class TestPartial(TestBase): + def abstract1(self): pass + + class TestConcrete(TestPartial): + def abstract2(self): pass + """ + ) + result = pytester.runpytest() + assert result.ret == ExitCode.OK + result.assert_outcomes(passed=1) From ebe2e8eac9db5a662cf60c9058e0c5ba480d3ad0 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Mon, 13 May 2024 22:11:40 +0300 Subject: [PATCH 05/53] changelog: document unittest 8.2 change as breaking --- doc/en/changelog.rst | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/doc/en/changelog.rst b/doc/en/changelog.rst index 2630d95cf..fb276a938 100644 --- a/doc/en/changelog.rst +++ b/doc/en/changelog.rst @@ -31,6 +31,24 @@ with advance notice in the **Deprecations** section of releases. pytest 8.2.0 (2024-04-27) ========================= +Breaking Changes +---------------- + +- `#12089 `_: pytest now requires that :class:`unittest.TestCase` subclasses can be instantiated freely using ``MyTestCase('runTest')``. + + If the class doesn't allow this, you may see an error during collection such as ``AttributeError: 'MyTestCase' object has no attribute 'runTest'``. + + Classes which do not override ``__init__``, or do not access the test method in ``__init__`` using ``getattr`` or similar, are unaffected. + + Classes which do should take care to not crash when ``"runTest"`` is given, as is shown in `unittest.TestCases's implementation `_. + Alternatively, consider using :meth:`setUp ` instead of ``__init__``. + + If you run into this issue using ``tornado.AsyncTestCase``, please see `issue 12263 `_. + + If you run into this issue using an abstract ``TestCase`` subclass, please see `issue 12275 `_. + + Historical note: the effect of this change on custom TestCase implementations was not properly considered initially, this is why it was done in a minor release. We apologize for the inconvenience. + Deprecations ------------ From 3a64c47f1f713fbc154d04960fe8382ecf94bdc4 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Tue, 14 May 2024 23:26:15 +0300 Subject: [PATCH 06/53] cacheprovider: fix `.pytest_cache` not being world-readable Fix #12308. --- changelog/12308.bugfix.rst | 1 + src/_pytest/cacheprovider.py | 7 +++++++ testing/test_cacheprovider.py | 15 +++++++++++++++ 3 files changed, 23 insertions(+) create mode 100644 changelog/12308.bugfix.rst diff --git a/changelog/12308.bugfix.rst b/changelog/12308.bugfix.rst new file mode 100644 index 000000000..07995427a --- /dev/null +++ b/changelog/12308.bugfix.rst @@ -0,0 +1 @@ +Fix a regression in pytest 8.2.0 where the permissions of automatically-created ``.pytest_cache`` directories became ``rwx------`` instead of the expected ``rwxr-xr-x``. diff --git a/src/_pytest/cacheprovider.py b/src/_pytest/cacheprovider.py index 4593e2a81..06def557e 100755 --- a/src/_pytest/cacheprovider.py +++ b/src/_pytest/cacheprovider.py @@ -213,6 +213,13 @@ class Cache: dir=self._cachedir.parent, ) as newpath: path = Path(newpath) + + # Reset permissions to the default, see #12308. + # Note: there's no way to get the current umask atomically, eek. + umask = os.umask(0o022) + os.umask(umask) + path.chmod(0o777 - umask) + with open(path.joinpath("README.md"), "xt", encoding="UTF-8") as f: f.write(README_CONTENT) with open(path.joinpath(".gitignore"), "xt", encoding="UTF-8") as f: diff --git a/testing/test_cacheprovider.py b/testing/test_cacheprovider.py index 6c18c358a..c85c1d04c 100644 --- a/testing/test_cacheprovider.py +++ b/testing/test_cacheprovider.py @@ -31,6 +31,21 @@ class TestNewAPI: p = config.cache.mkdir("name") assert p.is_dir() + def test_cache_dir_permissions(self, pytester: Pytester) -> None: + """The .pytest_cache directory should have world-readable permissions + (depending on umask). + + Regression test for #12308. + """ + pytester.makeini("[pytest]") + config = pytester.parseconfigure() + assert config.cache is not None + p = config.cache.mkdir("name") + assert p.is_dir() + # Instead of messing with umask, make sure .pytest_cache has the same + # permissions as the default that `mkdir` gives `p`. + assert (p.parent.stat().st_mode & 0o777) == (p.stat().st_mode & 0o777) + def test_config_cache_dataerror(self, pytester: Pytester) -> None: pytester.makeini("[pytest]") config = pytester.parseconfigure() From 1acf56d033e801f34ddc78d1124d818d96ba31b7 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Wed, 15 May 2024 17:11:26 +0300 Subject: [PATCH 07/53] fixtures: fix non-working package-scope parametrization reordering The `.parent` was incorrectly removed in a21fb87a90974189c1b8b26189959507189bb3a1, but it was actually correct (well, it assumes that Module.path.parent == Package.path, which I'm not sure is always correct, but that's a different matter). Restore it. Fix #12328. --- changelog/12328.bugfix.rst | 1 + src/_pytest/fixtures.py | 3 ++- testing/python/fixtures.py | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 changelog/12328.bugfix.rst diff --git a/changelog/12328.bugfix.rst b/changelog/12328.bugfix.rst new file mode 100644 index 000000000..f33442585 --- /dev/null +++ b/changelog/12328.bugfix.rst @@ -0,0 +1 @@ +Fix a regression in pytest 8.0.0 where package-scoped parameterized items were not correctly reordered to minimize setups/teardowns in some cases. diff --git a/src/_pytest/fixtures.py b/src/_pytest/fixtures.py index 5a290718f..a271f947d 100644 --- a/src/_pytest/fixtures.py +++ b/src/_pytest/fixtures.py @@ -187,7 +187,8 @@ def get_parametrized_fixture_keys( if scope is Scope.Session: scoped_item_path = None elif scope is Scope.Package: - scoped_item_path = item.path + # Package key = module's directory. + scoped_item_path = item.path.parent elif scope is Scope.Module: scoped_item_path = item.path elif scope is Scope.Class: diff --git a/testing/python/fixtures.py b/testing/python/fixtures.py index aec0deb99..13ab4904c 100644 --- a/testing/python/fixtures.py +++ b/testing/python/fixtures.py @@ -4274,6 +4274,39 @@ class TestScopeOrdering: request = TopRequest(items[0], _ispytest=True) assert request.fixturenames == "s1 p1 m1 m2 c1 f2 f1".split() + def test_parametrized_package_scope_reordering(self, pytester: Pytester) -> None: + """A paramaterized package-scoped fixture correctly reorders items to + minimize setups & teardowns. + + Regression test for #12328. + """ + pytester.makepyfile( + __init__="", + conftest=""" + import pytest + @pytest.fixture(scope="package", params=["a", "b"]) + def fix(request): + return request.param + """, + test_1="def test1(fix): pass", + test_2="def test2(fix): pass", + ) + + result = pytester.runpytest("--setup-plan") + assert result.ret == ExitCode.OK + result.stdout.fnmatch_lines( + [ + " SETUP P fix['a']", + " test_1.py::test1[a] (fixtures used: fix, request)", + " test_2.py::test2[a] (fixtures used: fix, request)", + " TEARDOWN P fix['a']", + " SETUP P fix['b']", + " test_1.py::test1[b] (fixtures used: fix, request)", + " test_2.py::test2[b] (fixtures used: fix, request)", + " TEARDOWN P fix['b']", + ], + ) + def test_multiple_packages(self, pytester: Pytester) -> None: """Complex test involving multiple package fixtures. Make sure teardowns are executed in order. From 8d0081182266a38cf7e4abd1d3cebb74a622469a Mon Sep 17 00:00:00 2001 From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Wed, 15 May 2024 12:49:34 -0400 Subject: [PATCH 08/53] Spelling and minor changes (#12122) --- doc/en/announce/release-2.0.0.rst | 4 +-- doc/en/announce/release-2.2.2.rst | 2 +- doc/en/announce/release-2.4.0.rst | 2 +- doc/en/announce/release-2.5.0.rst | 2 +- doc/en/announce/release-2.6.0.rst | 2 +- doc/en/announce/release-2.7.0.rst | 2 +- doc/en/announce/sprint2016.rst | 2 +- doc/en/changelog.rst | 38 +++++++++++----------- doc/en/deprecations.rst | 2 +- doc/en/example/customdirectory/conftest.py | 2 +- doc/en/getting-started.rst | 2 +- doc/en/naming20.rst | 2 +- doc/en/reference/fixtures.rst | 2 +- doc/en/reference/reference.rst | 2 +- src/_pytest/_py/error.py | 2 +- src/_pytest/_py/path.py | 4 +-- src/_pytest/assertion/rewrite.py | 2 +- src/_pytest/assertion/util.py | 4 +-- src/_pytest/cacheprovider.py | 2 +- src/_pytest/compat.py | 2 +- src/_pytest/config/__init__.py | 6 ++-- src/_pytest/fixtures.py | 4 +-- src/_pytest/hookspec.py | 6 ++-- src/_pytest/legacypath.py | 4 +-- src/_pytest/mark/__init__.py | 2 +- src/_pytest/pathlib.py | 4 +-- src/_pytest/stepwise.py | 2 +- testing/_py/test_local.py | 4 +-- testing/code/test_excinfo.py | 2 +- testing/code/test_source.py | 2 +- testing/logging/test_fixture.py | 31 ++++++++++-------- testing/python/fixtures.py | 2 +- testing/python/integration.py | 4 +-- testing/test_cacheprovider.py | 2 +- testing/test_compat.py | 2 +- testing/test_config.py | 4 +-- testing/test_conftest.py | 4 +-- testing/test_debugging.py | 4 +-- testing/test_doctest.py | 6 ++-- testing/test_junitxml.py | 2 +- testing/test_legacypath.py | 2 +- testing/test_mark_expression.py | 2 +- testing/test_pluginmanager.py | 4 +-- testing/test_runner.py | 2 +- testing/test_terminal.py | 2 +- testing/test_unittest.py | 6 ++-- 46 files changed, 100 insertions(+), 97 deletions(-) diff --git a/doc/en/announce/release-2.0.0.rst b/doc/en/announce/release-2.0.0.rst index ecb1a1db9..c2a9f6da4 100644 --- a/doc/en/announce/release-2.0.0.rst +++ b/doc/en/announce/release-2.0.0.rst @@ -62,7 +62,7 @@ New Features - new "-q" option which decreases verbosity and prints a more nose/unittest-style "dot" output. -- many many more detailed improvements details +- many, many, more detailed improvements details Fixes ----------------------- @@ -109,7 +109,7 @@ Important Notes in conftest.py files. They will cause nothing special. - removed support for calling the pre-1.0 collection API of "run()" and "join" - removed reading option values from conftest.py files or env variables. - This can now be done much much better and easier through the ini-file + This can now be done much, much, better and easier through the ini-file mechanism and the "addopts" entry in particular. - removed the "disabled" attribute in test classes. Use the skipping and pytestmark mechanism to skip or xfail a test class. diff --git a/doc/en/announce/release-2.2.2.rst b/doc/en/announce/release-2.2.2.rst index 22ef0bc7a..510b35ee1 100644 --- a/doc/en/announce/release-2.2.2.rst +++ b/doc/en/announce/release-2.2.2.rst @@ -4,7 +4,7 @@ pytest-2.2.2: bug fixes pytest-2.2.2 (updated to 2.2.3 to fix packaging issues) is a minor backward-compatible release of the versatile py.test testing tool. It contains bug fixes and a few refinements particularly to reporting with -"--collectonly", see below for betails. +"--collectonly", see below for details. For general information see here: diff --git a/doc/en/announce/release-2.4.0.rst b/doc/en/announce/release-2.4.0.rst index 138cc8957..9b8643296 100644 --- a/doc/en/announce/release-2.4.0.rst +++ b/doc/en/announce/release-2.4.0.rst @@ -181,7 +181,7 @@ Bug fixes: partially failed (finalizers would not always be called before) - fix issue320 - fix class scope for fixtures when mixed with - module-level functions. Thanks Anatloy Bubenkoff. + module-level functions. Thanks Anatoly Bubenkoff. - you can specify "-q" or "-qq" to get different levels of "quieter" reporting (thanks Katarzyna Jachim) diff --git a/doc/en/announce/release-2.5.0.rst b/doc/en/announce/release-2.5.0.rst index c6cdcdd8a..fe64f1b86 100644 --- a/doc/en/announce/release-2.5.0.rst +++ b/doc/en/announce/release-2.5.0.rst @@ -83,7 +83,7 @@ holger krekel Thanks Ralph Schmitt for the precise failure example. - fix issue244 by implementing special index for parameters to only use - indices for paramentrized test ids + indices for parametrized test ids - fix issue287 by running all finalizers but saving the exception from the first failing finalizer and re-raising it so teardown will diff --git a/doc/en/announce/release-2.6.0.rst b/doc/en/announce/release-2.6.0.rst index 56fbd6cc1..c00df5857 100644 --- a/doc/en/announce/release-2.6.0.rst +++ b/doc/en/announce/release-2.6.0.rst @@ -73,7 +73,7 @@ holger krekel - cleanup setup.py a bit and specify supported versions. Thanks Jurko Gospodnetic for the PR. -- change XPASS colour to yellow rather then red when tests are run +- change XPASS colour to yellow rather than red when tests are run with -v. - fix issue473: work around mock putting an unbound method into a class diff --git a/doc/en/announce/release-2.7.0.rst b/doc/en/announce/release-2.7.0.rst index 2840178a0..83cddb341 100644 --- a/doc/en/announce/release-2.7.0.rst +++ b/doc/en/announce/release-2.7.0.rst @@ -55,7 +55,7 @@ holger krekel github. See https://pytest.org/en/stable/contributing.html . Thanks to Anatoly for pushing and initial work on this. -- fix issue650: new option ``--docttest-ignore-import-errors`` which +- fix issue650: new option ``--doctest-ignore-import-errors`` which will turn import errors in doctests into skips. Thanks Charles Cloud for the complete PR. diff --git a/doc/en/announce/sprint2016.rst b/doc/en/announce/sprint2016.rst index 8e7065898..8d47a205c 100644 --- a/doc/en/announce/sprint2016.rst +++ b/doc/en/announce/sprint2016.rst @@ -49,7 +49,7 @@ place on 20th, 21st, 22nd, 24th and 25th. On the 23rd we took a break day for some hot hiking in the Black Forest. Sprint activity was organised heavily around pairing, with plenty of group -discusssions to take advantage of the high bandwidth, and lightning talks +discussions to take advantage of the high bandwidth, and lightning talks as well. diff --git a/doc/en/changelog.rst b/doc/en/changelog.rst index fb276a938..d5cde4988 100644 --- a/doc/en/changelog.rst +++ b/doc/en/changelog.rst @@ -168,7 +168,7 @@ Improvements - `#11311 `_: When using ``--override-ini`` for paths in invocations without a configuration file defined, the current working directory is used as the relative directory. - Previoulsy this would raise an :class:`AssertionError`. + Previously this would raise an :class:`AssertionError`. - `#11475 `_: :ref:`--import-mode=importlib ` now tries to import modules using the standard import mechanism (but still without changing :py:data:`sys.path`), falling back to importing modules directly only if that fails. @@ -1411,7 +1411,7 @@ Deprecations ``__init__`` method, they should take ``**kwargs``. See :ref:`uncooperative-constructors-deprecated` for details. - Note that a deprection warning is only emitted when there is a conflict in the + Note that a deprecation warning is only emitted when there is a conflict in the arguments pytest expected to pass. This deprecation was already part of pytest 7.0.0rc1 but wasn't documented. @@ -1453,7 +1453,7 @@ Breaking Changes - `#7259 `_: The :ref:`Node.reportinfo() ` function first return value type has been expanded from `py.path.local | str` to `os.PathLike[str] | str`. Most plugins which refer to `reportinfo()` only define it as part of a custom :class:`pytest.Item` implementation. - Since `py.path.local` is an `os.PathLike[str]`, these plugins are unaffacted. + Since `py.path.local` is an `os.PathLike[str]`, these plugins are unaffected. Plugins and users which call `reportinfo()`, use the first return value and interact with it as a `py.path.local`, would need to adjust by calling `py.path.local(fspath)`. Although preferably, avoid the legacy `py.path.local` and use `pathlib.Path`, or use `item.location` or `item.path`, instead. @@ -1961,7 +1961,7 @@ Bug Fixes the ``tmp_path``/``tmpdir`` fixture). Now the directories are created with private permissions. - pytest used to silently use a pre-existing ``/tmp/pytest-of-`` directory, + pytest used to silently use a preexisting ``/tmp/pytest-of-`` directory, even if owned by another user. This means another user could pre-create such a directory and gain control of another user's temporary directory. Now such a condition results in an error. @@ -2688,7 +2688,7 @@ Features also changes ``sys.modules`` as a side-effect), which works but has a number of drawbacks, like requiring test modules that don't live in packages to have unique names (as they need to reside under a unique name in ``sys.modules``). - ``--import-mode=importlib`` uses more fine grained import mechanisms from ``importlib`` which don't + ``--import-mode=importlib`` uses more fine-grained import mechanisms from ``importlib`` which don't require pytest to change ``sys.path`` or ``sys.modules`` at all, eliminating much of the drawbacks of the previous mode. @@ -2705,7 +2705,7 @@ Improvements ------------ - :issue:`4375`: The ``pytest`` command now suppresses the ``BrokenPipeError`` error message that - is printed to stderr when the output of ``pytest`` is piped and and the pipe is + is printed to stderr when the output of ``pytest`` is piped and the pipe is closed by the piped-to program (common examples are ``less`` and ``head``). @@ -3007,7 +3007,7 @@ Breaking Changes This hook has been marked as deprecated and not been even called by pytest for over 10 years now. -- :issue:`6673`: Reversed / fix meaning of "+/-" in error diffs. "-" means that sth. expected is missing in the result and "+" means that there are unexpected extras in the result. +- :issue:`6673`: Reversed / fix meaning of "+/-" in error diffs. "-" means that something expected is missing in the result and "+" means that there are unexpected extras in the result. - :issue:`6737`: The ``cached_result`` attribute of ``FixtureDef`` is now set to ``None`` when @@ -4612,7 +4612,7 @@ Bug Fixes Improved Documentation ---------------------- -- :issue:`4974`: Update docs for ``pytest_cmdline_parse`` hook to note availability liminations +- :issue:`4974`: Update docs for ``pytest_cmdline_parse`` hook to note availability limitations @@ -6470,7 +6470,7 @@ Features Bug Fixes --------- -- Fix hanging pexpect test on MacOS by using flush() instead of wait(). +- Fix hanging pexpect test on macOS by using flush() instead of wait(). (:issue:`2022`) - Fix restoring Python state after in-process pytest runs with the @@ -6518,7 +6518,7 @@ Trivial/Internal Changes ------------------------ - Show a simple and easy error when keyword expressions trigger a syntax error - (for example, ``"-k foo and import"`` will show an error that you can not use + (for example, ``"-k foo and import"`` will show an error that you cannot use the ``import`` keyword in expressions). (:issue:`2953`) - Change parametrized automatic test id generation to use the ``__name__`` @@ -8294,7 +8294,7 @@ time or change existing behaviors in order to make them less surprising/more use one will also have a "reprec" attribute with the recorded events/reports. - fix monkeypatch.setattr("x.y", raising=False) to actually not raise - if "y" is not a pre-existing attribute. Thanks Florian Bruhin. + if "y" is not a preexisting attribute. Thanks Florian Bruhin. - fix issue741: make running output from testdir.run copy/pasteable Thanks Bruno Oliveira. @@ -8350,7 +8350,7 @@ time or change existing behaviors in order to make them less surprising/more use - fix issue854: autouse yield_fixtures defined as class members of unittest.TestCase subclasses now work as expected. - Thannks xmo-odoo for the report and Bruno Oliveira for the PR. + Thanks xmo-odoo for the report and Bruno Oliveira for the PR. - fix issue833: --fixtures now shows all fixtures of collected test files, instead of just the fixtures declared on the first one. @@ -8454,7 +8454,7 @@ time or change existing behaviors in order to make them less surprising/more use github. See https://pytest.org/en/stable/contributing.html . Thanks to Anatoly for pushing and initial work on this. -- fix issue650: new option ``--docttest-ignore-import-errors`` which +- fix issue650: new option ``--doctest-ignore-import-errors`` which will turn import errors in doctests into skips. Thanks Charles Cloud for the complete PR. @@ -8642,7 +8642,7 @@ time or change existing behaviors in order to make them less surprising/more use - cleanup setup.py a bit and specify supported versions. Thanks Jurko Gospodnetic for the PR. -- change XPASS colour to yellow rather then red when tests are run +- change XPASS colour to yellow rather than red when tests are run with -v. - fix issue473: work around mock putting an unbound method into a class @@ -8815,7 +8815,7 @@ time or change existing behaviors in order to make them less surprising/more use Thanks Ralph Schmitt for the precise failure example. - fix issue244 by implementing special index for parameters to only use - indices for paramentrized test ids + indices for parametrized test ids - fix issue287 by running all finalizers but saving the exception from the first failing finalizer and re-raising it so teardown will @@ -8823,7 +8823,7 @@ time or change existing behaviors in order to make them less surprising/more use it might be the cause for other finalizers to fail. - fix ordering when mock.patch or other standard decorator-wrappings - are used with test methods. This fixues issue346 and should + are used with test methods. This fixes issue346 and should help with random "xdist" collection failures. Thanks to Ronny Pfannschmidt and Donald Stufft for helping to isolate it. @@ -9080,7 +9080,7 @@ Bug fixes: partially failed (finalizers would not always be called before) - fix issue320 - fix class scope for fixtures when mixed with - module-level functions. Thanks Anatloy Bubenkoff. + module-level functions. Thanks Anatoly Bubenkoff. - you can specify "-q" or "-qq" to get different levels of "quieter" reporting (thanks Katarzyna Jachim) @@ -9502,7 +9502,7 @@ Bug fixes: unexpected exceptions - fix issue47: timing output in junitxml for test cases is now correct - fix issue48: typo in MarkInfo repr leading to exception -- fix issue49: avoid confusing error when initizaliation partially fails +- fix issue49: avoid confusing error when initialization partially fails - fix issue44: env/username expansion for junitxml file path - show releaselevel information in test runs for pypy - reworked doc pages for better navigation and PDF generation @@ -9627,7 +9627,7 @@ Bug fixes: collection-before-running semantics were not setup as with pytest 1.3.4. Note, however, that the recommended and much cleaner way to do test - parametraization remains the "pytest_generate_tests" + parameterization remains the "pytest_generate_tests" mechanism, see the docs. 2.0.0 (2010-11-25) diff --git a/doc/en/deprecations.rst b/doc/en/deprecations.rst index 5ac93f151..a65ea3316 100644 --- a/doc/en/deprecations.rst +++ b/doc/en/deprecations.rst @@ -462,7 +462,7 @@ Now :class:`~pytest.Class` collects the test methods directly. Most plugins which reference ``Instance`` do so in order to ignore or skip it, using a check such as ``if isinstance(node, Instance): return``. Such plugins should simply remove consideration of ``Instance`` on pytest>=7. -However, to keep such uses working, a dummy type has been instanted in ``pytest.Instance`` and ``_pytest.python.Instance``, +However, to keep such uses working, a dummy type has been instanced in ``pytest.Instance`` and ``_pytest.python.Instance``, and importing it emits a deprecation warning. This was removed in pytest 8. diff --git a/doc/en/example/customdirectory/conftest.py b/doc/en/example/customdirectory/conftest.py index 350893cab..b2f68dba4 100644 --- a/doc/en/example/customdirectory/conftest.py +++ b/doc/en/example/customdirectory/conftest.py @@ -21,7 +21,7 @@ class ManifestDirectory(pytest.Directory): @pytest.hookimpl def pytest_collect_directory(path, parent): - # Use our custom collector for directories containing a `mainfest.json` file. + # Use our custom collector for directories containing a `manifest.json` file. if path.joinpath("manifest.json").is_file(): return ManifestDirectory.from_parent(parent=parent, path=path) # Otherwise fallback to the standard behavior. diff --git a/doc/en/getting-started.rst b/doc/en/getting-started.rst index 5b33e308d..468de3654 100644 --- a/doc/en/getting-started.rst +++ b/doc/en/getting-started.rst @@ -274,7 +274,7 @@ Continue reading Check out additional pytest resources to help you customize tests for your unique workflow: * ":ref:`usage`" for command line invocation examples -* ":ref:`existingtestsuite`" for working with pre-existing tests +* ":ref:`existingtestsuite`" for working with preexisting tests * ":ref:`mark`" for information on the ``pytest.mark`` mechanism * ":ref:`fixtures`" for providing a functional baseline to your tests * ":ref:`plugins`" for managing and writing plugins diff --git a/doc/en/naming20.rst b/doc/en/naming20.rst index 5a81df269..112130663 100644 --- a/doc/en/naming20.rst +++ b/doc/en/naming20.rst @@ -8,7 +8,7 @@ If you used older version of the ``py`` distribution (which included the py.test command line tool and Python name space) you accessed helpers and possibly collection classes through the ``py.test`` Python namespaces. The new ``pytest`` -Python module flaty provides the same objects, following +Python module flatly provides the same objects, following these renaming rules:: py.test.XYZ -> pytest.XYZ diff --git a/doc/en/reference/fixtures.rst b/doc/en/reference/fixtures.rst index 8ba59395e..dff93a035 100644 --- a/doc/en/reference/fixtures.rst +++ b/doc/en/reference/fixtures.rst @@ -39,7 +39,7 @@ Built-in fixtures Store and retrieve values across pytest runs. :fixture:`doctest_namespace` - Provide a dict injected into the docstests namespace. + Provide a dict injected into the doctests namespace. :fixture:`monkeypatch` Temporarily modify classes, functions, dictionaries, diff --git a/doc/en/reference/reference.rst b/doc/en/reference/reference.rst index e46478da0..4036b7d99 100644 --- a/doc/en/reference/reference.rst +++ b/doc/en/reference/reference.rst @@ -1940,7 +1940,7 @@ All the command-line flags can be obtained by running ``pytest --help``:: general: -k EXPRESSION Only run tests which match the given substring - expression. An expression is a Python evaluatable + expression. An expression is a Python evaluable expression where all names are substring-matched against test names and their parent classes. Example: -k 'test_method or test_other' matches all diff --git a/src/_pytest/_py/error.py b/src/_pytest/_py/error.py index 68f1eed7e..ab3a4ed31 100644 --- a/src/_pytest/_py/error.py +++ b/src/_pytest/_py/error.py @@ -41,7 +41,7 @@ _winerrnomap = { 3: errno.ENOENT, 17: errno.EEXIST, 18: errno.EXDEV, - 13: errno.EBUSY, # empty cd drive, but ENOMEDIUM seems unavailiable + 13: errno.EBUSY, # empty cd drive, but ENOMEDIUM seems unavailable 22: errno.ENOTDIR, 20: errno.ENOTDIR, 267: errno.ENOTDIR, diff --git a/src/_pytest/_py/path.py b/src/_pytest/_py/path.py index 27b115cfd..bcb05ac34 100644 --- a/src/_pytest/_py/path.py +++ b/src/_pytest/_py/path.py @@ -836,7 +836,7 @@ class LocalPath: def copy(self, target, mode=False, stat=False): """Copy path to target. - If mode is True, will copy copy permission from path to target. + If mode is True, will copy permission from path to target. If stat is True, copy permission, last modification time, last access time, and flags from path to target. """ @@ -1047,7 +1047,7 @@ class LocalPath: def pypkgpath(self): """Return the Python package path by looking for the last directory upwards which still contains an __init__.py. - Return None if a pkgpath can not be determined. + Return None if a pkgpath cannot be determined. """ pkgpath = None for parent in self.parts(reverse=True): diff --git a/src/_pytest/assertion/rewrite.py b/src/_pytest/assertion/rewrite.py index 3d5df0d6c..928c4f5e3 100644 --- a/src/_pytest/assertion/rewrite.py +++ b/src/_pytest/assertion/rewrite.py @@ -584,7 +584,7 @@ def _get_assertion_exprs(src: bytes) -> Dict[int, str]: # multi-line assert with message elif lineno in seen_lines: lines[-1] = lines[-1][:offset] - # multi line assert with escapd newline before message + # multi line assert with escaped newline before message else: lines.append(line[:offset]) _write_and_reset() diff --git a/src/_pytest/assertion/util.py b/src/_pytest/assertion/util.py index 008eabf9a..a118befcc 100644 --- a/src/_pytest/assertion/util.py +++ b/src/_pytest/assertion/util.py @@ -325,7 +325,7 @@ def _diff_text(left: str, right: str, verbose: int = 0) -> List[str]: def _compare_eq_iterable( left: Iterable[Any], right: Iterable[Any], - highligher: _HighlightFunc, + highlighter: _HighlightFunc, verbose: int = 0, ) -> List[str]: if verbose <= 0 and not running_on_ci(): @@ -340,7 +340,7 @@ def _compare_eq_iterable( # "right" is the expected base against which we compare "left", # see https://github.com/pytest-dev/pytest/issues/3333 explanation.extend( - highligher( + highlighter( "\n".join( line.rstrip() for line in difflib.ndiff(right_formatting, left_formatting) diff --git a/src/_pytest/cacheprovider.py b/src/_pytest/cacheprovider.py index 06def557e..5aa8f4835 100755 --- a/src/_pytest/cacheprovider.py +++ b/src/_pytest/cacheprovider.py @@ -251,7 +251,7 @@ class LFPluginCollWrapper: # Sort any lf-paths to the beginning. lf_paths = self.lfplugin._last_failed_paths - # Use stable sort to priorize last failed. + # Use stable sort to prioritize last failed. def sort_key(node: Union[nodes.Item, nodes.Collector]) -> bool: return node.path in lf_paths diff --git a/src/_pytest/compat.py b/src/_pytest/compat.py index 9d9411818..614848e0d 100644 --- a/src/_pytest/compat.py +++ b/src/_pytest/compat.py @@ -53,7 +53,7 @@ def iscoroutinefunction(func: object) -> bool: def syntax, and doesn't contain yield), or a function decorated with @asyncio.coroutine. - Note: copied and modified from Python 3.5's builtin couroutines.py to avoid + Note: copied and modified from Python 3.5's builtin coroutines.py to avoid importing asyncio directly, which in turns also initializes the "logging" module as a side-effect (see issue #8). """ diff --git a/src/_pytest/config/__init__.py b/src/_pytest/config/__init__.py index c8e8e7d29..c698ea9a7 100644 --- a/src/_pytest/config/__init__.py +++ b/src/_pytest/config/__init__.py @@ -462,7 +462,7 @@ class PytestPluginManager(PluginManager): # (see issue #1073). if not name.startswith("pytest_"): return None - # Ignore names which can not be hooks. + # Ignore names which cannot be hooks. if name == "pytest_plugins": return None @@ -574,8 +574,8 @@ class PytestPluginManager(PluginManager): self._noconftest = noconftest self._using_pyargs = pyargs foundanchor = False - for intitial_path in args: - path = str(intitial_path) + for initial_path in args: + path = str(initial_path) # remove node-id syntax i = path.find("::") if i != -1: diff --git a/src/_pytest/fixtures.py b/src/_pytest/fixtures.py index 5a290718f..3ce8b3fb4 100644 --- a/src/_pytest/fixtures.py +++ b/src/_pytest/fixtures.py @@ -326,7 +326,7 @@ class FuncFixtureInfo: working_set = set(self.initialnames) while working_set: argname = working_set.pop() - # Argname may be smth not included in the original names_closure, + # Argname may be something not included in the original names_closure, # in which case we ignore it. This currently happens with pseudo # FixtureDefs which wrap 'get_direct_param_fixture_func(request)'. # So they introduce the new dependency 'request' which might have @@ -1702,7 +1702,7 @@ class FixtureManager: If `node_or_object` is a collection node (with an underlying Python object), the node's object is traversed and the node's nodeid is used to - determine the fixtures' visibilty. `nodeid` must not be specified in + determine the fixtures' visibility. `nodeid` must not be specified in this case. If `node_or_object` is an object (e.g. a plugin), the object is diff --git a/src/_pytest/hookspec.py b/src/_pytest/hookspec.py index 01d3b6640..8a38ff4fb 100644 --- a/src/_pytest/hookspec.py +++ b/src/_pytest/hookspec.py @@ -651,7 +651,7 @@ def pytest_runtest_protocol( - ``pytest_runtest_logreport(report)`` - ``pytest_exception_interact(call, report)`` if an interactive exception occurred - - Call phase, if the the setup passed and the ``setuponly`` pytest option is not set: + - Call phase, if the setup passed and the ``setuponly`` pytest option is not set: - ``call = pytest_runtest_call(item)`` (wrapped in ``CallInfo(when="call")``) - ``report = pytest_runtest_makereport(item, call)`` - ``pytest_runtest_logreport(report)`` @@ -861,7 +861,7 @@ def pytest_fixture_setup( ) -> Optional[object]: """Perform fixture setup execution. - :param fixturdef: + :param fixturedef: The fixture definition object. :param request: The fixture request object. @@ -891,7 +891,7 @@ def pytest_fixture_post_finalizer( the fixture result ``fixturedef.cached_result`` is still available (not ``None``). - :param fixturdef: + :param fixturedef: The fixture definition object. :param request: The fixture request object. diff --git a/src/_pytest/legacypath.py b/src/_pytest/legacypath.py index b28c89767..d9de65b1a 100644 --- a/src/_pytest/legacypath.py +++ b/src/_pytest/legacypath.py @@ -384,7 +384,7 @@ def Config_inifile(self: Config) -> Optional[LEGACY_PATH]: return legacy_path(str(self.inipath)) if self.inipath else None -def Session_stardir(self: Session) -> LEGACY_PATH: +def Session_startdir(self: Session) -> LEGACY_PATH: """The path from which pytest was invoked. Prefer to use ``startpath`` which is a :class:`pathlib.Path`. @@ -439,7 +439,7 @@ def pytest_load_initial_conftests(early_config: Config) -> None: mp.setattr(Config, "inifile", property(Config_inifile), raising=False) # Add Session.startdir property. - mp.setattr(Session, "startdir", property(Session_stardir), raising=False) + mp.setattr(Session, "startdir", property(Session_startdir), raising=False) # Add pathlist configuration type. mp.setattr(Config, "_getini_unknown_type", Config__getini_unknown_type) diff --git a/src/_pytest/mark/__init__.py b/src/_pytest/mark/__init__.py index f5276d8fb..950a6959e 100644 --- a/src/_pytest/mark/__init__.py +++ b/src/_pytest/mark/__init__.py @@ -78,7 +78,7 @@ def pytest_addoption(parser: Parser) -> None: default="", metavar="EXPRESSION", help="Only run tests which match the given substring expression. " - "An expression is a Python evaluatable expression " + "An expression is a Python evaluable expression " "where all names are substring-matched against test names " "and their parent classes. Example: -k 'test_method or test_" "other' matches all test functions and classes whose name " diff --git a/src/_pytest/pathlib.py b/src/_pytest/pathlib.py index e14c2acd3..b11eea4e7 100644 --- a/src/_pytest/pathlib.py +++ b/src/_pytest/pathlib.py @@ -173,7 +173,7 @@ def rm_rf(path: Path) -> None: def find_prefixed(root: Path, prefix: str) -> Iterator["os.DirEntry[str]"]: - """Find all elements in root that begin with the prefix, case insensitive.""" + """Find all elements in root that begin with the prefix, case-insensitive.""" l_prefix = prefix.lower() for x in os.scandir(root): if x.name.lower().startswith(l_prefix): @@ -776,7 +776,7 @@ def resolve_package_path(path: Path) -> Optional[Path]: """Return the Python package path by looking for the last directory upwards which still contains an __init__.py. - Returns None if it can not be determined. + Returns None if it cannot be determined. """ result = None for parent in itertools.chain((path,), path.parents): diff --git a/src/_pytest/stepwise.py b/src/_pytest/stepwise.py index 3ebebc288..92d3a297e 100644 --- a/src/_pytest/stepwise.py +++ b/src/_pytest/stepwise.py @@ -40,7 +40,7 @@ def pytest_addoption(parser: Parser) -> None: @pytest.hookimpl def pytest_configure(config: Config) -> None: if config.option.stepwise_skip: - # allow --stepwise-skip to work on it's own merits. + # allow --stepwise-skip to work on its own merits. config.option.stepwise = True if config.getoption("stepwise"): config.pluginmanager.register(StepwisePlugin(config), "stepwiseplugin") diff --git a/testing/_py/test_local.py b/testing/_py/test_local.py index 243219bab..ea5794b25 100644 --- a/testing/_py/test_local.py +++ b/testing/_py/test_local.py @@ -667,7 +667,7 @@ class TestLocalPath(CommonFSTests): assert p == os.path.expanduser("~") @pytest.mark.skipif( - not sys.platform.startswith("win32"), reason="case insensitive only on windows" + not sys.platform.startswith("win32"), reason="case-insensitive only on windows" ) def test_eq_hash_are_case_insensitive_on_windows(self): a = local("/some/path") @@ -898,7 +898,7 @@ class TestExecutionOnWindows: class TestExecution: pytestmark = skiponwin32 - def test_sysfind_no_permisson_ignored(self, monkeypatch, tmpdir): + def test_sysfind_no_permission_ignored(self, monkeypatch, tmpdir): noperm = tmpdir.ensure("noperm", dir=True) monkeypatch.setenv("PATH", str(noperm), prepend=":") noperm.chmod(0) diff --git a/testing/code/test_excinfo.py b/testing/code/test_excinfo.py index f2c689a13..86e30dc48 100644 --- a/testing/code/test_excinfo.py +++ b/testing/code/test_excinfo.py @@ -1515,7 +1515,7 @@ def test_cwd_deleted(pytester: Pytester) -> None: result.stderr.no_fnmatch_line("*INTERNALERROR*") -def test_regression_nagative_line_index(pytester: Pytester) -> None: +def test_regression_negative_line_index(pytester: Pytester) -> None: """ With Python 3.10 alphas, there was an INTERNALERROR reported in https://github.com/pytest-dev/pytest/pull/8227 diff --git a/testing/code/test_source.py b/testing/code/test_source.py index 12ea27b35..2fa852057 100644 --- a/testing/code/test_source.py +++ b/testing/code/test_source.py @@ -255,7 +255,7 @@ def test_getfuncsource_dynamic() -> None: assert str(g_source).strip() == "def g():\n pass # pragma: no cover" -def test_getfuncsource_with_multine_string() -> None: +def test_getfuncsource_with_multiline_string() -> None: def f(): c = """while True: pass diff --git a/testing/logging/test_fixture.py b/testing/logging/test_fixture.py index 2e16913f0..c1cfff632 100644 --- a/testing/logging/test_fixture.py +++ b/testing/logging/test_fixture.py @@ -117,7 +117,7 @@ def test_change_disabled_level_undo(pytester: Pytester) -> None: result.stdout.no_fnmatch_line("*log from test2*") -def test_change_level_undos_handler_level(pytester: Pytester) -> None: +def test_change_level_undoes_handler_level(pytester: Pytester) -> None: """Ensure that 'set_level' is undone after the end of the test (handler). Issue #7569. Tests the handler level specifically. @@ -302,7 +302,15 @@ def logging_during_setup_and_teardown( assert [x.message for x in caplog.get_records("teardown")] == ["a_teardown_log"] -def test_caplog_captures_for_all_stages( +def private_assert_caplog_records_is_setup_call( + caplog: pytest.LogCaptureFixture, +) -> None: + # This reaches into private API, don't use this type of thing in real tests! + caplog_records = caplog._item.stash[caplog_records_key] + assert set(caplog_records) == {"setup", "call"} + + +def test_captures_for_all_stages( caplog: pytest.LogCaptureFixture, logging_during_setup_and_teardown: None ) -> None: assert not caplog.records @@ -312,9 +320,7 @@ def test_caplog_captures_for_all_stages( 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! - caplog_records = caplog._item.stash[caplog_records_key] - assert set(caplog_records) == {"setup", "call"} + private_assert_caplog_records_is_setup_call(caplog) def test_clear_for_call_stage( @@ -323,21 +329,18 @@ def test_clear_for_call_stage( 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("setup")] == ["a_setup_log"] - caplog_records = caplog._item.stash[caplog_records_key] - assert set(caplog_records) == {"setup", "call"} + private_assert_caplog_records_is_setup_call(caplog) caplog.clear() assert caplog.get_records("call") == [] assert [x.message for x in caplog.get_records("setup")] == ["a_setup_log"] - caplog_records = caplog._item.stash[caplog_records_key] - assert set(caplog_records) == {"setup", "call"} + private_assert_caplog_records_is_setup_call(caplog) 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("setup")] == ["a_setup_log"] - caplog_records = caplog._item.stash[caplog_records_key] - assert set(caplog_records) == {"setup", "call"} + private_assert_caplog_records_is_setup_call(caplog) def test_ini_controls_global_log_level(pytester: Pytester) -> None: @@ -363,11 +366,11 @@ def test_ini_controls_global_log_level(pytester: Pytester) -> None: ) result = pytester.runpytest() - # make sure that that we get a '0' exit code for the testsuite + # make sure that we get a '0' exit code for the testsuite assert result.ret == 0 -def test_caplog_can_override_global_log_level(pytester: Pytester) -> None: +def test_can_override_global_log_level(pytester: Pytester) -> None: pytester.makepyfile( """ import pytest @@ -406,7 +409,7 @@ def test_caplog_can_override_global_log_level(pytester: Pytester) -> None: assert result.ret == 0 -def test_caplog_captures_despite_exception(pytester: Pytester) -> None: +def test_captures_despite_exception(pytester: Pytester) -> None: pytester.makepyfile( """ import pytest diff --git a/testing/python/fixtures.py b/testing/python/fixtures.py index aec0deb99..15d7c33b2 100644 --- a/testing/python/fixtures.py +++ b/testing/python/fixtures.py @@ -933,7 +933,7 @@ class TestRequestBasic: ) -> None: """ Ensure exceptions raised during teardown by finalizers are suppressed - until all finalizers are called, then re-reaised together in an + until all finalizers are called, then re-raised together in an exception group (#2440) """ pytester.makepyfile( diff --git a/testing/python/integration.py b/testing/python/integration.py index 219ebf9ce..c20aaeed8 100644 --- a/testing/python/integration.py +++ b/testing/python/integration.py @@ -163,7 +163,7 @@ class TestMockDecoration: @mock.patch("os.path.abspath") @mock.patch("os.path.normpath") @mock.patch("os.path.basename", new=mock_basename) - def test_someting(normpath, abspath, tmp_path): + def test_something(normpath, abspath, tmp_path): abspath.return_value = "this" os.path.normpath(os.path.abspath("hello")) normpath.assert_any_call("this") @@ -176,7 +176,7 @@ class TestMockDecoration: funcnames = [ call.report.location[2] for call in calls if call.report.when == "call" ] - assert funcnames == ["T.test_hello", "test_someting"] + assert funcnames == ["T.test_hello", "test_something"] def test_mock_sorting(self, pytester: Pytester) -> None: pytest.importorskip("mock", "1.0.1") diff --git a/testing/test_cacheprovider.py b/testing/test_cacheprovider.py index c85c1d04c..d7815f77b 100644 --- a/testing/test_cacheprovider.py +++ b/testing/test_cacheprovider.py @@ -58,7 +58,7 @@ class TestNewAPI: assert val == -2 @pytest.mark.filterwarnings("ignore:could not create cache path") - def test_cache_writefail_cachfile_silent(self, pytester: Pytester) -> None: + def test_cache_writefail_cachefile_silent(self, pytester: Pytester) -> None: pytester.makeini("[pytest]") pytester.path.joinpath(".pytest_cache").write_text( "gone wrong", encoding="utf-8" diff --git a/testing/test_compat.py b/testing/test_compat.py index c898af7c5..73ac1bad8 100644 --- a/testing/test_compat.py +++ b/testing/test_compat.py @@ -94,7 +94,7 @@ def test_get_real_func_partial() -> None: assert get_real_func(partial(foo)) is foo -@pytest.mark.skipif(sys.version_info >= (3, 11), reason="couroutine removed") +@pytest.mark.skipif(sys.version_info >= (3, 11), reason="coroutine removed") def test_is_generator_asyncio(pytester: Pytester) -> None: pytester.makepyfile( """ diff --git a/testing/test_config.py b/testing/test_config.py index 776c8424a..1cb31fed0 100644 --- a/testing/test_config.py +++ b/testing/test_config.py @@ -216,7 +216,7 @@ class TestParseIni: def test_confcutdir_default_without_configfile(self, pytester: Pytester) -> None: # If --confcutdir is not specified, and there is no configfile, default - # to the roothpath. + # to the rootpath. sub = pytester.mkdir("sub") os.chdir(sub) config = pytester.parseconfigure() @@ -1738,7 +1738,7 @@ class TestOverrideIniArgs: ) pytester.makepyfile( r""" - def test_overriden(pytestconfig): + def test_overridden(pytestconfig): config_paths = pytestconfig.getini("paths") print(config_paths) for cpf in config_paths: diff --git a/testing/test_conftest.py b/testing/test_conftest.py index a3ebcbb78..eb3ebecdc 100644 --- a/testing/test_conftest.py +++ b/testing/test_conftest.py @@ -70,7 +70,7 @@ class TestConftestValueAccessGlobal: ) assert conftest._rget_with_confmod("a", p)[1] == 1 - def test_immediate_initialiation_and_incremental_are_the_same( + def test_immediate_initialization_and_incremental_are_the_same( self, basedir: Path ) -> None: conftest = PytestPluginManager() @@ -396,7 +396,7 @@ def test_conftest_symlink_files(pytester: Pytester) -> None: @pytest.mark.skipif( os.path.normcase("x") != os.path.normcase("X"), - reason="only relevant for case insensitive file systems", + reason="only relevant for case-insensitive file systems", ) def test_conftest_badcase(pytester: Pytester) -> None: """Check conftest.py loading when directory casing is wrong (#5792).""" diff --git a/testing/test_debugging.py b/testing/test_debugging.py index a99336c75..1f3422947 100644 --- a/testing/test_debugging.py +++ b/testing/test_debugging.py @@ -1122,7 +1122,7 @@ class TestTraceOption: def test_trace_after_runpytest(pytester: Pytester) -> None: - """Test that debugging's pytest_configure is re-entrant.""" + """Test that debugging's pytest_configure is reentrant.""" p1 = pytester.makepyfile( """ from _pytest.debugging import pytestPDB @@ -1153,7 +1153,7 @@ def test_trace_after_runpytest(pytester: Pytester) -> None: def test_quit_with_swallowed_SystemExit(pytester: Pytester) -> None: - """Test that debugging's pytest_configure is re-entrant.""" + """Test that debugging's pytest_configure is reentrant.""" p1 = pytester.makepyfile( """ def call_pdb_set_trace(): diff --git a/testing/test_doctest.py b/testing/test_doctest.py index de5d13531..d73112179 100644 --- a/testing/test_doctest.py +++ b/testing/test_doctest.py @@ -396,7 +396,7 @@ class TestDoctests: ] ) - def test_doctest_no_linedata_on_overriden_property(self, pytester: Pytester): + def test_doctest_no_linedata_on_overridden_property(self, pytester: Pytester): pytester.makepyfile( """ class Sample(object): @@ -414,7 +414,7 @@ class TestDoctests: result.stdout.fnmatch_lines( [ "*= FAILURES =*", - "*_ [[]doctest[]] test_doctest_no_linedata_on_overriden_property.Sample.some_property _*", + "*_ [[]doctest[]] test_doctest_no_linedata_on_overridden_property.Sample.some_property _*", "EXAMPLE LOCATION UNKNOWN, not showing all tests of that example", "[?][?][?] >>> Sample().some_property", "Expected:", @@ -422,7 +422,7 @@ class TestDoctests: "Got:", " 'something'", "", - "*/test_doctest_no_linedata_on_overriden_property.py:None: DocTestFailure", + "*/test_doctest_no_linedata_on_overridden_property.py:None: DocTestFailure", "*= 1 failed in *", ] ) diff --git a/testing/test_junitxml.py b/testing/test_junitxml.py index f8742dc2e..1ebc3ed3a 100644 --- a/testing/test_junitxml.py +++ b/testing/test_junitxml.py @@ -1001,7 +1001,7 @@ class TestNonPython: @pytest.mark.parametrize("junit_logging", ["no", "system-out"]) def test_nullbyte(pytester: Pytester, junit_logging: str) -> None: - # A null byte can not occur in XML (see section 2.2 of the spec) + # A null byte cannot occur in XML (see section 2.2 of the spec) pytester.makepyfile( """ import sys diff --git a/testing/test_legacypath.py b/testing/test_legacypath.py index f7f45dbf0..d2b33b4fb 100644 --- a/testing/test_legacypath.py +++ b/testing/test_legacypath.py @@ -155,7 +155,7 @@ def test_override_ini_paths(pytester: pytest.Pytester) -> None: ) pytester.makepyfile( r""" - def test_overriden(pytestconfig): + def test_overridden(pytestconfig): config_paths = pytestconfig.getini("paths") print(config_paths) for cpf in config_paths: diff --git a/testing/test_mark_expression.py b/testing/test_mark_expression.py index a7a9cf304..07c89f908 100644 --- a/testing/test_mark_expression.py +++ b/testing/test_mark_expression.py @@ -61,7 +61,7 @@ def test_basic(expr: str, expected: bool) -> None: ("not not not not not true", False), ), ) -def test_syntax_oddeties(expr: str, expected: bool) -> None: +def test_syntax_oddities(expr: str, expected: bool) -> None: matcher = {"true": True, "false": False}.__getitem__ assert evaluate(expr, matcher) is expected diff --git a/testing/test_pluginmanager.py b/testing/test_pluginmanager.py index da43364f6..99b003b66 100644 --- a/testing/test_pluginmanager.py +++ b/testing/test_pluginmanager.py @@ -420,7 +420,7 @@ class TestPytestPluginManager: pytestpm.consider_conftest(mod, registration_name="unused") -class TestPytestPluginManagerBootstrapming: +class TestPytestPluginManagerBootstrapping: def test_preparse_args(self, pytestpm: PytestPluginManager) -> None: pytest.raises( ImportError, lambda: pytestpm.consider_preparse(["xyz", "-p", "hello123"]) @@ -446,7 +446,7 @@ class TestPytestPluginManagerBootstrapming: assert len(l2) == len(l1) assert 42 not in l2 - def test_plugin_prevent_register_unregistered_alredy_registered( + def test_plugin_prevent_register_unregistered_already_registered( self, pytestpm: PytestPluginManager ) -> None: pytestpm.register(42, name="abc") diff --git a/testing/test_runner.py b/testing/test_runner.py index 436ce2f10..3ec567827 100644 --- a/testing/test_runner.py +++ b/testing/test_runner.py @@ -446,7 +446,7 @@ class BaseFunctionalTests: # assert rep.outcome.when == "setup" # assert rep.outcome.where.lineno == 3 # assert rep.outcome.where.path.basename == "test_func.py" - # assert instanace(rep.failed.failurerepr, PythonFailureRepr) + # assert isinstance(rep.failed.failurerepr, PythonFailureRepr) def test_systemexit_does_not_bail_out(self, pytester: Pytester) -> None: try: diff --git a/testing/test_terminal.py b/testing/test_terminal.py index 19848e7cb..6cd4a1827 100644 --- a/testing/test_terminal.py +++ b/testing/test_terminal.py @@ -926,7 +926,7 @@ class TestTerminalFunctional: def test_header_absolute_testpath( self, pytester: Pytester, monkeypatch: MonkeyPatch ) -> None: - """Regresstion test for #7814.""" + """Regression test for #7814.""" tests = pytester.path.joinpath("tests") tests.mkdir() pytester.makepyprojecttoml( diff --git a/testing/test_unittest.py b/testing/test_unittest.py index f73e083be..003a74d38 100644 --- a/testing/test_unittest.py +++ b/testing/test_unittest.py @@ -299,7 +299,7 @@ def test_setup_setUpClass(pytester: Pytester) -> None: @classmethod def tearDownClass(cls): cls.x -= 1 - def test_teareddown(): + def test_torn_down(): assert MyTestCase.x == 0 """ ) @@ -346,7 +346,7 @@ def test_setup_class(pytester: Pytester) -> None: assert self.x == 1 def teardown_class(cls): cls.x -= 1 - def test_teareddown(): + def test_torn_down(): assert MyTestCase.x == 0 """ ) @@ -881,7 +881,7 @@ def test_non_unittest_no_setupclass_support(pytester: Pytester) -> None: def tearDownClass(cls): cls.x = 1 - def test_not_teareddown(): + def test_not_torn_down(): assert TestFoo.x == 0 """ From 635fbe2bff805c86c0df1db463f4c5eea087aec6 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Fri, 17 May 2024 08:19:13 -0300 Subject: [PATCH 09/53] Attest package provenance (#12333) Use the new build provenance support added in [build-and-inspect-python-package 2.5.0](https://github.com/hynek/build-and-inspect-python-package/blob/main/CHANGELOG.md#250---2024-05-13). More information: https://github.blog/2024-05-02-introducing-artifact-attestations-now-in-public-beta/ Tested also in https://github.com/pytest-dev/pytest-mock/pull/431. Note: even though it is technically necessary only for the `deploy` workflow, as the `test` workflow does not publish its packages, decided to always attest the provenance in both cases to avoid any surprises related to this (say a misconfiguration) when deploying. --- .github/workflows/deploy.yml | 9 ++++++++- .github/workflows/test.yml | 2 +- changelog/12333.trivial.rst | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 changelog/12333.trivial.rst diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index cc0e6331d..20a72270f 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -19,6 +19,11 @@ jobs: SETUPTOOLS_SCM_PRETEND_VERSION: ${{ github.event.inputs.version }} timeout-minutes: 10 + # Required by attest-build-provenance-github. + permissions: + id-token: write + attestations: write + steps: - uses: actions/checkout@v4 with: @@ -26,7 +31,9 @@ jobs: persist-credentials: false - name: Build and Check Package - uses: hynek/build-and-inspect-python-package@v2.4.0 + uses: hynek/build-and-inspect-python-package@v2.5.0 + with: + attest-build-provenance-github: 'true' deploy: if: github.repository == 'pytest-dev/pytest' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 443474067..df801864f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -35,7 +35,7 @@ jobs: fetch-depth: 0 persist-credentials: false - name: Build and Check Package - uses: hynek/build-and-inspect-python-package@v2.4.0 + uses: hynek/build-and-inspect-python-package@v2.5.0 build: needs: [package] diff --git a/changelog/12333.trivial.rst b/changelog/12333.trivial.rst new file mode 100644 index 000000000..32c4c5771 --- /dev/null +++ b/changelog/12333.trivial.rst @@ -0,0 +1 @@ +pytest releases are now attested using the recent `Artifact Attestation ` support from GitHub, allowing users to verify the provenance of pytest's sdist and wheel artifacts. From ee9ea703f98df811738e7ea58bffe6c1bc660371 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Sat, 18 May 2024 12:07:06 -0400 Subject: [PATCH 10/53] Fix new typing issues in AST code (#12337) python/typeshed#11880 adds more precise types for AST nodes. I'm submitting some changes to adapt pytest to these changes. --- src/_pytest/assertion/rewrite.py | 12 ++++++------ testing/test_assertrewrite.py | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/_pytest/assertion/rewrite.py b/src/_pytest/assertion/rewrite.py index 928c4f5e3..b29a254f5 100644 --- a/src/_pytest/assertion/rewrite.py +++ b/src/_pytest/assertion/rewrite.py @@ -835,7 +835,7 @@ class AssertionRewriter(ast.NodeVisitor): current = self.stack.pop() if self.stack: self.explanation_specifiers = self.stack[-1] - keys = [ast.Constant(key) for key in current.keys()] + keys: List[Optional[ast.expr]] = [ast.Constant(key) for key in current.keys()] format_dict = ast.Dict(keys, list(current.values())) form = ast.BinOp(expl_expr, ast.Mod(), format_dict) name = "@py_format" + str(next(self.variable_counter)) @@ -926,13 +926,13 @@ class AssertionRewriter(ast.NodeVisitor): [*self.expl_stmts, hook_call_pass], [], ) - statements_pass = [hook_impl_test] + statements_pass: List[ast.stmt] = [hook_impl_test] # Test for assertion condition main_test = ast.If(negation, statements_fail, statements_pass) self.statements.append(main_test) if self.format_variables: - variables = [ + variables: List[ast.expr] = [ ast.Name(name, ast.Store()) for name in self.format_variables ] clear_format = ast.Assign(variables, ast.Constant(None)) @@ -1114,11 +1114,11 @@ class AssertionRewriter(ast.NodeVisitor): if isinstance(comp.left, (ast.Compare, ast.BoolOp)): left_expl = f"({left_expl})" res_variables = [self.variable() for i in range(len(comp.ops))] - load_names = [ast.Name(v, ast.Load()) for v in res_variables] + load_names: List[ast.expr] = [ast.Name(v, ast.Load()) for v in res_variables] store_names = [ast.Name(v, ast.Store()) for v in res_variables] it = zip(range(len(comp.ops)), comp.ops, comp.comparators) - expls = [] - syms = [] + expls: List[ast.expr] = [] + syms: List[ast.expr] = [] results = [left_res] for i, op, next_operand in it: if ( diff --git a/testing/test_assertrewrite.py b/testing/test_assertrewrite.py index 82c7055b9..8db9dbbe5 100644 --- a/testing/test_assertrewrite.py +++ b/testing/test_assertrewrite.py @@ -130,6 +130,7 @@ class TestAssertionRewrite: if isinstance(node, ast.Import): continue for n in [node, *ast.iter_child_nodes(node)]: + assert isinstance(n, (ast.stmt, ast.expr)) assert n.lineno == 3 assert n.col_offset == 0 assert n.end_lineno == 6 From dbee3fa34a9fb3712742f28ba15676274e68121d Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Fri, 17 May 2024 11:22:53 +0300 Subject: [PATCH 11/53] testing: remove conditionals for Python 3.11 beta releases No need to support beta releases of an older version anymore. Ref: 09b2c9532090db84daa3aa1a243f90dc8709fc00 --- testing/test_doctest.py | 6 ------ testing/test_main.py | 17 +---------------- 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/testing/test_doctest.py b/testing/test_doctest.py index d73112179..c6f156b0e 100644 --- a/testing/test_doctest.py +++ b/testing/test_doctest.py @@ -1,7 +1,6 @@ # mypy: allow-untyped-defs import inspect from pathlib import Path -import sys import textwrap from typing import Callable from typing import Optional @@ -224,11 +223,6 @@ class TestDoctests: "Traceback (most recent call last):", ' File "*/doctest.py", line *, in __run', " *", - *( - (" *^^^^*",) - if (3, 11, 0, "beta", 4) > sys.version_info >= (3, 11) - else () - ), ' File "", line 1, in ', "ZeroDivisionError: division by zero", "*/test_doctest_unexpected_exception.txt:2: UnexpectedException", diff --git a/testing/test_main.py b/testing/test_main.py index 345aa1e62..6294f66b3 100644 --- a/testing/test_main.py +++ b/testing/test_main.py @@ -3,7 +3,6 @@ import argparse import os from pathlib import Path import re -import sys from typing import Optional from _pytest.config import ExitCode @@ -45,32 +44,18 @@ def test_wrap_session_notify_exception(ret_exc, pytester: Pytester) -> None: assert result.ret == ExitCode.INTERNAL_ERROR assert result.stdout.lines[0] == "INTERNALERROR> Traceback (most recent call last):" - end_lines = ( - result.stdout.lines[-4:] - if (3, 11, 0, "beta", 4) > sys.version_info >= (3, 11) - else result.stdout.lines[-3:] - ) + end_lines = result.stdout.lines[-3:] if exc == SystemExit: assert end_lines == [ f'INTERNALERROR> File "{c1}", line 4, in pytest_sessionstart', 'INTERNALERROR> raise SystemExit("boom")', - *( - ("INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^",) - if (3, 11, 0, "beta", 4) > sys.version_info >= (3, 11) - else () - ), "INTERNALERROR> SystemExit: boom", ] else: assert end_lines == [ f'INTERNALERROR> File "{c1}", line 4, in pytest_sessionstart', 'INTERNALERROR> raise ValueError("boom")', - *( - ("INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^",) - if (3, 11, 0, "beta", 4) > sys.version_info >= (3, 11) - else () - ), "INTERNALERROR> ValueError: boom", ] if returncode is False: From cb732bbfb0a2dd8d7acbc703ce485bd2f631cf92 Mon Sep 17 00:00:00 2001 From: pytest bot Date: Sun, 19 May 2024 00:21:06 +0000 Subject: [PATCH 12/53] [automated] Update plugin list --- doc/en/reference/plugin_list.rst | 148 +++++++++++++++++++------------ 1 file changed, 90 insertions(+), 58 deletions(-) diff --git a/doc/en/reference/plugin_list.rst b/doc/en/reference/plugin_list.rst index d03861ccf..43c4748ea 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 =2.7.3) :pypi:`pytest-allure-collection` pytest plugin to collect allure markers without running any tests Apr 13, 2023 N/A pytest :pypi:`pytest-allure-dsl` pytest plugin to test case doc string dls instructions Oct 25, 2020 4 - Beta pytest + :pypi:`pytest-allure-id2history` Overwrite allure history id with testcase full name and testcase id if testcase has id, exclude parameters. May 14, 2024 4 - Beta pytest>=6.2.0 :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-alphamoon` Static code checks used at Alphamoon Dec 30, 2021 5 - Production/Stable pytest (>=3.5.0) @@ -126,7 +127,7 @@ This list contains 1457 plugins. :pypi:`pytest-aviator` Aviator's Flakybot pytest plugin that automatically reruns flaky tests. Nov 04, 2022 4 - Beta pytest :pypi:`pytest-avoidance` Makes pytest skip tests that don not need rerunning May 23, 2019 4 - Beta pytest (>=3.5.0) :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 10, 2024 4 - Beta pytest + :pypi:`pytest-aws-apigateway` pytest plugin for AWS ApiGateway May 18, 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. Feb 02, 2024 N/A pytest (>=8.0.0,<9.0.0) :pypi:`pytest-axe` pytest plugin for axe-selenium-python Nov 12, 2018 N/A pytest (>=3.0.0) @@ -147,7 +148,7 @@ This list contains 1457 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. Jan 25, 2024 N/A pytest - :pypi:`pytest-bec-e2e` BEC pytest plugin for end-to-end tests May 08, 2024 3 - Alpha pytest + :pypi:`pytest-bec-e2e` BEC pytest plugin for end-to-end tests May 17, 2024 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 @@ -232,6 +233,7 @@ This list contains 1457 plugins. :pypi:`pytest-ckan` Backport of CKAN 2.9 pytest plugin and fixtures to CAKN 2.8 Apr 28, 2020 4 - Beta pytest :pypi:`pytest-clarity` A plugin providing an alternative, colourful diff output for failing assertions. Jun 11, 2021 N/A N/A :pypi:`pytest-cldf` Easy quality control for CLDF datasets using pytest Nov 07, 2022 N/A pytest (>=3.6) + :pypi:`pytest-cleanslate` Collects and executes pytest tests separately May 15, 2024 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 Mar 19, 2024 5 - Production/Stable N/A :pypi:`pytest-clerk` A set of pytest fixtures to help with integration testing with Clerk. Apr 19, 2024 N/A pytest<9.0.0,>=8.0.0 @@ -241,7 +243,7 @@ This list contains 1457 plugins. :pypi:`pytest-cloud` Distributed tests planner plugin for pytest testing framework. Oct 05, 2020 6 - Mature N/A :pypi:`pytest-cloudflare-worker` pytest plugin for testing cloudflare workers Mar 30, 2021 4 - Beta pytest (>=6.0.0) :pypi:`pytest-cloudist` Distribute tests to cloud machines without fuss Sep 02, 2022 4 - Beta pytest (>=7.1.2,<8.0.0) - :pypi:`pytest-cmake` Provide CMake module for Pytest May 06, 2024 N/A pytest<9,>=4 + :pypi:`pytest-cmake` Provide CMake module for Pytest May 12, 2024 N/A pytest<9,>=4 :pypi:`pytest-cmake-presets` Execute CMake Presets via pytest Dec 26, 2022 N/A pytest (>=7.2.0,<8.0.0) :pypi:`pytest-cobra` PyTest plugin for testing Smart Contracts for Ethereum blockchain. Jun 29, 2019 3 - Alpha pytest (<4.0.0,>=3.7.1) :pypi:`pytest_codeblocks` Test code blocks in your READMEs Sep 17, 2023 5 - Production/Stable pytest >= 7.0.0 @@ -357,7 +359,7 @@ This list contains 1457 plugins. :pypi:`pytest-dir-equal` pytest-dir-equals is a pytest plugin providing helpers to assert directories equality allowing golden testing Dec 11, 2023 4 - Beta pytest>=7.3.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-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. Oct 18, 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. May 11, 2024 4 - Beta pytest!=6.0.0,<9,>=3.3.2 :pypi:`pytest-discover` Pytest plugin to record discovered tests in a file Mar 26, 2024 N/A pytest :pypi:`pytest-ditto` Snapshot testing pytest plugin with minimal ceremony and flexible persistence formats. May 07, 2024 4 - Beta pytest>=3.5.0 :pypi:`pytest-django` A Django plugin for pytest. Jan 30, 2024 5 - Production/Stable pytest >=7.0.0 @@ -553,7 +555,7 @@ This list contains 1457 plugins. :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-flexreport` Apr 15, 2023 4 - Beta pytest - :pypi:`pytest-fluent` A pytest plugin in order to provide logs via fluentd Jun 26, 2023 4 - Beta pytest (>=7.0.0) + :pypi:`pytest-fluent` A pytest plugin in order to provide logs via fluentd May 15, 2024 4 - Beta pytest>=7.0.0 :pypi:`pytest-fluentbit` A pytest plugin in order to provide logs via fluentbit Jun 16, 2023 4 - Beta pytest (>=7.0.0) :pypi:`pytest-fly` pytest observer Apr 14, 2024 3 - Alpha pytest :pypi:`pytest-flyte` Pytest fixtures for simplifying Flyte integration testing May 03, 2021 N/A pytest @@ -621,13 +623,13 @@ This list contains 1457 plugins. :pypi:`pytest-helpers-namespace` Pytest Helpers Namespace Plugin Dec 29, 2021 5 - Production/Stable pytest (>=6.0.0) :pypi:`pytest-henry` Aug 29, 2023 N/A N/A :pypi:`pytest-hidecaptured` Hide captured output May 04, 2018 4 - Beta pytest (>=2.8.5) - :pypi:`pytest-himark` This plugin aims to create markers automatically based on a json configuration. May 10, 2024 4 - Beta pytest>=6.2.0 + :pypi:`pytest-himark` This plugin aims to create markers automatically based on a json configuration. May 15, 2024 4 - Beta pytest>=6.2.0 :pypi:`pytest-historic` Custom report to display pytest historical execution records 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-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 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-custom-component` Experimental package to automatically extract test plugins for Home Assistant custom components May 11, 2024 3 - Alpha pytest==8.1.1 + :pypi:`pytest-homeassistant-custom-component` Experimental package to automatically extract test plugins for Home Assistant custom components May 18, 2024 3 - Alpha pytest==8.1.1 :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` Apr 18, 2024 N/A N/A @@ -708,7 +710,7 @@ This list contains 1457 plugins. :pypi:`pytest-jest` A custom jest-pytest oriented Pytest reporter May 22, 2018 4 - Beta pytest (>=3.3.2) :pypi:`pytest-jinja` A plugin to generate customizable jinja-based HTML reports in pytest Oct 04, 2022 3 - Alpha pytest (>=6.2.5,<7.0.0) :pypi:`pytest-jira` py.test JIRA integration plugin, using markers Apr 30, 2024 3 - Alpha N/A - :pypi:`pytest-jira-xfail` Plugin skips (xfail) tests if unresolved Jira issue(s) linked Jun 19, 2023 N/A pytest (>=7.2.0) + :pypi:`pytest-jira-xfail` Plugin skips (xfail) tests if unresolved Jira issue(s) linked May 16, 2024 N/A pytest>=7.2.0 :pypi:`pytest-jira-xray` pytest plugin to integrate tests with JIRA XRAY Mar 27, 2024 4 - Beta pytest>=6.2.4 :pypi:`pytest-job-selection` A pytest plugin for load balancing test suites Jan 30, 2023 4 - Beta pytest (>=3.5.0) :pypi:`pytest-jobserver` Limit parallel tests with posix jobserver. May 15, 2019 5 - Production/Stable pytest @@ -732,7 +734,7 @@ This list contains 1457 plugins. :pypi:`pytest-kivy` Kivy GUI tests fixtures using pytest Jul 06, 2021 4 - Beta pytest (>=3.6) :pypi:`pytest-knows` A pytest plugin that can automaticly skip test case based on dependence info calculated by trace Aug 22, 2014 N/A N/A :pypi:`pytest-konira` Run Konira DSL tests with py.test Oct 09, 2011 N/A N/A - :pypi:`pytest-kookit` Your simple but kooky integration testing with pytest May 06, 2024 N/A N/A + :pypi:`pytest-kookit` Your simple but kooky integration testing with pytest May 16, 2024 N/A N/A :pypi:`pytest-koopmans` A plugin for testing the koopmans package Nov 21, 2022 4 - Beta pytest (>=3.5.0) :pypi:`pytest-krtech-common` pytest krtech common library Nov 28, 2016 4 - Beta N/A :pypi:`pytest-kubernetes` Sep 14, 2023 N/A pytest (>=7.2.1,<8.0.0) @@ -764,7 +766,7 @@ This list contains 1457 plugins. :pypi:`pytest-litter` Pytest plugin which verifies that tests do not modify file trees. Nov 23, 2023 4 - Beta pytest >=6.1 :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-localftpserver` A PyTest plugin which provides an FTP fixture for your tests Oct 14, 2023 5 - Production/Stable pytest + :pypi:`pytest-localftpserver` A PyTest plugin which provides an FTP fixture for your tests May 17, 2024 5 - Production/Stable pytest :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-lock` pytest-lock is a pytest plugin that allows you to "lock" the results of unit tests, storing them in a local cache. This is particularly useful for tests that are resource-intensive or don't need to be run every time. When the tests are run subsequently, pytest-lock will compare the current results with the locked results and issue a warning if there are any discrepancies. Feb 03, 2024 N/A pytest (>=7.4.3,<8.0.0) @@ -800,7 +802,7 @@ This list contains 1457 plugins. :pypi:`pytest-maybe-raises` Pytest fixture for optional exception testing. May 27, 2022 N/A pytest ; extra == 'dev' :pypi:`pytest-mccabe` pytest plugin to run the mccabe code complexity checker. Jul 22, 2020 3 - Alpha pytest (>=5.4.0) :pypi:`pytest-md` Plugin for generating Markdown reports for pytest results Jul 11, 2019 3 - Alpha pytest (>=4.2.1) - :pypi:`pytest-md-report` A pytest plugin to generate test outcomes reports with markdown table format. May 03, 2024 4 - Beta pytest!=6.0.0,<9,>=3.3.2 + :pypi:`pytest-md-report` A pytest plugin to generate test outcomes reports with markdown table format. May 18, 2024 4 - Beta pytest!=6.0.0,<9,>=3.3.2 :pypi:`pytest-meilisearch` Pytest helpers for testing projects using Meilisearch Feb 15, 2024 N/A pytest (>=7.4.3) :pypi:`pytest-memlog` Log memory usage during tests May 03, 2023 N/A pytest (>=7.3.0,<8.0.0) :pypi:`pytest-memprof` Estimates memory consumption of test functions Mar 29, 2019 4 - Beta N/A @@ -875,7 +877,7 @@ This list contains 1457 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 Feb 16, 2024 N/A pytest (>=6.2.5,<7.0.0) + :pypi:`pytest-nhsd-apim` Pytest plugin accessing NHSDigital's APIM proxies May 17, 2024 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 Apr 11, 2024 N/A N/A @@ -975,7 +977,7 @@ This list contains 1457 plugins. :pypi:`pytest-playwrights` A pytest wrapper with fixtures for Playwright to automate web browsers Dec 02, 2021 N/A N/A :pypi:`pytest-playwright-snapshot` A pytest wrapper for snapshot testing with playwright Aug 19, 2021 N/A N/A :pypi:`pytest-playwright-visual` A pytest fixture for visual testing with Playwright Apr 28, 2022 N/A N/A - :pypi:`pytest-plone` Pytest plugin to test Plone addons Jan 05, 2023 3 - Alpha pytest + :pypi:`pytest-plone` Pytest plugin to test Plone addons May 15, 2024 3 - Alpha pytest<8.0.0 :pypi:`pytest-plt` Fixtures for quickly making Matplotlib plots in tests Jan 17, 2024 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-plus` PyTest Plus Plugin :: extends pytest functionality Mar 26, 2024 5 - Production/Stable pytest>=7.4.2 @@ -1013,6 +1015,7 @@ This list contains 1457 plugins. :pypi:`pytest-prysk` Pytest plugin for prysk Mar 12, 2024 4 - Beta pytest (>=7.3.2) :pypi:`pytest-pspec` A rspec format reporter for Python ptest Jun 02, 2020 4 - Beta pytest (>=3.0.0) :pypi:`pytest-psqlgraph` pytest plugin for testing applications that use psqlgraph Oct 19, 2021 4 - Beta pytest (>=6.0) + :pypi:`pytest-pt` pytest plugin to use \*.pt files as tests May 15, 2024 4 - Beta pytest :pypi:`pytest-ptera` Use ptera probes in tests Mar 01, 2022 N/A pytest (>=6.2.4,<7.0.0) :pypi:`pytest-pudb` Pytest PuDB debugger integration Oct 25, 2018 3 - Alpha pytest (>=2.0) :pypi:`pytest-pumpkin-spice` A pytest plugin that makes your test reporting pumpkin-spiced Sep 18, 2022 4 - Beta N/A @@ -1039,6 +1042,7 @@ This list contains 1457 plugins. :pypi:`pytest-pytestrail` Pytest plugin for interaction with TestRail Aug 27, 2020 4 - Beta pytest (>=3.8.0) :pypi:`pytest-pythonhashseed` Pytest plugin to set PYTHONHASHSEED env var. Feb 25, 2024 4 - Beta pytest>=3.0.0 :pypi:`pytest-pythonpath` pytest plugin for adding to the PYTHONPATH from command line or configs. Feb 10, 2022 5 - Production/Stable pytest (<7,>=2.5.2) + :pypi:`pytest-python-test-engineer-sort` Sort plugin for Pytest May 13, 2024 N/A pytest>=6.2.0 :pypi:`pytest-pytorch` pytest plugin for a better developer experience when working with the PyTorch test suite May 25, 2021 4 - Beta pytest :pypi:`pytest-pyvenv` A package for create venv in tests Feb 27, 2024 N/A pytest ; extra == 'test' :pypi:`pytest-pyvista` Pytest-pyvista package Sep 29, 2023 4 - Beta pytest>=3.5.0 @@ -1066,7 +1070,7 @@ This list contains 1457 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 May 10, 2024 4 - Beta pytest>=7.4.3 + :pypi:`pytest-ranking` A Pytest plugin for automatically prioritizing/ranking tests to speed up failure detection May 12, 2024 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. Mar 14, 2024 3 - Alpha N/A :pypi:`pytest-recorder` Pytest plugin, meant to facilitate unit tests writing for tools consumming Web APIs. Nov 21, 2023 N/A N/A @@ -1116,7 +1120,7 @@ This list contains 1457 plugins. :pypi:`pytest-rerunfailures` pytest plugin to re-run tests to eliminate flaky failures Mar 13, 2024 5 - Production/Stable pytest >=7.2 :pypi:`pytest-rerunfailures-all-logs` pytest plugin to re-run tests to eliminate flaky failures Mar 07, 2022 5 - Production/Stable N/A :pypi:`pytest-reserial` Pytest fixture for recording and replaying serial port traffic. Feb 08, 2024 4 - Beta pytest - :pypi:`pytest-resilient-circuits` Resilient Circuits fixtures for PyTest Apr 03, 2024 N/A pytest~=4.6; python_version == "2.7" + :pypi:`pytest-resilient-circuits` Resilient Circuits fixtures for PyTest May 17, 2024 N/A pytest~=4.6; python_version == "2.7" :pypi:`pytest-resource` Load resource fixture plugin to use with pytest Nov 14, 2018 4 - Beta N/A :pypi:`pytest-resource-path` Provides path for uniform access to test resources in isolated directory May 01, 2021 5 - Production/Stable pytest (>=3.5.0) :pypi:`pytest-resource-usage` Pytest plugin for reporting running time and peak memory usage Nov 06, 2022 5 - Production/Stable pytest>=7.0.0 @@ -1128,7 +1132,7 @@ This list contains 1457 plugins. :pypi:`pytest-result-sender` Apr 20, 2023 N/A pytest>=7.3.1 :pypi:`pytest-resume` A Pytest plugin to resuming from the last run test Apr 22, 2023 4 - Beta pytest (>=7.0) :pypi:`pytest-rethinkdb` A RethinkDB plugin for pytest. Jul 24, 2016 4 - Beta N/A - :pypi:`pytest-retry` Adds the ability to retry flaky tests in CI environments Feb 04, 2024 N/A pytest >=7.0.0 + :pypi:`pytest-retry` Adds the ability to retry flaky tests in CI environments May 14, 2024 N/A pytest>=7.0.0 :pypi:`pytest-retry-class` A pytest plugin to rerun entire class on failure Mar 25, 2023 N/A pytest (>=5.3) :pypi:`pytest-reusable-testcases` Apr 28, 2023 N/A N/A :pypi:`pytest-reverse` Pytest plugin to reverse test order. Jul 10, 2023 5 - Production/Stable pytest @@ -1140,7 +1144,7 @@ This list contains 1457 plugins. :pypi:`pytest-rmsis` Sycronise pytest results to Jira RMsis Aug 10, 2022 N/A pytest (>=5.3.5) :pypi:`pytest-rng` Fixtures for seeding tests and making randomness reproducible Aug 08, 2019 5 - Production/Stable pytest :pypi:`pytest-roast` pytest plugin for ROAST configuration override and fixtures Nov 09, 2022 5 - Production/Stable pytest - :pypi:`pytest_robotframework` a pytest plugin that can run both python and robotframework tests while generating robot reports for them May 03, 2024 N/A pytest<9,>=7 + :pypi:`pytest_robotframework` a pytest plugin that can run both python and robotframework tests while generating robot reports for them May 18, 2024 N/A pytest<9,>=7 :pypi:`pytest-rocketchat` Pytest to Rocket.Chat reporting plugin Apr 18, 2021 5 - Production/Stable N/A :pypi:`pytest-rotest` Pytest integration with rotest Sep 08, 2019 N/A pytest (>=3.5.0) :pypi:`pytest-rpc` Extend py.test for RPC OpenStack testing. Feb 22, 2019 4 - Beta pytest (~=3.6) @@ -1165,7 +1169,7 @@ This list contains 1457 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. May 03, 2024 5 - Production/Stable N/A + :pypi:`pytest-sbase` A complete web automation framework for end-to-end testing. May 16, 2024 5 - Production/Stable N/A :pypi:`pytest-scenario` pytest plugin for test scenarios Feb 06, 2017 3 - Alpha N/A :pypi:`pytest-schedule` The job of test scheduling for humans. Jan 07, 2023 5 - Production/Stable N/A :pypi:`pytest-schema` 👍 Validate return values against a schema-like object in testing Feb 16, 2024 5 - Production/Stable pytest >=3.5.0 @@ -1174,7 +1178,7 @@ This list contains 1457 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. May 03, 2024 5 - Production/Stable N/A + :pypi:`pytest-seleniumbase` A complete web automation framework for end-to-end testing. May 16, 2024 5 - Production/Stable N/A :pypi:`pytest-selenium-enhancer` pytest plugin for Selenium Apr 29, 2022 5 - Production/Stable N/A :pypi:`pytest-selenium-pdiff` A pytest package implementing perceptualdiff for Selenium tests. Apr 06, 2017 2 - Pre-Alpha N/A :pypi:`pytest-selfie` A pytest plugin for selfie snapshot testing. Apr 05, 2024 N/A pytest<9.0.0,>=8.0.0 @@ -1184,6 +1188,7 @@ This list contains 1457 plugins. :pypi:`pytest-server-fixtures` Extensible server fixures for py.test Dec 19, 2023 5 - Production/Stable pytest :pypi:`pytest-serverless` Automatically mocks resources from serverless.yml in pytest using moto. May 09, 2022 4 - Beta N/A :pypi:`pytest-servers` pytest servers May 09, 2024 3 - Alpha pytest>=6.2 + :pypi:`pytest-service` May 11, 2024 5 - Production/Stable pytest>=6.0.0 :pypi:`pytest-services` Services plugin for pytest testing framework Oct 30, 2020 6 - Mature N/A :pypi:`pytest-session2file` pytest-session2file (aka: pytest-session_to_file for v0.1.0 - v0.1.2) is a py.test plugin for capturing and saving to file the stdout of py.test. Jan 26, 2021 3 - Alpha pytest :pypi:`pytest-session-fixture-globalize` py.test plugin to make session fixtures behave as if written in conftest, even if it is written in some modules May 15, 2018 4 - Beta N/A @@ -1250,7 +1255,7 @@ This list contains 1457 plugins. :pypi:`pytest-splitio` Split.io SDK integration for e2e tests Sep 22, 2020 N/A pytest (<7,>=5.0) :pypi:`pytest-split-tests` A Pytest plugin for running a subset of your tests by splitting them in to equally sized groups. Forked from Mark Adams' original project pytest-test-groups. Jul 30, 2021 5 - Production/Stable pytest (>=2.5) :pypi:`pytest-split-tests-tresorit` Feb 22, 2021 1 - Planning N/A - :pypi:`pytest-splunk-addon` A Dynamic test tool for Splunk Apps and Add-ons Apr 19, 2024 N/A pytest (>5.4.0,<8) + :pypi:`pytest-splunk-addon` A Dynamic test tool for Splunk Apps and Add-ons May 16, 2024 N/A pytest<8,>5.4.0 :pypi:`pytest-splunk-addon-ui-smartx` Library to support testing Splunk Add-on UX May 10, 2024 N/A N/A :pypi:`pytest-splunk-env` pytest fixtures for interaction with Splunk Enterprise and Splunk Cloud Oct 22, 2020 N/A pytest (>=6.1.1,<7.0.0) :pypi:`pytest-sqitch` sqitch for pytest Apr 06, 2020 4 - Beta N/A @@ -1423,7 +1428,6 @@ This list contains 1457 plugins. :pypi:`pytest-vcrpandas` Test from HTTP interactions to dataframe processed. Jan 12, 2019 4 - Beta pytest :pypi:`pytest-vcs` Sep 22, 2022 4 - Beta N/A :pypi:`pytest-venv` py.test fixture for creating a virtual environment Nov 23, 2023 4 - Beta pytest - :pypi:`pytest-ver` Pytest module with Verification Protocol, Verification Report and Trace Matrix Feb 07, 2024 4 - Beta pytest :pypi:`pytest-verbose-parametrize` More descriptive output for parametrized py.test tests May 28, 2019 5 - Production/Stable pytest :pypi:`pytest-vimqf` A simple pytest plugin that will shrink pytest output when specified, to fit vim quickfix window. Feb 08, 2021 4 - Beta pytest (>=6.2.2,<7.0.0) :pypi:`pytest-virtualenv` Virtualenv fixture for py.test May 28, 2019 5 - Production/Stable pytest @@ -1463,7 +1467,7 @@ This list contains 1457 plugins. :pypi:`pytest-xfiles` Pytest fixtures providing data read from function, module or package related (x)files. Feb 27, 2018 N/A N/A :pypi:`pytest-xiuyu` This is a pytest plugin Jul 25, 2023 5 - Production/Stable N/A :pypi:`pytest-xlog` Extended logging for test and decorators May 31, 2020 4 - Beta N/A - :pypi:`pytest-xlsx` pytest plugin for generating test cases by xlsx(excel) Apr 23, 2024 N/A N/A + :pypi:`pytest-xlsx` pytest plugin for generating test cases by xlsx(excel) Apr 23, 2024 N/A pytest~=7.0 :pypi:`pytest-xpara` An extended parametrizing plugin of pytest. Oct 30, 2017 3 - Alpha pytest :pypi:`pytest-xprocess` A pytest plugin for managing processes across test runs. Mar 31, 2024 4 - Beta pytest>=2.8 :pypi:`pytest-xray` May 30, 2019 3 - Alpha N/A @@ -1720,6 +1724,13 @@ This list contains 1457 plugins. pytest plugin to test case doc string dls instructions + :pypi:`pytest-allure-id2history` + *last release*: May 14, 2024, + *status*: 4 - Beta, + *requires*: pytest>=6.2.0 + + Overwrite allure history id with testcase full name and testcase id if testcase has id, exclude parameters. + :pypi:`pytest-allure-intersection` *last release*: Oct 27, 2022, *status*: N/A, @@ -2141,7 +2152,7 @@ This list contains 1457 plugins. pytest plugin for testing AWS resource configurations :pypi:`pytest-aws-apigateway` - *last release*: May 10, 2024, + *last release*: May 18, 2024, *status*: 4 - Beta, *requires*: pytest @@ -2288,7 +2299,7 @@ This list contains 1457 plugins. Pytest plugin to run your tests with beartype checking enabled. :pypi:`pytest-bec-e2e` - *last release*: May 08, 2024, + *last release*: May 17, 2024, *status*: 3 - Alpha, *requires*: pytest @@ -2882,6 +2893,13 @@ This list contains 1457 plugins. Easy quality control for CLDF datasets using pytest + :pypi:`pytest-cleanslate` + *last release*: May 15, 2024, + *status*: N/A, + *requires*: pytest + + Collects and executes pytest tests separately + :pypi:`pytest_cleanup` *last release*: Jan 28, 2020, *status*: N/A, @@ -2946,7 +2964,7 @@ This list contains 1457 plugins. Distribute tests to cloud machines without fuss :pypi:`pytest-cmake` - *last release*: May 06, 2024, + *last release*: May 12, 2024, *status*: N/A, *requires*: pytest<9,>=4 @@ -3758,9 +3776,9 @@ This list contains 1457 plugins. Disable plugins per test :pypi:`pytest-discord` - *last release*: Oct 18, 2023, + *last release*: May 11, 2024, *status*: 4 - Beta, - *requires*: pytest !=6.0.0,<8,>=3.3.2 + *requires*: pytest!=6.0.0,<9,>=3.3.2 A pytest plugin to notify test results to a Discord channel. @@ -5130,9 +5148,9 @@ This list contains 1457 plugins. :pypi:`pytest-fluent` - *last release*: Jun 26, 2023, + *last release*: May 15, 2024, *status*: 4 - Beta, - *requires*: pytest (>=7.0.0) + *requires*: pytest>=7.0.0 A pytest plugin in order to provide logs via fluentd @@ -5606,7 +5624,7 @@ This list contains 1457 plugins. Hide captured output :pypi:`pytest-himark` - *last release*: May 10, 2024, + *last release*: May 15, 2024, *status*: 4 - Beta, *requires*: pytest>=6.2.0 @@ -5648,7 +5666,7 @@ This list contains 1457 plugins. A pytest plugin for use with homeassistant custom components. :pypi:`pytest-homeassistant-custom-component` - *last release*: May 11, 2024, + *last release*: May 18, 2024, *status*: 3 - Alpha, *requires*: pytest==8.1.1 @@ -6215,9 +6233,9 @@ This list contains 1457 plugins. py.test JIRA integration plugin, using markers :pypi:`pytest-jira-xfail` - *last release*: Jun 19, 2023, + *last release*: May 16, 2024, *status*: N/A, - *requires*: pytest (>=7.2.0) + *requires*: pytest>=7.2.0 Plugin skips (xfail) tests if unresolved Jira issue(s) linked @@ -6383,7 +6401,7 @@ This list contains 1457 plugins. Run Konira DSL tests with py.test :pypi:`pytest-kookit` - *last release*: May 06, 2024, + *last release*: May 16, 2024, *status*: N/A, *requires*: N/A @@ -6607,7 +6625,7 @@ This list contains 1457 plugins. Generate local badges (shields) reporting your test suite status. :pypi:`pytest-localftpserver` - *last release*: Oct 14, 2023, + *last release*: May 17, 2024, *status*: 5 - Production/Stable, *requires*: pytest @@ -6859,7 +6877,7 @@ This list contains 1457 plugins. Plugin for generating Markdown reports for pytest results :pypi:`pytest-md-report` - *last release*: May 03, 2024, + *last release*: May 18, 2024, *status*: 4 - Beta, *requires*: pytest!=6.0.0,<9,>=3.3.2 @@ -7384,9 +7402,9 @@ This list contains 1457 plugins. pytest ngs fixtures :pypi:`pytest-nhsd-apim` - *last release*: Feb 16, 2024, + *last release*: May 17, 2024, *status*: N/A, - *requires*: pytest (>=6.2.5,<7.0.0) + *requires*: pytest<9.0.0,>=8.2.0 Pytest plugin accessing NHSDigital's APIM proxies @@ -8084,9 +8102,9 @@ This list contains 1457 plugins. A pytest fixture for visual testing with Playwright :pypi:`pytest-plone` - *last release*: Jan 05, 2023, + *last release*: May 15, 2024, *status*: 3 - Alpha, - *requires*: pytest + *requires*: pytest<8.0.0 Pytest plugin to test Plone addons @@ -8349,6 +8367,13 @@ This list contains 1457 plugins. pytest plugin for testing applications that use psqlgraph + :pypi:`pytest-pt` + *last release*: May 15, 2024, + *status*: 4 - Beta, + *requires*: pytest + + pytest plugin to use \*.pt files as tests + :pypi:`pytest-ptera` *last release*: Mar 01, 2022, *status*: N/A, @@ -8531,6 +8556,13 @@ This list contains 1457 plugins. pytest plugin for adding to the PYTHONPATH from command line or configs. + :pypi:`pytest-python-test-engineer-sort` + *last release*: May 13, 2024, + *status*: N/A, + *requires*: pytest>=6.2.0 + + Sort plugin for Pytest + :pypi:`pytest-pytorch` *last release*: May 25, 2021, *status*: 4 - Beta, @@ -8721,7 +8753,7 @@ This list contains 1457 plugins. Randomise the order in which pytest tests are run with some control over the randomness :pypi:`pytest-ranking` - *last release*: May 10, 2024, + *last release*: May 12, 2024, *status*: 4 - Beta, *requires*: pytest>=7.4.3 @@ -9071,7 +9103,7 @@ This list contains 1457 plugins. Pytest fixture for recording and replaying serial port traffic. :pypi:`pytest-resilient-circuits` - *last release*: Apr 03, 2024, + *last release*: May 17, 2024, *status*: N/A, *requires*: pytest~=4.6; python_version == "2.7" @@ -9155,9 +9187,9 @@ This list contains 1457 plugins. A RethinkDB plugin for pytest. :pypi:`pytest-retry` - *last release*: Feb 04, 2024, + *last release*: May 14, 2024, *status*: N/A, - *requires*: pytest >=7.0.0 + *requires*: pytest>=7.0.0 Adds the ability to retry flaky tests in CI environments @@ -9239,7 +9271,7 @@ This list contains 1457 plugins. pytest plugin for ROAST configuration override and fixtures :pypi:`pytest_robotframework` - *last release*: May 03, 2024, + *last release*: May 18, 2024, *status*: N/A, *requires*: pytest<9,>=7 @@ -9414,7 +9446,7 @@ This list contains 1457 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*: May 03, 2024, + *last release*: May 16, 2024, *status*: 5 - Production/Stable, *requires*: N/A @@ -9477,7 +9509,7 @@ This list contains 1457 plugins. pytest plugin to automatically capture screenshots upon selenium webdriver events :pypi:`pytest-seleniumbase` - *last release*: May 03, 2024, + *last release*: May 16, 2024, *status*: 5 - Production/Stable, *requires*: N/A @@ -9546,6 +9578,13 @@ This list contains 1457 plugins. pytest servers + :pypi:`pytest-service` + *last release*: May 11, 2024, + *status*: 5 - Production/Stable, + *requires*: pytest>=6.0.0 + + + :pypi:`pytest-services` *last release*: Oct 30, 2020, *status*: 6 - Mature, @@ -10009,9 +10048,9 @@ This list contains 1457 plugins. :pypi:`pytest-splunk-addon` - *last release*: Apr 19, 2024, + *last release*: May 16, 2024, *status*: N/A, - *requires*: pytest (>5.4.0,<8) + *requires*: pytest<8,>5.4.0 A Dynamic test tool for Splunk Apps and Add-ons @@ -11219,13 +11258,6 @@ This list contains 1457 plugins. py.test fixture for creating a virtual environment - :pypi:`pytest-ver` - *last release*: Feb 07, 2024, - *status*: 4 - Beta, - *requires*: pytest - - Pytest module with Verification Protocol, Verification Report and Trace Matrix - :pypi:`pytest-verbose-parametrize` *last release*: May 28, 2019, *status*: 5 - Production/Stable, @@ -11502,7 +11534,7 @@ This list contains 1457 plugins. :pypi:`pytest-xlsx` *last release*: Apr 23, 2024, *status*: N/A, - *requires*: N/A + *requires*: pytest~=7.0 pytest plugin for generating test cases by xlsx(excel) From 1cb704ff2c6f6d4e8abd45734d05e9a3f326348b Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Fri, 17 May 2024 09:59:29 +0300 Subject: [PATCH 13/53] Add Python 3.13 (beta1) support --- .github/workflows/test.yml | 22 +++++++++++++++++++--- changelog/12334.improvement.rst | 1 + pyproject.toml | 1 + src/_pytest/_code/code.py | 7 +++---- src/_pytest/pytester.py | 6 +++++- testing/code/test_excinfo.py | 8 ++++++-- testing/code/test_source.py | 6 +++++- testing/test_cacheprovider.py | 2 +- testing/test_doctest.py | 4 +++- tox.ini | 1 + 10 files changed, 45 insertions(+), 13 deletions(-) create mode 100644 changelog/12334.improvement.rst diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index df801864f..09d37aaa2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -55,6 +55,7 @@ jobs: "windows-py310", "windows-py311", "windows-py312", + "windows-py313", "ubuntu-py38", "ubuntu-py38-pluggy", @@ -63,12 +64,14 @@ jobs: "ubuntu-py310", "ubuntu-py311", "ubuntu-py312", + "ubuntu-py313", "ubuntu-pypy3", "macos-py38", "macos-py39", "macos-py310", "macos-py312", + "macos-py313", "doctesting", "plugins", @@ -97,9 +100,13 @@ jobs: os: windows-latest tox_env: "py311" - name: "windows-py312" - python: "3.12-dev" + python: "3.12" os: windows-latest tox_env: "py312" + - name: "windows-py313" + python: "3.13-dev" + os: windows-latest + tox_env: "py313" - name: "ubuntu-py38" python: "3.8" @@ -128,10 +135,15 @@ jobs: tox_env: "py311" use_coverage: true - name: "ubuntu-py312" - python: "3.12-dev" + python: "3.12" os: ubuntu-latest tox_env: "py312" use_coverage: true + - name: "ubuntu-py313" + python: "3.13-dev" + os: ubuntu-latest + tox_env: "py313" + use_coverage: true - name: "ubuntu-pypy3" python: "pypy-3.8" os: ubuntu-latest @@ -151,9 +163,13 @@ jobs: os: macos-latest tox_env: "py310-xdist" - name: "macos-py312" - python: "3.12-dev" + python: "3.12" os: macos-latest tox_env: "py312-xdist" + - name: "macos-py313" + python: "3.13-dev" + os: macos-latest + tox_env: "py313-xdist" - name: "plugins" python: "3.12" diff --git a/changelog/12334.improvement.rst b/changelog/12334.improvement.rst new file mode 100644 index 000000000..7fd52e9db --- /dev/null +++ b/changelog/12334.improvement.rst @@ -0,0 +1 @@ +Support for Python 3.13 (beta1 at the time of writing). diff --git a/pyproject.toml b/pyproject.toml index 2be02ee7e..b85f39d85 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,6 +31,7 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Topic :: Software Development :: Libraries", "Topic :: Software Development :: Testing", "Topic :: Utilities", diff --git a/src/_pytest/_code/code.py b/src/_pytest/_code/code.py index b80d53ca5..cfa226bb7 100644 --- a/src/_pytest/_code/code.py +++ b/src/_pytest/_code/code.py @@ -424,15 +424,14 @@ class Traceback(List[TracebackEntry]): # which generates code objects that have hash/value equality # XXX needs a test key = entry.frame.code.path, id(entry.frame.code.raw), entry.lineno - # print "checking for recursion at", key values = cache.setdefault(key, []) + # Since Python 3.13 f_locals is a proxy, freeze it. + loc = dict(entry.frame.f_locals) if values: - f = entry.frame - loc = f.f_locals for otherloc in values: if otherloc == loc: return i - values.append(entry.frame.f_locals) + values.append(loc) return None diff --git a/src/_pytest/pytester.py b/src/_pytest/pytester.py index 31c6de781..f9ab007a4 100644 --- a/src/_pytest/pytester.py +++ b/src/_pytest/pytester.py @@ -289,7 +289,8 @@ class HookRecorder: __tracebackhide__ = True i = 0 entries = list(entries) - backlocals = sys._getframe(1).f_locals + # Since Python 3.13, f_locals is not a dict, but eval requires a dict. + backlocals = dict(sys._getframe(1).f_locals) while entries: name, check = entries.pop(0) for ind, call in enumerate(self.calls[i:]): @@ -760,6 +761,9 @@ class Pytester: ) -> Path: items = list(files.items()) + if ext is None: + raise TypeError("ext must not be None") + if ext and not ext.startswith("."): raise ValueError( f"pytester.makefile expects a file extension, try .{ext} instead of {ext}" diff --git a/testing/code/test_excinfo.py b/testing/code/test_excinfo.py index 86e30dc48..b54745129 100644 --- a/testing/code/test_excinfo.py +++ b/testing/code/test_excinfo.py @@ -1,6 +1,7 @@ # mypy: allow-untyped-defs from __future__ import annotations +import fnmatch import importlib import io import operator @@ -237,7 +238,7 @@ class TestTraceback_f_g_h: n += 1 f(n) - excinfo = pytest.raises(RuntimeError, f, 8) + excinfo = pytest.raises(RecursionError, f, 8) traceback = excinfo.traceback recindex = traceback.recursionindex() assert recindex == 3 @@ -373,7 +374,10 @@ def test_excinfo_no_sourcecode(): except ValueError: excinfo = _pytest._code.ExceptionInfo.from_current() s = str(excinfo.traceback[-1]) - assert s == " File '':1 in \n ???\n" + # TODO: Since Python 3.13b1 under pytest-xdist, the * is `import + # sys;exec(eval(sys.stdin.readline()))` (execnet bootstrap code) + # instead of `???` like before. Is this OK? + fnmatch.fnmatch(s, " File '':1 in \n *\n") def test_excinfo_no_python_sourcecode(tmp_path: Path) -> None: diff --git a/testing/code/test_source.py b/testing/code/test_source.py index 2fa852057..a00259976 100644 --- a/testing/code/test_source.py +++ b/testing/code/test_source.py @@ -370,7 +370,11 @@ def test_getfslineno() -> None: pass B.__name__ = B.__qualname__ = "B2" - assert getfslineno(B)[1] == -1 + # Since Python 3.13 this started working. + if sys.version_info >= (3, 13): + assert getfslineno(B)[1] != -1 + else: + assert getfslineno(B)[1] == -1 def test_code_of_object_instance_with_call() -> None: diff --git a/testing/test_cacheprovider.py b/testing/test_cacheprovider.py index d7815f77b..8728ae84f 100644 --- a/testing/test_cacheprovider.py +++ b/testing/test_cacheprovider.py @@ -194,7 +194,7 @@ class TestNewAPI: assert pytester.path.joinpath("custom_cache_dir").is_dir() -@pytest.mark.parametrize("env", ((), ("TOX_ENV_DIR", "/tox_env_dir"))) +@pytest.mark.parametrize("env", ((), ("TOX_ENV_DIR", "mydir/tox-env"))) def test_cache_reportheader( env: Sequence[str], pytester: Pytester, monkeypatch: MonkeyPatch ) -> None: diff --git a/testing/test_doctest.py b/testing/test_doctest.py index c6f156b0e..9b33d641a 100644 --- a/testing/test_doctest.py +++ b/testing/test_doctest.py @@ -1,6 +1,7 @@ # mypy: allow-untyped-defs import inspect from pathlib import Path +import sys import textwrap from typing import Callable from typing import Optional @@ -223,6 +224,7 @@ class TestDoctests: "Traceback (most recent call last):", ' File "*/doctest.py", line *, in __run', " *", + *((" *^^^^*", " *", " *") if sys.version_info >= (3, 13) else ()), ' File "", line 1, in ', "ZeroDivisionError: division by zero", "*/test_doctest_unexpected_exception.txt:2: UnexpectedException", @@ -379,7 +381,7 @@ class TestDoctests: "*= FAILURES =*", "*_ [[]doctest[]] test_doctest_linedata_on_property.Sample.some_property _*", "004 ", - "005 >>> Sample().some_property", + "005 *>>> Sample().some_property", "Expected:", " 'another thing'", "Got:", diff --git a/tox.ini b/tox.ini index 4e1ff1119..0a3f0acf5 100644 --- a/tox.ini +++ b/tox.ini @@ -9,6 +9,7 @@ envlist = py310 py311 py312 + py313 pypy3 py38-{pexpect,xdist,unittestextras,numpy,pluggymain,pylib} doctesting From 32baa0b93d770a7acb9f7b59eb2d3382e6b9b78e Mon Sep 17 00:00:00 2001 From: pytest bot Date: Sun, 19 May 2024 16:43:40 +0000 Subject: [PATCH 14/53] Prepare release version 8.2.1 (cherry picked from commit 66ff8dffdf9eee9b3dd6686de34542c49ff80dcd) --- changelog/12120.bugfix.rst | 1 - changelog/12191.bugfix.rst | 1 - changelog/12300.bugfix.rst | 1 - changelog/12308.bugfix.rst | 1 - changelog/12333.trivial.rst | 1 - changelog/12334.improvement.rst | 1 - doc/en/announce/index.rst | 1 + doc/en/announce/release-8.2.1.rst | 19 +++++++++++++++++ doc/en/builtin.rst | 2 +- doc/en/changelog.rst | 32 +++++++++++++++++++++++++++++ doc/en/example/parametrize.rst | 6 +++--- doc/en/example/pythoncollection.rst | 4 ++-- doc/en/getting-started.rst | 2 +- doc/en/how-to/fixtures.rst | 2 +- 14 files changed, 60 insertions(+), 14 deletions(-) delete mode 100644 changelog/12120.bugfix.rst delete mode 100644 changelog/12191.bugfix.rst delete mode 100644 changelog/12300.bugfix.rst delete mode 100644 changelog/12308.bugfix.rst delete mode 100644 changelog/12333.trivial.rst delete mode 100644 changelog/12334.improvement.rst create mode 100644 doc/en/announce/release-8.2.1.rst diff --git a/changelog/12120.bugfix.rst b/changelog/12120.bugfix.rst deleted file mode 100644 index b1ca4913b..000000000 --- a/changelog/12120.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fix `PermissionError` crashes arising from directories which are not selected on the command-line. diff --git a/changelog/12191.bugfix.rst b/changelog/12191.bugfix.rst deleted file mode 100644 index 5102d4698..000000000 --- a/changelog/12191.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Keyboard interrupts and system exits are now properly handled during the test collection. diff --git a/changelog/12300.bugfix.rst b/changelog/12300.bugfix.rst deleted file mode 100644 index 6c1624820..000000000 --- a/changelog/12300.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed handling of 'Function not implemented' error under squashfuse_ll, which is a different way to say that the mountpoint is read-only. diff --git a/changelog/12308.bugfix.rst b/changelog/12308.bugfix.rst deleted file mode 100644 index 07995427a..000000000 --- a/changelog/12308.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fix a regression in pytest 8.2.0 where the permissions of automatically-created ``.pytest_cache`` directories became ``rwx------`` instead of the expected ``rwxr-xr-x``. diff --git a/changelog/12333.trivial.rst b/changelog/12333.trivial.rst deleted file mode 100644 index 32c4c5771..000000000 --- a/changelog/12333.trivial.rst +++ /dev/null @@ -1 +0,0 @@ -pytest releases are now attested using the recent `Artifact Attestation ` support from GitHub, allowing users to verify the provenance of pytest's sdist and wheel artifacts. diff --git a/changelog/12334.improvement.rst b/changelog/12334.improvement.rst deleted file mode 100644 index 7fd52e9db..000000000 --- a/changelog/12334.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -Support for Python 3.13 (beta1 at the time of writing). diff --git a/doc/en/announce/index.rst b/doc/en/announce/index.rst index 4d0a3ab55..8a33f7fb5 100644 --- a/doc/en/announce/index.rst +++ b/doc/en/announce/index.rst @@ -6,6 +6,7 @@ Release announcements :maxdepth: 2 + release-8.2.1 release-8.2.0 release-8.1.2 release-8.1.1 diff --git a/doc/en/announce/release-8.2.1.rst b/doc/en/announce/release-8.2.1.rst new file mode 100644 index 000000000..4452edec1 --- /dev/null +++ b/doc/en/announce/release-8.2.1.rst @@ -0,0 +1,19 @@ +pytest-8.2.1 +======================================= + +pytest 8.2.1 has just been released to PyPI. + +This is a bug-fix release, being a drop-in replacement. To upgrade:: + + pip install --upgrade pytest + +The full changelog is available at https://docs.pytest.org/en/stable/changelog.html. + +Thanks to all of the contributors to this release: + +* Bruno Oliveira +* Ran Benita + + +Happy testing, +The pytest Development Team diff --git a/doc/en/builtin.rst b/doc/en/builtin.rst index d5f2e9a1b..458253fab 100644 --- a/doc/en/builtin.rst +++ b/doc/en/builtin.rst @@ -22,7 +22,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a cachedir: .pytest_cache rootdir: /home/sweet/project collected 0 items - cache -- .../_pytest/cacheprovider.py:542 + cache -- .../_pytest/cacheprovider.py:549 Return a cache object that can persist state between testing sessions. cache.get(key, default) diff --git a/doc/en/changelog.rst b/doc/en/changelog.rst index d5cde4988..f69b9782b 100644 --- a/doc/en/changelog.rst +++ b/doc/en/changelog.rst @@ -28,6 +28,38 @@ with advance notice in the **Deprecations** section of releases. .. towncrier release notes start +pytest 8.2.1 (2024-05-19) +========================= + +Improvements +------------ + +- `#12334 `_: Support for Python 3.13 (beta1 at the time of writing). + + + +Bug Fixes +--------- + +- `#12120 `_: Fix `PermissionError` crashes arising from directories which are not selected on the command-line. + + +- `#12191 `_: Keyboard interrupts and system exits are now properly handled during the test collection. + + +- `#12300 `_: Fixed handling of 'Function not implemented' error under squashfuse_ll, which is a different way to say that the mountpoint is read-only. + + +- `#12308 `_: Fix a regression in pytest 8.2.0 where the permissions of automatically-created ``.pytest_cache`` directories became ``rwx------`` instead of the expected ``rwxr-xr-x``. + + + +Trivial/Internal Changes +------------------------ + +- `#12333 `_: pytest releases are now attested using the recent `Artifact Attestation ` support from GitHub, allowing users to verify the provenance of pytest's sdist and wheel artifacts. + + pytest 8.2.0 (2024-04-27) ========================= diff --git a/doc/en/example/parametrize.rst b/doc/en/example/parametrize.rst index 1bbe2faaa..03f6852e5 100644 --- a/doc/en/example/parametrize.rst +++ b/doc/en/example/parametrize.rst @@ -162,7 +162,7 @@ objects, they are still using the default pytest representation: rootdir: /home/sweet/project collected 8 items - + @@ -239,7 +239,7 @@ If you just collect tests you'll also nicely see 'advanced' and 'basic' as varia rootdir: /home/sweet/project collected 4 items - + @@ -318,7 +318,7 @@ Let's first see how it looks like at collection time: rootdir: /home/sweet/project collected 2 items - + diff --git a/doc/en/example/pythoncollection.rst b/doc/en/example/pythoncollection.rst index a383173d0..aa9d05d72 100644 --- a/doc/en/example/pythoncollection.rst +++ b/doc/en/example/pythoncollection.rst @@ -152,7 +152,7 @@ The test collection would look like this: configfile: pytest.ini collected 2 items - + @@ -215,7 +215,7 @@ You can always peek at the collection tree without running tests like this: configfile: pytest.ini collected 3 items - + diff --git a/doc/en/getting-started.rst b/doc/en/getting-started.rst index 468de3654..94e0d80e6 100644 --- a/doc/en/getting-started.rst +++ b/doc/en/getting-started.rst @@ -22,7 +22,7 @@ Install ``pytest`` .. code-block:: bash $ pytest --version - pytest 8.2.0 + pytest 8.2.1 .. _`simpletest`: diff --git a/doc/en/how-to/fixtures.rst b/doc/en/how-to/fixtures.rst index 72b69a146..6cc20c8c3 100644 --- a/doc/en/how-to/fixtures.rst +++ b/doc/en/how-to/fixtures.rst @@ -1418,7 +1418,7 @@ Running the above tests results in the following test IDs being used: rootdir: /home/sweet/project collected 12 items - + From d4f827d86b1c15a4628c1a41bdea57e577d71784 Mon Sep 17 00:00:00 2001 From: Hynek Schlawack Date: Sun, 19 May 2024 17:14:45 -0400 Subject: [PATCH 15/53] Fix link in changelog (#12343) --- doc/en/changelog.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/en/changelog.rst b/doc/en/changelog.rst index f69b9782b..ca7f5b999 100644 --- a/doc/en/changelog.rst +++ b/doc/en/changelog.rst @@ -57,7 +57,7 @@ Bug Fixes Trivial/Internal Changes ------------------------ -- `#12333 `_: pytest releases are now attested using the recent `Artifact Attestation ` support from GitHub, allowing users to verify the provenance of pytest's sdist and wheel artifacts. +- `#12333 `_: pytest releases are now attested using the recent `Artifact Attestation `_ support from GitHub, allowing users to verify the provenance of pytest's sdist and wheel artifacts. pytest 8.2.0 (2024-04-27) From 00be7c07390fa5b85882bb19bbb246732a5d84cb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 May 2024 07:11:04 +0200 Subject: [PATCH 16/53] build(deps): Bump pytest-asyncio in /testing/plugins_integration (#12345) Bumps [pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio) from 0.23.6 to 0.23.7. - [Release notes](https://github.com/pytest-dev/pytest-asyncio/releases) - [Commits](https://github.com/pytest-dev/pytest-asyncio/compare/v0.23.6...v0.23.7) --- updated-dependencies: - dependency-name: pytest-asyncio dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- testing/plugins_integration/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/plugins_integration/requirements.txt b/testing/plugins_integration/requirements.txt index d4d0fc633..458cc2f97 100644 --- a/testing/plugins_integration/requirements.txt +++ b/testing/plugins_integration/requirements.txt @@ -1,6 +1,6 @@ anyio[curio,trio]==4.3.0 django==5.0.6 -pytest-asyncio==0.23.6 +pytest-asyncio==0.23.7 pytest-bdd==7.1.2 pytest-cov==5.0.0 pytest-django==4.8.0 From 5d5c9dc85850f64621190e62bd20d4b190bdbdb6 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 21 May 2024 07:04:09 +0000 Subject: [PATCH 17/53] [pre-commit.ci] pre-commit autoupdate (#12321) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.4.3 → v0.4.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.3...v0.4.4) - [github.com/tox-dev/pyproject-fmt: 1.8.0 → 2.1.3](https://github.com/tox-dev/pyproject-fmt/compare/1.8.0...2.1.3) Also fix the comment following autofix Co-authored-by: Pierre Sassoulas --- .pre-commit-config.yaml | 4 +- pyproject.toml | 276 +++++++++++++++++++++------------------- 2 files changed, 149 insertions(+), 131 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b83ae9696..f20f61761 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.4.3" + rev: "v0.4.4" hooks: - id: ruff args: ["--fix"] @@ -38,7 +38,7 @@ repos: # on <3.11 - exceptiongroup>=1.0.0rc8 - repo: https://github.com/tox-dev/pyproject-fmt - rev: "1.8.0" + rev: "2.1.3" hooks: - id: pyproject-fmt # https://pyproject-fmt.readthedocs.io/en/latest/#calculating-max-supported-python-version diff --git a/pyproject.toml b/pyproject.toml index b85f39d85..e3c64b3e9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,10 @@ +[build-system] +build-backend = "setuptools.build_meta" +requires = [ + "setuptools>=61", + "setuptools-scm[toml]>=6.2.3", +] + [project] name = "pytest" description = "pytest: simple powerful testing with Python" @@ -6,15 +13,15 @@ keywords = [ "test", "unittest", ] -license = {text = "MIT"} +license = { text = "MIT" } authors = [ - {name = "Holger Krekel"}, - {name = "Bruno Oliveira"}, - {name = "Ronny Pfannschmidt"}, - {name = "Floris Bruynooghe"}, - {name = "Brianna Laugher"}, - {name = "Florian Bruhin"}, - {name = "Others (See AUTHORS)"}, + { name = "Holger Krekel" }, + { name = "Bruno Oliveira" }, + { name = "Ronny Pfannschmidt" }, + { name = "Floris Bruynooghe" }, + { name = "Brianna Laugher" }, + { name = "Florian Bruhin" }, + { name = "Others (See AUTHORS)" }, ] requires-python = ">=3.8" classifiers = [ @@ -31,7 +38,6 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: 3.13", "Topic :: Software Development :: Libraries", "Topic :: Software Development :: Testing", "Topic :: Utilities", @@ -40,15 +46,14 @@ dynamic = [ "version", ] dependencies = [ - 'colorama; sys_platform == "win32"', - 'exceptiongroup>=1.0.0rc8; python_version < "3.11"', + "colorama; sys_platform=='win32'", + "exceptiongroup>=1.0.0rc8; python_version<'3.11'", "iniconfig", "packaging", - "pluggy<2.0,>=1.5", - 'tomli>=1; python_version < "3.11"', + "pluggy<2,>=1.5", + "tomli>=1; python_version<'3.11'", ] -[project.optional-dependencies] -dev = [ +optional-dependencies.dev = [ "argcomplete", "attrs>=19.2", "hypothesis>=3.56", @@ -58,59 +63,54 @@ dev = [ "setuptools", "xmlschema", ] -[project.urls] -Changelog = "https://docs.pytest.org/en/stable/changelog.html" -Homepage = "https://docs.pytest.org/en/latest/" -Source = "https://github.com/pytest-dev/pytest" -Tracker = "https://github.com/pytest-dev/pytest/issues" -Twitter = "https://twitter.com/pytestdotorg" -[project.scripts] -"py.test" = "pytest:console_main" -pytest = "pytest:console_main" - -[build-system] -build-backend = "setuptools.build_meta" -requires = [ - "setuptools>=61", - "setuptools-scm[toml]>=6.2.3", -] +urls.Changelog = "https://docs.pytest.org/en/stable/changelog.html" +urls.Homepage = "https://docs.pytest.org/en/latest/" +urls.Source = "https://github.com/pytest-dev/pytest" +urls.Tracker = "https://github.com/pytest-dev/pytest/issues" +urls.Twitter = "https://twitter.com/pytestdotorg" +scripts."py.test" = "pytest:console_main" +scripts.pytest = "pytest:console_main" [tool.setuptools.package-data] -"_pytest" = ["py.typed"] -"pytest" = ["py.typed"] +"_pytest" = [ + "py.typed", +] +"pytest" = [ + "py.typed", +] [tool.setuptools_scm] write_to = "src/_pytest/_version.py" [tool.black] -target-version = ['py38'] +target-version = [ + 'py38', +] [tool.ruff] -src = ["src"] line-length = 88 - -[tool.ruff.format] -docstring-code-format = true - -[tool.ruff.lint] -select = [ - "B", # bugbear - "D", # pydocstyle - "E", # pycodestyle - "F", # pyflakes - "I", # isort - "PYI", # flake8-pyi - "UP", # pyupgrade - "RUF", # ruff - "W", # pycodestyle - "PIE", # flake8-pie - "PGH004", # pygrep-hooks - Use specific rule codes when using noqa - "PLE", # pylint error - "PLW", # pylint warning - "PLR1714", # Consider merging multiple comparisons - "T100", # flake8-debugger +src = [ + "src", ] -ignore = [ +format.docstring-code-format = true +lint.select = [ + "B", # bugbear + "D", # pydocstyle + "E", # pycodestyle + "F", # pyflakes + "I", # isort + "PGH004", # pygrep-hooks - Use specific rule codes when using noqa + "PIE", # flake8-pie + "PLE", # pylint error + "PLR1714", # Consider merging multiple comparisons + "PLW", # pylint warning + "PYI", # flake8-pyi + "RUF", # ruff + "T100", # flake8-debugger + "UP", # pyupgrade + "W", # pycodestyle +] +lint.ignore = [ # bugbear ignore "B004", # Using `hasattr(x, "__call__")` to test if x is callable is unreliable. "B007", # Loop control variable `i` not used within loop body @@ -118,10 +118,6 @@ ignore = [ "B010", # [*] Do not call `setattr` with a constant attribute value. "B011", # Do not `assert False` (`python -O` removes these calls) "B028", # No explicit `stacklevel` keyword argument found - # pycodestyle ignore - # pytest can do weird low-level things, and we usually know - # what we're doing when we use type(..) is ... - "E721", # Do not compare types, use `isinstance()` # pydocstyle ignore "D100", # Missing docstring in public module "D101", # Missing docstring in public class @@ -131,46 +127,51 @@ ignore = [ "D105", # Missing docstring in magic method "D106", # Missing docstring in public nested class "D107", # Missing docstring in `__init__` - "D209", # [*] Multi-line docstring closing quotes should be on a separate line "D205", # 1 blank line required between summary line and description + "D209", # [*] Multi-line docstring closing quotes should be on a separate line "D400", # First line should end with a period "D401", # First line of docstring should be in imperative mood "D402", # First line should not be the function's signature "D404", # First word of the docstring should not be "This" "D415", # First line should end with a period, question mark, or exclamation point + # pytest can do weird low-level things, and we usually know + # what we're doing when we use type(..) is ... + "E721", # Do not compare types, use `isinstance()` + # pylint ignore + "PLR5501", # Use `elif` instead of `else` then `if` + "PLW0120", # remove the else and dedent its contents + "PLW0603", # Using the global statement + "PLW2901", # for loop variable overwritten by assignment target # ruff ignore "RUF012", # Mutable class attributes should be annotated with `typing.ClassVar` - # pylint ignore - "PLW0603", # Using the global statement - "PLW0120", # remove the else and dedent its contents - "PLW2901", # for loop variable overwritten by assignment target - "PLR5501", # Use `elif` instead of `else` then `if` ] - -[tool.ruff.lint.pycodestyle] +lint.per-file-ignores."src/_pytest/_py/**/*.py" = [ + "B", + "PYI", +] +lint.per-file-ignores."src/_pytest/_version.py" = [ + "I001", +] +lint.per-file-ignores."testing/python/approx.py" = [ + "B015", +] +lint.isort.combine-as-imports = true +lint.isort.force-single-line = true +lint.isort.force-sort-within-sections = true +lint.isort.known-local-folder = [ + "pytest", + "_pytest", +] +lint.isort.lines-after-imports = 2 +lint.isort.order-by-type = false # In order to be able to format for 88 char in ruff format -max-line-length = 120 - -[tool.ruff.lint.pydocstyle] -convention = "pep257" - -[tool.ruff.lint.isort] -force-single-line = true -combine-as-imports = true -force-sort-within-sections = true -order-by-type = false -known-local-folder = ["pytest", "_pytest"] -lines-after-imports = 2 - -[tool.ruff.lint.per-file-ignores] -"src/_pytest/_py/**/*.py" = ["B", "PYI"] -"src/_pytest/_version.py" = ["I001"] -"testing/python/approx.py" = ["B015"] +lint.pycodestyle.max-line-length = 120 +lint.pydocstyle.convention = "pep257" [tool.pylint.main] # Maximum number of characters on a single line. max-line-length = 120 -disable= [ +disable = [ "abstract-method", "arguments-differ", "arguments-renamed", @@ -291,16 +292,27 @@ indent = 4 [tool.pytest.ini_options] minversion = "2.0" addopts = "-rfEX -p pytester --strict-markers" -python_files = ["test_*.py", "*_test.py", "testing/python/*.py"] -python_classes = ["Test", "Acceptance"] -python_functions = ["test"] +python_files = [ + "test_*.py", + "*_test.py", + "testing/python/*.py", +] +python_classes = [ + "Test", + "Acceptance", +] +python_functions = [ + "test", +] # NOTE: "doc" is not included here, but gets tested explicitly via "doctesting". -testpaths = ["testing"] +testpaths = [ + "testing", +] norecursedirs = [ - "testing/example_scripts", - ".*", - "build", - "dist", + "testing/example_scripts", + ".*", + "build", + "dist", ] xfail_strict = true filterwarnings = [ @@ -355,49 +367,55 @@ directory = "changelog/" title_format = "pytest {version} ({project_date})" template = "changelog/_template.rst" - [[tool.towncrier.type]] - directory = "breaking" - name = "Breaking Changes" - showcontent = true +[[tool.towncrier.type]] +directory = "breaking" +name = "Breaking Changes" +showcontent = true - [[tool.towncrier.type]] - directory = "deprecation" - name = "Deprecations" - showcontent = true +[[tool.towncrier.type]] +directory = "deprecation" +name = "Deprecations" +showcontent = true - [[tool.towncrier.type]] - directory = "feature" - name = "Features" - showcontent = true +[[tool.towncrier.type]] +directory = "feature" +name = "Features" +showcontent = true - [[tool.towncrier.type]] - directory = "improvement" - name = "Improvements" - showcontent = true +[[tool.towncrier.type]] +directory = "improvement" +name = "Improvements" +showcontent = true - [[tool.towncrier.type]] - directory = "bugfix" - name = "Bug Fixes" - showcontent = true +[[tool.towncrier.type]] +directory = "bugfix" +name = "Bug Fixes" +showcontent = true - [[tool.towncrier.type]] - directory = "vendor" - name = "Vendored Libraries" - showcontent = true +[[tool.towncrier.type]] +directory = "vendor" +name = "Vendored Libraries" +showcontent = true - [[tool.towncrier.type]] - directory = "doc" - name = "Improved Documentation" - showcontent = true +[[tool.towncrier.type]] +directory = "doc" +name = "Improved Documentation" +showcontent = true - [[tool.towncrier.type]] - directory = "trivial" - name = "Trivial/Internal Changes" - showcontent = true +[[tool.towncrier.type]] +directory = "trivial" +name = "Trivial/Internal Changes" +showcontent = true [tool.mypy] -files = ["src", "testing", "scripts"] -mypy_path = ["src"] +files = [ + "src", + "testing", + "scripts", +] +mypy_path = [ + "src", +] check_untyped_defs = true disallow_any_generics = true disallow_untyped_defs = true From cbf6bd9dd28d8464f7eebe32e51b398e2a5e3039 Mon Sep 17 00:00:00 2001 From: Sam Jirovec <47160720+samjirovec@users.noreply.github.com> Date: Tue, 21 May 2024 08:56:18 -0500 Subject: [PATCH 18/53] Issue #12290 - Docs using Furo Theme W/ Dark Mode (#12326) * furo theme for docs site * removing duplicate tocs from deprecations and reference pages * removing pallets references in code and config * reverting trainings to sidebar * removed sphinx style and unpinned packaging version * updated styles --- AUTHORS | 1 + CONTRIBUTING.rst | 4 ---- changelog/12290.doc.rst | 1 + doc/en/{img => _static}/pytest1.png | Bin doc/en/_templates/sidebar/brand.html | 7 ++++++ doc/en/_templates/slim_searchbox.html | 14 ------------ doc/en/_templates/style.html | 7 ++++++ doc/en/conf.py | 30 ++++++++++---------------- doc/en/deprecations.rst | 4 ---- doc/en/index.rst | 21 +++++++++--------- doc/en/reference/reference.rst | 3 --- doc/en/requirements.txt | 4 ++-- 12 files changed, 39 insertions(+), 57 deletions(-) create mode 100644 changelog/12290.doc.rst rename doc/en/{img => _static}/pytest1.png (100%) create mode 100644 doc/en/_templates/sidebar/brand.html delete mode 100644 doc/en/_templates/slim_searchbox.html create mode 100644 doc/en/_templates/style.html diff --git a/AUTHORS b/AUTHORS index 54ed85fc7..cc53ce10d 100644 --- a/AUTHORS +++ b/AUTHORS @@ -358,6 +358,7 @@ Sadra Barikbin Saiprasad Kale Samuel Colvin Samuel Dion-Girardeau +Samuel Jirovec Samuel Searles-Bryant Samuel Therrien (Avasam) Samuele Pedroni diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index d7da59c81..0bf440da2 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -5,10 +5,6 @@ Contribution getting started Contributions are highly welcomed and appreciated. Every little bit of help counts, so do not hesitate! -.. contents:: - :depth: 2 - :backlinks: none - .. _submitfeedback: diff --git a/changelog/12290.doc.rst b/changelog/12290.doc.rst new file mode 100644 index 000000000..07fe3babc --- /dev/null +++ b/changelog/12290.doc.rst @@ -0,0 +1 @@ +Updated Sphinx theme to use Furo instead of Flask, enabling Dark mode theme. diff --git a/doc/en/img/pytest1.png b/doc/en/_static/pytest1.png similarity index 100% rename from doc/en/img/pytest1.png rename to doc/en/_static/pytest1.png diff --git a/doc/en/_templates/sidebar/brand.html b/doc/en/_templates/sidebar/brand.html new file mode 100644 index 000000000..f997c4cca --- /dev/null +++ b/doc/en/_templates/sidebar/brand.html @@ -0,0 +1,7 @@ + + + diff --git a/doc/en/_templates/slim_searchbox.html b/doc/en/_templates/slim_searchbox.html deleted file mode 100644 index f088ff8d3..000000000 --- a/doc/en/_templates/slim_searchbox.html +++ /dev/null @@ -1,14 +0,0 @@ -{# - basic/searchbox.html with heading removed. -#} -{%- if pagename != "search" and builder != "singlehtml" %} - - -{%- endif %} diff --git a/doc/en/_templates/style.html b/doc/en/_templates/style.html new file mode 100644 index 000000000..400cb75ff --- /dev/null +++ b/doc/en/_templates/style.html @@ -0,0 +1,7 @@ + diff --git a/doc/en/conf.py b/doc/en/conf.py index af54b4689..e64931ae5 100644 --- a/doc/en/conf.py +++ b/doc/en/conf.py @@ -15,9 +15,7 @@ # # The full version, including alpha/beta/rc tags. # The short X.Y version. -import os import shutil -import sys from textwrap import dedent from typing import TYPE_CHECKING @@ -65,7 +63,6 @@ latex_elements = { # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = [ - "pallets_sphinx_themes", "pygments_pytest", "sphinx.ext.autodoc", "sphinx.ext.autosummary", @@ -140,10 +137,6 @@ add_module_names = False # output. They are ignored by default. # show_authors = False -# The name of the Pygments (syntax highlighting) style to use. -pygments_style = "sphinx" - - # A list of ignored prefixes for module index sorting. # modindex_common_prefix = [] @@ -216,12 +209,9 @@ nitpick_ignore = [ # -- Options for HTML output --------------------------------------------------- -sys.path.append(os.path.abspath("_themes")) -html_theme_path = ["_themes"] - # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -html_theme = "flask" +html_theme = "furo" # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the @@ -266,18 +256,24 @@ html_favicon = "img/favicon.png" html_sidebars = { "index": [ - "slim_searchbox.html", + "sidebar/brand.html", + "sidebar/search.html", + "sidebar/scroll-start.html", "sidebarintro.html", "globaltoc.html", "links.html", - "sourcelink.html", + "sidebar/scroll-end.html", + "style.html", ], "**": [ - "slim_searchbox.html", + "sidebar/brand.html", + "sidebar/search.html", + "sidebar/scroll-start.html", "globaltoc.html", "relations.html", "links.html", - "sourcelink.html", + "sidebar/scroll-end.html", + "style.html", ], } @@ -337,10 +333,6 @@ latex_documents = [ ) ] -# The name of an image file (relative to this directory) to place at the top of -# the title page. -latex_logo = "img/pytest1.png" - # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. # latex_use_parts = False diff --git a/doc/en/deprecations.rst b/doc/en/deprecations.rst index a65ea3316..bf6268a49 100644 --- a/doc/en/deprecations.rst +++ b/doc/en/deprecations.rst @@ -7,10 +7,6 @@ This page lists all pytest features that are currently deprecated or have been r The objective is to give users a clear rationale why a certain feature has been removed, and what alternatives should be used instead. -.. contents:: - :depth: 3 - :local: - Deprecated Features ------------------- diff --git a/doc/en/index.rst b/doc/en/index.rst index 83eb27b0a..2aebb0d6b 100644 --- a/doc/en/index.rst +++ b/doc/en/index.rst @@ -1,17 +1,17 @@ :orphan: -.. sidebar:: Next Open Trainings and Events - - - `Professional Testing with Python `_, via `Python Academy `_ (3 day in-depth training): - * **June 11th to 13th 2024**, Remote - * **March 4th to 6th 2025**, Leipzig, Germany / Remote - - `pytest development sprint `_, **June 17th -- 22nd 2024** - - pytest tips and tricks for a better testsuite, `Europython 2024 `_, **July 8th -- 14th 2024** (3h), Prague - - Also see :doc:`previous talks and blogposts `. - .. _features: +.. sidebar:: **Next Open Trainings and Events** + + - `Professional Testing with Python `_, via `Python Academy `_ (3 day in-depth training): + * **June 11th to 13th 2024**, Remote + * **March 4th to 6th 2025**, Leipzig, Germany / Remote + - `pytest development sprint `_, **June 17th -- 22nd 2024** + - pytest tips and tricks for a better testsuite, `Europython 2024 `_, **July 8th -- 14th 2024** (3h), Prague + + Also see :doc:`previous talks and blogposts ` + pytest: helps you write better programs ======================================= @@ -25,7 +25,6 @@ scale to support complex functional testing for applications and libraries. **PyPI package name**: :pypi:`pytest` - A quick example --------------- diff --git a/doc/en/reference/reference.rst b/doc/en/reference/reference.rst index 4036b7d99..3675c7cb2 100644 --- a/doc/en/reference/reference.rst +++ b/doc/en/reference/reference.rst @@ -7,9 +7,6 @@ API Reference This page contains the full reference to pytest's API. -.. contents:: - :depth: 3 - :local: Constants --------- diff --git a/doc/en/requirements.txt b/doc/en/requirements.txt index 974988c8c..6e7221d64 100644 --- a/doc/en/requirements.txt +++ b/doc/en/requirements.txt @@ -1,4 +1,3 @@ -pallets-sphinx-themes pluggy>=1.5.0 pygments-pytest>=2.3.0 sphinx-removed-in>=0.2.0 @@ -8,4 +7,5 @@ sphinxcontrib-svg2pdfconverter # Pin packaging because it no longer handles 'latest' version, which # is the version that is assigned to the docs. # See https://github.com/pytest-dev/pytest/pull/10578#issuecomment-1348249045. -packaging <22 +packaging +furo From 889d9b28d786c75b66f4d1acb80123bdb341639c Mon Sep 17 00:00:00 2001 From: Nathan Goldbaum Date: Fri, 24 May 2024 05:16:44 -0600 Subject: [PATCH 19/53] Add thread safety section to flaky test docs (#12359) Closes #12356 --- AUTHORS | 1 + changelog/12356.doc.rst | 2 ++ doc/en/explanation/flaky.rst | 22 +++++++++++++++++++--- 3 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 changelog/12356.doc.rst diff --git a/AUTHORS b/AUTHORS index cc53ce10d..18c60750e 100644 --- a/AUTHORS +++ b/AUTHORS @@ -289,6 +289,7 @@ Mike Lundy Milan Lesnek Miro Hrončok mrbean-bremen +Nathan Goldbaum Nathaniel Compton Nathaniel Waisbrot Ned Batchelder diff --git a/changelog/12356.doc.rst b/changelog/12356.doc.rst new file mode 100644 index 000000000..312c26d32 --- /dev/null +++ b/changelog/12356.doc.rst @@ -0,0 +1,2 @@ +Added a subsection to the documentation for debugging flaky tests to mention +lack of thread safety in pytest as a possible source of flakyness. diff --git a/doc/en/explanation/flaky.rst b/doc/en/explanation/flaky.rst index 41cbe8479..cb6c39834 100644 --- a/doc/en/explanation/flaky.rst +++ b/doc/en/explanation/flaky.rst @@ -18,7 +18,7 @@ System state Broadly speaking, a flaky test indicates that the test relies on some system state that is not being appropriately controlled - the test environment is not sufficiently isolated. Higher level tests are more likely to be flaky as they rely on more state. -Flaky tests sometimes appear when a test suite is run in parallel (such as use of pytest-xdist). This can indicate a test is reliant on test ordering. +Flaky tests sometimes appear when a test suite is run in parallel (such as use of `pytest-xdist`_). This can indicate a test is reliant on test ordering. - Perhaps a different test is failing to clean up after itself and leaving behind data which causes the flaky test to fail. - The flaky test is reliant on data from a previous test that doesn't clean up after itself, and in parallel runs that previous test is not always present @@ -30,9 +30,22 @@ Overly strict assertion Overly strict assertions can cause problems with floating point comparison as well as timing issues. :func:`pytest.approx` is useful here. +Thread safety +~~~~~~~~~~~~~ -Pytest features -^^^^^^^^^^^^^^^ +pytest is single-threaded, executing its tests always in the same thread, sequentially, never spawning any threads itself. + +Even in case of plugins which run tests in parallel, for example `pytest-xdist`_, usually work by spawning multiple *processes* and running tests in batches, without using multiple threads. + +It is of course possible (and common) for tests and fixtures to spawn threads themselves as part of their testing workflow (for example, a fixture that starts a server thread in the background, or a test which executes production code that spawns threads), but some care must be taken: + +* Make sure to eventually wait on any spawned threads -- for example at the end of a test, or during the teardown of a fixture. +* Avoid using primitives provided by pytest (:func:`pytest.warns`, :func:`pytest.raises`, etc) from multiple threads, as they are not thread-safe. + +If your test suite uses threads and your are seeing flaky test results, do not discount the possibility that the test is implicitly using global state in pytest itself. + +Related features +^^^^^^^^^^^^^^^^ Xfail strict ~~~~~~~~~~~~ @@ -123,3 +136,6 @@ Resources * `Flaky Tests at Google and How We Mitigate Them `_ by John Micco, 2016 * `Where do Google's flaky tests come from? `_ by Jeff Listfield, 2017 + + +.. _pytest-xdist: https://github.com/pytest-dev/pytest-xdist From b83dd34ce19da60486155ea9be81bfeb5c1b86b9 Mon Sep 17 00:00:00 2001 From: pytest bot Date: Sun, 26 May 2024 00:21:28 +0000 Subject: [PATCH 20/53] [automated] Update plugin list --- doc/en/reference/plugin_list.rst | 196 +++++++++++++++++-------------- 1 file changed, 110 insertions(+), 86 deletions(-) diff --git a/doc/en/reference/plugin_list.rst b/doc/en/reference/plugin_list.rst index 43c4748ea..5d2a93493 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 =7.0.0 + :pypi:`pytest-asyncio` Pytest support for asyncio May 19, 2024 4 - Beta pytest<9,>=7.0.0 :pypi:`pytest-asyncio-cooperative` Run all your asynchronous tests cooperatively. Feb 25, 2024 N/A N/A :pypi:`pytest-asyncio-network-simulator` pytest-asyncio-network-simulator: Plugin for pytest for simulator the network in tests Jul 31, 2018 3 - Alpha pytest (<3.7.0,>=3.3.2) :pypi:`pytest-async-mongodb` pytest plugin for async MongoDB Oct 18, 2017 5 - Production/Stable pytest (>=2.5.2) @@ -127,7 +127,7 @@ This list contains 1461 plugins. :pypi:`pytest-aviator` Aviator's Flakybot pytest plugin that automatically reruns flaky tests. Nov 04, 2022 4 - Beta pytest :pypi:`pytest-avoidance` Makes pytest skip tests that don not need rerunning May 23, 2019 4 - Beta pytest (>=3.5.0) :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 18, 2024 4 - Beta pytest + :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. Feb 02, 2024 N/A pytest (>=8.0.0,<9.0.0) :pypi:`pytest-axe` pytest plugin for axe-selenium-python Nov 12, 2018 N/A pytest (>=3.0.0) @@ -142,13 +142,13 @@ This list contains 1461 plugins. :pypi:`pytest-bdd` BDD for pytest Mar 17, 2024 6 - Mature pytest (>=6.2.0) :pypi:`pytest-bdd-html` pytest plugin to display BDD info in HTML test report Nov 22, 2022 3 - Alpha pytest (!=6.0.0,>=5.0) :pypi:`pytest-bdd-ng` BDD for pytest Dec 31, 2023 4 - Beta pytest >=5.0 - :pypi:`pytest-bdd-report` A pytest-bdd plugin for generating useful and informative BDD test reports Feb 19, 2024 N/A pytest >=7.1.3 + :pypi:`pytest-bdd-report` A pytest-bdd plugin for generating useful and informative BDD test reports May 20, 2024 N/A pytest >=7.1.3 :pypi:`pytest-bdd-splinter` Common steps for pytest bdd and splinter integration Aug 12, 2019 5 - Production/Stable pytest (>=4.0.0) :pypi:`pytest-bdd-web` A simple plugin to use with pytest Jan 02, 2020 4 - Beta pytest (>=3.5.0) :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. Jan 25, 2024 N/A pytest - :pypi:`pytest-bec-e2e` BEC pytest plugin for end-to-end tests May 17, 2024 3 - Alpha pytest + :pypi:`pytest-bec-e2e` BEC pytest plugin for end-to-end tests May 21, 2024 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 @@ -233,7 +233,7 @@ This list contains 1461 plugins. :pypi:`pytest-ckan` Backport of CKAN 2.9 pytest plugin and fixtures to CAKN 2.8 Apr 28, 2020 4 - Beta pytest :pypi:`pytest-clarity` A plugin providing an alternative, colourful diff output for failing assertions. Jun 11, 2021 N/A N/A :pypi:`pytest-cldf` Easy quality control for CLDF datasets using pytest Nov 07, 2022 N/A pytest (>=3.6) - :pypi:`pytest-cleanslate` Collects and executes pytest tests separately May 15, 2024 N/A pytest + :pypi:`pytest-cleanslate` Collects and executes pytest tests separately May 20, 2024 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 Mar 19, 2024 5 - Production/Stable N/A :pypi:`pytest-clerk` A set of pytest fixtures to help with integration testing with Clerk. Apr 19, 2024 N/A pytest<9.0.0,>=8.0.0 @@ -258,6 +258,7 @@ This list contains 1461 plugins. :pypi:`pytest-collect-formatter` Formatter for pytest collect output Mar 29, 2021 5 - Production/Stable N/A :pypi:`pytest-collect-formatter2` Formatter for pytest collect output May 31, 2021 5 - Production/Stable N/A :pypi:`pytest-collect-interface-info-plugin` Get executed interface information in pytest interface automation framework Sep 25, 2023 4 - Beta N/A + :pypi:`pytest-collect-jmeter-report-tests` A simple plugin to use with pytest May 20, 2024 4 - Beta pytest>=7.2.1 :pypi:`pytest-collector` Python package for collecting pytest. Aug 02, 2022 N/A pytest (>=7.0,<8.0) :pypi:`pytest-collect-pytest-interinfo` A simple plugin to use with pytest Sep 26, 2023 4 - Beta N/A :pypi:`pytest-colordots` Colorizes the progress indicators Oct 06, 2017 5 - Production/Stable N/A @@ -309,7 +310,7 @@ This list contains 1461 plugins. :pypi:`pytest-dash` pytest fixtures to run dash applications. Mar 18, 2019 N/A N/A :pypi:`pytest-dashboard` Apr 22, 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. Apr 21, 2024 4 - Beta pytest + :pypi:`pytest-databases` Reusable database fixtures for any and all databases. May 25, 2024 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 Oct 03, 2023 5 - Production/Stable pytest >=5.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) @@ -368,7 +369,7 @@ This list contains 1461 plugins. :pypi:`pytest-django-cache-xdist` A djangocachexdist plugin for pytest May 12, 2020 4 - Beta N/A :pypi:`pytest-django-casperjs` Integrate CasperJS with your django tests as a pytest fixture. Mar 15, 2015 2 - Pre-Alpha N/A :pypi:`pytest-django-class` A pytest plugin for running django in class-scoped fixtures Aug 08, 2023 4 - Beta N/A - :pypi:`pytest-django-docker-pg` Jan 30, 2024 5 - Production/Stable pytest <8.0.0,>=7.0.0 + :pypi:`pytest-django-docker-pg` May 21, 2024 5 - Production/Stable pytest<9.0.0,>=7.0.0 :pypi:`pytest-django-dotenv` Pytest plugin used to setup environment variables with django-dotenv Nov 26, 2019 4 - Beta pytest (>=2.6.0) :pypi:`pytest-django-factories` Factories for your Django models that can be used as Pytest fixtures. Nov 12, 2020 4 - Beta N/A :pypi:`pytest-django-filefield` Replaces FileField.storage with something you can patch globally. May 09, 2022 5 - Production/Stable pytest >= 5.2 @@ -443,14 +444,14 @@ This list contains 1461 plugins. :pypi:`pytest-eliot` An eliot plugin for pytest. Aug 31, 2022 1 - Planning pytest (>=5.4.0) :pypi:`pytest-elk-reporter` A simple plugin to use with pytest Apr 04, 2024 4 - Beta pytest>=3.5.0 :pypi:`pytest-email` Send execution result email Jul 08, 2020 N/A pytest - :pypi:`pytest-embedded` A pytest plugin that designed for embedded testing. Apr 30, 2024 5 - Production/Stable pytest>=7.0 - :pypi:`pytest-embedded-arduino` Make pytest-embedded plugin work with Arduino. Apr 30, 2024 5 - Production/Stable N/A - :pypi:`pytest-embedded-idf` Make pytest-embedded plugin work with ESP-IDF. Apr 30, 2024 5 - Production/Stable N/A - :pypi:`pytest-embedded-jtag` Make pytest-embedded plugin work with JTAG. Apr 30, 2024 5 - Production/Stable N/A - :pypi:`pytest-embedded-qemu` Make pytest-embedded plugin work with QEMU. Apr 30, 2024 5 - Production/Stable N/A - :pypi:`pytest-embedded-serial` Make pytest-embedded plugin work with Serial. Apr 30, 2024 5 - Production/Stable N/A - :pypi:`pytest-embedded-serial-esp` Make pytest-embedded plugin work with Espressif target boards. Apr 30, 2024 5 - Production/Stable N/A - :pypi:`pytest-embedded-wokwi` Make pytest-embedded plugin work with the Wokwi CLI. Apr 30, 2024 5 - Production/Stable N/A + :pypi:`pytest-embedded` A pytest plugin that designed for embedded testing. May 23, 2024 5 - Production/Stable pytest>=7.0 + :pypi:`pytest-embedded-arduino` Make pytest-embedded plugin work with Arduino. May 23, 2024 5 - Production/Stable N/A + :pypi:`pytest-embedded-idf` Make pytest-embedded plugin work with ESP-IDF. May 23, 2024 5 - Production/Stable N/A + :pypi:`pytest-embedded-jtag` Make pytest-embedded plugin work with JTAG. May 23, 2024 5 - Production/Stable N/A + :pypi:`pytest-embedded-qemu` Make pytest-embedded plugin work with QEMU. May 23, 2024 5 - Production/Stable N/A + :pypi:`pytest-embedded-serial` Make pytest-embedded plugin work with Serial. May 23, 2024 5 - Production/Stable N/A + :pypi:`pytest-embedded-serial-esp` Make pytest-embedded plugin work with Espressif target boards. May 23, 2024 5 - Production/Stable N/A + :pypi:`pytest-embedded-wokwi` Make pytest-embedded plugin work with the Wokwi CLI. May 23, 2024 5 - Production/Stable N/A :pypi:`pytest-embrace` 💝 Dataclasses-as-tests. Describe the runtime once and multiply coverage with no boilerplate. Mar 25, 2023 N/A pytest (>=7.0,<8.0) :pypi:`pytest-emoji` A pytest plugin that adds emojis to your test result report Feb 19, 2019 4 - Beta pytest (>=4.2.1) :pypi:`pytest-emoji-output` Pytest plugin to represent test output with emoji support Apr 09, 2023 4 - Beta pytest (==7.0.1) @@ -645,7 +646,7 @@ This list contains 1461 plugins. :pypi:`pytest-html-object-storage` Pytest report plugin for send HTML report on object-storage Jan 17, 2024 5 - Production/Stable N/A :pypi:`pytest-html-profiling` Pytest plugin for generating HTML reports with per-test profiling and optionally call graph visualizations. Based on pytest-html by Dave Hunt. Feb 11, 2020 5 - Production/Stable pytest (>=3.0) :pypi:`pytest-html-reporter` Generates a static html report based on pytest framework Feb 13, 2022 N/A N/A - :pypi:`pytest-html-report-merger` Oct 23, 2023 N/A N/A + :pypi:`pytest-html-report-merger` May 22, 2024 N/A 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-httpbin` Easily test your HTTP library against a local copy of httpbin May 08, 2023 5 - Production/Stable pytest ; extra == 'test' @@ -680,7 +681,7 @@ This list contains 1461 plugins. :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 19, 2023 4 - Beta pytest >=7.0.0 :pypi:`pytest-inmanta` A py.test plugin providing fixtures to simplify inmanta modules testing. Dec 13, 2023 5 - Production/Stable pytest - :pypi:`pytest-inmanta-extensions` Inmanta tests package Apr 02, 2024 5 - Production/Stable N/A + :pypi:`pytest-inmanta-extensions` Inmanta tests package May 24, 2024 5 - Production/Stable N/A :pypi:`pytest-inmanta-lsm` Common fixtures for inmanta LSM related modules May 10, 2024 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 @@ -716,11 +717,13 @@ This list contains 1461 plugins. :pypi:`pytest-jobserver` Limit parallel tests with posix jobserver. May 15, 2019 5 - Production/Stable pytest :pypi:`pytest-joke` Test failures are better served with humor. Oct 08, 2019 4 - Beta pytest (>=4.2.1) :pypi:`pytest-json` Generate JSON test reports Jan 18, 2016 4 - Beta N/A + :pypi:`pytest-json-ctrf` Pytest plugin to generate json report in CTRF (Common Test Report Format) May 21, 2024 N/A pytest>6.0.0 :pypi:`pytest-json-fixtures` JSON output for the --fixtures flag Mar 14, 2023 4 - Beta N/A :pypi:`pytest-jsonlint` UNKNOWN Aug 04, 2016 N/A N/A :pypi:`pytest-json-report` A pytest plugin to report test results as JSON files Mar 15, 2022 4 - Beta pytest (>=3.8.0) :pypi:`pytest-json-report-wip` A pytest plugin to report test results as JSON files Oct 28, 2023 4 - Beta pytest >=3.8.0 :pypi:`pytest-jsonschema` A pytest plugin to perform JSONSchema validations Mar 27, 2024 4 - Beta pytest>=6.2.0 + :pypi:`pytest-jtl-collector` A simple plugin to use with pytest May 20, 2024 4 - Beta pytest>=7.2.1 :pypi:`pytest-jtr` pytest plugin supporting json test report output Apr 15, 2024 N/A pytest<8.0.0,>=7.1.2 :pypi:`pytest-jupyter` A pytest plugin for testing Jupyter libraries and extensions. Apr 04, 2024 4 - Beta pytest>=7.0 :pypi:`pytest-jupyterhub` A reusable JupyterHub pytest plugin Apr 25, 2023 5 - Production/Stable pytest @@ -766,7 +769,7 @@ This list contains 1461 plugins. :pypi:`pytest-litter` Pytest plugin which verifies that tests do not modify file trees. Nov 23, 2023 4 - Beta pytest >=6.1 :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-localftpserver` A PyTest plugin which provides an FTP fixture for your tests May 17, 2024 5 - Production/Stable pytest + :pypi:`pytest-localftpserver` A PyTest plugin which provides an FTP fixture for your tests May 19, 2024 5 - Production/Stable pytest :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-lock` pytest-lock is a pytest plugin that allows you to "lock" the results of unit tests, storing them in a local cache. This is particularly useful for tests that are resource-intensive or don't need to be run every time. When the tests are run subsequently, pytest-lock will compare the current results with the locked results and issue a warning if there are any discrepancies. Feb 03, 2024 N/A pytest (>=7.4.3,<8.0.0) @@ -779,11 +782,11 @@ This list contains 1461 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-logikal` Common testing environment Mar 30, 2024 5 - Production/Stable pytest==8.1.1 + :pypi:`pytest-logikal` Common testing environment May 23, 2024 5 - Production/Stable pytest==8.2.1 :pypi:`pytest-log-report` Package for creating a pytest test run reprot Dec 26, 2019 N/A N/A :pypi:`pytest-loguru` Pytest Loguru Mar 20, 2024 5 - Production/Stable pytest; extra == "test" :pypi:`pytest-loop` pytest plugin for looping tests Mar 30, 2024 5 - Production/Stable pytest - :pypi:`pytest-lsp` A pytest plugin for end-to-end testing of language servers Feb 07, 2024 3 - Alpha pytest + :pypi:`pytest-lsp` A pytest plugin for end-to-end testing of language servers May 22, 2024 3 - Alpha pytest :pypi:`pytest-manual-marker` pytest marker for marking manual tests Aug 04, 2022 3 - Alpha pytest>=7 :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) @@ -818,7 +821,7 @@ This list contains 1461 plugins. :pypi:`pytest-mimesis` Mimesis integration with the pytest test runner Mar 21, 2020 5 - Production/Stable pytest (>=4.2) :pypi:`pytest-minecraft` A pytest plugin for running tests against Minecraft releases Apr 06, 2022 N/A pytest (>=6.0.1) :pypi:`pytest-mini` A plugin to test mp Feb 06, 2023 N/A pytest (>=7.2.0,<8.0.0) - :pypi:`pytest-minio-mock` A pytest plugin for mocking Minio S3 interactions Apr 27, 2024 N/A pytest>=5.0.0 + :pypi:`pytest-minio-mock` A pytest plugin for mocking Minio S3 interactions May 19, 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-mitmproxy` pytest plugin for mitmproxy tests Mar 07, 2024 N/A pytest >=7.0 :pypi:`pytest-ml` Test your machine learning! May 04, 2019 4 - Beta N/A @@ -864,7 +867,7 @@ This list contains 1461 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-runner` Run the mypy static type checker as a pytest test case Apr 23, 2024 N/A pytest>=8.0 :pypi:`pytest-mypy-testing` Pytest plugin to check mypy output. Mar 04, 2024 N/A pytest>=7,<9 - :pypi:`pytest-mysql` MySQL process and client fixtures for pytest Oct 30, 2023 5 - Production/Stable pytest >=6.2 + :pypi:`pytest-mysql` MySQL process and client fixtures for pytest May 23, 2024 5 - Production/Stable pytest>=6.2 :pypi:`pytest-ndb` pytest notebook debugger Apr 28, 2024 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-neo` pytest-neo is a plugin for pytest that shows tests like screen of Matrix. Jan 08, 2022 3 - Alpha pytest (>=6.2.0) @@ -877,7 +880,7 @@ This list contains 1461 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 May 17, 2024 N/A pytest<9.0.0,>=8.2.0 + :pypi:`pytest-nhsd-apim` Pytest plugin accessing NHSDigital's APIM proxies May 20, 2024 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 Apr 11, 2024 N/A N/A @@ -929,7 +932,6 @@ This list contains 1461 plugins. :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-parameterize-from-files` A pytest plugin that parameterizes tests from data files. Feb 15, 2024 4 - Beta pytest>=7.2.0 :pypi:`pytest-parametrization` Simpler PyTest parametrization May 22, 2022 5 - Production/Stable N/A :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. Nov 03, 2023 5 - Production/Stable pytest @@ -949,12 +951,12 @@ This list contains 1461 plugins. :pypi:`pytest-pep8` pytest plugin to check PEP8 requirements Apr 27, 2014 N/A N/A :pypi:`pytest-percent` Change the exit code of pytest test sessions when a required percent of tests pass. May 21, 2020 N/A pytest (>=5.2.0) :pypi:`pytest-percents` Mar 16, 2024 N/A N/A - :pypi:`pytest-perf` Run performance tests against the mainline code. Jan 28, 2024 5 - Production/Stable pytest >=6 ; extra == 'testing' + :pypi:`pytest-perf` Run performance tests against the mainline code. May 20, 2024 5 - Production/Stable pytest!=8.1.*,>=6; extra == "testing" :pypi:`pytest-performance` A simple plugin to ensure the execution of critical sections of code has not been impacted Sep 11, 2020 5 - Production/Stable pytest (>=3.7.0) :pypi:`pytest-performancetotal` A performance plugin for pytest Mar 19, 2024 4 - Beta N/A - :pypi:`pytest-persistence` Pytest tool for persistent objects Jul 04, 2023 N/A N/A + :pypi:`pytest-persistence` Pytest tool for persistent objects May 23, 2024 N/A N/A :pypi:`pytest-pexpect` Pytest pexpect plugin. Mar 27, 2024 4 - Beta pytest>=6.2.0 - :pypi:`pytest-pg` A tiny plugin for pytest which runs PostgreSQL in Docker Apr 03, 2024 5 - Production/Stable pytest>=6.0.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-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-picked` Run the tests related to the changed files Jul 27, 2023 N/A pytest (>=3.7.0) @@ -971,7 +973,7 @@ This list contains 1461 plugins. :pypi:`pytest-play` pytest plugin that let you automate actions and assertions with test metrics reporting executing plain YAML files Jun 12, 2019 5 - Production/Stable N/A :pypi:`pytest-playbook` Pytest plugin for reading playbooks. Jan 21, 2021 3 - Alpha pytest (>=6.1.2,<7.0.0) :pypi:`pytest-playwright` A pytest wrapper with fixtures for Playwright to automate web browsers May 06, 2024 N/A N/A - :pypi:`pytest_playwright_async` ASYNC Pytest plugin for Playwright May 04, 2024 N/A N/A + :pypi:`pytest_playwright_async` ASYNC Pytest plugin for Playwright May 24, 2024 N/A N/A :pypi:`pytest-playwright-asyncio` Aug 29, 2023 N/A N/A :pypi:`pytest-playwright-enhanced` A pytest plugin for playwright python Mar 24, 2024 N/A pytest<9.0.0,>=8.0.0 :pypi:`pytest-playwrights` A pytest wrapper with fixtures for Playwright to automate web browsers Dec 02, 2021 N/A N/A @@ -982,7 +984,7 @@ This list contains 1461 plugins. :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 Mar 26, 2024 5 - Production/Stable pytest>=7.4.2 :pypi:`pytest-pmisc` Mar 21, 2019 5 - Production/Stable N/A - :pypi:`pytest-pogo` Pytest plugin for pogo-migrate Mar 11, 2024 1 - Planning pytest (>=7,<9) + :pypi:`pytest-pogo` Pytest plugin for pogo-migrate May 22, 2024 1 - Planning pytest<9,>=7 :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 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 @@ -1046,7 +1048,7 @@ This list contains 1461 plugins. :pypi:`pytest-pytorch` pytest plugin for a better developer experience when working with the PyTorch test suite May 25, 2021 4 - Beta pytest :pypi:`pytest-pyvenv` A package for create venv in tests Feb 27, 2024 N/A pytest ; extra == 'test' :pypi:`pytest-pyvista` Pytest-pyvista package Sep 29, 2023 4 - Beta pytest>=3.5.0 - :pypi:`pytest-qaseio` Pytest plugin for Qase.io integration Sep 12, 2023 4 - Beta pytest (>=7.2.2,<8.0.0) + :pypi:`pytest-qaseio` Pytest plugin for Qase.io integration May 22, 2024 4 - Beta pytest<9.0.0,>=7.2.2 :pypi:`pytest-qasync` Pytest support for qasync. Jul 12, 2021 4 - Beta pytest (>=5.4.0) :pypi:`pytest-qatouch` Pytest plugin for uploading test results to your QA Touch Testrun. Feb 14, 2023 4 - Beta pytest (>=6.2.0) :pypi:`pytest-qgis` A pytest plugin for testing QGIS python plugins Nov 29, 2023 5 - Production/Stable pytest >=6.0 @@ -1119,7 +1121,7 @@ This list contains 1461 plugins. :pypi:`pytest-rerunclassfailures` pytest rerun class failures plugin Apr 24, 2024 5 - Production/Stable pytest>=7.2 :pypi:`pytest-rerunfailures` pytest plugin to re-run tests to eliminate flaky failures Mar 13, 2024 5 - Production/Stable pytest >=7.2 :pypi:`pytest-rerunfailures-all-logs` pytest plugin to re-run tests to eliminate flaky failures Mar 07, 2022 5 - Production/Stable N/A - :pypi:`pytest-reserial` Pytest fixture for recording and replaying serial port traffic. Feb 08, 2024 4 - Beta pytest + :pypi:`pytest-reserial` Pytest fixture for recording and replaying serial port traffic. May 23, 2024 4 - Beta pytest :pypi:`pytest-resilient-circuits` Resilient Circuits fixtures for PyTest May 17, 2024 N/A pytest~=4.6; python_version == "2.7" :pypi:`pytest-resource` Load resource fixture plugin to use with pytest Nov 14, 2018 4 - Beta N/A :pypi:`pytest-resource-path` Provides path for uniform access to test resources in isolated directory May 01, 2021 5 - Production/Stable pytest (>=3.5.0) @@ -1144,7 +1146,7 @@ This list contains 1461 plugins. :pypi:`pytest-rmsis` Sycronise pytest results to Jira RMsis Aug 10, 2022 N/A pytest (>=5.3.5) :pypi:`pytest-rng` Fixtures for seeding tests and making randomness reproducible Aug 08, 2019 5 - Production/Stable pytest :pypi:`pytest-roast` pytest plugin for ROAST configuration override and fixtures Nov 09, 2022 5 - Production/Stable pytest - :pypi:`pytest_robotframework` a pytest plugin that can run both python and robotframework tests while generating robot reports for them May 18, 2024 N/A pytest<9,>=7 + :pypi:`pytest_robotframework` a pytest plugin that can run both python and robotframework tests while generating robot reports for them May 24, 2024 N/A pytest<9,>=7 :pypi:`pytest-rocketchat` Pytest to Rocket.Chat reporting plugin Apr 18, 2021 5 - Production/Stable N/A :pypi:`pytest-rotest` Pytest integration with rotest Sep 08, 2019 N/A pytest (>=3.5.0) :pypi:`pytest-rpc` Extend py.test for RPC OpenStack testing. Feb 22, 2019 4 - Beta pytest (~=3.6) @@ -1171,6 +1173,7 @@ This list contains 1461 plugins. :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. May 16, 2024 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. May 19, 2024 5 - Production/Stable pytest>=7.2.0 :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 Feb 16, 2024 5 - Production/Stable pytest >=3.5.0 :pypi:`pytest-screenshot-on-failure` Saves a screenshot when a test case from a pytest execution fails Jul 21, 2023 4 - Beta N/A @@ -1260,7 +1263,7 @@ This list contains 1461 plugins. :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-sqlalchemy` pytest plugin with sqlalchemy related fixtures Mar 13, 2018 3 - Alpha N/A - :pypi:`pytest-sqlalchemy-mock` pytest sqlalchemy plugin for mock Mar 15, 2023 3 - Alpha pytest (>=2.0) + :pypi:`pytest-sqlalchemy-mock` pytest sqlalchemy plugin for mock May 21, 2024 3 - Alpha pytest>=7.0.0 :pypi:`pytest-sqlalchemy-session` A pytest plugin for preserving test isolation that use SQLAlchemy. May 19, 2023 4 - Beta pytest (>=7.0) :pypi:`pytest-sql-bigquery` Yet another SQL-testing framework for BigQuery provided by pytest plugin Dec 19, 2019 N/A pytest :pypi:`pytest-sqlfluff` A pytest plugin to use sqlfluff to enable format checking of sql files. Dec 21, 2022 4 - Beta pytest (>=3.5.0) @@ -1312,7 +1315,7 @@ This list contains 1461 plugins. :pypi:`pytest-telegram-notifier` Telegram notification plugin for Pytest Jun 27, 2023 5 - Production/Stable N/A :pypi:`pytest-tempdir` Predictable and repeatable tempdir support. Oct 11, 2019 4 - Beta pytest (>=2.8.1) :pypi:`pytest-terra-fixt` Terraform and Terragrunt fixtures for pytest Sep 15, 2022 N/A pytest (==6.2.5) - :pypi:`pytest-terraform` A pytest plugin for using terraform fixtures Jun 20, 2023 N/A pytest (>=6.0) + :pypi:`pytest-terraform` A pytest plugin for using terraform fixtures May 21, 2024 N/A pytest>=6.0 :pypi:`pytest-terraform-fixture` generate terraform resources to use with pytest Nov 14, 2018 4 - Beta N/A :pypi:`pytest-testbook` A plugin to run tests written in Jupyter notebook Dec 11, 2016 3 - Alpha N/A :pypi:`pytest-testconfig` Test configuration plugin for pytest. Jan 11, 2020 4 - Beta pytest (>=3.5.0) @@ -1469,7 +1472,7 @@ This list contains 1461 plugins. :pypi:`pytest-xlog` Extended logging for test and decorators May 31, 2020 4 - Beta N/A :pypi:`pytest-xlsx` pytest plugin for generating test cases by xlsx(excel) Apr 23, 2024 N/A pytest~=7.0 :pypi:`pytest-xpara` An extended parametrizing plugin of pytest. Oct 30, 2017 3 - Alpha pytest - :pypi:`pytest-xprocess` A pytest plugin for managing processes across test runs. Mar 31, 2024 4 - Beta pytest>=2.8 + :pypi:`pytest-xprocess` A pytest plugin for managing processes across test runs. May 19, 2024 4 - Beta pytest>=2.8 :pypi:`pytest-xray` May 30, 2019 3 - Alpha N/A :pypi:`pytest-xrayjira` Mar 17, 2020 3 - Alpha pytest (==4.3.1) :pypi:`pytest-xray-server` May 03, 2022 3 - Alpha pytest (>=5.3.1) @@ -2026,9 +2029,9 @@ This list contains 1461 plugins. Pytest fixtures for async generators :pypi:`pytest-asyncio` - *last release*: Mar 19, 2024, + *last release*: May 19, 2024, *status*: 4 - Beta, - *requires*: pytest <9,>=7.0.0 + *requires*: pytest<9,>=7.0.0 Pytest support for asyncio @@ -2152,7 +2155,7 @@ This list contains 1461 plugins. pytest plugin for testing AWS resource configurations :pypi:`pytest-aws-apigateway` - *last release*: May 18, 2024, + *last release*: May 24, 2024, *status*: 4 - Beta, *requires*: pytest @@ -2257,7 +2260,7 @@ This list contains 1461 plugins. BDD for pytest :pypi:`pytest-bdd-report` - *last release*: Feb 19, 2024, + *last release*: May 20, 2024, *status*: N/A, *requires*: pytest >=7.1.3 @@ -2299,7 +2302,7 @@ This list contains 1461 plugins. Pytest plugin to run your tests with beartype checking enabled. :pypi:`pytest-bec-e2e` - *last release*: May 17, 2024, + *last release*: May 21, 2024, *status*: 3 - Alpha, *requires*: pytest @@ -2894,7 +2897,7 @@ This list contains 1461 plugins. Easy quality control for CLDF datasets using pytest :pypi:`pytest-cleanslate` - *last release*: May 15, 2024, + *last release*: May 20, 2024, *status*: N/A, *requires*: pytest @@ -3068,6 +3071,13 @@ This list contains 1461 plugins. Get executed interface information in pytest interface automation framework + :pypi:`pytest-collect-jmeter-report-tests` + *last release*: May 20, 2024, + *status*: 4 - Beta, + *requires*: pytest>=7.2.1 + + A simple plugin to use with pytest + :pypi:`pytest-collector` *last release*: Aug 02, 2022, *status*: N/A, @@ -3426,7 +3436,7 @@ This list contains 1461 plugins. Useful functions for managing data for pytest fixtures :pypi:`pytest-databases` - *last release*: Apr 21, 2024, + *last release*: May 25, 2024, *status*: 4 - Beta, *requires*: pytest @@ -3839,9 +3849,9 @@ This list contains 1461 plugins. A pytest plugin for running django in class-scoped fixtures :pypi:`pytest-django-docker-pg` - *last release*: Jan 30, 2024, + *last release*: May 21, 2024, *status*: 5 - Production/Stable, - *requires*: pytest <8.0.0,>=7.0.0 + *requires*: pytest<9.0.0,>=7.0.0 @@ -4364,56 +4374,56 @@ This list contains 1461 plugins. Send execution result email :pypi:`pytest-embedded` - *last release*: Apr 30, 2024, + *last release*: May 23, 2024, *status*: 5 - Production/Stable, *requires*: pytest>=7.0 A pytest plugin that designed for embedded testing. :pypi:`pytest-embedded-arduino` - *last release*: Apr 30, 2024, + *last release*: May 23, 2024, *status*: 5 - Production/Stable, *requires*: N/A Make pytest-embedded plugin work with Arduino. :pypi:`pytest-embedded-idf` - *last release*: Apr 30, 2024, + *last release*: May 23, 2024, *status*: 5 - Production/Stable, *requires*: N/A Make pytest-embedded plugin work with ESP-IDF. :pypi:`pytest-embedded-jtag` - *last release*: Apr 30, 2024, + *last release*: May 23, 2024, *status*: 5 - Production/Stable, *requires*: N/A Make pytest-embedded plugin work with JTAG. :pypi:`pytest-embedded-qemu` - *last release*: Apr 30, 2024, + *last release*: May 23, 2024, *status*: 5 - Production/Stable, *requires*: N/A Make pytest-embedded plugin work with QEMU. :pypi:`pytest-embedded-serial` - *last release*: Apr 30, 2024, + *last release*: May 23, 2024, *status*: 5 - Production/Stable, *requires*: N/A Make pytest-embedded plugin work with Serial. :pypi:`pytest-embedded-serial-esp` - *last release*: Apr 30, 2024, + *last release*: May 23, 2024, *status*: 5 - Production/Stable, *requires*: N/A Make pytest-embedded plugin work with Espressif target boards. :pypi:`pytest-embedded-wokwi` - *last release*: Apr 30, 2024, + *last release*: May 23, 2024, *status*: 5 - Production/Stable, *requires*: N/A @@ -5778,7 +5788,7 @@ This list contains 1461 plugins. Generates a static html report based on pytest framework :pypi:`pytest-html-report-merger` - *last release*: Oct 23, 2023, + *last release*: May 22, 2024, *status*: N/A, *requires*: N/A @@ -6023,7 +6033,7 @@ This list contains 1461 plugins. A py.test plugin providing fixtures to simplify inmanta modules testing. :pypi:`pytest-inmanta-extensions` - *last release*: Apr 02, 2024, + *last release*: May 24, 2024, *status*: 5 - Production/Stable, *requires*: N/A @@ -6274,6 +6284,13 @@ This list contains 1461 plugins. Generate JSON test reports + :pypi:`pytest-json-ctrf` + *last release*: May 21, 2024, + *status*: N/A, + *requires*: pytest>6.0.0 + + Pytest plugin to generate json report in CTRF (Common Test Report Format) + :pypi:`pytest-json-fixtures` *last release*: Mar 14, 2023, *status*: 4 - Beta, @@ -6309,6 +6326,13 @@ This list contains 1461 plugins. A pytest plugin to perform JSONSchema validations + :pypi:`pytest-jtl-collector` + *last release*: May 20, 2024, + *status*: 4 - Beta, + *requires*: pytest>=7.2.1 + + A simple plugin to use with pytest + :pypi:`pytest-jtr` *last release*: Apr 15, 2024, *status*: N/A, @@ -6625,7 +6649,7 @@ This list contains 1461 plugins. Generate local badges (shields) reporting your test suite status. :pypi:`pytest-localftpserver` - *last release*: May 17, 2024, + *last release*: May 19, 2024, *status*: 5 - Production/Stable, *requires*: pytest @@ -6716,9 +6740,9 @@ This list contains 1461 plugins. :pypi:`pytest-logikal` - *last release*: Mar 30, 2024, + *last release*: May 23, 2024, *status*: 5 - Production/Stable, - *requires*: pytest==8.1.1 + *requires*: pytest==8.2.1 Common testing environment @@ -6744,7 +6768,7 @@ This list contains 1461 plugins. pytest plugin for looping tests :pypi:`pytest-lsp` - *last release*: Feb 07, 2024, + *last release*: May 22, 2024, *status*: 3 - Alpha, *requires*: pytest @@ -6989,7 +7013,7 @@ This list contains 1461 plugins. A plugin to test mp :pypi:`pytest-minio-mock` - *last release*: Apr 27, 2024, + *last release*: May 19, 2024, *status*: N/A, *requires*: pytest>=5.0.0 @@ -7311,9 +7335,9 @@ This list contains 1461 plugins. Pytest plugin to check mypy output. :pypi:`pytest-mysql` - *last release*: Oct 30, 2023, + *last release*: May 23, 2024, *status*: 5 - Production/Stable, - *requires*: pytest >=6.2 + *requires*: pytest>=6.2 MySQL process and client fixtures for pytest @@ -7402,7 +7426,7 @@ This list contains 1461 plugins. pytest ngs fixtures :pypi:`pytest-nhsd-apim` - *last release*: May 17, 2024, + *last release*: May 20, 2024, *status*: N/A, *requires*: pytest<9.0.0,>=8.2.0 @@ -7765,13 +7789,6 @@ This list contains 1461 plugins. Configure pytest fixtures using a combination of"parametrize" and markers - :pypi:`pytest-parameterize-from-files` - *last release*: Feb 15, 2024, - *status*: 4 - Beta, - *requires*: pytest>=7.2.0 - - A pytest plugin that parameterizes tests from data files. - :pypi:`pytest-parametrization` *last release*: May 22, 2022, *status*: 5 - Production/Stable, @@ -7906,9 +7923,9 @@ This list contains 1461 plugins. :pypi:`pytest-perf` - *last release*: Jan 28, 2024, + *last release*: May 20, 2024, *status*: 5 - Production/Stable, - *requires*: pytest >=6 ; extra == 'testing' + *requires*: pytest!=8.1.*,>=6; extra == "testing" Run performance tests against the mainline code. @@ -7927,7 +7944,7 @@ This list contains 1461 plugins. A performance plugin for pytest :pypi:`pytest-persistence` - *last release*: Jul 04, 2023, + *last release*: May 23, 2024, *status*: N/A, *requires*: N/A @@ -7941,7 +7958,7 @@ This list contains 1461 plugins. Pytest pexpect plugin. :pypi:`pytest-pg` - *last release*: Apr 03, 2024, + *last release*: May 21, 2024, *status*: 5 - Production/Stable, *requires*: pytest>=6.0.0 @@ -8060,7 +8077,7 @@ This list contains 1461 plugins. A pytest wrapper with fixtures for Playwright to automate web browsers :pypi:`pytest_playwright_async` - *last release*: May 04, 2024, + *last release*: May 24, 2024, *status*: N/A, *requires*: N/A @@ -8137,9 +8154,9 @@ This list contains 1461 plugins. :pypi:`pytest-pogo` - *last release*: Mar 11, 2024, + *last release*: May 22, 2024, *status*: 1 - Planning, - *requires*: pytest (>=7,<9) + *requires*: pytest<9,>=7 Pytest plugin for pogo-migrate @@ -8585,9 +8602,9 @@ This list contains 1461 plugins. Pytest-pyvista package :pypi:`pytest-qaseio` - *last release*: Sep 12, 2023, + *last release*: May 22, 2024, *status*: 4 - Beta, - *requires*: pytest (>=7.2.2,<8.0.0) + *requires*: pytest<9.0.0,>=7.2.2 Pytest plugin for Qase.io integration @@ -9096,7 +9113,7 @@ This list contains 1461 plugins. pytest plugin to re-run tests to eliminate flaky failures :pypi:`pytest-reserial` - *last release*: Feb 08, 2024, + *last release*: May 23, 2024, *status*: 4 - Beta, *requires*: pytest @@ -9271,7 +9288,7 @@ This list contains 1461 plugins. pytest plugin for ROAST configuration override and fixtures :pypi:`pytest_robotframework` - *last release*: May 18, 2024, + *last release*: May 24, 2024, *status*: N/A, *requires*: pytest<9,>=7 @@ -9459,6 +9476,13 @@ This list contains 1461 plugins. pytest plugin for test scenarios + :pypi:`pytest-scenario-files` + *last release*: May 19, 2024, + *status*: 5 - Production/Stable, + *requires*: pytest>=7.2.0 + + A pytest plugin that generates unit test scenarios from data files. + :pypi:`pytest-schedule` *last release*: Jan 07, 2023, *status*: 5 - Production/Stable, @@ -10083,9 +10107,9 @@ This list contains 1461 plugins. pytest plugin with sqlalchemy related fixtures :pypi:`pytest-sqlalchemy-mock` - *last release*: Mar 15, 2023, + *last release*: May 21, 2024, *status*: 3 - Alpha, - *requires*: pytest (>=2.0) + *requires*: pytest>=7.0.0 pytest sqlalchemy plugin for mock @@ -10447,9 +10471,9 @@ This list contains 1461 plugins. Terraform and Terragrunt fixtures for pytest :pypi:`pytest-terraform` - *last release*: Jun 20, 2023, + *last release*: May 21, 2024, *status*: N/A, - *requires*: pytest (>=6.0) + *requires*: pytest>=6.0 A pytest plugin for using terraform fixtures @@ -11546,7 +11570,7 @@ This list contains 1461 plugins. An extended parametrizing plugin of pytest. :pypi:`pytest-xprocess` - *last release*: Mar 31, 2024, + *last release*: May 19, 2024, *status*: 4 - Beta, *requires*: pytest>=2.8 From c3c51037f0a18e65d49aac093d9bd7a2e924f0a2 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Sat, 25 May 2024 22:02:28 +0300 Subject: [PATCH 21/53] unittest: fix class instances no longer released on test teardown since pytest 8.2.0 Fix #12367. --- changelog/12367.bugfix.rst | 1 + src/_pytest/unittest.py | 3 ++- testing/test_unittest.py | 36 ++++++++++++++++++++---------------- 3 files changed, 23 insertions(+), 17 deletions(-) create mode 100644 changelog/12367.bugfix.rst diff --git a/changelog/12367.bugfix.rst b/changelog/12367.bugfix.rst new file mode 100644 index 000000000..e8bf2e4f1 --- /dev/null +++ b/changelog/12367.bugfix.rst @@ -0,0 +1 @@ +Fix a regression in pytest 8.2.0 where unittest class instances (a fresh one is created for each test) were not released promptly on test teardown but only on session teardown. diff --git a/src/_pytest/unittest.py b/src/_pytest/unittest.py index 919b497c2..643443f08 100644 --- a/src/_pytest/unittest.py +++ b/src/_pytest/unittest.py @@ -218,11 +218,12 @@ class TestCaseFunction(Function): super().setup() def teardown(self) -> None: - super().teardown() if self._explicit_tearDown is not None: self._explicit_tearDown() self._explicit_tearDown = None self._obj = None + self._instance = None + super().teardown() def startTest(self, testcase: "unittest.TestCase") -> None: pass diff --git a/testing/test_unittest.py b/testing/test_unittest.py index 003a74d38..c359715dc 100644 --- a/testing/test_unittest.py +++ b/testing/test_unittest.py @@ -1,5 +1,4 @@ # mypy: allow-untyped-defs -import gc import sys from typing import List @@ -192,30 +191,35 @@ def test_teardown(pytester: Pytester) -> None: def test_teardown_issue1649(pytester: Pytester) -> None: """ Are TestCase objects cleaned up? Often unittest TestCase objects set - attributes that are large and expensive during setUp. + attributes that are large and expensive during test run or setUp. The TestCase will not be cleaned up if the test fails, because it would then exist in the stackframe. + + Regression test for #1649 (see also #12367). """ - testpath = pytester.makepyfile( + pytester.makepyfile( """ import unittest - class TestCaseObjectsShouldBeCleanedUp(unittest.TestCase): - def setUp(self): - self.an_expensive_object = 1 - def test_demo(self): - pass + import gc - """ + class TestCaseObjectsShouldBeCleanedUp(unittest.TestCase): + def test_expensive(self): + self.an_expensive_obj = object() + + def test_is_it_still_alive(self): + gc.collect() + for obj in gc.get_objects(): + if type(obj).__name__ == "TestCaseObjectsShouldBeCleanedUp": + assert not hasattr(obj, "an_expensive_obj") + break + else: + assert False, "Could not find TestCaseObjectsShouldBeCleanedUp instance" + """ ) - pytester.inline_run("-s", testpath) - gc.collect() - - # Either already destroyed, or didn't run setUp. - for obj in gc.get_objects(): - if type(obj).__name__ == "TestCaseObjectsShouldBeCleanedUp": - assert not hasattr(obj, "an_expensive_obj") + result = pytester.runpytest() + assert result.ret == ExitCode.OK def test_unittest_skip_issue148(pytester: Pytester) -> None: From 020db7ec046a7e84c431db7dbe5163887732602e Mon Sep 17 00:00:00 2001 From: James Frost Date: Sun, 26 May 2024 11:21:30 +0100 Subject: [PATCH 22/53] Add html_baseurl to sphinx conf.py (#12364) This is used to set the tag that points to the canonical version of the webpage. Including this indicates to search engines which version to include in their indexes, and should prevent older versions showing up. Fixes #12363 --- AUTHORS | 1 + changelog/12363.doc.rst | 1 + doc/en/conf.py | 3 +++ 3 files changed, 5 insertions(+) create mode 100644 changelog/12363.doc.rst diff --git a/AUTHORS b/AUTHORS index 18c60750e..748b9bae2 100644 --- a/AUTHORS +++ b/AUTHORS @@ -192,6 +192,7 @@ Jake VanderPlas Jakob van Santen Jakub Mitoraj James Bourbeau +James Frost Jan Balster Janne Vanhala Jason R. Coombs diff --git a/changelog/12363.doc.rst b/changelog/12363.doc.rst new file mode 100644 index 000000000..c657281ba --- /dev/null +++ b/changelog/12363.doc.rst @@ -0,0 +1 @@ +The documentation webpages now links to a canonical version to reduce outdated documentation in search engine results. diff --git a/doc/en/conf.py b/doc/en/conf.py index e64931ae5..738d07dc2 100644 --- a/doc/en/conf.py +++ b/doc/en/conf.py @@ -312,6 +312,9 @@ html_show_sourcelink = False # Output file base name for HTML help builder. htmlhelp_basename = "pytestdoc" +# The base URL which points to the root of the HTML documentation. It is used +# to indicate the location of document using the canonical link relation (#12363). +html_baseurl = "https://docs.pytest.org/en/stable/" # -- Options for LaTeX output -------------------------------------------------- From 24abe4eb03f64bfed301e6d70dfcf4f0c6a8cc0e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 27 May 2024 06:43:30 +0200 Subject: [PATCH 23/53] build(deps): Bump anyio[curio,trio] in /testing/plugins_integration (#12374) Bumps [anyio[curio,trio]](https://github.com/agronholm/anyio) from 4.3.0 to 4.4.0. - [Release notes](https://github.com/agronholm/anyio/releases) - [Changelog](https://github.com/agronholm/anyio/blob/master/docs/versionhistory.rst) - [Commits](https://github.com/agronholm/anyio/compare/4.3.0...4.4.0) --- updated-dependencies: - dependency-name: anyio[curio,trio] dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- testing/plugins_integration/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/plugins_integration/requirements.txt b/testing/plugins_integration/requirements.txt index 458cc2f97..cf6e4763d 100644 --- a/testing/plugins_integration/requirements.txt +++ b/testing/plugins_integration/requirements.txt @@ -1,4 +1,4 @@ -anyio[curio,trio]==4.3.0 +anyio[curio,trio]==4.4.0 django==5.0.6 pytest-asyncio==0.23.7 pytest-bdd==7.1.2 From 88fae23bdddef9db9dba771080e220cfea65356a Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Mon, 27 May 2024 21:18:03 +0200 Subject: [PATCH 24/53] [pylint] Fixes all ``use-maxplit-args``, ``consider-using-enumerate`` (#12172) * [pylint 'use-maxsplit-arg'] Do not split more than necessary when using the first element * [pylint 'consider-using-enumerate'] Use zip when iterating on two iterators * [pylint] 'cell-var-from-loop' and 'disallowed-name' permanent disable * [pylint] Disable 'possibly-used-before-assignment' following 3.2.0 release --- pyproject.toml | 7 +++---- src/_pytest/fixtures.py | 9 +++++++-- testing/test_reports.py | 12 ++++++------ testing/test_warnings.py | 6 ++---- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index e3c64b3e9..11590a90e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -181,13 +181,12 @@ disable = [ "bad-mcs-method-argument", "broad-exception-caught", "broad-exception-raised", - "cell-var-from-loop", + "cell-var-from-loop", # B023 from ruff / flake8-bugbear "comparison-of-constants", "comparison-with-callable", "comparison-with-itself", "condition-evals-to-constant", "consider-using-dict-items", - "consider-using-enumerate", "consider-using-from-import", "consider-using-f-string", "consider-using-in", @@ -195,7 +194,7 @@ disable = [ "consider-using-ternary", "consider-using-with", "cyclic-import", - "disallowed-name", + "disallowed-name", # foo / bar are used often in tests "duplicate-code", "eval-used", "exec-used", @@ -229,6 +228,7 @@ disable = [ "pointless-exception-statement", "pointless-statement", "pointless-string-statement", + "possibly-used-before-assignment", "protected-access", "raise-missing-from", "redefined-argument-from-local", @@ -276,7 +276,6 @@ disable = [ "useless-else-on-loop", "useless-import-alias", "useless-return", - "use-maxsplit-arg", "using-constant-test", "wrong-import-order", ] diff --git a/src/_pytest/fixtures.py b/src/_pytest/fixtures.py index 06da52aed..b7a58081b 100644 --- a/src/_pytest/fixtures.py +++ b/src/_pytest/fixtures.py @@ -1821,7 +1821,10 @@ def _show_fixtures_per_test(config: Config, session: "Session") -> None: fixture_doc = inspect.getdoc(fixture_def.func) if fixture_doc: write_docstring( - tw, fixture_doc.split("\n\n")[0] if verbose <= 0 else fixture_doc + tw, + fixture_doc.split("\n\n", maxsplit=1)[0] + if verbose <= 0 + else fixture_doc, ) else: tw.line(" no docstring available", red=True) @@ -1903,7 +1906,9 @@ def _showfixtures_main(config: Config, session: "Session") -> None: tw.write("\n") doc = inspect.getdoc(fixturedef.func) if doc: - write_docstring(tw, doc.split("\n\n")[0] if verbose <= 0 else doc) + write_docstring( + tw, doc.split("\n\n", maxsplit=1)[0] if verbose <= 0 else doc + ) else: tw.line(" no docstring available", red=True) tw.line() diff --git a/testing/test_reports.py b/testing/test_reports.py index c6baeebc9..7987b4017 100644 --- a/testing/test_reports.py +++ b/testing/test_reports.py @@ -100,14 +100,13 @@ class TestReportSerialization: rep_entries = rep.longrepr.reprtraceback.reprentries a_entries = a.longrepr.reprtraceback.reprentries - for i in range(len(a_entries)): - rep_entry = rep_entries[i] + assert len(rep_entries) == len(a_entries) # python < 3.10 zip(strict=True) + for a_entry, rep_entry in zip(a_entries, rep_entries): assert isinstance(rep_entry, ReprEntry) assert rep_entry.reprfileloc is not None assert rep_entry.reprfuncargs is not None assert rep_entry.reprlocals is not None - a_entry = a_entries[i] assert isinstance(a_entry, ReprEntry) assert a_entry.reprfileloc is not None assert a_entry.reprfuncargs is not None @@ -146,9 +145,10 @@ class TestReportSerialization: rep_entries = rep.longrepr.reprtraceback.reprentries a_entries = a.longrepr.reprtraceback.reprentries - for i in range(len(a_entries)): - assert isinstance(rep_entries[i], ReprEntryNative) - assert rep_entries[i].lines == a_entries[i].lines + assert len(rep_entries) == len(a_entries) # python < 3.10 zip(strict=True) + for rep_entry, a_entry in zip(rep_entries, a_entries): + assert isinstance(rep_entry, ReprEntryNative) + assert rep_entry.lines == a_entry.lines def test_itemreport_outcomes(self, pytester: Pytester) -> None: # This test came originally from test_remote.py in xdist (ca03269). diff --git a/testing/test_warnings.py b/testing/test_warnings.py index 770454e83..73c8c1b32 100644 --- a/testing/test_warnings.py +++ b/testing/test_warnings.py @@ -280,10 +280,8 @@ def test_warning_recorded_hook(pytester: Pytester) -> None: ("call warning", "runtest", "test_warning_recorded_hook.py::test_func"), ("teardown warning", "runtest", "test_warning_recorded_hook.py::test_func"), ] - for index in range(len(expected)): - collected_result = collected[index] - expected_result = expected[index] - + assert len(collected) == len(expected) # python < 3.10 zip(strict=True) + for collected_result, expected_result in zip(collected, expected): assert collected_result[0] == expected_result[0], str(collected) assert collected_result[1] == expected_result[1], str(collected) assert collected_result[2] == expected_result[2], str(collected) From 48cb8a2b329d0e8beaf30804c503eddb5e531385 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 27 May 2024 22:31:18 +0000 Subject: [PATCH 25/53] [pre-commit.ci] pre-commit autoupdate (#12380) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [pre-commit.ci] pre-commit autoupdate updates: - [github.com/astral-sh/ruff-pre-commit: v0.4.4 → v0.4.5](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.4...v0.4.5) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- src/_pytest/_code/code.py | 4 ++-- src/_pytest/config/__init__.py | 2 +- src/_pytest/doctest.py | 2 +- src/_pytest/threadexception.py | 4 ++-- src/_pytest/unraisableexception.py | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f20f61761..64bdbb36a 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.4.4" + rev: "v0.4.5" hooks: - id: ruff args: ["--fix"] diff --git a/src/_pytest/_code/code.py b/src/_pytest/_code/code.py index cfa226bb7..4fb686a86 100644 --- a/src/_pytest/_code/code.py +++ b/src/_pytest/_code/code.py @@ -199,8 +199,8 @@ class TracebackEntry: rawentry: TracebackType, repr_style: Optional['Literal["short", "long"]'] = None, ) -> None: - self._rawentry: "Final" = rawentry - self._repr_style: "Final" = repr_style + self._rawentry: Final = rawentry + self._repr_style: Final = repr_style def with_repr_style( self, repr_style: Optional['Literal["short", "long"]'] diff --git a/src/_pytest/config/__init__.py b/src/_pytest/config/__init__.py index c698ea9a7..f3d3b3062 100644 --- a/src/_pytest/config/__init__.py +++ b/src/_pytest/config/__init__.py @@ -1913,7 +1913,7 @@ def parse_warning_filter( parts.append("") action_, message, category_, module, lineno_ = (s.strip() for s in parts) try: - action: "warnings._ActionKind" = warnings._getaction(action_) # type: ignore[attr-defined] + action: warnings._ActionKind = warnings._getaction(action_) # type: ignore[attr-defined] except warnings._OptionError as e: raise UsageError(error_template.format(error=str(e))) from None try: diff --git a/src/_pytest/doctest.py b/src/_pytest/doctest.py index 35a136762..2d7453b4e 100644 --- a/src/_pytest/doctest.py +++ b/src/_pytest/doctest.py @@ -298,7 +298,7 @@ class DoctestItem(Item): def runtest(self) -> None: _check_all_skipped(self.dtest) self._disable_output_capturing_for_darwin() - failures: List["doctest.DocTestFailure"] = [] + failures: List[doctest.DocTestFailure] = [] # Type ignored because we change the type of `out` from what # doctest expects. self.runner.run(self.dtest, out=failures) # type: ignore[arg-type] diff --git a/src/_pytest/threadexception.py b/src/_pytest/threadexception.py index 09faf661b..603a1777c 100644 --- a/src/_pytest/threadexception.py +++ b/src/_pytest/threadexception.py @@ -34,8 +34,8 @@ class catch_threading_exception: """ def __init__(self) -> None: - self.args: Optional["threading.ExceptHookArgs"] = None - self._old_hook: Optional[Callable[["threading.ExceptHookArgs"], Any]] = None + self.args: Optional[threading.ExceptHookArgs] = None + self._old_hook: Optional[Callable[[threading.ExceptHookArgs], Any]] = None def _hook(self, args: "threading.ExceptHookArgs") -> None: self.args = args diff --git a/src/_pytest/unraisableexception.py b/src/_pytest/unraisableexception.py index f649267ab..50b121e88 100644 --- a/src/_pytest/unraisableexception.py +++ b/src/_pytest/unraisableexception.py @@ -34,8 +34,8 @@ class catch_unraisable_exception: """ def __init__(self) -> None: - self.unraisable: Optional["sys.UnraisableHookArgs"] = None - self._old_hook: Optional[Callable[["sys.UnraisableHookArgs"], Any]] = None + self.unraisable: Optional[sys.UnraisableHookArgs] = None + self._old_hook: Optional[Callable[[sys.UnraisableHookArgs], Any]] = None def _hook(self, unraisable: "sys.UnraisableHookArgs") -> None: # Storing unraisable.object can resurrect an object which is being From 9f121e85a78310e50acde71082dc0df3e5ce895c Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Tue, 28 May 2024 13:47:00 -0300 Subject: [PATCH 26/53] Clarify pytest_ignore_collect docs (#12385) Fixes #12383 Co-authored-by: Ran Benita --- src/_pytest/hookspec.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/_pytest/hookspec.py b/src/_pytest/hookspec.py index 8a38ff4fb..c7f9d036c 100644 --- a/src/_pytest/hookspec.py +++ b/src/_pytest/hookspec.py @@ -311,7 +311,12 @@ def pytest_collection_finish(session: "Session") -> None: def pytest_ignore_collect( collection_path: Path, path: "LEGACY_PATH", config: "Config" ) -> Optional[bool]: - """Return True to prevent considering this path for collection. + """Return ``True`` to ignore this path for collection. + + Return ``None`` to let other plugins ignore the path for collection. + + Returning ``False`` will forcefully *not* ignore this path for collection, + without giving a chance for other plugins to ignore this path. This hook is consulted for all files and directories prior to calling more specific hooks. From 383659d0be02e8ce5cb47f70961877dcec943018 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 29 May 2024 13:39:29 +0200 Subject: [PATCH 27/53] build(deps): Bump hynek/build-and-inspect-python-package (#12373) Bumps [hynek/build-and-inspect-python-package](https://github.com/hynek/build-and-inspect-python-package) from 2.5.0 to 2.6.0. - [Release notes](https://github.com/hynek/build-and-inspect-python-package/releases) - [Changelog](https://github.com/hynek/build-and-inspect-python-package/blob/main/CHANGELOG.md) - [Commits](https://github.com/hynek/build-and-inspect-python-package/compare/v2.5.0...v2.6.0) --- updated-dependencies: - dependency-name: hynek/build-and-inspect-python-package dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/deploy.yml | 2 +- .github/workflows/test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 20a72270f..640a0f1c2 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -31,7 +31,7 @@ jobs: persist-credentials: false - name: Build and Check Package - uses: hynek/build-and-inspect-python-package@v2.5.0 + uses: hynek/build-and-inspect-python-package@v2.6.0 with: attest-build-provenance-github: 'true' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 09d37aaa2..45e9c918a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -35,7 +35,7 @@ jobs: fetch-depth: 0 persist-credentials: false - name: Build and Check Package - uses: hynek/build-and-inspect-python-package@v2.5.0 + uses: hynek/build-and-inspect-python-package@v2.6.0 build: needs: [package] From db67d5c8749273ebed23788526ad511e342d8b8d Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Mon, 27 May 2024 22:18:59 +0200 Subject: [PATCH 28/53] [pylint 'use-yield-from'] Fix all occurences in existing code --- src/_pytest/_py/path.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/_pytest/_py/path.py b/src/_pytest/_py/path.py index bcb05ac34..c7ab1182f 100644 --- a/src/_pytest/_py/path.py +++ b/src/_pytest/_py/path.py @@ -161,15 +161,13 @@ class Visitor: ) if not self.breadthfirst: for subdir in dirs: - for p in self.gen(subdir): - yield p + yield from self.gen(subdir) for p in self.optsort(entries): if self.fil is None or self.fil(p): yield p if self.breadthfirst: for subdir in dirs: - for p in self.gen(subdir): - yield p + yield from self.gen(subdir) class FNMatcher: From c45afde35d3a81ff27b6ae6c31c515b12d499338 Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Mon, 27 May 2024 22:34:02 +0200 Subject: [PATCH 29/53] [pylint 'consider-using-sys-exit'] Fix all occurences in existing code --- extra/get_issues.py | 3 ++- pyproject.toml | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/extra/get_issues.py b/extra/get_issues.py index a0c2f19ad..64e859e0c 100644 --- a/extra/get_issues.py +++ b/extra/get_issues.py @@ -1,5 +1,6 @@ import json from pathlib import Path +import sys import requests @@ -17,7 +18,7 @@ def get_issues(): if r.status_code == 403: # API request limit exceeded print(data["message"]) - exit(1) + sys.exit(1) issues.extend(data) # Look for next page diff --git a/pyproject.toml b/pyproject.toml index 11590a90e..4594595e2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -190,7 +190,6 @@ disable = [ "consider-using-from-import", "consider-using-f-string", "consider-using-in", - "consider-using-sys-exit", "consider-using-ternary", "consider-using-with", "cyclic-import", From 0d33cdf02a2b742a63be75cbb2309803ea51c525 Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Mon, 27 May 2024 23:12:29 +0200 Subject: [PATCH 30/53] [pylint] Disable the only 'misplaced-bare-raise' --- pyproject.toml | 3 +-- src/_pytest/logging.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 4594595e2..3e01d048e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -211,10 +211,9 @@ disable = [ "keyword-arg-before-vararg", "line-too-long", "method-hidden", - "misplaced-bare-raise", "missing-docstring", "missing-timeout", - "multiple-statements", + "multiple-statements", # multiple-statements-on-one-line-colon (E701) from ruff "no-else-break", "no-else-continue", "no-else-raise", diff --git a/src/_pytest/logging.py b/src/_pytest/logging.py index af5e443ce..c9139d369 100644 --- a/src/_pytest/logging.py +++ b/src/_pytest/logging.py @@ -401,7 +401,7 @@ class LogCaptureHandler(logging_StreamHandler): # The default behavior of logging is to print "Logging error" # to stderr with the call stack and some extra details. # pytest wants to make such mistakes visible during testing. - raise + raise # pylint: disable=misplaced-bare-raise @final From 908e112999c62307c891603bb509cf691ea66f66 Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Sun, 31 Mar 2024 23:59:08 +0200 Subject: [PATCH 31/53] [pylint 'implicit-str-concat'] fix existing unwanted implicit str concat --- pyproject.toml | 1 - testing/_py/test_local.py | 2 +- testing/test_cacheprovider.py | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 3e01d048e..0627c94c7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -200,7 +200,6 @@ disable = [ "expression-not-assigned", "fixme", "global-statement", - "implicit-str-concat", "import-error", "import-outside-toplevel", "inconsistent-return-statements", diff --git a/testing/_py/test_local.py b/testing/_py/test_local.py index ea5794b25..0215aba96 100644 --- a/testing/_py/test_local.py +++ b/testing/_py/test_local.py @@ -207,7 +207,7 @@ class CommonFSTests: @pytest.mark.parametrize( "fil", - ["*dir", "*dir", pytest.mark.skip("sys.version_info <" " (3,6)")(b"*dir")], + ["*dir", "*dir", pytest.mark.skip("sys.version_info < (3,6)")(b"*dir")], ) def test_visit_filterfunc_is_string(self, path1, fil): lst = [] diff --git a/testing/test_cacheprovider.py b/testing/test_cacheprovider.py index 8728ae84f..08158f619 100644 --- a/testing/test_cacheprovider.py +++ b/testing/test_cacheprovider.py @@ -1163,7 +1163,7 @@ class TestNewFirst: ) p1.write_text( - "def test_1(): assert 1\n" "def test_2(): assert 1\n", encoding="utf-8" + "def test_1(): assert 1\ndef test_2(): assert 1\n", encoding="utf-8" ) os.utime(p1, ns=(p1.stat().st_atime_ns, int(1e9))) From 10c6db2df2f6c40b212785ef00fc834cc5eb3288 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 30 May 2024 16:48:37 +0200 Subject: [PATCH 32/53] doc: Update trainings/events (#12401) --- doc/en/index.rst | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/doc/en/index.rst b/doc/en/index.rst index 2aebb0d6b..58527ea73 100644 --- a/doc/en/index.rst +++ b/doc/en/index.rst @@ -4,11 +4,10 @@ .. sidebar:: **Next Open Trainings and Events** - - `Professional Testing with Python `_, via `Python Academy `_ (3 day in-depth training): - * **June 11th to 13th 2024**, Remote - * **March 4th to 6th 2025**, Leipzig, Germany / Remote - - `pytest development sprint `_, **June 17th -- 22nd 2024** - - pytest tips and tricks for a better testsuite, `Europython 2024 `_, **July 8th -- 14th 2024** (3h), Prague + - `pytest development sprint `_, **June 17th -- 22nd 2024**, Klaus (AT) / Remote + - `pytest tips and tricks for a better testsuite `_, at `Europython 2024 `_, **July 8th -- 14th 2024** (3h), Prague (CZ) + - `pytest: Professionelles Testen (nicht nur) für Python `_, at `CH Open Workshoptage `_, **September 2nd 2024**, HSLU Rotkreuz (CH) + - `Professional Testing with Python `_, via `Python Academy `_ (3 day in-depth training), **March 4th -- 6th 2025**, Leipzig (DE) / Remote Also see :doc:`previous talks and blogposts ` From 98021838fd97e10e1c9095fcbd0abbb6432a83cb Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 2 Jun 2024 09:31:40 -0300 Subject: [PATCH 33/53] [automated] Update plugin list (#12405) Co-authored-by: pytest bot --- doc/en/reference/plugin_list.rst | 192 ++++++++++++++++++++----------- 1 file changed, 124 insertions(+), 68 deletions(-) diff --git a/doc/en/reference/plugin_list.rst b/doc/en/reference/plugin_list.rst index 5d2a93493..0f1162779 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 =7; extra == "pytest" - :pypi:`nuts` Network Unit Testing System Aug 11, 2023 N/A pytest (>=7.3.0,<8.0.0) + :pypi:`nuts` Network Unit Testing System May 28, 2024 N/A pytest<8,>=7 :pypi:`pytest-abq` Pytest integration for the ABQ universal test runner. Apr 07, 2023 N/A N/A :pypi:`pytest-abstracts` A contextmanager pytest fixture for handling multiple mock abstracts May 25, 2022 N/A N/A :pypi:`pytest-accept` A pytest-plugin for updating doctest outputs Feb 10, 2024 N/A pytest (>=6) @@ -124,6 +124,7 @@ This list contains 1464 plugins. :pypi:`pytest-automock` Pytest plugin for automatical mocks creation May 16, 2023 N/A pytest ; extra == 'dev' :pypi:`pytest-auto-parametrize` pytest plugin: avoid repeating arguments in parametrize Oct 02, 2016 3 - Alpha N/A :pypi:`pytest-autotest` This fixture provides a configured "driver" for Android Automated Testing, using uiautomator2. Aug 25, 2021 N/A pytest + :pypi:`pytest-aux` templates/examples and aux for pytest May 31, 2024 N/A N/A :pypi:`pytest-aviator` Aviator's Flakybot pytest plugin that automatically reruns flaky tests. Nov 04, 2022 4 - Beta pytest :pypi:`pytest-avoidance` Makes pytest skip tests that don not need rerunning May 23, 2019 4 - Beta pytest (>=3.5.0) :pypi:`pytest-aws` pytest plugin for testing AWS resource configurations Oct 04, 2017 4 - Beta N/A @@ -148,7 +149,7 @@ This list contains 1464 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. Jan 25, 2024 N/A pytest - :pypi:`pytest-bec-e2e` BEC pytest plugin for end-to-end tests May 21, 2024 3 - Alpha pytest + :pypi:`pytest-bec-e2e` BEC pytest plugin for end-to-end tests May 31, 2024 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 @@ -171,6 +172,7 @@ This list contains 1464 plugins. :pypi:`pytest-board` Local continuous test runner with pytest and watchdog. Jan 20, 2019 N/A N/A :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 May 27, 2024 5 - Production/Stable pytest>=8.2.0 :pypi:`pytest-bpdb` A py.test plug-in to enable drop to bpdb debugger on test failure. Jan 19, 2015 2 - Pre-Alpha N/A :pypi:`pytest-bq` BigQuery fixtures and fixture factories for Pytest. May 08, 2024 5 - Production/Stable pytest>=6.2 :pypi:`pytest-bravado` Pytest-bravado automatically generates from OpenAPI specification client fixtures. Feb 15, 2022 N/A N/A @@ -233,7 +235,7 @@ This list contains 1464 plugins. :pypi:`pytest-ckan` Backport of CKAN 2.9 pytest plugin and fixtures to CAKN 2.8 Apr 28, 2020 4 - Beta pytest :pypi:`pytest-clarity` A plugin providing an alternative, colourful diff output for failing assertions. Jun 11, 2021 N/A N/A :pypi:`pytest-cldf` Easy quality control for CLDF datasets using pytest Nov 07, 2022 N/A pytest (>=3.6) - :pypi:`pytest-cleanslate` Collects and executes pytest tests separately May 20, 2024 N/A pytest + :pypi:`pytest-cleanslate` Collects and executes pytest tests separately May 30, 2024 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 Mar 19, 2024 5 - Production/Stable N/A :pypi:`pytest-clerk` A set of pytest fixtures to help with integration testing with Clerk. Apr 19, 2024 N/A pytest<9.0.0,>=8.0.0 @@ -243,7 +245,7 @@ This list contains 1464 plugins. :pypi:`pytest-cloud` Distributed tests planner plugin for pytest testing framework. Oct 05, 2020 6 - Mature N/A :pypi:`pytest-cloudflare-worker` pytest plugin for testing cloudflare workers Mar 30, 2021 4 - Beta pytest (>=6.0.0) :pypi:`pytest-cloudist` Distribute tests to cloud machines without fuss Sep 02, 2022 4 - Beta pytest (>=7.1.2,<8.0.0) - :pypi:`pytest-cmake` Provide CMake module for Pytest May 12, 2024 N/A pytest<9,>=4 + :pypi:`pytest-cmake` Provide CMake module for Pytest May 31, 2024 N/A pytest<9,>=4 :pypi:`pytest-cmake-presets` Execute CMake Presets via pytest Dec 26, 2022 N/A pytest (>=7.2.0,<8.0.0) :pypi:`pytest-cobra` PyTest plugin for testing Smart Contracts for Ethereum blockchain. Jun 29, 2019 3 - Alpha pytest (<4.0.0,>=3.7.1) :pypi:`pytest_codeblocks` Test code blocks in your READMEs Sep 17, 2023 5 - Production/Stable pytest >= 7.0.0 @@ -302,13 +304,14 @@ This list contains 1464 plugins. :pypi:`pytest-custom-concurrency` Custom grouping concurrence for pytest Feb 08, 2021 N/A N/A :pypi:`pytest-custom-exit-code` Exit pytest test session with custom exit code in different scenarios Aug 07, 2019 4 - Beta pytest (>=4.0.2) :pypi:`pytest-custom-nodeid` Custom grouping for pytest-xdist, rename test cases name and test cases nodeid, support allure report Mar 07, 2021 N/A N/A + :pypi:`pytest-custom-outputs` A plugin that allows users to create and use custom outputs instead of the standard Pass and Fail May 30, 2024 4 - Beta pytest>=6.2.0 :pypi:`pytest-custom-report` Configure the symbols displayed for test outcomes Jan 30, 2019 N/A pytest :pypi:`pytest-custom-scheduling` Custom grouping for pytest-xdist, rename test cases name and test cases nodeid, support allure report Mar 01, 2021 N/A N/A :pypi:`pytest-cython` A plugin for testing Cython extension modules Apr 05, 2024 5 - Production/Stable pytest>=8 :pypi:`pytest-cython-collect` Jun 17, 2022 N/A pytest :pypi:`pytest-darker` A pytest plugin for checking of modified code using Darker Feb 25, 2024 N/A pytest <7,>=6.0.1 :pypi:`pytest-dash` pytest fixtures to run dash applications. Mar 18, 2019 N/A N/A - :pypi:`pytest-dashboard` Apr 22, 2024 N/A pytest<8.0.0,>=7.4.3 + :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. May 25, 2024 4 - Beta pytest :pypi:`pytest-databricks` Pytest plugin for remote Databricks notebooks testing Jul 29, 2020 N/A pytest @@ -362,7 +365,8 @@ This list contains 1464 plugins. :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. May 11, 2024 4 - Beta pytest!=6.0.0,<9,>=3.3.2 :pypi:`pytest-discover` Pytest plugin to record discovered tests in a file Mar 26, 2024 N/A pytest - :pypi:`pytest-ditto` Snapshot testing pytest plugin with minimal ceremony and flexible persistence formats. May 07, 2024 4 - Beta pytest>=3.5.0 + :pypi:`pytest-ditto` Snapshot testing pytest plugin with minimal ceremony and flexible persistence formats. May 29, 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-django` A Django plugin for pytest. Jan 30, 2024 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 @@ -444,13 +448,13 @@ This list contains 1464 plugins. :pypi:`pytest-eliot` An eliot plugin for pytest. Aug 31, 2022 1 - Planning pytest (>=5.4.0) :pypi:`pytest-elk-reporter` A simple plugin to use with pytest Apr 04, 2024 4 - Beta pytest>=3.5.0 :pypi:`pytest-email` Send execution result email Jul 08, 2020 N/A pytest - :pypi:`pytest-embedded` A pytest plugin that designed for embedded testing. May 23, 2024 5 - Production/Stable pytest>=7.0 + :pypi:`pytest-embedded` A pytest plugin that designed for embedded testing. May 31, 2024 5 - Production/Stable pytest>=7.0 :pypi:`pytest-embedded-arduino` Make pytest-embedded plugin work with Arduino. May 23, 2024 5 - Production/Stable N/A :pypi:`pytest-embedded-idf` Make pytest-embedded plugin work with ESP-IDF. May 23, 2024 5 - Production/Stable N/A :pypi:`pytest-embedded-jtag` Make pytest-embedded plugin work with JTAG. May 23, 2024 5 - Production/Stable N/A :pypi:`pytest-embedded-qemu` Make pytest-embedded plugin work with QEMU. May 23, 2024 5 - Production/Stable N/A - :pypi:`pytest-embedded-serial` Make pytest-embedded plugin work with Serial. May 23, 2024 5 - Production/Stable N/A - :pypi:`pytest-embedded-serial-esp` Make pytest-embedded plugin work with Espressif target boards. May 23, 2024 5 - Production/Stable N/A + :pypi:`pytest-embedded-serial` Make pytest-embedded plugin work with Serial. May 31, 2024 5 - Production/Stable N/A + :pypi:`pytest-embedded-serial-esp` Make pytest-embedded plugin work with Espressif target boards. May 31, 2024 5 - Production/Stable N/A :pypi:`pytest-embedded-wokwi` Make pytest-embedded plugin work with the Wokwi CLI. May 23, 2024 5 - Production/Stable N/A :pypi:`pytest-embrace` 💝 Dataclasses-as-tests. Describe the runtime once and multiply coverage with no boilerplate. Mar 25, 2023 N/A pytest (>=7.0,<8.0) :pypi:`pytest-emoji` A pytest plugin that adds emojis to your test result report Feb 19, 2019 4 - Beta pytest (>=4.2.1) @@ -480,6 +484,7 @@ This list contains 1464 plugins. :pypi:`pytest_exact_fixtures` Parse queries in Lucene and Elasticsearch syntaxes Feb 04, 2019 N/A N/A :pypi:`pytest-examples` Pytest plugin for testing examples in docstrings and markdown files. Jul 11, 2023 4 - Beta pytest>=7 :pypi:`pytest-exasol-itde` Feb 15, 2024 N/A pytest (>=7,<9) + :pypi:`pytest-exasol-saas` May 27, 2024 N/A pytest<9,>=7 :pypi:`pytest-excel` pytest plugin for generating excel reports Sep 14, 2023 5 - Production/Stable N/A :pypi:`pytest-exceptional` Better exceptions Mar 16, 2017 4 - Beta N/A :pypi:`pytest-exception-script` Walk your code through exception script to check it's resiliency to failures. Aug 04, 2020 3 - Alpha pytest @@ -520,7 +525,7 @@ This list contains 1464 plugins. :pypi:`pytest-fastest` Use SCM and coverage to run only needed tests Oct 04, 2023 4 - Beta pytest (>=4.4) :pypi:`pytest-fast-first` Pytest plugin that runs fast tests first Jan 19, 2023 3 - Alpha pytest :pypi:`pytest-faulthandler` py.test plugin that activates the fault handler module for tests (dummy package) Jul 04, 2019 6 - Mature pytest (>=5.0) - :pypi:`pytest-fauna` A collection of helpful test fixtures for Fauna DB. Apr 22, 2024 N/A N/A + :pypi:`pytest-fauna` A collection of helpful test fixtures for Fauna DB. May 30, 2024 N/A N/A :pypi:`pytest-fauxfactory` Integration of fauxfactory into pytest. Dec 06, 2017 5 - Production/Stable pytest (>=3.2) :pypi:`pytest-figleaf` py.test figleaf coverage plugin Jan 18, 2010 5 - Production/Stable N/A :pypi:`pytest-file` Pytest File Mar 18, 2024 1 - Planning N/A @@ -616,7 +621,6 @@ This list contains 1464 plugins. :pypi:`pytest-hardware-test-report` A simple plugin to use with pytest Apr 01, 2024 4 - Beta pytest<9.0.0,>=8.0.0 :pypi:`pytest-harmony` Chain tests and data with pytest Jan 17, 2023 N/A pytest (>=7.2.1,<8.0.0) :pypi:`pytest-harvest` Store data created during your pytest tests execution, and retrieve it at the end of the session, e.g. for applicative benchmarking purposes. Mar 16, 2024 5 - Production/Stable N/A - :pypi:`pytest-helm-chart` A plugin to provide different types and configs of Kubernetes clusters that can be used for testing. Jun 15, 2020 4 - Beta pytest (>=5.4.2,<6.0.0) :pypi:`pytest-helm-charts` A plugin to provide different types and configs of Kubernetes clusters that can be used for testing. Feb 07, 2024 4 - Beta pytest (>=8.0.0,<9.0.0) :pypi:`pytest-helm-templates` Pytest fixtures for unit testing the output of helm templates May 08, 2024 N/A pytest~=7.4.0; extra == "dev" :pypi:`pytest-helper` Functions to help in using the pytest testing framework May 31, 2019 5 - Production/Stable N/A @@ -630,7 +634,7 @@ This list contains 1464 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 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-custom-component` Experimental package to automatically extract test plugins for Home Assistant custom components May 18, 2024 3 - Alpha pytest==8.1.1 + :pypi:`pytest-homeassistant-custom-component` Experimental package to automatically extract test plugins for Home Assistant custom components May 31, 2024 3 - Alpha pytest==8.2.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-hot-reloading` Apr 18, 2024 N/A N/A @@ -743,7 +747,7 @@ This list contains 1464 plugins. :pypi:`pytest-kubernetes` Sep 14, 2023 N/A pytest (>=7.2.1,<8.0.0) :pypi:`pytest-kuunda` pytest plugin to help with test data setup for PySpark tests Feb 25, 2024 4 - Beta pytest >=6.2.0 :pypi:`pytest-kwparametrize` Alternate syntax for @pytest.mark.parametrize with test cases as dictionaries and default value fallbacks Jan 22, 2021 N/A pytest (>=6) - :pypi:`pytest-lambda` Define pytest fixtures with lambda functions. Aug 20, 2022 3 - Alpha pytest (>=3.6,<8) + :pypi:`pytest-lambda` Define pytest fixtures with lambda functions. May 27, 2024 5 - Production/Stable pytest<9,>=3.6 :pypi:`pytest-lamp` Jan 06, 2017 3 - Alpha N/A :pypi:`pytest-langchain` Pytest-style test runner for langchain agents Feb 26, 2023 N/A pytest :pypi:`pytest-lark` Create fancy and clear HTML test reports. Nov 05, 2023 N/A N/A @@ -817,13 +821,13 @@ This list contains 1464 plugins. :pypi:`pytest-messenger` Pytest to Slack reporting plugin Nov 24, 2022 5 - Production/Stable N/A :pypi:`pytest-metadata` pytest plugin for test session metadata Feb 12, 2024 5 - Production/Stable pytest>=7.0.0 :pypi:`pytest-metrics` Custom metrics report for pytest Apr 04, 2020 N/A pytest - :pypi:`pytest-mh` Pytest multihost plugin Mar 14, 2024 N/A pytest + :pypi:`pytest-mh` Pytest multihost plugin May 28, 2024 N/A pytest :pypi:`pytest-mimesis` Mimesis integration with the pytest test runner Mar 21, 2020 5 - Production/Stable pytest (>=4.2) :pypi:`pytest-minecraft` A pytest plugin for running tests against Minecraft releases Apr 06, 2022 N/A pytest (>=6.0.1) :pypi:`pytest-mini` A plugin to test mp Feb 06, 2023 N/A pytest (>=7.2.0,<8.0.0) - :pypi:`pytest-minio-mock` A pytest plugin for mocking Minio S3 interactions May 19, 2024 N/A pytest>=5.0.0 + :pypi:`pytest-minio-mock` A pytest plugin for mocking Minio S3 interactions May 26, 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-mitmproxy` pytest plugin for mitmproxy tests Mar 07, 2024 N/A pytest >=7.0 + :pypi:`pytest-mitmproxy` pytest plugin for mitmproxy tests May 28, 2024 N/A pytest>=7.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 @@ -839,7 +843,6 @@ This list contains 1464 plugins. :pypi:`pytest-modalt` Massively distributed pytest runs using modal.com Feb 27, 2024 4 - Beta pytest >=6.2.0 :pypi:`pytest-modified-env` Pytest plugin to fail a test if it leaves modified \`os.environ\` afterwards. Jan 29, 2022 4 - Beta N/A :pypi:`pytest-modifyjunit` Utility for adding additional properties to junit xml for IDM QE Jan 10, 2019 N/A N/A - :pypi:`pytest-modifyscope` pytest plugin to modify fixture scope Apr 12, 2020 N/A pytest :pypi:`pytest-molecule` PyTest Molecule Plugin :: discover and run molecule tests Mar 29, 2022 5 - Production/Stable pytest (>=7.0.0) :pypi:`pytest-molecule-JC` PyTest Molecule Plugin :: discover and run molecule tests Jul 18, 2023 5 - Production/Stable pytest (>=7.0.0) :pypi:`pytest-mongo` MongoDB process and client fixtures plugin for Pytest. Mar 13, 2024 5 - Production/Stable pytest >=6.2 @@ -907,7 +910,7 @@ This list contains 1464 plugins. :pypi:`pytest-offline` Mar 09, 2023 1 - Planning pytest (>=7.0.0,<8.0.0) :pypi:`pytest-ogsm-plugin` 针对特定项目定制化插件,优化了pytest报告展示方式,并添加了项目所需特定参数 May 16, 2023 N/A N/A :pypi:`pytest-ok` The ultimate pytest output plugin Apr 01, 2019 4 - Beta N/A - :pypi:`pytest-only` Use @pytest.mark.only to run a single test Mar 09, 2024 5 - Production/Stable pytest (<7.1) ; python_full_version <= "3.6.0" + :pypi:`pytest-only` Use @pytest.mark.only to run a single test May 27, 2024 5 - Production/Stable pytest<9,>=3.6.0 :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 Apr 16, 2020 3 - Alpha pytest (>=4.6) @@ -1019,6 +1022,7 @@ This list contains 1464 plugins. :pypi:`pytest-psqlgraph` pytest plugin for testing applications that use psqlgraph Oct 19, 2021 4 - Beta pytest (>=6.0) :pypi:`pytest-pt` pytest plugin to use \*.pt files as tests May 15, 2024 4 - Beta pytest :pypi:`pytest-ptera` Use ptera probes in tests Mar 01, 2022 N/A pytest (>=6.2.4,<7.0.0) + :pypi:`pytest-publish` Jun 01, 2024 N/A pytest<9.0.0,>=8.0.0 :pypi:`pytest-pudb` Pytest PuDB debugger integration Oct 25, 2018 3 - Alpha pytest (>=2.0) :pypi:`pytest-pumpkin-spice` A pytest plugin that makes your test reporting pumpkin-spiced Sep 18, 2022 4 - Beta N/A :pypi:`pytest-purkinje` py.test plugin for purkinje test runner Oct 28, 2017 2 - Pre-Alpha N/A @@ -1048,7 +1052,8 @@ This list contains 1464 plugins. :pypi:`pytest-pytorch` pytest plugin for a better developer experience when working with the PyTorch test suite May 25, 2021 4 - Beta pytest :pypi:`pytest-pyvenv` A package for create venv in tests Feb 27, 2024 N/A pytest ; extra == 'test' :pypi:`pytest-pyvista` Pytest-pyvista package Sep 29, 2023 4 - Beta pytest>=3.5.0 - :pypi:`pytest-qaseio` Pytest plugin for Qase.io integration May 22, 2024 4 - Beta pytest<9.0.0,>=7.2.2 + :pypi:`pytest-qanova` A pytest plugin to collect test information May 26, 2024 3 - Alpha pytest + :pypi:`pytest-qaseio` Pytest plugin for Qase.io integration May 30, 2024 4 - Beta pytest<9.0.0,>=7.2.2 :pypi:`pytest-qasync` Pytest support for qasync. Jul 12, 2021 4 - Beta pytest (>=5.4.0) :pypi:`pytest-qatouch` Pytest plugin for uploading test results to your QA Touch Testrun. Feb 14, 2023 4 - Beta pytest (>=6.2.0) :pypi:`pytest-qgis` A pytest plugin for testing QGIS python plugins Nov 29, 2023 5 - Production/Stable pytest >=6.0 @@ -1146,7 +1151,7 @@ This list contains 1464 plugins. :pypi:`pytest-rmsis` Sycronise pytest results to Jira RMsis Aug 10, 2022 N/A pytest (>=5.3.5) :pypi:`pytest-rng` Fixtures for seeding tests and making randomness reproducible Aug 08, 2019 5 - Production/Stable pytest :pypi:`pytest-roast` pytest plugin for ROAST configuration override and fixtures Nov 09, 2022 5 - Production/Stable pytest - :pypi:`pytest_robotframework` a pytest plugin that can run both python and robotframework tests while generating robot reports for them May 24, 2024 N/A pytest<9,>=7 + :pypi:`pytest_robotframework` a pytest plugin that can run both python and robotframework tests while generating robot reports for them May 29, 2024 N/A pytest<9,>=7 :pypi:`pytest-rocketchat` Pytest to Rocket.Chat reporting plugin Apr 18, 2021 5 - Production/Stable N/A :pypi:`pytest-rotest` Pytest integration with rotest Sep 08, 2019 N/A pytest (>=3.5.0) :pypi:`pytest-rpc` Extend py.test for RPC OpenStack testing. Feb 22, 2019 4 - Beta pytest (~=3.6) @@ -1258,7 +1263,7 @@ This list contains 1464 plugins. :pypi:`pytest-splitio` Split.io SDK integration for e2e tests Sep 22, 2020 N/A pytest (<7,>=5.0) :pypi:`pytest-split-tests` A Pytest plugin for running a subset of your tests by splitting them in to equally sized groups. Forked from Mark Adams' original project pytest-test-groups. Jul 30, 2021 5 - Production/Stable pytest (>=2.5) :pypi:`pytest-split-tests-tresorit` Feb 22, 2021 1 - Planning N/A - :pypi:`pytest-splunk-addon` A Dynamic test tool for Splunk Apps and Add-ons May 16, 2024 N/A pytest<8,>5.4.0 + :pypi:`pytest-splunk-addon` A Dynamic test tool for Splunk Apps and Add-ons May 27, 2024 N/A pytest<8,>5.4.0 :pypi:`pytest-splunk-addon-ui-smartx` Library to support testing Splunk Add-on UX May 10, 2024 N/A N/A :pypi:`pytest-splunk-env` pytest fixtures for interaction with Splunk Enterprise and Splunk Cloud Oct 22, 2020 N/A pytest (>=6.1.1,<7.0.0) :pypi:`pytest-sqitch` sqitch for pytest Apr 06, 2020 4 - Beta N/A @@ -1281,7 +1286,7 @@ This list contains 1464 plugins. :pypi:`pytest-stoq` A plugin to pytest stoq Feb 09, 2021 4 - Beta N/A :pypi:`pytest-store` Pytest plugin to store values from test runs Nov 16, 2023 3 - Alpha pytest (>=7.0.0) :pypi:`pytest-stress` A Pytest plugin that allows you to loop tests for a user defined amount of time. Dec 07, 2019 4 - Beta pytest (>=3.6.0) - :pypi:`pytest-structlog` Structured logging assertions Mar 13, 2024 N/A pytest + :pypi:`pytest-structlog` Structured logging assertions May 30, 2024 N/A pytest :pypi:`pytest-structmpd` provide structured temporary directory Oct 17, 2018 N/A N/A :pypi:`pytest-stub` Stub packages, modules and attributes. Apr 28, 2020 5 - Production/Stable N/A :pypi:`pytest-stubprocess` Provide stub implementations for subprocesses in Python tests Sep 17, 2018 3 - Alpha pytest (>=3.5.0) @@ -1323,7 +1328,7 @@ This list contains 1464 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. Oct 25, 2016 5 - Production/Stable N/A - :pypi:`pytest-testinfra` Test infrastructures Feb 15, 2024 5 - Production/Stable pytest >=6 + :pypi:`pytest-testinfra` Test infrastructures May 26, 2024 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-testlink-adaptor` pytest reporting plugin for testlink Dec 20, 2018 4 - Beta pytest (>=2.6) @@ -1352,6 +1357,7 @@ This list contains 1464 plugins. :pypi:`pytest-tesults` Tesults plugin for pytest Feb 15, 2024 5 - Production/Stable pytest >=3.5.0 :pypi:`pytest-textual-snapshot` Snapshot testing for Textual apps Aug 23, 2023 4 - Beta pytest (>=7.0.0) :pypi:`pytest-tezos` pytest-ligo Jan 16, 2020 4 - Beta N/A + :pypi:`pytest-tf` Test your OpenTofu and Terraform config using a PyTest plugin May 29, 2024 N/A pytest<9.0.0,>=8.2.1 :pypi:`pytest-th2-bdd` pytest_th2_bdd May 13, 2022 N/A N/A :pypi:`pytest-thawgun` Pytest plugin for time travel May 26, 2020 3 - Alpha N/A :pypi:`pytest-thread` Jul 07, 2023 N/A N/A @@ -1453,7 +1459,7 @@ This list contains 1464 plugins. :pypi:`pytest-webdriver` Selenium webdriver fixture for py.test May 28, 2019 5 - Production/Stable pytest :pypi:`pytest-webtest-extras` Pytest plugin to enhance pytest-html and allure reports of webtest projects by adding screenshots, comments and webpage sources. Nov 13, 2023 N/A pytest >= 7.0.0 :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 Mar 22, 2024 N/A pytest>=7.3.1 + :pypi:`pytest-when` Utility which makes mocking more readable and controllable May 28, 2024 N/A pytest>=7.3.1 :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-win32consoletitle` Pytest progress in console title (Win32 only) Aug 08, 2021 N/A N/A @@ -1477,6 +1483,7 @@ This list contains 1464 plugins. :pypi:`pytest-xrayjira` Mar 17, 2020 3 - Alpha pytest (==4.3.1) :pypi:`pytest-xray-server` May 03, 2022 3 - Alpha pytest (>=5.3.1) :pypi:`pytest-xskynet` A package to prevent Dependency Confusion attacks against Yandex. Feb 20, 2024 N/A N/A + :pypi:`pytest-xstress` Jun 01, 2024 N/A pytest<9.0.0,>=8.0.0 :pypi:`pytest-xvfb` A pytest plugin to run Xvfb (or Xephyr/Xvnc) for tests. May 29, 2023 4 - Beta pytest (>=2.8.1) :pypi:`pytest-xvirt` A pytest plugin to virtualize test. For example to transparently running them on a remote box. Oct 01, 2023 4 - Beta pytest >=7.1.0 :pypi:`pytest-yaml` This plugin is used to load yaml output to your test using pytest framework. Oct 05, 2018 N/A pytest @@ -1518,9 +1525,9 @@ This list contains 1464 plugins. Test whether your code is logging correctly 🪵 :pypi:`nuts` - *last release*: Aug 11, 2023, + *last release*: May 28, 2024, *status*: N/A, - *requires*: pytest (>=7.3.0,<8.0.0) + *requires*: pytest<8,>=7 Network Unit Testing System @@ -2133,6 +2140,13 @@ This list contains 1464 plugins. This fixture provides a configured "driver" for Android Automated Testing, using uiautomator2. + :pypi:`pytest-aux` + *last release*: May 31, 2024, + *status*: N/A, + *requires*: N/A + + templates/examples and aux for pytest + :pypi:`pytest-aviator` *last release*: Nov 04, 2022, *status*: 4 - Beta, @@ -2302,7 +2316,7 @@ This list contains 1464 plugins. Pytest plugin to run your tests with beartype checking enabled. :pypi:`pytest-bec-e2e` - *last release*: May 21, 2024, + *last release*: May 31, 2024, *status*: 3 - Alpha, *requires*: pytest @@ -2462,6 +2476,13 @@ This list contains 1464 plugins. + :pypi:`pytest-boto-mock` + *last release*: May 27, 2024, + *status*: 5 - Production/Stable, + *requires*: pytest>=8.2.0 + + Thin-wrapper around the mock package for easier use with pytest + :pypi:`pytest-bpdb` *last release*: Jan 19, 2015, *status*: 2 - Pre-Alpha, @@ -2897,7 +2918,7 @@ This list contains 1464 plugins. Easy quality control for CLDF datasets using pytest :pypi:`pytest-cleanslate` - *last release*: May 20, 2024, + *last release*: May 30, 2024, *status*: N/A, *requires*: pytest @@ -2967,7 +2988,7 @@ This list contains 1464 plugins. Distribute tests to cloud machines without fuss :pypi:`pytest-cmake` - *last release*: May 12, 2024, + *last release*: May 31, 2024, *status*: N/A, *requires*: pytest<9,>=4 @@ -3379,6 +3400,13 @@ This list contains 1464 plugins. Custom grouping for pytest-xdist, rename test cases name and test cases nodeid, support allure report + :pypi:`pytest-custom-outputs` + *last release*: May 30, 2024, + *status*: 4 - Beta, + *requires*: pytest>=6.2.0 + + A plugin that allows users to create and use custom outputs instead of the standard Pass and Fail + :pypi:`pytest-custom-report` *last release*: Jan 30, 2019, *status*: N/A, @@ -3422,7 +3450,7 @@ This list contains 1464 plugins. pytest fixtures to run dash applications. :pypi:`pytest-dashboard` - *last release*: Apr 22, 2024, + *last release*: May 30, 2024, *status*: N/A, *requires*: pytest<8.0.0,>=7.4.3 @@ -3800,12 +3828,19 @@ This list contains 1464 plugins. Pytest plugin to record discovered tests in a file :pypi:`pytest-ditto` - *last release*: May 07, 2024, + *last release*: May 29, 2024, *status*: 4 - Beta, *requires*: pytest>=3.5.0 Snapshot testing pytest plugin with minimal ceremony and flexible persistence formats. + :pypi:`pytest-ditto-pandas` + *last release*: May 29, 2024, + *status*: 4 - Beta, + *requires*: pytest>=3.5.0 + + pytest-ditto plugin for pandas snapshots. + :pypi:`pytest-django` *last release*: Jan 30, 2024, *status*: 5 - Production/Stable, @@ -4374,7 +4409,7 @@ This list contains 1464 plugins. Send execution result email :pypi:`pytest-embedded` - *last release*: May 23, 2024, + *last release*: May 31, 2024, *status*: 5 - Production/Stable, *requires*: pytest>=7.0 @@ -4409,14 +4444,14 @@ This list contains 1464 plugins. Make pytest-embedded plugin work with QEMU. :pypi:`pytest-embedded-serial` - *last release*: May 23, 2024, + *last release*: May 31, 2024, *status*: 5 - Production/Stable, *requires*: N/A Make pytest-embedded plugin work with Serial. :pypi:`pytest-embedded-serial-esp` - *last release*: May 23, 2024, + *last release*: May 31, 2024, *status*: 5 - Production/Stable, *requires*: N/A @@ -4625,6 +4660,13 @@ This list contains 1464 plugins. + :pypi:`pytest-exasol-saas` + *last release*: May 27, 2024, + *status*: N/A, + *requires*: pytest<9,>=7 + + + :pypi:`pytest-excel` *last release*: Sep 14, 2023, *status*: 5 - Production/Stable, @@ -4906,7 +4948,7 @@ This list contains 1464 plugins. py.test plugin that activates the fault handler module for tests (dummy package) :pypi:`pytest-fauna` - *last release*: Apr 22, 2024, + *last release*: May 30, 2024, *status*: N/A, *requires*: N/A @@ -5577,13 +5619,6 @@ This list contains 1464 plugins. Store data created during your pytest tests execution, and retrieve it at the end of the session, e.g. for applicative benchmarking purposes. - :pypi:`pytest-helm-chart` - *last release*: Jun 15, 2020, - *status*: 4 - Beta, - *requires*: pytest (>=5.4.2,<6.0.0) - - A plugin to provide different types and configs of Kubernetes clusters that can be used for testing. - :pypi:`pytest-helm-charts` *last release*: Feb 07, 2024, *status*: 4 - Beta, @@ -5676,9 +5711,9 @@ This list contains 1464 plugins. A pytest plugin for use with homeassistant custom components. :pypi:`pytest-homeassistant-custom-component` - *last release*: May 18, 2024, + *last release*: May 31, 2024, *status*: 3 - Alpha, - *requires*: pytest==8.1.1 + *requires*: pytest==8.2.0 Experimental package to automatically extract test plugins for Home Assistant custom components @@ -6467,9 +6502,9 @@ This list contains 1464 plugins. Alternate syntax for @pytest.mark.parametrize with test cases as dictionaries and default value fallbacks :pypi:`pytest-lambda` - *last release*: Aug 20, 2022, - *status*: 3 - Alpha, - *requires*: pytest (>=3.6,<8) + *last release*: May 27, 2024, + *status*: 5 - Production/Stable, + *requires*: pytest<9,>=3.6 Define pytest fixtures with lambda functions. @@ -6985,7 +7020,7 @@ This list contains 1464 plugins. Custom metrics report for pytest :pypi:`pytest-mh` - *last release*: Mar 14, 2024, + *last release*: May 28, 2024, *status*: N/A, *requires*: pytest @@ -7013,7 +7048,7 @@ This list contains 1464 plugins. A plugin to test mp :pypi:`pytest-minio-mock` - *last release*: May 19, 2024, + *last release*: May 26, 2024, *status*: N/A, *requires*: pytest>=5.0.0 @@ -7027,9 +7062,9 @@ This list contains 1464 plugins. Pytest plugin that creates missing fixtures :pypi:`pytest-mitmproxy` - *last release*: Mar 07, 2024, + *last release*: May 28, 2024, *status*: N/A, - *requires*: pytest >=7.0 + *requires*: pytest>=7.0 pytest plugin for mitmproxy tests @@ -7138,13 +7173,6 @@ This list contains 1464 plugins. Utility for adding additional properties to junit xml for IDM QE - :pypi:`pytest-modifyscope` - *last release*: Apr 12, 2020, - *status*: N/A, - *requires*: pytest - - pytest plugin to modify fixture scope - :pypi:`pytest-molecule` *last release*: Mar 29, 2022, *status*: 5 - Production/Stable, @@ -7615,9 +7643,9 @@ This list contains 1464 plugins. The ultimate pytest output plugin :pypi:`pytest-only` - *last release*: Mar 09, 2024, + *last release*: May 27, 2024, *status*: 5 - Production/Stable, - *requires*: pytest (<7.1) ; python_full_version <= "3.6.0" + *requires*: pytest<9,>=3.6.0 Use @pytest.mark.only to run a single test @@ -8398,6 +8426,13 @@ This list contains 1464 plugins. Use ptera probes in tests + :pypi:`pytest-publish` + *last release*: Jun 01, 2024, + *status*: N/A, + *requires*: pytest<9.0.0,>=8.0.0 + + + :pypi:`pytest-pudb` *last release*: Oct 25, 2018, *status*: 3 - Alpha, @@ -8601,8 +8636,15 @@ This list contains 1464 plugins. Pytest-pyvista package + :pypi:`pytest-qanova` + *last release*: May 26, 2024, + *status*: 3 - Alpha, + *requires*: pytest + + A pytest plugin to collect test information + :pypi:`pytest-qaseio` - *last release*: May 22, 2024, + *last release*: May 30, 2024, *status*: 4 - Beta, *requires*: pytest<9.0.0,>=7.2.2 @@ -9288,7 +9330,7 @@ This list contains 1464 plugins. pytest plugin for ROAST configuration override and fixtures :pypi:`pytest_robotframework` - *last release*: May 24, 2024, + *last release*: May 29, 2024, *status*: N/A, *requires*: pytest<9,>=7 @@ -10072,7 +10114,7 @@ This list contains 1464 plugins. :pypi:`pytest-splunk-addon` - *last release*: May 16, 2024, + *last release*: May 27, 2024, *status*: N/A, *requires*: pytest<8,>5.4.0 @@ -10233,7 +10275,7 @@ This list contains 1464 plugins. A Pytest plugin that allows you to loop tests for a user defined amount of time. :pypi:`pytest-structlog` - *last release*: Mar 13, 2024, + *last release*: May 30, 2024, *status*: N/A, *requires*: pytest @@ -10527,9 +10569,9 @@ This list contains 1464 plugins. A Pytest plugin for running a subset of your tests by splitting them in to equally sized groups. :pypi:`pytest-testinfra` - *last release*: Feb 15, 2024, + *last release*: May 26, 2024, *status*: 5 - Production/Stable, - *requires*: pytest >=6 + *requires*: pytest>=6 Test infrastructures @@ -10729,6 +10771,13 @@ This list contains 1464 plugins. pytest-ligo + :pypi:`pytest-tf` + *last release*: May 29, 2024, + *status*: N/A, + *requires*: pytest<9.0.0,>=8.2.1 + + Test your OpenTofu and Terraform config using a PyTest plugin + :pypi:`pytest-th2-bdd` *last release*: May 13, 2022, *status*: N/A, @@ -11437,7 +11486,7 @@ This list contains 1464 plugins. Welian API Automation test framework pytest plugin :pypi:`pytest-when` - *last release*: Mar 22, 2024, + *last release*: May 28, 2024, *status*: N/A, *requires*: pytest>=7.3.1 @@ -11604,6 +11653,13 @@ This list contains 1464 plugins. A package to prevent Dependency Confusion attacks against Yandex. + :pypi:`pytest-xstress` + *last release*: Jun 01, 2024, + *status*: N/A, + *requires*: pytest<9.0.0,>=8.0.0 + + + :pypi:`pytest-xvfb` *last release*: May 29, 2023, *status*: 4 - Beta, From 17065cb008caaf26a48128fec1721c7f3d92b4c2 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Sun, 2 Jun 2024 16:57:50 +0300 Subject: [PATCH 34/53] cacheprovider: fix "Directory not empty" crash from cache directory creation Fix #12381 Test plan: It's possible to write a deterministic test case for this, but somewhat of a hassle so I tested it manually. I reproduced by removing existing `.pytest_cache`, adding a sleep before the rename and running two pytests. I verified that it doesn't reproduce after the fix. --- changelog/12381.bugfix.rst | 1 + src/_pytest/cacheprovider.py | 27 +++++++++++++++++++-------- 2 files changed, 20 insertions(+), 8 deletions(-) create mode 100644 changelog/12381.bugfix.rst diff --git a/changelog/12381.bugfix.rst b/changelog/12381.bugfix.rst new file mode 100644 index 000000000..02233cd4a --- /dev/null +++ b/changelog/12381.bugfix.rst @@ -0,0 +1 @@ +Fix possible "Directory not empty" crashes arising from concurent cache dir (``.pytest_cache``) creation. Regressed in pytest 8.2.0. diff --git a/src/_pytest/cacheprovider.py b/src/_pytest/cacheprovider.py index 5aa8f4835..7e00135a4 100755 --- a/src/_pytest/cacheprovider.py +++ b/src/_pytest/cacheprovider.py @@ -4,6 +4,7 @@ # This plugin was not named "cache" to avoid conflicts with the external # pytest-cache version. import dataclasses +import errno import json import os from pathlib import Path @@ -227,14 +228,24 @@ class Cache: with open(path.joinpath("CACHEDIR.TAG"), "xb") as f: f.write(CACHEDIR_TAG_CONTENT) - path.rename(self._cachedir) - # Create a directory in place of the one we just moved so that `TemporaryDirectory`'s - # cleanup doesn't complain. - # - # TODO: pass ignore_cleanup_errors=True when we no longer support python < 3.10. See - # https://github.com/python/cpython/issues/74168. Note that passing delete=False would - # do the wrong thing in case of errors and isn't supported until python 3.12. - path.mkdir() + try: + path.rename(self._cachedir) + except OSError as e: + # If 2 concurrent pytests both race to the rename, the loser + # gets "Directory not empty" from the rename. In this case, + # everything is handled so just continue (while letting the + # temporary directory be cleaned up). + if e.errno != errno.ENOTEMPTY: + raise + else: + # Create a directory in place of the one we just moved so that + # `TemporaryDirectory`'s cleanup doesn't complain. + # + # TODO: pass ignore_cleanup_errors=True when we no longer support python < 3.10. + # See https://github.com/python/cpython/issues/74168. Note that passing + # delete=False would do the wrong thing in case of errors and isn't supported + # until python 3.12. + path.mkdir() class LFPluginCollWrapper: From 1eee63a891d3598e6d3178c3c793eecdd5940b5c Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Mon, 27 May 2024 00:44:05 +0300 Subject: [PATCH 35/53] fixtures: minor cleanups to reorder_items This makes some minor clarity and performance improvements to the code. --- src/_pytest/fixtures.py | 125 +++++++++++++++++++++------------------- 1 file changed, 65 insertions(+), 60 deletions(-) diff --git a/src/_pytest/fixtures.py b/src/_pytest/fixtures.py index b7a58081b..37fc44ff9 100644 --- a/src/_pytest/fixtures.py +++ b/src/_pytest/fixtures.py @@ -21,6 +21,7 @@ from typing import Generic from typing import Iterable from typing import Iterator from typing import List +from typing import Mapping from typing import MutableMapping from typing import NoReturn from typing import Optional @@ -161,6 +162,12 @@ def getfixturemarker(obj: object) -> Optional["FixtureFunctionMarker"]: ) +# Algorithm for sorting on a per-parametrized resource setup basis. +# It is called for Session scope first and performs sorting +# down to the lower scopes such as to minimize number of "high scope" +# setups and teardowns. + + @dataclasses.dataclass(frozen=True) class FixtureArgKey: argname: str @@ -169,97 +176,91 @@ class FixtureArgKey: item_cls: Optional[type] -def get_parametrized_fixture_keys( +_V = TypeVar("_V") +OrderedSet = Dict[_V, None] + + +def get_parametrized_fixture_argkeys( item: nodes.Item, scope: Scope ) -> Iterator[FixtureArgKey]: """Return list of keys for all parametrized arguments which match the specified scope.""" assert scope is not Scope.Function + try: callspec: CallSpec2 = item.callspec # type: ignore[attr-defined] except AttributeError: return + + item_cls = None + if scope is Scope.Session: + scoped_item_path = None + elif scope is Scope.Package: + # Package key = module's directory. + scoped_item_path = item.path.parent + elif scope is Scope.Module: + scoped_item_path = item.path + elif scope is Scope.Class: + scoped_item_path = item.path + item_cls = item.cls # type: ignore[attr-defined] + else: + assert_never(scope) + for argname in callspec.indices: if callspec._arg2scope[argname] != scope: continue - - item_cls = None - if scope is Scope.Session: - scoped_item_path = None - elif scope is Scope.Package: - # Package key = module's directory. - scoped_item_path = item.path.parent - elif scope is Scope.Module: - scoped_item_path = item.path - elif scope is Scope.Class: - scoped_item_path = item.path - item_cls = item.cls # type: ignore[attr-defined] - else: - assert_never(scope) - param_index = callspec.indices[argname] yield FixtureArgKey(argname, param_index, scoped_item_path, item_cls) -# Algorithm for sorting on a per-parametrized resource setup basis. -# It is called for Session scope first and performs sorting -# down to the lower scopes such as to minimize number of "high scope" -# setups and teardowns. - - def reorder_items(items: Sequence[nodes.Item]) -> List[nodes.Item]: - argkeys_cache: Dict[Scope, Dict[nodes.Item, Dict[FixtureArgKey, None]]] = {} + argkeys_by_item: Dict[Scope, Dict[nodes.Item, OrderedSet[FixtureArgKey]]] = {} items_by_argkey: Dict[Scope, Dict[FixtureArgKey, Deque[nodes.Item]]] = {} for scope in HIGH_SCOPES: - scoped_argkeys_cache = argkeys_cache[scope] = {} + scoped_argkeys_by_item = argkeys_by_item[scope] = {} scoped_items_by_argkey = items_by_argkey[scope] = defaultdict(deque) for item in items: - keys = dict.fromkeys(get_parametrized_fixture_keys(item, scope), None) - if keys: - scoped_argkeys_cache[item] = keys - for key in keys: - scoped_items_by_argkey[key].append(item) - items_dict = dict.fromkeys(items, None) + argkeys = dict.fromkeys(get_parametrized_fixture_argkeys(item, scope)) + if argkeys: + scoped_argkeys_by_item[item] = argkeys + for argkey in argkeys: + scoped_items_by_argkey[argkey].append(item) + + items_set = dict.fromkeys(items) return list( - reorder_items_atscope(items_dict, argkeys_cache, items_by_argkey, Scope.Session) + reorder_items_atscope( + items_set, argkeys_by_item, items_by_argkey, Scope.Session + ) ) -def fix_cache_order( - item: nodes.Item, - argkeys_cache: Dict[Scope, Dict[nodes.Item, Dict[FixtureArgKey, None]]], - items_by_argkey: Dict[Scope, Dict[FixtureArgKey, "Deque[nodes.Item]"]], -) -> None: - for scope in HIGH_SCOPES: - for key in argkeys_cache[scope].get(item, []): - items_by_argkey[scope][key].appendleft(item) - - def reorder_items_atscope( - items: Dict[nodes.Item, None], - argkeys_cache: Dict[Scope, Dict[nodes.Item, Dict[FixtureArgKey, None]]], - items_by_argkey: Dict[Scope, Dict[FixtureArgKey, "Deque[nodes.Item]"]], + items: OrderedSet[nodes.Item], + argkeys_by_item: Mapping[Scope, Mapping[nodes.Item, OrderedSet[FixtureArgKey]]], + items_by_argkey: Mapping[Scope, Mapping[FixtureArgKey, "Deque[nodes.Item]"]], scope: Scope, -) -> Dict[nodes.Item, None]: +) -> OrderedSet[nodes.Item]: if scope is Scope.Function or len(items) < 3: return items - ignore: Set[Optional[FixtureArgKey]] = set() - items_deque = deque(items) - items_done: Dict[nodes.Item, None] = {} + scoped_items_by_argkey = items_by_argkey[scope] - scoped_argkeys_cache = argkeys_cache[scope] + scoped_argkeys_by_item = argkeys_by_item[scope] + + ignore: Set[FixtureArgKey] = set() + items_deque = deque(items) + items_done: OrderedSet[nodes.Item] = {} while items_deque: - no_argkey_group: Dict[nodes.Item, None] = {} + no_argkey_items: OrderedSet[nodes.Item] = {} slicing_argkey = None while items_deque: item = items_deque.popleft() - if item in items_done or item in no_argkey_group: + if item in items_done or item in no_argkey_items: continue argkeys = dict.fromkeys( - (k for k in scoped_argkeys_cache.get(item, []) if k not in ignore), None + k for k in scoped_argkeys_by_item.get(item, ()) if k not in ignore ) if not argkeys: - no_argkey_group[item] = None + no_argkey_items[item] = None else: slicing_argkey, _ = argkeys.popitem() # We don't have to remove relevant items from later in the @@ -268,16 +269,20 @@ def reorder_items_atscope( i for i in scoped_items_by_argkey[slicing_argkey] if i in items ] for i in reversed(matching_items): - fix_cache_order(i, argkeys_cache, items_by_argkey) items_deque.appendleft(i) + # Fix items_by_argkey order. + for other_scope in HIGH_SCOPES: + other_scoped_items_by_argkey = items_by_argkey[other_scope] + for argkey in argkeys_by_item[other_scope].get(i, ()): + other_scoped_items_by_argkey[argkey].appendleft(i) break - if no_argkey_group: - no_argkey_group = reorder_items_atscope( - no_argkey_group, argkeys_cache, items_by_argkey, scope.next_lower() + if no_argkey_items: + reordered_no_argkey_items = reorder_items_atscope( + no_argkey_items, argkeys_by_item, items_by_argkey, scope.next_lower() ) - for item in no_argkey_group: - items_done[item] = None - ignore.add(slicing_argkey) + items_done.update(reordered_no_argkey_items) + if slicing_argkey is not None: + ignore.add(slicing_argkey) return items_done From 7be95f9b30ffd418483bdb57112f9339465d4695 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 3 Jun 2024 14:11:41 +0200 Subject: [PATCH 36/53] code: do not truncate args when running with -vvv (#12241) Related to #2871. --- AUTHORS | 1 + changelog/2871.improvement.rst | 1 + src/_pytest/_code/code.py | 12 +++++++++++- src/_pytest/nodes.py | 3 +++ testing/code/test_excinfo.py | 24 ++++++++++++++++++++++++ testing/test_assertion.py | 33 +++++++++++++++++++++++++++++++++ 6 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 changelog/2871.improvement.rst diff --git a/AUTHORS b/AUTHORS index 748b9bae2..0560caf72 100644 --- a/AUTHORS +++ b/AUTHORS @@ -279,6 +279,7 @@ Michael Droettboom Michael Goerz Michael Krebs Michael Seifert +Michael Vogt Michal Wajszczuk Michał Górny Michał Zięba diff --git a/changelog/2871.improvement.rst b/changelog/2871.improvement.rst new file mode 100644 index 000000000..1ba399550 --- /dev/null +++ b/changelog/2871.improvement.rst @@ -0,0 +1 @@ +Do not truncate arguments to functions in output when running with `-vvv`. diff --git a/src/_pytest/_code/code.py b/src/_pytest/_code/code.py index 4fb686a86..b1ef9fe22 100644 --- a/src/_pytest/_code/code.py +++ b/src/_pytest/_code/code.py @@ -635,6 +635,7 @@ class ExceptionInfo(Generic[E]): ] = True, funcargs: bool = False, truncate_locals: bool = True, + truncate_args: bool = True, chain: bool = True, ) -> Union["ReprExceptionInfo", "ExceptionChainRepr"]: """Return str()able representation of this exception info. @@ -665,6 +666,9 @@ class ExceptionInfo(Generic[E]): :param bool truncate_locals: With ``showlocals==True``, make sure locals can be safely represented as strings. + :param bool truncate_args: + With ``showargs==True``, make sure args can be safely represented as strings. + :param bool chain: If chained exceptions in Python 3 should be shown. @@ -691,6 +695,7 @@ class ExceptionInfo(Generic[E]): tbfilter=tbfilter, funcargs=funcargs, truncate_locals=truncate_locals, + truncate_args=truncate_args, chain=chain, ) return fmt.repr_excinfo(self) @@ -809,6 +814,7 @@ class FormattedExcinfo: tbfilter: Union[bool, Callable[[ExceptionInfo[BaseException]], Traceback]] = True funcargs: bool = False truncate_locals: bool = True + truncate_args: bool = True chain: bool = True astcache: Dict[Union[str, Path], ast.AST] = dataclasses.field( default_factory=dict, init=False, repr=False @@ -839,7 +845,11 @@ class FormattedExcinfo: if self.funcargs: args = [] for argname, argvalue in entry.frame.getargs(var=True): - args.append((argname, saferepr(argvalue))) + if self.truncate_args: + str_repr = saferepr(argvalue) + else: + str_repr = saferepr(argvalue, maxsize=None) + args.append((argname, str_repr)) return ReprFuncArgs(args) return None diff --git a/src/_pytest/nodes.py b/src/_pytest/nodes.py index 974d756a2..e73101971 100644 --- a/src/_pytest/nodes.py +++ b/src/_pytest/nodes.py @@ -448,6 +448,8 @@ class Node(abc.ABC, metaclass=NodeMeta): else: truncate_locals = True + truncate_args = False if self.config.getoption("verbose", 0) > 2 else True + # excinfo.getrepr() formats paths relative to the CWD if `abspath` is False. # It is possible for a fixture/test to change the CWD while this code runs, which # would then result in the user seeing confusing paths in the failure message. @@ -466,6 +468,7 @@ class Node(abc.ABC, metaclass=NodeMeta): style=style, tbfilter=tbfilter, truncate_locals=truncate_locals, + truncate_args=truncate_args, ) def repr_failure( diff --git a/testing/code/test_excinfo.py b/testing/code/test_excinfo.py index b54745129..f7f780e98 100644 --- a/testing/code/test_excinfo.py +++ b/testing/code/test_excinfo.py @@ -11,6 +11,7 @@ import re import sys import textwrap from typing import Any +from typing import cast from typing import TYPE_CHECKING import _pytest._code @@ -712,6 +713,29 @@ raise ValueError() assert full_reprlocals.lines assert full_reprlocals.lines[0] == "l = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]" + def test_repr_args_not_truncated(self, importasmod) -> None: + mod = importasmod( + """ + def func1(m): + raise ValueError("hello\\nworld") + """ + ) + excinfo = pytest.raises(ValueError, mod.func1, "m" * 500) + excinfo.traceback = excinfo.traceback.filter(excinfo) + entry = excinfo.traceback[-1] + p = FormattedExcinfo(funcargs=True, truncate_args=True) + reprfuncargs = p.repr_args(entry) + assert reprfuncargs is not None + arg1 = cast(str, reprfuncargs.args[0][1]) + assert len(arg1) < 500 + assert "..." in arg1 + # again without truncate + p = FormattedExcinfo(funcargs=True, truncate_args=False) + reprfuncargs = p.repr_args(entry) + assert reprfuncargs is not None + assert reprfuncargs.args[0] == ("m", repr("m" * 500)) + assert "..." not in cast(str, reprfuncargs.args[0][1]) + def test_repr_tracebackentry_lines(self, importasmod) -> None: mod = importasmod( """ diff --git a/testing/test_assertion.py b/testing/test_assertion.py index a8960436b..726235999 100644 --- a/testing/test_assertion.py +++ b/testing/test_assertion.py @@ -2045,3 +2045,36 @@ def test_fine_grained_assertion_verbosity(pytester: Pytester): f"E AssertionError: assert 'hello world' in '{long_text}'", ] ) + + +def test_full_output_vvv(pytester: Pytester) -> None: + pytester.makepyfile( + r""" + def crash_helper(m): + assert 1 == 2 + def test_vvv(): + crash_helper(500 * "a") + """ + ) + result = pytester.runpytest("") + # without -vvv, the passed args are truncated + expected_non_vvv_arg_line = "m = 'aaaaaaaaaaaaaaa*..aaaaaaaaaaaa*" + result.stdout.fnmatch_lines( + [ + expected_non_vvv_arg_line, + "test_full_output_vvv.py:2: AssertionError", + ], + ) + # double check that the untruncated part is not in the output + expected_vvv_arg_line = "m = '{}'".format(500 * "a") + result.stdout.no_fnmatch_line(expected_vvv_arg_line) + + # but with "-vvv" the args are not truncated + result = pytester.runpytest("-vvv") + result.stdout.fnmatch_lines( + [ + expected_vvv_arg_line, + "test_full_output_vvv.py:2: AssertionError", + ] + ) + result.stdout.no_fnmatch_line(expected_non_vvv_arg_line) From 3433c7adf52a79592438d7af0637ae905657ee56 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 4 Jun 2024 09:06:33 +0200 Subject: [PATCH 37/53] [pre-commit.ci] pre-commit autoupdate (#12413) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.4.5 → v0.4.7](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.5...v0.4.7) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 64bdbb36a..6a9fde6a5 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.4.5" + rev: "v0.4.7" hooks: - id: ruff args: ["--fix"] From e89d23b24741c001e8651a77303992cfa41c1664 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Sun, 2 Jun 2024 17:57:38 +0300 Subject: [PATCH 38/53] fixtures: fix catastrophic performance problem in `reorder_items` Fix #12355. In the issue, it was reported that the `reorder_items` has quadratic (or worse...) behavior with certain simple parametrizations. After some debugging I found that the problem happens because the "Fix items_by_argkey order" loop keeps adding the same item to the deque, and it reaches epic sizes which causes the slowdown. I don't claim to understand how the `reorder_items` algorithm works, but if as far as I understand, if an item already exists in the deque, the correct thing to do is to move it to the front. Since a deque doesn't have such an (efficient) operation, this switches to `OrderedDict` which can efficiently append from both sides, deduplicate and move to front. --- changelog/12355.bugfix.rst | 1 + src/_pytest/fixtures.py | 20 +++++++++++++------- testing/python/fixtures.py | 19 +++++++++++++++++++ 3 files changed, 33 insertions(+), 7 deletions(-) create mode 100644 changelog/12355.bugfix.rst diff --git a/changelog/12355.bugfix.rst b/changelog/12355.bugfix.rst new file mode 100644 index 000000000..1ce43e60e --- /dev/null +++ b/changelog/12355.bugfix.rst @@ -0,0 +1 @@ +Fix possible catastrophic performance slowdown on a certain parametrization pattern involving many higher-scoped parameters. diff --git a/src/_pytest/fixtures.py b/src/_pytest/fixtures.py index 37fc44ff9..353082c17 100644 --- a/src/_pytest/fixtures.py +++ b/src/_pytest/fixtures.py @@ -25,6 +25,7 @@ from typing import Mapping from typing import MutableMapping from typing import NoReturn from typing import Optional +from typing import OrderedDict from typing import overload from typing import Sequence from typing import Set @@ -77,8 +78,6 @@ if sys.version_info < (3, 11): if TYPE_CHECKING: - from typing import Deque - from _pytest.main import Session from _pytest.python import CallSpec2 from _pytest.python import Function @@ -215,16 +214,18 @@ def get_parametrized_fixture_argkeys( def reorder_items(items: Sequence[nodes.Item]) -> List[nodes.Item]: argkeys_by_item: Dict[Scope, Dict[nodes.Item, OrderedSet[FixtureArgKey]]] = {} - items_by_argkey: Dict[Scope, Dict[FixtureArgKey, Deque[nodes.Item]]] = {} + items_by_argkey: Dict[ + Scope, Dict[FixtureArgKey, OrderedDict[nodes.Item, None]] + ] = {} for scope in HIGH_SCOPES: scoped_argkeys_by_item = argkeys_by_item[scope] = {} - scoped_items_by_argkey = items_by_argkey[scope] = defaultdict(deque) + scoped_items_by_argkey = items_by_argkey[scope] = defaultdict(OrderedDict) for item in items: argkeys = dict.fromkeys(get_parametrized_fixture_argkeys(item, scope)) if argkeys: scoped_argkeys_by_item[item] = argkeys for argkey in argkeys: - scoped_items_by_argkey[argkey].append(item) + scoped_items_by_argkey[argkey][item] = None items_set = dict.fromkeys(items) return list( @@ -237,7 +238,9 @@ def reorder_items(items: Sequence[nodes.Item]) -> List[nodes.Item]: def reorder_items_atscope( items: OrderedSet[nodes.Item], argkeys_by_item: Mapping[Scope, Mapping[nodes.Item, OrderedSet[FixtureArgKey]]], - items_by_argkey: Mapping[Scope, Mapping[FixtureArgKey, "Deque[nodes.Item]"]], + items_by_argkey: Mapping[ + Scope, Mapping[FixtureArgKey, OrderedDict[nodes.Item, None]] + ], scope: Scope, ) -> OrderedSet[nodes.Item]: if scope is Scope.Function or len(items) < 3: @@ -274,7 +277,10 @@ def reorder_items_atscope( for other_scope in HIGH_SCOPES: other_scoped_items_by_argkey = items_by_argkey[other_scope] for argkey in argkeys_by_item[other_scope].get(i, ()): - other_scoped_items_by_argkey[argkey].appendleft(i) + other_scoped_items_by_argkey[argkey][i] = None + other_scoped_items_by_argkey[argkey].move_to_end( + i, last=False + ) break if no_argkey_items: reordered_no_argkey_items = reorder_items_atscope( diff --git a/testing/python/fixtures.py b/testing/python/fixtures.py index d54bcc4d4..d3cff38f9 100644 --- a/testing/python/fixtures.py +++ b/testing/python/fixtures.py @@ -2219,6 +2219,25 @@ class TestAutouseManagement: reprec = pytester.inline_run("-s") reprec.assertoutcome(passed=2) + def test_reordering_catastrophic_performance(self, pytester: Pytester) -> None: + """Check that a certain high-scope parametrization pattern doesn't cause + a catasrophic slowdown. + + Regression test for #12355. + """ + pytester.makepyfile(""" + import pytest + + params = tuple("abcdefghijklmnopqrstuvwxyz") + @pytest.mark.parametrize(params, [range(len(params))] * 3, scope="module") + def test_parametrize(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z): + pass + """) + + result = pytester.runpytest() + + result.assert_outcomes(passed=3) + class TestFixtureMarker: def test_parametrize(self, pytester: Pytester) -> None: From 4cd80e19c51c9cc57470b51d0c1c05d355f79556 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Tue, 4 Jun 2024 16:51:13 +0300 Subject: [PATCH 39/53] Merge pull request #12415 from pytest-dev/release-8.2.2 Prepare release 8.2.2 (cherry picked from commit f3a494cca3bf0491f7277abff229a1331382ae26) --- changelog/12290.doc.rst | 1 - changelog/12355.bugfix.rst | 1 - changelog/12356.doc.rst | 2 -- changelog/12363.doc.rst | 1 - changelog/12367.bugfix.rst | 1 - changelog/12381.bugfix.rst | 1 - doc/en/announce/index.rst | 1 + doc/en/announce/release-8.2.2.rst | 19 +++++++++++++++++++ doc/en/builtin.rst | 4 ++-- doc/en/changelog.rst | 29 +++++++++++++++++++++++++++++ doc/en/example/parametrize.rst | 6 +++--- doc/en/example/pythoncollection.rst | 4 ++-- doc/en/getting-started.rst | 2 +- doc/en/how-to/fixtures.rst | 2 +- 14 files changed, 58 insertions(+), 16 deletions(-) delete mode 100644 changelog/12290.doc.rst delete mode 100644 changelog/12355.bugfix.rst delete mode 100644 changelog/12356.doc.rst delete mode 100644 changelog/12363.doc.rst delete mode 100644 changelog/12367.bugfix.rst delete mode 100644 changelog/12381.bugfix.rst create mode 100644 doc/en/announce/release-8.2.2.rst diff --git a/changelog/12290.doc.rst b/changelog/12290.doc.rst deleted file mode 100644 index 07fe3babc..000000000 --- a/changelog/12290.doc.rst +++ /dev/null @@ -1 +0,0 @@ -Updated Sphinx theme to use Furo instead of Flask, enabling Dark mode theme. diff --git a/changelog/12355.bugfix.rst b/changelog/12355.bugfix.rst deleted file mode 100644 index 1ce43e60e..000000000 --- a/changelog/12355.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fix possible catastrophic performance slowdown on a certain parametrization pattern involving many higher-scoped parameters. diff --git a/changelog/12356.doc.rst b/changelog/12356.doc.rst deleted file mode 100644 index 312c26d32..000000000 --- a/changelog/12356.doc.rst +++ /dev/null @@ -1,2 +0,0 @@ -Added a subsection to the documentation for debugging flaky tests to mention -lack of thread safety in pytest as a possible source of flakyness. diff --git a/changelog/12363.doc.rst b/changelog/12363.doc.rst deleted file mode 100644 index c657281ba..000000000 --- a/changelog/12363.doc.rst +++ /dev/null @@ -1 +0,0 @@ -The documentation webpages now links to a canonical version to reduce outdated documentation in search engine results. diff --git a/changelog/12367.bugfix.rst b/changelog/12367.bugfix.rst deleted file mode 100644 index e8bf2e4f1..000000000 --- a/changelog/12367.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fix a regression in pytest 8.2.0 where unittest class instances (a fresh one is created for each test) were not released promptly on test teardown but only on session teardown. diff --git a/changelog/12381.bugfix.rst b/changelog/12381.bugfix.rst deleted file mode 100644 index 02233cd4a..000000000 --- a/changelog/12381.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fix possible "Directory not empty" crashes arising from concurent cache dir (``.pytest_cache``) creation. Regressed in pytest 8.2.0. diff --git a/doc/en/announce/index.rst b/doc/en/announce/index.rst index 8a33f7fb5..c65eb5f36 100644 --- a/doc/en/announce/index.rst +++ b/doc/en/announce/index.rst @@ -6,6 +6,7 @@ Release announcements :maxdepth: 2 + release-8.2.2 release-8.2.1 release-8.2.0 release-8.1.2 diff --git a/doc/en/announce/release-8.2.2.rst b/doc/en/announce/release-8.2.2.rst new file mode 100644 index 000000000..3b1d93bd0 --- /dev/null +++ b/doc/en/announce/release-8.2.2.rst @@ -0,0 +1,19 @@ +pytest-8.2.2 +======================================= + +pytest 8.2.2 has just been released to PyPI. + +This is a bug-fix release, being a drop-in replacement. To upgrade:: + + pip install --upgrade pytest + +The full changelog is available at https://docs.pytest.org/en/stable/changelog.html. + +Thanks to all of the contributors to this release: + +* Bruno Oliveira +* Ran Benita + + +Happy testing, +The pytest Development Team diff --git a/doc/en/builtin.rst b/doc/en/builtin.rst index 458253fab..8dfffb082 100644 --- a/doc/en/builtin.rst +++ b/doc/en/builtin.rst @@ -22,7 +22,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a cachedir: .pytest_cache rootdir: /home/sweet/project collected 0 items - cache -- .../_pytest/cacheprovider.py:549 + cache -- .../_pytest/cacheprovider.py:560 Return a cache object that can persist state between testing sessions. cache.get(key, default) @@ -115,7 +115,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a For more details: :ref:`doctest_namespace`. - pytestconfig [session scope] -- .../_pytest/fixtures.py:1335 + pytestconfig [session scope] -- .../_pytest/fixtures.py:1338 Session-scoped fixture that returns the session's :class:`pytest.Config` object. diff --git a/doc/en/changelog.rst b/doc/en/changelog.rst index ca7f5b999..3ab2307ee 100644 --- a/doc/en/changelog.rst +++ b/doc/en/changelog.rst @@ -28,6 +28,35 @@ with advance notice in the **Deprecations** section of releases. .. towncrier release notes start +pytest 8.2.2 (2024-06-04) +========================= + +Bug Fixes +--------- + +- `#12355 `_: Fix possible catastrophic performance slowdown on a certain parametrization pattern involving many higher-scoped parameters. + + +- `#12367 `_: Fix a regression in pytest 8.2.0 where unittest class instances (a fresh one is created for each test) were not released promptly on test teardown but only on session teardown. + + +- `#12381 `_: Fix possible "Directory not empty" crashes arising from concurent cache dir (``.pytest_cache``) creation. Regressed in pytest 8.2.0. + + + +Improved Documentation +---------------------- + +- `#12290 `_: Updated Sphinx theme to use Furo instead of Flask, enabling Dark mode theme. + + +- `#12356 `_: Added a subsection to the documentation for debugging flaky tests to mention + lack of thread safety in pytest as a possible source of flakyness. + + +- `#12363 `_: The documentation webpages now links to a canonical version to reduce outdated documentation in search engine results. + + pytest 8.2.1 (2024-05-19) ========================= diff --git a/doc/en/example/parametrize.rst b/doc/en/example/parametrize.rst index 03f6852e5..d540bf083 100644 --- a/doc/en/example/parametrize.rst +++ b/doc/en/example/parametrize.rst @@ -162,7 +162,7 @@ objects, they are still using the default pytest representation: rootdir: /home/sweet/project collected 8 items - + @@ -239,7 +239,7 @@ If you just collect tests you'll also nicely see 'advanced' and 'basic' as varia rootdir: /home/sweet/project collected 4 items - + @@ -318,7 +318,7 @@ Let's first see how it looks like at collection time: rootdir: /home/sweet/project collected 2 items - + diff --git a/doc/en/example/pythoncollection.rst b/doc/en/example/pythoncollection.rst index aa9d05d72..39b799ed9 100644 --- a/doc/en/example/pythoncollection.rst +++ b/doc/en/example/pythoncollection.rst @@ -152,7 +152,7 @@ The test collection would look like this: configfile: pytest.ini collected 2 items - + @@ -215,7 +215,7 @@ You can always peek at the collection tree without running tests like this: configfile: pytest.ini collected 3 items - + diff --git a/doc/en/getting-started.rst b/doc/en/getting-started.rst index 94e0d80e6..85bee729b 100644 --- a/doc/en/getting-started.rst +++ b/doc/en/getting-started.rst @@ -22,7 +22,7 @@ Install ``pytest`` .. code-block:: bash $ pytest --version - pytest 8.2.1 + pytest 8.2.2 .. _`simpletest`: diff --git a/doc/en/how-to/fixtures.rst b/doc/en/how-to/fixtures.rst index 6cc20c8c3..35c3238de 100644 --- a/doc/en/how-to/fixtures.rst +++ b/doc/en/how-to/fixtures.rst @@ -1418,7 +1418,7 @@ Running the above tests results in the following test IDs being used: rootdir: /home/sweet/project collected 12 items - + From c9d8765381d71197fc981a9636828aea5063dc7f Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Mon, 3 Jun 2024 19:16:56 +0300 Subject: [PATCH 40/53] fixtures: change `register_fixture` to not accept `scope=None` There is no reason to allow this. --- src/_pytest/fixtures.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_pytest/fixtures.py b/src/_pytest/fixtures.py index 353082c17..c078898dd 100644 --- a/src/_pytest/fixtures.py +++ b/src/_pytest/fixtures.py @@ -1636,7 +1636,7 @@ class FixtureManager: func: "_FixtureFunc[object]", nodeid: Optional[str], scope: Union[ - Scope, _ScopeName, Callable[[str, Config], _ScopeName], None + Scope, _ScopeName, Callable[[str, Config], _ScopeName] ] = "function", params: Optional[Sequence[object]] = None, ids: Optional[ From 043ff9abc657124db3504d3604e16ddebfe6e28f Mon Sep 17 00:00:00 2001 From: holger krekel Date: Thu, 6 Jun 2024 12:24:31 +0200 Subject: [PATCH 41/53] Remove hp42 contact details from the documentation (#12427) --- doc/en/contact.rst | 7 ------- 1 file changed, 7 deletions(-) diff --git a/doc/en/contact.rst b/doc/en/contact.rst index beed10d7f..68efef522 100644 --- a/doc/en/contact.rst +++ b/doc/en/contact.rst @@ -26,19 +26,12 @@ Contact channels `_, or `via Matrix `_). -- private mail to Holger.Krekel at gmail com if you want to communicate sensitive issues - - -- `merlinux.eu`_ offers pytest and tox-related professional teaching and - consulting. .. _`pytest issue tracker`: https://github.com/pytest-dev/pytest/issues .. _`old issue tracker`: https://bitbucket.org/hpk42/py-trunk/issues/ .. _`pytest discussions`: https://github.com/pytest-dev/pytest/discussions -.. _`merlinux.eu`: https://merlinux.eu/ - .. _`get an account`: .. _tetamap: https://tetamap.wordpress.com/ From 6b2daaa2e9c8c325bdcb0886fc90d2df198af405 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20K=C5=82oczko?= <31284574+kloczek@users.noreply.github.com> Date: Thu, 6 Jun 2024 22:52:29 +0100 Subject: [PATCH 42/53] [pre-commit] Add pyupgrade back as a manual stage (#12418) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Launchable with ``pre-commit run --hook-stage manual pyupgrade -a`` --------- Signed-off-by: Tomasz Kłoczko Co-authored-by: Pierre Sassoulas --- .pre-commit-config.yaml | 5 +++++ testing/test_unittest.py | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6a9fde6a5..fb583b111 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -43,6 +43,11 @@ repos: - id: pyproject-fmt # https://pyproject-fmt.readthedocs.io/en/latest/#calculating-max-supported-python-version additional_dependencies: ["tox>=4.9"] +- repo: https://github.com/asottile/pyupgrade + rev: v3.15.2 + hooks: + - id: pyupgrade + stages: [manual] - repo: local hooks: - id: pylint diff --git a/testing/test_unittest.py b/testing/test_unittest.py index c359715dc..9561cad5e 100644 --- a/testing/test_unittest.py +++ b/testing/test_unittest.py @@ -384,7 +384,7 @@ def test_testcase_adderrorandfailure_defers(pytester: Pytester, type: str) -> No @pytest.mark.parametrize("type", ["Error", "Failure"]) def test_testcase_custom_exception_info(pytester: Pytester, type: str) -> None: pytester.makepyfile( - """ + f""" from typing import Generic, TypeVar from unittest import TestCase import pytest, _pytest._code @@ -413,7 +413,7 @@ def test_testcase_custom_exception_info(pytester: Pytester, type: str) -> None: def test_hello(self): pass - """.format(**locals()) + """ ) result = pytester.runpytest() result.stdout.fnmatch_lines( From f94109937123ff5a9c780a74ed043e9467c4f1f2 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 7 Jun 2024 02:32:33 -0400 Subject: [PATCH 43/53] Cleanup MockAwareDocTestFinder. (#12431) * Only rely on _find_lineno on Python 3.10 and earlier. * Update docstring to reflect current expectation. * Only rely on _find on Python 3.9 and earlier. * Mark line as uncovered. * Remove empty else block (implicit is better than explicit). Closes #12430 Closes #12432 --- src/_pytest/doctest.py | 66 +++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/src/_pytest/doctest.py b/src/_pytest/doctest.py index 2d7453b4e..23ad7a7a9 100644 --- a/src/_pytest/doctest.py +++ b/src/_pytest/doctest.py @@ -505,43 +505,46 @@ class DoctestModule(Module): import doctest class MockAwareDocTestFinder(doctest.DocTestFinder): - """A hackish doctest finder that overrides stdlib internals to fix a stdlib bug. + if sys.version_info < (3, 11): - https://github.com/pytest-dev/pytest/issues/3456 - https://bugs.python.org/issue25532 - """ + def _find_lineno(self, obj, source_lines): + """On older Pythons, doctest code does not take into account + `@property`. https://github.com/python/cpython/issues/61648 - def _find_lineno(self, obj, source_lines): - """Doctest code does not take into account `@property`, this - is a hackish way to fix it. https://bugs.python.org/issue17446 + Moreover, wrapped Doctests need to be unwrapped so the correct + line number is returned. #8796 + """ + if isinstance(obj, property): + obj = getattr(obj, "fget", obj) - Wrapped Doctests will need to be unwrapped so the correct - line number is returned. This will be reported upstream. #8796 - """ - if isinstance(obj, property): - obj = getattr(obj, "fget", obj) + if hasattr(obj, "__wrapped__"): + # Get the main obj in case of it being wrapped + obj = inspect.unwrap(obj) - if hasattr(obj, "__wrapped__"): - # Get the main obj in case of it being wrapped - obj = inspect.unwrap(obj) - - # Type ignored because this is a private function. - return super()._find_lineno( # type:ignore[misc] - obj, - source_lines, - ) - - def _find( - self, tests, obj, name, module, source_lines, globs, seen - ) -> None: - if _is_mocked(obj): - return - with _patch_unwrap_mock_aware(): # Type ignored because this is a private function. - super()._find( # type:ignore[misc] - tests, obj, name, module, source_lines, globs, seen + return super()._find_lineno( # type:ignore[misc] + obj, + source_lines, ) + if sys.version_info < (3, 10): + + def _find( + self, tests, obj, name, module, source_lines, globs, seen + ) -> None: + """Override _find to work around issue in stdlib. + + https://github.com/pytest-dev/pytest/issues/3456 + https://github.com/python/cpython/issues/69718 + """ + if _is_mocked(obj): + return # pragma: no cover + with _patch_unwrap_mock_aware(): + # Type ignored because this is a private function. + super()._find( # type:ignore[misc] + tests, obj, name, module, source_lines, globs, seen + ) + if sys.version_info < (3, 13): def _from_module(self, module, object): @@ -556,9 +559,6 @@ class DoctestModule(Module): # Type ignored because this is a private function. return super()._from_module(module, object) # type: ignore[misc] - else: # pragma: no cover - pass - try: module = self.obj except Collector.CollectError: From c07bbdfa5bc39b20ddc529fed83f3a405354ca75 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Tue, 4 Jun 2024 23:29:14 +0300 Subject: [PATCH 44/53] Avoid some TYPE_CHECKING It's better not to use it when possible. --- src/_pytest/_code/code.py | 12 ++++++------ src/_pytest/config/__init__.py | 17 ++++++++--------- src/_pytest/debugging.py | 14 +++++--------- src/_pytest/fixtures.py | 2 +- src/_pytest/main.py | 5 +++-- src/_pytest/mark/structures.py | 2 +- src/_pytest/nodes.py | 6 +++--- src/_pytest/stepwise.py | 7 +------ src/_pytest/unittest.py | 17 +++++++++-------- testing/code/test_excinfo.py | 6 +++--- 10 files changed, 40 insertions(+), 48 deletions(-) diff --git a/src/_pytest/_code/code.py b/src/_pytest/_code/code.py index b1ef9fe22..b6e06340d 100644 --- a/src/_pytest/_code/code.py +++ b/src/_pytest/_code/code.py @@ -55,7 +55,7 @@ from _pytest.pathlib import bestrelpath if sys.version_info < (3, 11): from exceptiongroup import BaseExceptionGroup -_TracebackStyle = Literal["long", "short", "line", "no", "native", "value", "auto"] +TracebackStyle = Literal["long", "short", "line", "no", "native", "value", "auto"] class Code: @@ -628,7 +628,7 @@ class ExceptionInfo(Generic[E]): def getrepr( self, showlocals: bool = False, - style: _TracebackStyle = "long", + style: TracebackStyle = "long", abspath: bool = False, tbfilter: Union[ bool, Callable[["ExceptionInfo[BaseException]"], Traceback] @@ -809,7 +809,7 @@ class FormattedExcinfo: fail_marker: ClassVar = "E" showlocals: bool = False - style: _TracebackStyle = "long" + style: TracebackStyle = "long" abspath: bool = True tbfilter: Union[bool, Callable[[ExceptionInfo[BaseException]], Traceback]] = True funcargs: bool = False @@ -1174,7 +1174,7 @@ class ReprExceptionInfo(ExceptionRepr): class ReprTraceback(TerminalRepr): reprentries: Sequence[Union["ReprEntry", "ReprEntryNative"]] extraline: Optional[str] - style: _TracebackStyle + style: TracebackStyle entrysep: ClassVar = "_ " @@ -1208,7 +1208,7 @@ class ReprTracebackNative(ReprTraceback): class ReprEntryNative(TerminalRepr): lines: Sequence[str] - style: ClassVar[_TracebackStyle] = "native" + style: ClassVar[TracebackStyle] = "native" def toterminal(self, tw: TerminalWriter) -> None: tw.write("".join(self.lines)) @@ -1220,7 +1220,7 @@ class ReprEntry(TerminalRepr): reprfuncargs: Optional["ReprFuncArgs"] reprlocals: Optional["ReprLocals"] reprfileloc: Optional["ReprFileLocation"] - style: _TracebackStyle + style: TracebackStyle def _write_entry_lines(self, tw: TerminalWriter) -> None: """Write the source code portions of a list of traceback entries with syntax highlighting. diff --git a/src/_pytest/config/__init__.py b/src/_pytest/config/__init__.py index f3d3b3062..287fac463 100644 --- a/src/_pytest/config/__init__.py +++ b/src/_pytest/config/__init__.py @@ -54,7 +54,10 @@ from _pytest import __version__ import _pytest._code from _pytest._code import ExceptionInfo from _pytest._code import filter_traceback +from _pytest._code.code import TracebackStyle from _pytest._io import TerminalWriter +from _pytest.config.argparsing import Argument +from _pytest.config.argparsing import Parser import _pytest.deprecated import _pytest.hookspec from _pytest.outcomes import fail @@ -71,9 +74,7 @@ from _pytest.warning_types import warn_explicit_for if TYPE_CHECKING: - from .argparsing import Argument - from .argparsing import Parser - from _pytest._code.code import _TracebackStyle + from _pytest.cacheprovider import Cache from _pytest.terminal import TerminalReporter @@ -1030,6 +1031,9 @@ class Config: #: 'testpaths' configuration value. TESTPATHS = enum.auto() + # Set by cacheprovider plugin. + cache: Optional["Cache"] + def __init__( self, pluginmanager: PytestPluginManager, @@ -1091,11 +1095,6 @@ class Config: self.args_source = Config.ArgsSource.ARGS self.args: List[str] = [] - if TYPE_CHECKING: - from _pytest.cacheprovider import Cache - - self.cache: Optional[Cache] = None - @property def rootpath(self) -> Path: """The path to the :ref:`rootdir `. @@ -1175,7 +1174,7 @@ class Config: option: Optional[argparse.Namespace] = None, ) -> None: if option and getattr(option, "fulltrace", False): - style: _TracebackStyle = "long" + style: TracebackStyle = "long" else: style = "native" excrepr = excinfo.getrepr( diff --git a/src/_pytest/debugging.py b/src/_pytest/debugging.py index 1338ef9f2..eacb2836d 100644 --- a/src/_pytest/debugging.py +++ b/src/_pytest/debugging.py @@ -13,12 +13,12 @@ from typing import List from typing import Optional from typing import Tuple from typing import Type -from typing import TYPE_CHECKING from typing import Union import unittest from _pytest import outcomes from _pytest._code import ExceptionInfo +from _pytest.capture import CaptureManager from _pytest.config import Config from _pytest.config import ConftestImportFailure from _pytest.config import hookimpl @@ -27,11 +27,7 @@ from _pytest.config.argparsing import Parser from _pytest.config.exceptions import UsageError from _pytest.nodes import Node from _pytest.reports import BaseReport - - -if TYPE_CHECKING: - from _pytest.capture import CaptureManager - from _pytest.runner import CallInfo +from _pytest.runner import CallInfo def _validate_usepdb_cls(value: str) -> Tuple[str, str]: @@ -310,7 +306,7 @@ class PdbTrace: return (yield) -def wrap_pytest_function_for_tracing(pyfuncitem): +def wrap_pytest_function_for_tracing(pyfuncitem) -> None: """Change the Python function object of the given Function item by a wrapper which actually enters pdb before calling the python function itself, effectively leaving the user in the pdb prompt in the first @@ -322,14 +318,14 @@ def wrap_pytest_function_for_tracing(pyfuncitem): # python < 3.7.4) runcall's first param is `func`, which means we'd get # an exception if one of the kwargs to testfunction was called `func`. @functools.wraps(testfunction) - def wrapper(*args, **kwargs): + def wrapper(*args, **kwargs) -> None: func = functools.partial(testfunction, *args, **kwargs) _pdb.runcall(func) pyfuncitem.obj = wrapper -def maybe_wrap_pytest_function_for_tracing(pyfuncitem): +def maybe_wrap_pytest_function_for_tracing(pyfuncitem) -> None: """Wrap the given pytestfunct item for tracing support if --trace was given in the command line.""" if pyfuncitem.config.getvalue("trace"): diff --git a/src/_pytest/fixtures.py b/src/_pytest/fixtures.py index 353082c17..93c8bc669 100644 --- a/src/_pytest/fixtures.py +++ b/src/_pytest/fixtures.py @@ -60,6 +60,7 @@ from _pytest.config.argparsing import Parser from _pytest.deprecated import check_ispytest from _pytest.deprecated import MARKED_FIXTURE from _pytest.deprecated import YIELD_FIXTURE +from _pytest.main import Session from _pytest.mark import Mark from _pytest.mark import ParameterSet from _pytest.mark.structures import MarkDecorator @@ -78,7 +79,6 @@ if sys.version_info < (3, 11): if TYPE_CHECKING: - from _pytest.main import Session from _pytest.python import CallSpec2 from _pytest.python import Function from _pytest.python import Metafunc diff --git a/src/_pytest/main.py b/src/_pytest/main.py index 716d5cf78..d200a6877 100644 --- a/src/_pytest/main.py +++ b/src/_pytest/main.py @@ -38,7 +38,6 @@ from _pytest.config import PytestPluginManager from _pytest.config import UsageError from _pytest.config.argparsing import Parser from _pytest.config.compat import PathAwareHookProxy -from _pytest.fixtures import FixtureManager from _pytest.outcomes import exit from _pytest.pathlib import absolutepath from _pytest.pathlib import bestrelpath @@ -55,6 +54,8 @@ from _pytest.warning_types import PytestWarning if TYPE_CHECKING: from typing import Self + from _pytest.fixtures import FixtureManager + def pytest_addoption(parser: Parser) -> None: parser.addini( @@ -551,7 +552,7 @@ class Session(nodes.Collector): # Set on the session by runner.pytest_sessionstart. _setupstate: SetupState # Set on the session by fixtures.pytest_sessionstart. - _fixturemanager: FixtureManager + _fixturemanager: "FixtureManager" exitstatus: Union[int, ExitCode] def __init__(self, config: Config) -> None: diff --git a/src/_pytest/mark/structures.py b/src/_pytest/mark/structures.py index 3567142a6..456808063 100644 --- a/src/_pytest/mark/structures.py +++ b/src/_pytest/mark/structures.py @@ -31,6 +31,7 @@ from _pytest.config import Config from _pytest.deprecated import check_ispytest from _pytest.deprecated import MARKED_FIXTURE from _pytest.outcomes import fail +from _pytest.scope import _ScopeName from _pytest.warning_types import PytestUnknownMarkWarning @@ -430,7 +431,6 @@ def store_mark(obj, mark: Mark, *, stacklevel: int = 2) -> None: # Typing for builtin pytest marks. This is cheating; it gives builtin marks # special privilege, and breaks modularity. But practicality beats purity... if TYPE_CHECKING: - from _pytest.scope import _ScopeName class _SkipMarkDecorator(MarkDecorator): @overload # type: ignore[override,no-overload-impl] diff --git a/src/_pytest/nodes.py b/src/_pytest/nodes.py index e73101971..aad54f8b3 100644 --- a/src/_pytest/nodes.py +++ b/src/_pytest/nodes.py @@ -30,6 +30,7 @@ from _pytest._code import getfslineno from _pytest._code.code import ExceptionInfo from _pytest._code.code import TerminalRepr from _pytest._code.code import Traceback +from _pytest._code.code import TracebackStyle from _pytest.compat import LEGACY_PATH from _pytest.config import Config from _pytest.config import ConftestImportFailure @@ -49,7 +50,6 @@ if TYPE_CHECKING: from typing import Self # Imported here due to circular import. - from _pytest._code.code import _TracebackStyle from _pytest.main import Session @@ -416,7 +416,7 @@ class Node(abc.ABC, metaclass=NodeMeta): def _repr_failure_py( self, excinfo: ExceptionInfo[BaseException], - style: "Optional[_TracebackStyle]" = None, + style: "Optional[TracebackStyle]" = None, ) -> TerminalRepr: from _pytest.fixtures import FixtureLookupError @@ -474,7 +474,7 @@ class Node(abc.ABC, metaclass=NodeMeta): def repr_failure( self, excinfo: ExceptionInfo[BaseException], - style: "Optional[_TracebackStyle]" = None, + style: "Optional[TracebackStyle]" = None, ) -> Union[str, TerminalRepr]: """Return a representation of a collection or test failure. diff --git a/src/_pytest/stepwise.py b/src/_pytest/stepwise.py index 92d3a297e..1e3a09d96 100644 --- a/src/_pytest/stepwise.py +++ b/src/_pytest/stepwise.py @@ -1,18 +1,14 @@ from typing import List from typing import Optional -from typing import TYPE_CHECKING from _pytest import nodes +from _pytest.cacheprovider import Cache from _pytest.config import Config from _pytest.config.argparsing import Parser from _pytest.main import Session from _pytest.reports import TestReport -import pytest -if TYPE_CHECKING: - from _pytest.cacheprovider import Cache - STEPWISE_CACHE_DIR = "cache/stepwise" @@ -37,7 +33,6 @@ def pytest_addoption(parser: Parser) -> None: ) -@pytest.hookimpl def pytest_configure(config: Config) -> None: if config.option.stepwise_skip: # allow --stepwise-skip to work on its own merits. diff --git a/src/_pytest/unittest.py b/src/_pytest/unittest.py index 643443f08..56a9c5d09 100644 --- a/src/_pytest/unittest.py +++ b/src/_pytest/unittest.py @@ -41,10 +41,11 @@ if TYPE_CHECKING: import twisted.trial.unittest - _SysExcInfoType = Union[ - Tuple[Type[BaseException], BaseException, types.TracebackType], - Tuple[None, None, None], - ] + +_SysExcInfoType = Union[ + Tuple[Type[BaseException], BaseException, types.TracebackType], + Tuple[None, None, None], +] def pytest_pycollect_makeitem( @@ -228,7 +229,7 @@ class TestCaseFunction(Function): def startTest(self, testcase: "unittest.TestCase") -> None: pass - def _addexcinfo(self, rawexcinfo: "_SysExcInfoType") -> None: + def _addexcinfo(self, rawexcinfo: _SysExcInfoType) -> None: # Unwrap potential exception info (see twisted trial support below). rawexcinfo = getattr(rawexcinfo, "_rawexcinfo", rawexcinfo) try: @@ -264,7 +265,7 @@ class TestCaseFunction(Function): self.__dict__.setdefault("_excinfo", []).append(excinfo) def addError( - self, testcase: "unittest.TestCase", rawexcinfo: "_SysExcInfoType" + self, testcase: "unittest.TestCase", rawexcinfo: _SysExcInfoType ) -> None: try: if isinstance(rawexcinfo[1], exit.Exception): @@ -274,7 +275,7 @@ class TestCaseFunction(Function): self._addexcinfo(rawexcinfo) def addFailure( - self, testcase: "unittest.TestCase", rawexcinfo: "_SysExcInfoType" + self, testcase: "unittest.TestCase", rawexcinfo: _SysExcInfoType ) -> None: self._addexcinfo(rawexcinfo) @@ -287,7 +288,7 @@ class TestCaseFunction(Function): def addExpectedFailure( self, testcase: "unittest.TestCase", - rawexcinfo: "_SysExcInfoType", + rawexcinfo: _SysExcInfoType, reason: str = "", ) -> None: try: diff --git a/testing/code/test_excinfo.py b/testing/code/test_excinfo.py index f7f780e98..fc60ae9ac 100644 --- a/testing/code/test_excinfo.py +++ b/testing/code/test_excinfo.py @@ -28,7 +28,7 @@ import pytest if TYPE_CHECKING: - from _pytest._code.code import _TracebackStyle + from _pytest._code.code import TracebackStyle if sys.version_info < (3, 11): from exceptiongroup import ExceptionGroup @@ -925,7 +925,7 @@ raise ValueError() ) excinfo = pytest.raises(ValueError, mod.entry) - styles: tuple[_TracebackStyle, ...] = ("long", "short") + styles: tuple[TracebackStyle, ...] = ("long", "short") for style in styles: p = FormattedExcinfo(style=style) reprtb = p.repr_traceback(excinfo) @@ -1052,7 +1052,7 @@ raise ValueError() ) excinfo = pytest.raises(ValueError, mod.entry) - styles: tuple[_TracebackStyle, ...] = ("short", "long", "no") + styles: tuple[TracebackStyle, ...] = ("short", "long", "no") for style in styles: for showlocals in (True, False): repr = excinfo.getrepr(style=style, showlocals=showlocals) From 13f97632c64a733bb8b11c96b423b8480e99246c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 7 Jun 2024 07:03:09 +0000 Subject: [PATCH 45/53] build(deps): Bump pytest-trio in /testing/plugins_integration Bumps [pytest-trio](https://github.com/python-trio/pytest-trio) from 0.7.0 to 0.8.0. - [Release notes](https://github.com/python-trio/pytest-trio/releases) - [Commits](https://github.com/python-trio/pytest-trio/compare/v0.7.0...v0.8.0) --- updated-dependencies: - dependency-name: pytest-trio dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- testing/plugins_integration/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/plugins_integration/requirements.txt b/testing/plugins_integration/requirements.txt index cf6e4763d..f44a02915 100644 --- a/testing/plugins_integration/requirements.txt +++ b/testing/plugins_integration/requirements.txt @@ -9,7 +9,7 @@ pytest-html==4.1.1 pytest-mock==3.14.0 pytest-rerunfailures==14.0 pytest-sugar==1.0.0 -pytest-trio==0.7.0 +pytest-trio==0.8.0 pytest-twisted==1.14.1 twisted==24.3.0 pytest-xvfb==3.0.0 From de47b73520fd9b7e41272701d7fd4663357af046 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Fri, 7 Jun 2024 09:49:29 +0300 Subject: [PATCH 46/53] unittest: fix assertion errors on unittest reruns This fixes unittest test reruns when using plugins like pytest-rerunfailures. The `instance` property uses AttributeError to check if the instance needs to be initialized, so `del` is the correct way to clear it, not setting to `None`. Regressed in 8.2.2. --- changelog/12424.bugfix.rst | 1 + src/_pytest/unittest.py | 2 +- .../pytest_rerunfailures_integration.py | 11 +++++++++++ tox.ini | 2 +- 4 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 changelog/12424.bugfix.rst create mode 100644 testing/plugins_integration/pytest_rerunfailures_integration.py diff --git a/changelog/12424.bugfix.rst b/changelog/12424.bugfix.rst new file mode 100644 index 000000000..7ad112685 --- /dev/null +++ b/changelog/12424.bugfix.rst @@ -0,0 +1 @@ +Fix crash with `assert testcase is not None` assertion failure when re-running unittest tests using plugins like pytest-rerunfailures. Regressed in 8.2.2. diff --git a/src/_pytest/unittest.py b/src/_pytest/unittest.py index 643443f08..ca82ac5c1 100644 --- a/src/_pytest/unittest.py +++ b/src/_pytest/unittest.py @@ -222,7 +222,7 @@ class TestCaseFunction(Function): self._explicit_tearDown() self._explicit_tearDown = None self._obj = None - self._instance = None + del self._instance super().teardown() def startTest(self, testcase: "unittest.TestCase") -> None: diff --git a/testing/plugins_integration/pytest_rerunfailures_integration.py b/testing/plugins_integration/pytest_rerunfailures_integration.py new file mode 100644 index 000000000..9a13a3279 --- /dev/null +++ b/testing/plugins_integration/pytest_rerunfailures_integration.py @@ -0,0 +1,11 @@ +import unittest + + +class MyTestCase(unittest.TestCase): + first_time = True + + def test_fail_the_first_time(self) -> None: + """Regression test for issue #12424.""" + if self.first_time: + type(self).first_time = False + self.fail() diff --git a/tox.ini b/tox.ini index 0a3f0acf5..35b335a01 100644 --- a/tox.ini +++ b/tox.ini @@ -141,7 +141,7 @@ commands = pytest --cov=. simple_integration.py pytest --ds=django_settings simple_integration.py pytest --html=simple.html simple_integration.py - pytest --reruns 5 simple_integration.py + pytest --reruns 5 simple_integration.py pytest_rerunfailures_integration.py pytest pytest_anyio_integration.py pytest pytest_asyncio_integration.py pytest pytest_mock_integration.py From 9bfcca6f4838c854e526afb784820ec2af4f8ca1 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 9 Jun 2024 22:49:33 -0300 Subject: [PATCH 47/53] [automated] Update plugin list (#12441) Co-authored-by: pytest bot --- doc/en/reference/plugin_list.rst | 158 +++++++++++++++++++------------ 1 file changed, 99 insertions(+), 59 deletions(-) diff --git a/doc/en/reference/plugin_list.rst b/doc/en/reference/plugin_list.rst index 0f1162779..ab7d28edf 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 =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-attrib` pytest plugin to select tests based on attributes similar to the nose-attrib plugin May 24, 2016 4 - Beta N/A + :pypi:`pytest-attributes` A plugin that allows users to add attributes to their tests. These attributes can then be referenced by fixtures or the test itself. Jun 06, 2024 4 - Beta pytest>=6.2.0 :pypi:`pytest-austin` Austin plugin for pytest Oct 11, 2020 4 - Beta N/A :pypi:`pytest-autocap` automatically capture test & fixture stdout/stderr to files May 15, 2022 N/A pytest (<7.2,>=7.1.2) :pypi:`pytest-autochecklog` automatically check condition and log all the checks Apr 25, 2015 4 - Beta N/A @@ -140,7 +141,7 @@ This list contains 1471 plugins. :pypi:`pytest-bandit-xayon` A bandit plugin for pytest Oct 17, 2022 4 - Beta pytest (>=3.5.0) :pypi:`pytest-base-url` pytest plugin for URL based testing Jan 31, 2024 5 - Production/Stable pytest>=7.0.0 :pypi:`pytest-batch-regression` A pytest plugin to repeat the entire test suite in batches. May 08, 2024 N/A pytest>=6.0.0 - :pypi:`pytest-bdd` BDD for pytest Mar 17, 2024 6 - Mature pytest (>=6.2.0) + :pypi:`pytest-bdd` BDD for pytest Jun 04, 2024 6 - Mature pytest>=6.2.0 :pypi:`pytest-bdd-html` pytest plugin to display BDD info in HTML test report Nov 22, 2022 3 - Alpha pytest (!=6.0.0,>=5.0) :pypi:`pytest-bdd-ng` BDD for pytest Dec 31, 2023 4 - Beta pytest >=5.0 :pypi:`pytest-bdd-report` A pytest-bdd plugin for generating useful and informative BDD test reports May 20, 2024 N/A pytest >=7.1.3 @@ -149,7 +150,7 @@ This list contains 1471 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. Jan 25, 2024 N/A pytest - :pypi:`pytest-bec-e2e` BEC pytest plugin for end-to-end tests May 31, 2024 3 - Alpha pytest + :pypi:`pytest-bec-e2e` BEC pytest plugin for end-to-end tests Jun 07, 2024 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 @@ -172,7 +173,7 @@ This list contains 1471 plugins. :pypi:`pytest-board` Local continuous test runner with pytest and watchdog. Jan 20, 2019 N/A N/A :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 May 27, 2024 5 - Production/Stable pytest>=8.2.0 + :pypi:`pytest-boto-mock` Thin-wrapper around the mock package for easier use with pytest Jun 05, 2024 5 - Production/Stable pytest>=8.2.0 :pypi:`pytest-bpdb` A py.test plug-in to enable drop to bpdb debugger on test failure. Jan 19, 2015 2 - Pre-Alpha N/A :pypi:`pytest-bq` BigQuery fixtures and fixture factories for Pytest. May 08, 2024 5 - Production/Stable pytest>=6.2 :pypi:`pytest-bravado` Pytest-bravado automatically generates from OpenAPI specification client fixtures. Feb 15, 2022 N/A N/A @@ -185,7 +186,7 @@ This list contains 1471 plugins. :pypi:`pytest_browserstack` Py.test plugin for BrowserStack Jan 27, 2016 4 - Beta N/A :pypi:`pytest-browserstack-local` \`\`py.test\`\` plugin to run \`\`BrowserStackLocal\`\` in background. Feb 09, 2018 N/A N/A :pypi:`pytest-budosystems` Budo Systems is a martial arts school management system. This module is the Budo Systems Pytest Plugin. May 07, 2023 3 - Alpha pytest - :pypi:`pytest-bug` Pytest plugin for marking tests as a bug Sep 23, 2023 5 - Production/Stable pytest >=7.1.0 + :pypi:`pytest-bug` Pytest plugin for marking tests as a bug Jun 05, 2024 5 - Production/Stable pytest>=8.0.0 :pypi:`pytest-bugtong-tag` pytest-bugtong-tag is a plugin for pytest Jan 16, 2022 N/A N/A :pypi:`pytest-bugzilla` py.test bugzilla integration plugin May 05, 2010 4 - Beta N/A :pypi:`pytest-bugzilla-notifier` A plugin that allows you to execute create, update, and read information from BugZilla bugs Jun 15, 2018 4 - Beta pytest (>=2.9.2) @@ -265,7 +266,7 @@ This list contains 1471 plugins. :pypi:`pytest-collect-pytest-interinfo` A simple plugin to use with pytest Sep 26, 2023 4 - Beta N/A :pypi:`pytest-colordots` Colorizes the progress indicators Oct 06, 2017 5 - Production/Stable N/A :pypi:`pytest-commander` An interactive GUI test runner for PyTest Aug 17, 2021 N/A pytest (<7.0.0,>=6.2.4) - :pypi:`pytest-common-subject` pytest framework for testing different aspects of a common method May 15, 2022 N/A pytest (>=3.6,<8) + :pypi:`pytest-common-subject` pytest framework for testing different aspects of a common method Jun 03, 2024 N/A pytest<9,>=3.6 :pypi:`pytest-compare` pytest plugin for comparing call arguments. Jun 22, 2023 5 - Production/Stable N/A :pypi:`pytest-concurrent` Concurrently execute test cases with multithread, multiprocess and gevent Jan 12, 2019 4 - Beta pytest (>=3.1.1) :pypi:`pytest-config` Base configurations and utilities for developing your Python project test suite with pytest. Nov 07, 2014 5 - Production/Stable N/A @@ -285,7 +286,7 @@ This list contains 1471 plugins. :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 - :pypi:`pytest-coveragemarkers` Using pytest markers to track functional coverage and filtering of tests Apr 15, 2024 N/A pytest<8.0.0,>=7.1.2 + :pypi:`pytest-coveragemarkers` Using pytest markers to track functional coverage and filtering of tests Jun 04, 2024 N/A pytest<8.0.0,>=7.1.2 :pypi:`pytest-cov-exclude` Pytest plugin for excluding tests based on coverage data Apr 29, 2016 4 - Beta pytest (>=2.8.0,<2.9.0); extra == 'dev' :pypi:`pytest_covid` Too many faillure, less tests. Jun 24, 2020 N/A N/A :pypi:`pytest-cpp` Use pytest's runner to discover and execute C++ tests Nov 01, 2023 5 - Production/Stable pytest >=7.0 @@ -335,7 +336,7 @@ This list contains 1471 plugins. :pypi:`pytest-dbt` Unit test dbt models with standard python tooling Jun 08, 2023 2 - Pre-Alpha pytest (>=7.0.0,<8.0.0) :pypi:`pytest-dbt-adapter` A pytest plugin for testing dbt adapter plugins Nov 24, 2021 N/A pytest (<7,>=6) :pypi:`pytest-dbt-conventions` A pytest plugin for linting a dbt project's conventions Mar 02, 2022 N/A pytest (>=6.2.5,<7.0.0) - :pypi:`pytest-dbt-core` Pytest extension for dbt. Aug 25, 2023 N/A pytest >=6.2.5 ; extra == 'test' + :pypi:`pytest-dbt-core` Pytest extension for dbt. Jun 04, 2024 N/A pytest>=6.2.5; extra == "test" :pypi:`pytest-dbt-postgres` Pytest tooling to unittest DBT & Postgres models Jan 02, 2024 N/A pytest (>=7.4.3,<8.0.0) :pypi:`pytest-dbus-notification` D-BUS notifications for pytest results. Mar 05, 2014 5 - Production/Stable N/A :pypi:`pytest-dbx` Pytest plugin to run unit tests for dbx (Databricks CLI extensions) related code Nov 29, 2022 N/A pytest (>=7.1.3,<8.0.0) @@ -442,6 +443,7 @@ This list contains 1471 plugins. :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 Dec 05, 2023 5 - Production/Stable pytest >=2.2 + :pypi:`pytest-edit` Edit the source code of a failed test with \`pytest --edit\`. Jun 07, 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. Mar 15, 2024 5 - Production/Stable pytest >=7.0 :pypi:`pytest-elements` Tool to help automate user interfaces Jan 13, 2021 N/A pytest (>=5.4,<6.0) @@ -484,7 +486,7 @@ This list contains 1471 plugins. :pypi:`pytest_exact_fixtures` Parse queries in Lucene and Elasticsearch syntaxes Feb 04, 2019 N/A N/A :pypi:`pytest-examples` Pytest plugin for testing examples in docstrings and markdown files. Jul 11, 2023 4 - Beta pytest>=7 :pypi:`pytest-exasol-itde` Feb 15, 2024 N/A pytest (>=7,<9) - :pypi:`pytest-exasol-saas` May 27, 2024 N/A pytest<9,>=7 + :pypi:`pytest-exasol-saas` Jun 07, 2024 N/A pytest<9,>=7 :pypi:`pytest-excel` pytest plugin for generating excel reports Sep 14, 2023 5 - Production/Stable N/A :pypi:`pytest-exceptional` Better exceptions Mar 16, 2017 4 - Beta N/A :pypi:`pytest-exception-script` Walk your code through exception script to check it's resiliency to failures. Aug 04, 2020 3 - Alpha pytest @@ -515,7 +517,7 @@ This list contains 1471 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-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-fail-slow` Fail tests that take too long to run Feb 11, 2024 N/A pytest>=7.0 + :pypi:`pytest-fail-slow` Fail tests that take too long to run Jun 01, 2024 N/A pytest>=7.0 :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-client` A package to prevent Dependency Confusion attacks against Yandex. Feb 21, 2024 N/A N/A @@ -561,7 +563,7 @@ This list contains 1471 plugins. :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-flexreport` Apr 15, 2023 4 - Beta pytest - :pypi:`pytest-fluent` A pytest plugin in order to provide logs via fluentd May 15, 2024 4 - Beta pytest>=7.0.0 + :pypi:`pytest-fluent` A pytest plugin in order to provide logs via fluentd Jun 05, 2024 4 - Beta pytest>=7.0.0 :pypi:`pytest-fluentbit` A pytest plugin in order to provide logs via fluentbit Jun 16, 2023 4 - Beta pytest (>=7.0.0) :pypi:`pytest-fly` pytest observer Apr 14, 2024 3 - Alpha pytest :pypi:`pytest-flyte` Pytest fixtures for simplifying Flyte integration testing May 03, 2021 N/A pytest @@ -628,13 +630,13 @@ This list contains 1471 plugins. :pypi:`pytest-helpers-namespace` Pytest Helpers Namespace Plugin Dec 29, 2021 5 - Production/Stable pytest (>=6.0.0) :pypi:`pytest-henry` Aug 29, 2023 N/A N/A :pypi:`pytest-hidecaptured` Hide captured output May 04, 2018 4 - Beta pytest (>=2.8.5) - :pypi:`pytest-himark` This plugin aims to create markers automatically based on a json configuration. May 15, 2024 4 - Beta pytest>=6.2.0 + :pypi:`pytest-himark` This plugin aims to create markers automatically based on a json configuration. Jun 05, 2024 4 - Beta pytest>=6.2.0 :pypi:`pytest-historic` Custom report to display pytest historical execution records 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-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 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-custom-component` Experimental package to automatically extract test plugins for Home Assistant custom components May 31, 2024 3 - Alpha pytest==8.2.0 + :pypi:`pytest-homeassistant-custom-component` Experimental package to automatically extract test plugins for Home Assistant custom components Jun 08, 2024 3 - Alpha pytest==8.2.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-hot-reloading` Apr 18, 2024 N/A N/A @@ -703,7 +705,7 @@ This list contains 1471 plugins. :pypi:`pytest-involve` Run tests covering a specific file or changeset Feb 02, 2020 4 - Beta pytest (>=3.5.0) :pypi:`pytest-ipdb` A py.test plug-in to enable drop to ipdb debugger on test failure. Mar 20, 2013 2 - Pre-Alpha N/A :pypi:`pytest-ipynb` THIS PROJECT IS ABANDONED Jan 29, 2019 3 - Alpha N/A - :pypi:`pytest-ipywidgets` Apr 08, 2024 N/A pytest + :pypi:`pytest-ipywidgets` Jun 06, 2024 N/A pytest :pypi:`pytest-isolate` Feb 20, 2023 4 - Beta pytest :pypi:`pytest-isort` py.test plugin to check import ordering using isort Mar 05, 2024 5 - Production/Stable pytest (>=5.0) :pypi:`pytest-it` Pytest plugin to display test reports as a plaintext spec, inspired by Rspec: https://github.com/mattduck/pytest-it. Jan 29, 2024 4 - Beta N/A @@ -715,7 +717,7 @@ This list contains 1471 plugins. :pypi:`pytest-jest` A custom jest-pytest oriented Pytest reporter May 22, 2018 4 - Beta pytest (>=3.3.2) :pypi:`pytest-jinja` A plugin to generate customizable jinja-based HTML reports in pytest Oct 04, 2022 3 - Alpha pytest (>=6.2.5,<7.0.0) :pypi:`pytest-jira` py.test JIRA integration plugin, using markers Apr 30, 2024 3 - Alpha N/A - :pypi:`pytest-jira-xfail` Plugin skips (xfail) tests if unresolved Jira issue(s) linked May 16, 2024 N/A pytest>=7.2.0 + :pypi:`pytest-jira-xfail` Plugin skips (xfail) tests if unresolved Jira issue(s) linked Jun 06, 2024 N/A pytest>=7.2.0 :pypi:`pytest-jira-xray` pytest plugin to integrate tests with JIRA XRAY Mar 27, 2024 4 - Beta pytest>=6.2.4 :pypi:`pytest-job-selection` A pytest plugin for load balancing test suites Jan 30, 2023 4 - Beta pytest (>=3.5.0) :pypi:`pytest-jobserver` Limit parallel tests with posix jobserver. May 15, 2019 5 - Production/Stable pytest @@ -728,7 +730,7 @@ This list contains 1471 plugins. :pypi:`pytest-json-report-wip` A pytest plugin to report test results as JSON files Oct 28, 2023 4 - Beta pytest >=3.8.0 :pypi:`pytest-jsonschema` A pytest plugin to perform JSONSchema validations Mar 27, 2024 4 - Beta pytest>=6.2.0 :pypi:`pytest-jtl-collector` A simple plugin to use with pytest May 20, 2024 4 - Beta pytest>=7.2.1 - :pypi:`pytest-jtr` pytest plugin supporting json test report output Apr 15, 2024 N/A pytest<8.0.0,>=7.1.2 + :pypi:`pytest-jtr` pytest plugin supporting json test report output Jun 04, 2024 N/A pytest<8.0.0,>=7.1.2 :pypi:`pytest-jupyter` A pytest plugin for testing Jupyter libraries and extensions. Apr 04, 2024 4 - Beta pytest>=7.0 :pypi:`pytest-jupyterhub` A reusable JupyterHub pytest plugin Apr 25, 2023 5 - Production/Stable pytest :pypi:`pytest-kafka` Zookeeper, Kafka server, and Kafka consumer fixtures for Pytest Jun 14, 2023 N/A pytest @@ -798,6 +800,7 @@ This list contains 1471 plugins. :pypi:`pytest-marker-bugzilla` py.test bugzilla integration plugin, using markers Jan 09, 2020 N/A N/A :pypi:`pytest-markers-presence` A simple plugin to detect missed pytest tags and markers" Feb 04, 2021 4 - Beta pytest (>=6.0) :pypi:`pytest-markfiltration` UNKNOWN Nov 08, 2011 3 - Alpha N/A + :pypi:`pytest-mark-manage` 用例标签化管理 Jun 07, 2024 N/A pytest :pypi:`pytest-mark-no-py3` pytest plugin and bowler codemod to help migrate tests to Python 3 May 17, 2019 N/A pytest :pypi:`pytest-marks` UNKNOWN Nov 23, 2012 3 - Alpha N/A :pypi:`pytest-matcher` Easy way to match captured \`pytest\` output against expectations stored in files Mar 15, 2024 5 - Production/Stable pytest @@ -913,7 +916,7 @@ This list contains 1471 plugins. :pypi:`pytest-only` Use @pytest.mark.only to run a single test May 27, 2024 5 - Production/Stable pytest<9,>=3.6.0 :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 Apr 16, 2020 3 - Alpha pytest (>=4.6) + :pypi:`pytest-openfiles` Pytest plugin for detecting inadvertent open file handles Jun 05, 2024 3 - Alpha pytest>=4.6 :pypi:`pytest-opentelemetry` A pytest plugin for instrumenting test runs via OpenTelemetry Oct 01, 2023 N/A pytest :pypi:`pytest-opentmi` pytest plugin for publish results to opentmi Jun 02, 2022 5 - Production/Stable pytest (>=5.0) :pypi:`pytest-operator` Fixtures for Operators Sep 28, 2022 N/A pytest @@ -1022,7 +1025,7 @@ This list contains 1471 plugins. :pypi:`pytest-psqlgraph` pytest plugin for testing applications that use psqlgraph Oct 19, 2021 4 - Beta pytest (>=6.0) :pypi:`pytest-pt` pytest plugin to use \*.pt files as tests May 15, 2024 4 - Beta pytest :pypi:`pytest-ptera` Use ptera probes in tests Mar 01, 2022 N/A pytest (>=6.2.4,<7.0.0) - :pypi:`pytest-publish` Jun 01, 2024 N/A pytest<9.0.0,>=8.0.0 + :pypi:`pytest-publish` Jun 04, 2024 N/A pytest<9.0.0,>=8.0.0 :pypi:`pytest-pudb` Pytest PuDB debugger integration Oct 25, 2018 3 - Alpha pytest (>=2.0) :pypi:`pytest-pumpkin-spice` A pytest plugin that makes your test reporting pumpkin-spiced Sep 18, 2022 4 - Beta N/A :pypi:`pytest-purkinje` py.test plugin for purkinje test runner Oct 28, 2017 2 - Pre-Alpha N/A @@ -1077,13 +1080,13 @@ This list contains 1471 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 May 12, 2024 4 - Beta pytest>=7.4.3 + :pypi:`pytest-ranking` A Pytest plugin for automatically prioritizing/ranking tests to speed up failure detection Jun 07, 2024 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. Mar 14, 2024 3 - Alpha N/A :pypi:`pytest-recorder` Pytest plugin, meant to facilitate unit tests writing for tools consumming Web APIs. Nov 21, 2023 N/A N/A :pypi:`pytest-recording` A pytest plugin that allows you recording of network interactions via VCR.py Dec 06, 2023 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-redis` Redis fixtures and fixture factories for Pytest. Apr 19, 2023 5 - Production/Stable pytest (>=6.2) + :pypi:`pytest-redis` Redis fixtures and fixture factories for Pytest. Jun 05, 2024 5 - Production/Stable pytest>=6.2 :pypi:`pytest-redislite` Pytest plugin for testing code using Redis Apr 05, 2022 4 - Beta pytest :pypi:`pytest-redmine` Pytest plugin for redmine Mar 19, 2018 1 - Planning N/A :pypi:`pytest-ref` A plugin to store reference files to ease regression testing Nov 23, 2019 4 - Beta pytest (>=3.5.0) @@ -1151,7 +1154,7 @@ This list contains 1471 plugins. :pypi:`pytest-rmsis` Sycronise pytest results to Jira RMsis Aug 10, 2022 N/A pytest (>=5.3.5) :pypi:`pytest-rng` Fixtures for seeding tests and making randomness reproducible Aug 08, 2019 5 - Production/Stable pytest :pypi:`pytest-roast` pytest plugin for ROAST configuration override and fixtures Nov 09, 2022 5 - Production/Stable pytest - :pypi:`pytest_robotframework` a pytest plugin that can run both python and robotframework tests while generating robot reports for them May 29, 2024 N/A pytest<9,>=7 + :pypi:`pytest_robotframework` a pytest plugin that can run both python and robotframework tests while generating robot reports for them Jun 07, 2024 N/A pytest<9,>=7 :pypi:`pytest-rocketchat` Pytest to Rocket.Chat reporting plugin Apr 18, 2021 5 - Production/Stable N/A :pypi:`pytest-rotest` Pytest integration with rotest Sep 08, 2019 N/A pytest (>=3.5.0) :pypi:`pytest-rpc` Extend py.test for RPC OpenStack testing. Feb 22, 2019 4 - Beta pytest (~=3.6) @@ -1176,7 +1179,7 @@ This list contains 1471 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. May 16, 2024 5 - Production/Stable N/A + :pypi:`pytest-sbase` A complete web automation framework for end-to-end testing. Jun 07, 2024 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. May 19, 2024 5 - Production/Stable pytest>=7.2.0 :pypi:`pytest-schedule` The job of test scheduling for humans. Jan 07, 2023 5 - Production/Stable N/A @@ -1186,7 +1189,7 @@ This list contains 1471 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. May 16, 2024 5 - Production/Stable N/A + :pypi:`pytest-seleniumbase` A complete web automation framework for end-to-end testing. Jun 07, 2024 5 - Production/Stable N/A :pypi:`pytest-selenium-enhancer` pytest plugin for Selenium Apr 29, 2022 5 - Production/Stable N/A :pypi:`pytest-selenium-pdiff` A pytest package implementing perceptualdiff for Selenium tests. Apr 06, 2017 2 - Pre-Alpha N/A :pypi:`pytest-selfie` A pytest plugin for selfie snapshot testing. Apr 05, 2024 N/A pytest<9.0.0,>=8.0.0 @@ -1263,8 +1266,8 @@ This list contains 1471 plugins. :pypi:`pytest-splitio` Split.io SDK integration for e2e tests Sep 22, 2020 N/A pytest (<7,>=5.0) :pypi:`pytest-split-tests` A Pytest plugin for running a subset of your tests by splitting them in to equally sized groups. Forked from Mark Adams' original project pytest-test-groups. Jul 30, 2021 5 - Production/Stable pytest (>=2.5) :pypi:`pytest-split-tests-tresorit` Feb 22, 2021 1 - Planning N/A - :pypi:`pytest-splunk-addon` A Dynamic test tool for Splunk Apps and Add-ons May 27, 2024 N/A pytest<8,>5.4.0 - :pypi:`pytest-splunk-addon-ui-smartx` Library to support testing Splunk Add-on UX May 10, 2024 N/A N/A + :pypi:`pytest-splunk-addon` A Dynamic test tool for Splunk Apps and Add-ons Jun 03, 2024 N/A pytest<8,>5.4.0 + :pypi:`pytest-splunk-addon-ui-smartx` Library to support testing Splunk Add-on UX Jun 05, 2024 N/A N/A :pypi:`pytest-splunk-env` pytest fixtures for interaction with Splunk Enterprise and Splunk Cloud Oct 22, 2020 N/A pytest (>=6.1.1,<7.0.0) :pypi:`pytest-sqitch` sqitch for pytest Apr 06, 2020 4 - Beta N/A :pypi:`pytest-sqlalchemy` pytest plugin with sqlalchemy related fixtures Mar 13, 2018 3 - Alpha N/A @@ -1286,7 +1289,7 @@ This list contains 1471 plugins. :pypi:`pytest-stoq` A plugin to pytest stoq Feb 09, 2021 4 - Beta N/A :pypi:`pytest-store` Pytest plugin to store values from test runs Nov 16, 2023 3 - Alpha pytest (>=7.0.0) :pypi:`pytest-stress` A Pytest plugin that allows you to loop tests for a user defined amount of time. Dec 07, 2019 4 - Beta pytest (>=3.6.0) - :pypi:`pytest-structlog` Structured logging assertions May 30, 2024 N/A pytest + :pypi:`pytest-structlog` Structured logging assertions Jun 08, 2024 N/A pytest :pypi:`pytest-structmpd` provide structured temporary directory Oct 17, 2018 N/A N/A :pypi:`pytest-stub` Stub packages, modules and attributes. Apr 28, 2020 5 - Production/Stable N/A :pypi:`pytest-stubprocess` Provide stub implementations for subprocesses in Python tests Sep 17, 2018 3 - Alpha pytest (>=3.5.0) @@ -1386,8 +1389,9 @@ This list contains 1471 plugins. :pypi:`pytest-tomato` Mar 01, 2019 5 - Production/Stable N/A :pypi:`pytest-toolbelt` This is just a collection of utilities for pytest, but don't really belong in pytest proper. Aug 12, 2019 3 - Alpha N/A :pypi:`pytest-toolbox` Numerous useful plugins for pytest. Apr 07, 2018 N/A pytest (>=3.5.0) - :pypi:`pytest-toolkit` Useful utils for testing Apr 13, 2024 N/A N/A + :pypi:`pytest-toolkit` Useful utils for testing Jun 07, 2024 N/A N/A :pypi:`pytest-tools` Pytest tools Oct 21, 2022 4 - Beta N/A + :pypi:`pytest-topo` Topological sorting for pytest Jun 05, 2024 N/A pytest>=7.0.0 :pypi:`pytest-tornado` A py.test plugin providing fixtures and markers to simplify testing of asynchronous tornado applications. Jun 17, 2020 5 - Production/Stable pytest (>=3.6) :pypi:`pytest-tornado5` A py.test plugin providing fixtures and markers to simplify testing of asynchronous tornado applications. Nov 16, 2018 5 - Production/Stable pytest (>=3.6) :pypi:`pytest-tornado-yen3` A py.test plugin providing fixtures and markers to simplify testing of asynchronous tornado applications. Oct 15, 2018 5 - Production/Stable N/A @@ -1498,6 +1502,7 @@ This list contains 1471 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-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-zcc` eee Jun 02, 2024 N/A N/A :pypi:`pytest-zebrunner` Pytest connector for Zebrunner reporting Jan 08, 2024 5 - Production/Stable pytest (>=4.5.0) :pypi:`pytest-zeebe` Pytest fixtures for testing Camunda 8 processes using a Zeebe test engine. Feb 01, 2024 N/A pytest (>=7.4.2,<8.0.0) :pypi:`pytest-zest` Zesty additions to pytest. Nov 17, 2022 N/A N/A @@ -2091,6 +2096,13 @@ This list contains 1471 plugins. pytest plugin to select tests based on attributes similar to the nose-attrib plugin + :pypi:`pytest-attributes` + *last release*: Jun 06, 2024, + *status*: 4 - Beta, + *requires*: pytest>=6.2.0 + + A plugin that allows users to add attributes to their tests. These attributes can then be referenced by fixtures or the test itself. + :pypi:`pytest-austin` *last release*: Oct 11, 2020, *status*: 4 - Beta, @@ -2253,9 +2265,9 @@ This list contains 1471 plugins. A pytest plugin to repeat the entire test suite in batches. :pypi:`pytest-bdd` - *last release*: Mar 17, 2024, + *last release*: Jun 04, 2024, *status*: 6 - Mature, - *requires*: pytest (>=6.2.0) + *requires*: pytest>=6.2.0 BDD for pytest @@ -2316,7 +2328,7 @@ This list contains 1471 plugins. Pytest plugin to run your tests with beartype checking enabled. :pypi:`pytest-bec-e2e` - *last release*: May 31, 2024, + *last release*: Jun 07, 2024, *status*: 3 - Alpha, *requires*: pytest @@ -2477,7 +2489,7 @@ This list contains 1471 plugins. :pypi:`pytest-boto-mock` - *last release*: May 27, 2024, + *last release*: Jun 05, 2024, *status*: 5 - Production/Stable, *requires*: pytest>=8.2.0 @@ -2568,9 +2580,9 @@ This list contains 1471 plugins. Budo Systems is a martial arts school management system. This module is the Budo Systems Pytest Plugin. :pypi:`pytest-bug` - *last release*: Sep 23, 2023, + *last release*: Jun 05, 2024, *status*: 5 - Production/Stable, - *requires*: pytest >=7.1.0 + *requires*: pytest>=8.0.0 Pytest plugin for marking tests as a bug @@ -3128,9 +3140,9 @@ This list contains 1471 plugins. An interactive GUI test runner for PyTest :pypi:`pytest-common-subject` - *last release*: May 15, 2022, + *last release*: Jun 03, 2024, *status*: N/A, - *requires*: pytest (>=3.6,<8) + *requires*: pytest<9,>=3.6 pytest framework for testing different aspects of a common method @@ -3268,7 +3280,7 @@ This list contains 1471 plugins. Coverage dynamic context support for PyTest, including sub-processes :pypi:`pytest-coveragemarkers` - *last release*: Apr 15, 2024, + *last release*: Jun 04, 2024, *status*: N/A, *requires*: pytest<8.0.0,>=7.1.2 @@ -3618,9 +3630,9 @@ This list contains 1471 plugins. A pytest plugin for linting a dbt project's conventions :pypi:`pytest-dbt-core` - *last release*: Aug 25, 2023, + *last release*: Jun 04, 2024, *status*: N/A, - *requires*: pytest >=6.2.5 ; extra == 'test' + *requires*: pytest>=6.2.5; extra == "test" Pytest extension for dbt. @@ -4366,6 +4378,13 @@ This list contains 1471 plugins. pytest plugin with mechanisms for echoing environment variables, package version and generic attributes + :pypi:`pytest-edit` + *last release*: Jun 07, 2024, + *status*: N/A, + *requires*: pytest + + Edit the source code of a failed test with \`pytest --edit\`. + :pypi:`pytest-ekstazi` *last release*: Sep 10, 2022, *status*: N/A, @@ -4661,7 +4680,7 @@ This list contains 1471 plugins. :pypi:`pytest-exasol-saas` - *last release*: May 27, 2024, + *last release*: Jun 07, 2024, *status*: N/A, *requires*: pytest<9,>=7 @@ -4878,7 +4897,7 @@ This list contains 1471 plugins. A pytest plugin that helps better distinguishing real test failures from setup flakiness. :pypi:`pytest-fail-slow` - *last release*: Feb 11, 2024, + *last release*: Jun 01, 2024, *status*: N/A, *requires*: pytest>=7.0 @@ -5200,7 +5219,7 @@ This list contains 1471 plugins. :pypi:`pytest-fluent` - *last release*: May 15, 2024, + *last release*: Jun 05, 2024, *status*: 4 - Beta, *requires*: pytest>=7.0.0 @@ -5669,7 +5688,7 @@ This list contains 1471 plugins. Hide captured output :pypi:`pytest-himark` - *last release*: May 15, 2024, + *last release*: Jun 05, 2024, *status*: 4 - Beta, *requires*: pytest>=6.2.0 @@ -5711,7 +5730,7 @@ This list contains 1471 plugins. A pytest plugin for use with homeassistant custom components. :pypi:`pytest-homeassistant-custom-component` - *last release*: May 31, 2024, + *last release*: Jun 08, 2024, *status*: 3 - Alpha, *requires*: pytest==8.2.0 @@ -6194,7 +6213,7 @@ This list contains 1471 plugins. THIS PROJECT IS ABANDONED :pypi:`pytest-ipywidgets` - *last release*: Apr 08, 2024, + *last release*: Jun 06, 2024, *status*: N/A, *requires*: pytest @@ -6278,7 +6297,7 @@ This list contains 1471 plugins. py.test JIRA integration plugin, using markers :pypi:`pytest-jira-xfail` - *last release*: May 16, 2024, + *last release*: Jun 06, 2024, *status*: N/A, *requires*: pytest>=7.2.0 @@ -6369,7 +6388,7 @@ This list contains 1471 plugins. A simple plugin to use with pytest :pypi:`pytest-jtr` - *last release*: Apr 15, 2024, + *last release*: Jun 04, 2024, *status*: N/A, *requires*: pytest<8.0.0,>=7.1.2 @@ -6858,6 +6877,13 @@ This list contains 1471 plugins. UNKNOWN + :pypi:`pytest-mark-manage` + *last release*: Jun 07, 2024, + *status*: N/A, + *requires*: pytest + + 用例标签化管理 + :pypi:`pytest-mark-no-py3` *last release*: May 17, 2019, *status*: N/A, @@ -7664,9 +7690,9 @@ This list contains 1471 plugins. Run object-oriented tests in a simple format :pypi:`pytest-openfiles` - *last release*: Apr 16, 2020, + *last release*: Jun 05, 2024, *status*: 3 - Alpha, - *requires*: pytest (>=4.6) + *requires*: pytest>=4.6 Pytest plugin for detecting inadvertent open file handles @@ -8427,7 +8453,7 @@ This list contains 1471 plugins. Use ptera probes in tests :pypi:`pytest-publish` - *last release*: Jun 01, 2024, + *last release*: Jun 04, 2024, *status*: N/A, *requires*: pytest<9.0.0,>=8.0.0 @@ -8812,7 +8838,7 @@ This list contains 1471 plugins. Randomise the order in which pytest tests are run with some control over the randomness :pypi:`pytest-ranking` - *last release*: May 12, 2024, + *last release*: Jun 07, 2024, *status*: 4 - Beta, *requires*: pytest>=7.4.3 @@ -8854,9 +8880,9 @@ This list contains 1471 plugins. Provides pytest plugins for reporting request/response traffic, screenshots, and more to ReportPortal :pypi:`pytest-redis` - *last release*: Apr 19, 2023, + *last release*: Jun 05, 2024, *status*: 5 - Production/Stable, - *requires*: pytest (>=6.2) + *requires*: pytest>=6.2 Redis fixtures and fixture factories for Pytest. @@ -9330,7 +9356,7 @@ This list contains 1471 plugins. pytest plugin for ROAST configuration override and fixtures :pypi:`pytest_robotframework` - *last release*: May 29, 2024, + *last release*: Jun 07, 2024, *status*: N/A, *requires*: pytest<9,>=7 @@ -9505,7 +9531,7 @@ This list contains 1471 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*: May 16, 2024, + *last release*: Jun 07, 2024, *status*: 5 - Production/Stable, *requires*: N/A @@ -9575,7 +9601,7 @@ This list contains 1471 plugins. pytest plugin to automatically capture screenshots upon selenium webdriver events :pypi:`pytest-seleniumbase` - *last release*: May 16, 2024, + *last release*: Jun 07, 2024, *status*: 5 - Production/Stable, *requires*: N/A @@ -10114,14 +10140,14 @@ This list contains 1471 plugins. :pypi:`pytest-splunk-addon` - *last release*: May 27, 2024, + *last release*: Jun 03, 2024, *status*: N/A, *requires*: pytest<8,>5.4.0 A Dynamic test tool for Splunk Apps and Add-ons :pypi:`pytest-splunk-addon-ui-smartx` - *last release*: May 10, 2024, + *last release*: Jun 05, 2024, *status*: N/A, *requires*: N/A @@ -10275,7 +10301,7 @@ This list contains 1471 plugins. A Pytest plugin that allows you to loop tests for a user defined amount of time. :pypi:`pytest-structlog` - *last release*: May 30, 2024, + *last release*: Jun 08, 2024, *status*: N/A, *requires*: pytest @@ -10975,7 +11001,7 @@ This list contains 1471 plugins. Numerous useful plugins for pytest. :pypi:`pytest-toolkit` - *last release*: Apr 13, 2024, + *last release*: Jun 07, 2024, *status*: N/A, *requires*: N/A @@ -10988,6 +11014,13 @@ This list contains 1471 plugins. Pytest tools + :pypi:`pytest-topo` + *last release*: Jun 05, 2024, + *status*: N/A, + *requires*: pytest>=7.0.0 + + Topological sorting for pytest + :pypi:`pytest-tornado` *last release*: Jun 17, 2020, *status*: 5 - Production/Stable, @@ -11758,6 +11791,13 @@ This list contains 1471 plugins. OWASP ZAP plugin for py.test. + :pypi:`pytest-zcc` + *last release*: Jun 02, 2024, + *status*: N/A, + *requires*: N/A + + eee + :pypi:`pytest-zebrunner` *last release*: Jan 08, 2024, *status*: 5 - Production/Stable, From 3d91e422293c9fa811348a9f4602632a66d758eb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Jun 2024 08:28:57 +0200 Subject: [PATCH 48/53] build(deps): Bump pytest-bdd in /testing/plugins_integration (#12442) Bumps [pytest-bdd](https://github.com/pytest-dev/pytest-bdd) from 7.1.2 to 7.2.0. - [Release notes](https://github.com/pytest-dev/pytest-bdd/releases) - [Changelog](https://github.com/pytest-dev/pytest-bdd/blob/master/CHANGES.rst) - [Commits](https://github.com/pytest-dev/pytest-bdd/compare/7.1.2...7.2.0) --- updated-dependencies: - dependency-name: pytest-bdd dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- testing/plugins_integration/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/plugins_integration/requirements.txt b/testing/plugins_integration/requirements.txt index f44a02915..b3ced6e5c 100644 --- a/testing/plugins_integration/requirements.txt +++ b/testing/plugins_integration/requirements.txt @@ -1,7 +1,7 @@ anyio[curio,trio]==4.4.0 django==5.0.6 pytest-asyncio==0.23.7 -pytest-bdd==7.1.2 +pytest-bdd==7.2.0 pytest-cov==5.0.0 pytest-django==4.8.0 pytest-flakes==4.0.5 From 67a570aea9e16ecf2694cea86bec326ce9056f9f Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Mon, 10 Jun 2024 11:38:33 +0300 Subject: [PATCH 49/53] terminalwriter: factor out pygments lexer & formatter selection to own functions We intend to add some more logic here. --- src/_pytest/_io/terminalwriter.py | 120 ++++++++++++++++++------------ 1 file changed, 72 insertions(+), 48 deletions(-) diff --git a/src/_pytest/_io/terminalwriter.py b/src/_pytest/_io/terminalwriter.py index 5bcd05927..26344fd31 100644 --- a/src/_pytest/_io/terminalwriter.py +++ b/src/_pytest/_io/terminalwriter.py @@ -8,11 +8,17 @@ from typing import Literal from typing import Optional from typing import Sequence from typing import TextIO +from typing import TYPE_CHECKING from ..compat import assert_never from .wcwidth import wcswidth +if TYPE_CHECKING: + from pygments.formatter import Formatter + from pygments.lexer import Lexer + + # This code was initially copied from py 1.8.1, file _io/terminalwriter.py. @@ -194,58 +200,76 @@ class TerminalWriter: for indent, new_line in zip(indents, new_lines): self.line(indent + new_line) - def _highlight( - self, source: str, lexer: Literal["diff", "python"] = "python" - ) -> str: - """Highlight the given source if we have markup support.""" + def _get_pygments_lexer( + self, lexer: Literal["python", "diff"] + ) -> Optional["Lexer"]: + try: + if lexer == "python": + from pygments.lexers.python import PythonLexer + + return PythonLexer() + elif lexer == "diff": + from pygments.lexers.diff import DiffLexer + + return DiffLexer() + else: + assert_never(lexer) + except ModuleNotFoundError: + return None + + def _get_pygments_formatter(self) -> Optional["Formatter"]: + try: + import pygments.util + except ModuleNotFoundError: + return None + from _pytest.config.exceptions import UsageError - if not source or not self.hasmarkup or not self.code_highlight: - return source + theme = os.getenv("PYTEST_THEME") + theme_mode = os.getenv("PYTEST_THEME_MODE", "dark") try: from pygments.formatters.terminal import TerminalFormatter - if lexer == "python": - from pygments.lexers.python import PythonLexer as Lexer - elif lexer == "diff": - from pygments.lexers.diff import DiffLexer as Lexer - else: - assert_never(lexer) - from pygments import highlight - import pygments.util - except ImportError: - return source - else: - try: - highlighted: str = highlight( - source, - Lexer(), - TerminalFormatter( - bg=os.getenv("PYTEST_THEME_MODE", "dark"), - style=os.getenv("PYTEST_THEME"), - ), - ) - # pygments terminal formatter may add a newline when there wasn't one. - # We don't want this, remove. - if highlighted[-1] == "\n" and source[-1] != "\n": - highlighted = highlighted[:-1] + return TerminalFormatter(bg=theme_mode, style=theme) - # Some lexers will not set the initial color explicitly - # which may lead to the previous color being propagated to the - # start of the expression, so reset first. - return "\x1b[0m" + highlighted - except pygments.util.ClassNotFound as e: - raise UsageError( - "PYTEST_THEME environment variable had an invalid value: '{}'. " - "Only valid pygment styles are allowed.".format( - os.getenv("PYTEST_THEME") - ) - ) from e - except pygments.util.OptionError as e: - raise UsageError( - "PYTEST_THEME_MODE environment variable had an invalid value: '{}'. " - "The only allowed values are 'dark' and 'light'.".format( - os.getenv("PYTEST_THEME_MODE") - ) - ) from e + except pygments.util.ClassNotFound as e: + raise UsageError( + f"PYTEST_THEME environment variable had an invalid value: '{theme}'. " + "Only valid pygment styles are allowed." + ) from e + except pygments.util.OptionError as e: + raise UsageError( + f"PYTEST_THEME_MODE environment variable had an invalid value: '{theme_mode}'. " + "The only allowed values are 'dark' and 'light'." + ) from e + + def _highlight( + self, source: str, lexer: Literal["diff", "python"] = "python" + ) -> str: + """Highlight the given source if we have markup support.""" + if not source or not self.hasmarkup or not self.code_highlight: + return source + + pygments_lexer = self._get_pygments_lexer(lexer) + if pygments_lexer is None: + return source + + pygments_formatter = self._get_pygments_formatter() + if pygments_formatter is None: + return source + + from pygments import highlight + + highlighted: str = highlight(source, pygments_lexer, pygments_formatter) + # pygments terminal formatter may add a newline when there wasn't one. + # We don't want this, remove. + if highlighted[-1] == "\n" and source[-1] != "\n": + highlighted = highlighted[:-1] + + # Some lexers will not set the initial color explicitly + # which may lead to the previous color being propagated to the + # start of the expression, so reset first. + highlighted = "\x1b[0m" + highlighted + + return highlighted From 7ef9da1f02f517d5db758117439edf289087cd7f Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Mon, 10 Jun 2024 11:41:10 +0300 Subject: [PATCH 50/53] terminalwriter: improve `PYTEST_THEME`, `PYTEST_THEME_MODE` usage errors --- src/_pytest/_io/terminalwriter.py | 8 ++++---- testing/test_terminal.py | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/_pytest/_io/terminalwriter.py b/src/_pytest/_io/terminalwriter.py index 26344fd31..083c18232 100644 --- a/src/_pytest/_io/terminalwriter.py +++ b/src/_pytest/_io/terminalwriter.py @@ -235,13 +235,13 @@ class TerminalWriter: except pygments.util.ClassNotFound as e: raise UsageError( - f"PYTEST_THEME environment variable had an invalid value: '{theme}'. " - "Only valid pygment styles are allowed." + f"PYTEST_THEME environment variable has an invalid value: '{theme}'. " + "Hint: See available pygments styles with `pygmentize -L styles`." ) from e except pygments.util.OptionError as e: raise UsageError( - f"PYTEST_THEME_MODE environment variable had an invalid value: '{theme_mode}'. " - "The only allowed values are 'dark' and 'light'." + f"PYTEST_THEME_MODE environment variable has an invalid value: '{theme_mode}'. " + "The allowed values are 'dark' (default) and 'light'." ) from e def _highlight( diff --git a/testing/test_terminal.py b/testing/test_terminal.py index 6cd4a1827..ce9fdc50c 100644 --- a/testing/test_terminal.py +++ b/testing/test_terminal.py @@ -2609,8 +2609,8 @@ class TestCodeHighlight: monkeypatch.setenv("PYTEST_THEME", "invalid") result = pytester.runpytest_subprocess("--color=yes") result.stderr.fnmatch_lines( - "ERROR: PYTEST_THEME environment variable had an invalid value: 'invalid'. " - "Only valid pygment styles are allowed." + "ERROR: PYTEST_THEME environment variable has an invalid value: 'invalid'. " + "Hint: See available pygments styles with `pygmentize -L styles`." ) def test_code_highlight_invalid_theme_mode( @@ -2625,8 +2625,8 @@ class TestCodeHighlight: monkeypatch.setenv("PYTEST_THEME_MODE", "invalid") result = pytester.runpytest_subprocess("--color=yes") result.stderr.fnmatch_lines( - "ERROR: PYTEST_THEME_MODE environment variable had an invalid value: 'invalid'. " - "The only allowed values are 'dark' and 'light'." + "ERROR: PYTEST_THEME_MODE environment variable has an invalid value: 'invalid'. " + "The allowed values are 'dark' (default) and 'light'." ) From 23ca9798f7a119615017c177fc884e2f77c23abc Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Tue, 11 Jun 2024 18:36:20 +0300 Subject: [PATCH 51/53] doc: fix broken code blocks (#12449) Caused by 4588653b2497ed25976b7aaff225b889fb476756. The issue was fixed in https://github.com/astral-sh/ruff/issues/11577, so won't trigger again. Fix #12437. --- src/_pytest/capture.py | 4 ++++ src/_pytest/config/__init__.py | 1 + src/_pytest/monkeypatch.py | 1 + src/_pytest/pytester.py | 3 +++ 4 files changed, 9 insertions(+) diff --git a/src/_pytest/capture.py b/src/_pytest/capture.py index 198d41950..89a938d54 100644 --- a/src/_pytest/capture.py +++ b/src/_pytest/capture.py @@ -983,6 +983,7 @@ def capsys(request: SubRequest) -> Generator[CaptureFixture[str], None, None]: Returns an instance of :class:`CaptureFixture[str] `. Example: + .. code-block:: python def test_output(capsys): @@ -1010,6 +1011,7 @@ def capsysbinary(request: SubRequest) -> Generator[CaptureFixture[bytes], None, Returns an instance of :class:`CaptureFixture[bytes] `. Example: + .. code-block:: python def test_output(capsysbinary): @@ -1037,6 +1039,7 @@ def capfd(request: SubRequest) -> Generator[CaptureFixture[str], None, None]: Returns an instance of :class:`CaptureFixture[str] `. Example: + .. code-block:: python def test_system_echo(capfd): @@ -1064,6 +1067,7 @@ def capfdbinary(request: SubRequest) -> Generator[CaptureFixture[bytes], None, N Returns an instance of :class:`CaptureFixture[bytes] `. Example: + .. code-block:: python def test_system_echo(capfdbinary): diff --git a/src/_pytest/config/__init__.py b/src/_pytest/config/__init__.py index 287fac463..058aaa1ff 100644 --- a/src/_pytest/config/__init__.py +++ b/src/_pytest/config/__init__.py @@ -1735,6 +1735,7 @@ class Config: can be used to explicitly use the global verbosity level. Example: + .. code-block:: ini # content of pytest.ini diff --git a/src/_pytest/monkeypatch.py b/src/_pytest/monkeypatch.py index 3f398df76..f498d60df 100644 --- a/src/_pytest/monkeypatch.py +++ b/src/_pytest/monkeypatch.py @@ -142,6 +142,7 @@ class MonkeyPatch: which undoes any patching done inside the ``with`` block upon exit. Example: + .. code-block:: python import functools diff --git a/src/_pytest/pytester.py b/src/_pytest/pytester.py index f9ab007a4..42f50900a 100644 --- a/src/_pytest/pytester.py +++ b/src/_pytest/pytester.py @@ -805,6 +805,7 @@ class Pytester: The first created file. Examples: + .. code-block:: python pytester.makefile(".txt", "line1", "line2") @@ -858,6 +859,7 @@ class Pytester: existing files. Examples: + .. code-block:: python def test_something(pytester): @@ -877,6 +879,7 @@ class Pytester: existing files. Examples: + .. code-block:: python def test_something(pytester): From ff7598013581b5820dd83253df7d0cc46f785020 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 11 Jun 2024 12:36:39 -0300 Subject: [PATCH 52/53] [pre-commit.ci] pre-commit autoupdate (#12447) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [pre-commit.ci] pre-commit autoupdate updates: - [github.com/astral-sh/ruff-pre-commit: v0.4.7 → v0.4.8](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.7...v0.4.8) - [github.com/asottile/pyupgrade: v3.15.2 → v3.16.0](https://github.com/asottile/pyupgrade/compare/v3.15.2...v3.16.0) * Apply pyupgrade automatically --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Pierre Sassoulas --- .pre-commit-config.yaml | 4 ++-- src/_pytest/cacheprovider.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fb583b111..42fbc31ea 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.4.7" + rev: "v0.4.8" hooks: - id: ruff args: ["--fix"] @@ -44,7 +44,7 @@ repos: # https://pyproject-fmt.readthedocs.io/en/latest/#calculating-max-supported-python-version additional_dependencies: ["tox>=4.9"] - repo: https://github.com/asottile/pyupgrade - rev: v3.15.2 + rev: v3.16.0 hooks: - id: pyupgrade stages: [manual] diff --git a/src/_pytest/cacheprovider.py b/src/_pytest/cacheprovider.py index 7e00135a4..8ad36f9b9 100755 --- a/src/_pytest/cacheprovider.py +++ b/src/_pytest/cacheprovider.py @@ -221,9 +221,9 @@ class Cache: os.umask(umask) path.chmod(0o777 - umask) - with open(path.joinpath("README.md"), "xt", encoding="UTF-8") as f: + with open(path.joinpath("README.md"), "x", encoding="UTF-8") as f: f.write(README_CONTENT) - with open(path.joinpath(".gitignore"), "xt", encoding="UTF-8") as f: + with open(path.joinpath(".gitignore"), "x", encoding="UTF-8") as f: f.write("# Created by pytest automatically.\n*\n") with open(path.joinpath("CACHEDIR.TAG"), "xb") as f: f.write(CACHEDIR_TAG_CONTENT) From 2effd8cb2c91abf4782201c431f19d0b22517920 Mon Sep 17 00:00:00 2001 From: neutraljump <162650677+neutraljump@users.noreply.github.com> Date: Thu, 13 Jun 2024 21:39:02 +0930 Subject: [PATCH 53/53] Docs: clean up various documentation pages (#12451) * Change Contribution doc title to match sidebar * Rearrange sentence for clarity * Update backwards-compatibility.rst some minor grammar changes * Update pythonpath.rst fixed some gramatical errors * Update AUTHORS * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update doc/en/explanation/pythonpath.rst From a quick overview it looks like lowercase is more consistent, although some pages do use `pytest` in code blocks Co-authored-by: Bruno Oliveira --------- Co-authored-by: Mackerello <82668740+Mackerello@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Bruno Oliveira --- AUTHORS | 2 ++ CONTRIBUTING.rst | 4 ++-- doc/en/backwards-compatibility.rst | 28 ++++++++++++---------------- doc/en/explanation/pythonpath.rst | 16 ++++++++-------- 4 files changed, 24 insertions(+), 26 deletions(-) diff --git a/AUTHORS b/AUTHORS index 0560caf72..80b6d5157 100644 --- a/AUTHORS +++ b/AUTHORS @@ -259,6 +259,7 @@ Marc Bresson Marco Gorelli Mark Abramowitz Mark Dickinson +Mark Vong Marko Pacak Markus Unterwaditzer Martijn Faassen @@ -301,6 +302,7 @@ Nicholas Devenish Nicholas Murphy Niclas Olofsson Nicolas Delaby +Nico Vidal Nikolay Kondratyev Nipunn Koorapati Oleg Pidsadnyi diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 0bf440da2..12e2b18bb 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -1,5 +1,5 @@ ============================ -Contribution getting started +Contributing ============================ Contributions are highly welcomed and appreciated. Every little bit of help counts, @@ -124,7 +124,7 @@ For example: Submitting Plugins to pytest-dev -------------------------------- -Pytest development of the core, some plugins and support code happens +Development of the pytest core, support code, and some plugins happens in repositories living under the ``pytest-dev`` organisations: - `pytest-dev on GitHub `_ diff --git a/doc/en/backwards-compatibility.rst b/doc/en/backwards-compatibility.rst index e04e64a76..c0feb833c 100644 --- a/doc/en/backwards-compatibility.rst +++ b/doc/en/backwards-compatibility.rst @@ -5,30 +5,26 @@ Backwards Compatibility Policy .. versionadded: 6.0 -pytest is actively evolving and is a project that has been decades in the making, -we keep learning about new and better structures to express different details about testing. +Pytest is an actively evolving project that has been decades in the making. +We keep learning about new and better structures to express different details about testing. -While we implement those modifications we try to ensure an easy transition and don't want to impose unnecessary churn on our users and community/plugin authors. +While we implement those modifications, we try to ensure an easy transition and don't want to impose unnecessary churn on our users and community/plugin authors. As of now, pytest considers multiple types of backward compatibility transitions: -a) trivial: APIs which trivially translate to the new mechanism, - and do not cause problematic changes. +a) trivial: APIs that trivially translate to the new mechanism and do not cause problematic changes. - We try to support those indefinitely while encouraging users to switch to newer/better mechanisms through documentation. + We try to support those indefinitely while encouraging users to switch to newer or better mechanisms through documentation. -b) transitional: the old and new API don't conflict - and we can help users transition by using warnings, while supporting both for a prolonged time. +b) transitional: the old and new APIs don't conflict, and we can help users transition by using warnings while supporting both for a prolonged period of time. - We will only start the removal of deprecated functionality in major releases (e.g. if we deprecate something in 3.0 we will start to remove it in 4.0), and keep it around for at least two minor releases (e.g. if we deprecate something in 3.9 and 4.0 is the next release, we start to remove it in 5.0, not in 4.0). + We will only start the removal of deprecated functionality in major releases (e.g., if we deprecate something in 3.0, we will start to remove it in 4.0), and keep it around for at least two minor releases (e.g., if we deprecate something in 3.9 and 4.0 is the next release, we start to remove it in 5.0, not in 4.0). A deprecated feature scheduled to be removed in major version X will use the warning class `PytestRemovedInXWarning` (a subclass of :class:`~pytest.PytestDeprecationWarning`). - When the deprecation expires (e.g. 4.0 is released), we won't remove the deprecated functionality immediately, but will use the standard warning filters to turn `PytestRemovedInXWarning` (e.g. `PytestRemovedIn4Warning`) into **errors** by default. This approach makes it explicit that removal is imminent, and still gives you time to turn the deprecated feature into a warning instead of an error so it can be dealt with in your own time. In the next minor release (e.g. 4.1), the feature will be effectively removed. + When the deprecation expires (e.g., 4.0 is released), we won't remove the deprecated functionality immediately but will use the standard warning filters to turn `PytestRemovedInXWarning` (e.g., `PytestRemovedIn4Warning`) into **errors** by default. This approach makes it explicit that removal is imminent and still gives you time to turn the deprecated feature into a warning instead of an error so it can be dealt with in your own time. In the next minor release (e.g., 4.1), the feature will be effectively removed. - -c) true breakage: should only be considered when normal transition is unreasonably unsustainable and would offset important development/features by years. - In addition, they should be limited to APIs where the number of actual users is very small (for example only impacting some plugins), and can be coordinated with the community in advance. +c) True breakage should only be considered when a normal transition is unreasonably unsustainable and would offset important developments or features by years. In addition, they should be limited to APIs where the number of actual users is very small (for example, only impacting some plugins) and can be coordinated with the community in advance. Examples for such upcoming changes: @@ -62,11 +58,11 @@ Focus primary on smooth transition - stance (pre 6.0) Keeping backwards compatibility has a very high priority in the pytest project. Although we have deprecated functionality over the years, most of it is still supported. All deprecations in pytest were done because simpler or more efficient ways of accomplishing the same tasks have emerged, making the old way of doing things unnecessary. -With the pytest 3.0 release we introduced a clear communication scheme for when we will actually remove the old busted joint and politely ask you to use the new hotness instead, while giving you enough time to adjust your tests or raise concerns if there are valid reasons to keep deprecated functionality around. +With the pytest 3.0 release, we introduced a clear communication scheme for when we will actually remove the old busted joint and politely ask you to use the new hotness instead, while giving you enough time to adjust your tests or raise concerns if there are valid reasons to keep deprecated functionality around. -To communicate changes we issue deprecation warnings using a custom warning hierarchy (see :ref:`internal-warnings`). These warnings may be suppressed using the standard means: ``-W`` command-line flag or ``filterwarnings`` ini options (see :ref:`warnings`), but we suggest to use these sparingly and temporarily, and heed the warnings when possible. +To communicate changes, we issue deprecation warnings using a custom warning hierarchy (see :ref:`internal-warnings`). These warnings may be suppressed using the standard means: ``-W`` command-line flag or ``filterwarnings`` ini options (see :ref:`warnings`), but we suggest to use these sparingly and temporarily, and heed the warnings when possible. -We will only start the removal of deprecated functionality in major releases (e.g. if we deprecate something in 3.0 we will start to remove it in 4.0), and keep it around for at least two minor releases (e.g. if we deprecate something in 3.9 and 4.0 is the next release, we start to remove it in 5.0, not in 4.0). +We will only start the removal of deprecated functionality in major releases (e.g. if we deprecate something in 3.0, we will start to remove it in 4.0), and keep it around for at least two minor releases (e.g. if we deprecate something in 3.9 and 4.0 is the next release, we start to remove it in 5.0, not in 4.0). When the deprecation expires (e.g. 4.0 is released), we won't remove the deprecated functionality immediately, but will use the standard warning filters to turn them into **errors** by default. This approach makes it explicit that removal is imminent, and still gives you time to turn the deprecated feature into a warning instead of an error so it can be dealt with in your own time. In the next minor release (e.g. 4.1), the feature will be effectively removed. diff --git a/doc/en/explanation/pythonpath.rst b/doc/en/explanation/pythonpath.rst index 33eba86b5..d0314a6db 100644 --- a/doc/en/explanation/pythonpath.rst +++ b/doc/en/explanation/pythonpath.rst @@ -8,15 +8,15 @@ pytest import mechanisms and ``sys.path``/``PYTHONPATH`` Import modes ------------ -pytest as a testing framework needs to import test modules and ``conftest.py`` files for execution. +pytest as a testing framework that needs to import test modules and ``conftest.py`` files for execution. -Importing files in Python is a non-trivial processes, so aspects of the +Importing files in Python is a non-trivial process, so aspects of the import process can be controlled through the ``--import-mode`` command-line flag, which can assume these values: .. _`import-mode-prepend`: -* ``prepend`` (default): the directory path containing each module will be inserted into the *beginning* +* ``prepend`` (default): The directory path containing each module will be inserted into the *beginning* of :py:data:`sys.path` if not already there, and then imported with the :func:`importlib.import_module ` function. @@ -34,7 +34,7 @@ these values: * ``append``: the directory containing each module is appended to the end of :py:data:`sys.path` if not already there, and imported with :func:`importlib.import_module `. - This better allows to run test modules against installed versions of a package even if the + This better allows users to run test modules against installed versions of a package even if the package under test has the same import root. For example: :: @@ -45,7 +45,7 @@ these values: the tests will run against the installed version of ``pkg_under_test`` when ``--import-mode=append`` is used whereas - with ``prepend`` they would pick up the local version. This kind of confusion is why + with ``prepend``, they would pick up the local version. This kind of confusion is why we advocate for using :ref:`src-layouts `. Same as ``prepend``, requires test module names to be unique when the test directory tree is @@ -67,7 +67,7 @@ these values: are not importable. The recommendation in this case it to place testing utility modules together with the application/library code, for example ``app.testing.helpers``. - Important: by "test utility modules" we mean functions/classes which are imported by + Important: by "test utility modules", we mean functions/classes which are imported by other tests directly; this does not include fixtures, which should be placed in ``conftest.py`` files, along with the test modules, and are discovered automatically by pytest. @@ -76,8 +76,8 @@ these values: 1. Given a certain module path, for example ``tests/core/test_models.py``, derives a canonical name like ``tests.core.test_models`` and tries to import it. - For non-test modules this will work if they are accessible via :py:data:`sys.path`, so - for example ``.env/lib/site-packages/app/core.py`` will be importable as ``app.core``. + For non-test modules, this will work if they are accessible via :py:data:`sys.path`. So + for example, ``.env/lib/site-packages/app/core.py`` will be importable as ``app.core``. This is happens when plugins import non-test modules (for example doctesting). If this step succeeds, the module is returned.