From cac1eed0ea2901c6acc249cdd0050fe61caf1e85 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 21 Oct 2023 23:43:14 -0300 Subject: [PATCH 01/22] [automated] Update plugin list (#11534) Co-authored-by: pytest bot --- doc/en/reference/plugin_list.rst | 108 ++++++++++++++++++++----------- 1 file changed, 70 insertions(+), 38 deletions(-) diff --git a/doc/en/reference/plugin_list.rst b/doc/en/reference/plugin_list.rst index 0761c00a5..6ee6098cf 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-chunks` Run only a chunk of your test suite Jul 05, 2022 N/A pytest (>=6.0.0) :pypi:`pytest-circleci` py.test plugin for CircleCI May 03, 2019 N/A N/A :pypi:`pytest-circleci-parallelized` Parallelize pytest across CircleCI workers. Oct 20, 2022 N/A N/A @@ -329,7 +330,7 @@ This list contains 1329 plugins. :pypi:`pytest-dir-equal` pytest-dir-equals is a pytest plugin providing helpers to assert directories equality allowing golden testing Jun 23, 2023 4 - Beta pytest>=7.1.2 :pypi:`pytest-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. Jul 16, 2023 4 - Beta pytest (!=6.0.0,<8,>=3.3.2) + :pypi:`pytest-discord` A pytest plugin to notify test results to a Discord channel. Oct 18, 2023 4 - Beta pytest !=6.0.0,<8,>=3.3.2 :pypi:`pytest-django` A Django plugin for pytest. Dec 07, 2021 5 - Production/Stable pytest (>=5.4.0) :pypi:`pytest-django-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 @@ -532,7 +533,7 @@ This list contains 1329 plugins. :pypi:`pytest-ghostinspector` For finding/executing Ghost Inspector tests May 17, 2016 3 - Alpha N/A :pypi:`pytest-girder` A set of pytest fixtures for testing Girder applications. Oct 09, 2023 N/A N/A :pypi:`pytest-git` Git repository fixture for py.test May 28, 2019 5 - Production/Stable pytest - :pypi:`pytest-gitconfig` Provide a gitconfig sandbox for testing Oct 14, 2023 4 - Beta pytest>=7.1.2 + :pypi:`pytest-gitconfig` Provide a gitconfig sandbox for testing Oct 15, 2023 4 - Beta pytest>=7.1.2 :pypi:`pytest-gitcov` Pytest plugin for reporting on coverage of the last git commit. Jan 11, 2020 2 - Pre-Alpha N/A :pypi:`pytest-git-fixtures` Pytest fixtures for testing with git. Mar 11, 2021 4 - Beta pytest :pypi:`pytest-github` Plugin for py.test that associates tests with github issues using a marker. Mar 07, 2019 5 - Production/Stable N/A @@ -613,7 +614,7 @@ This list contains 1329 plugins. :pypi:`pytest-informative-node` display more node ininformation. Apr 25, 2019 4 - Beta N/A :pypi:`pytest-infrastructure` pytest stack validation prior to testing executing Apr 12, 2020 4 - Beta N/A :pypi:`pytest-ini` Reuse pytest.ini to store env variables Apr 26, 2022 N/A N/A - :pypi:`pytest-inline` A pytest plugin for writing inline tests. Oct 10, 2023 4 - Beta pytest >=7.0.0 + :pypi:`pytest-inline` A pytest plugin for writing inline tests. Oct 19, 2023 4 - Beta pytest >=7.0.0 :pypi:`pytest-inmanta` A py.test plugin providing fixtures to simplify inmanta modules testing. Aug 03, 2023 5 - Production/Stable N/A :pypi:`pytest-inmanta-extensions` Inmanta tests package Oct 13, 2023 5 - Production/Stable N/A :pypi:`pytest-inmanta-lsm` Common fixtures for inmanta LSM related modules May 17, 2023 5 - Production/Stable N/A @@ -692,7 +693,7 @@ This list contains 1329 plugins. :pypi:`pytest-litter` Pytest plugin which verifies that tests do not modify file trees. Aug 08, 2023 4 - Beta pytest >=6.1 :pypi:`pytest-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 04, 2022 5 - Production/Stable pytest + :pypi:`pytest-localftpserver` A PyTest plugin which provides an FTP fixture for your tests Oct 14, 2023 5 - Production/Stable pytest :pypi:`pytest-localserver` pytest plugin to test server connections locally. Oct 12, 2023 4 - Beta N/A :pypi:`pytest-localstack` Pytest plugin for AWS integration tests Jun 07, 2023 4 - Beta pytest (>=6.0.0,<7.0.0) :pypi:`pytest-lockable` lockable resource plugin for pytest Aug 09, 2023 5 - Production/Stable pytest @@ -745,7 +746,7 @@ This list contains 1329 plugins. :pypi:`pytest-missing-fixtures` Pytest plugin that creates missing fixtures Oct 14, 2020 4 - Beta pytest (>=3.5.0) :pypi:`pytest-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 Jun 15, 2023 5 - Production/Stable pytest (>=5.0) + :pypi:`pytest-mock` Thin-wrapper around the mock package for easier use with pytest Oct 19, 2023 5 - Production/Stable pytest >=5.0 :pypi:`pytest-mock-api` A mock API server with configurable routes and responses available as a fixture. Feb 13, 2019 1 - Planning pytest (>=4.0.0) :pypi:`pytest-mock-generator` A pytest fixture wrapper for https://pypi.org/project/mock-generator May 16, 2022 5 - Production/Stable N/A :pypi:`pytest-mock-helper` Help you mock HTTP call and generate mock code Jan 24, 2018 N/A pytest @@ -784,7 +785,7 @@ This list contains 1329 plugins. :pypi:`pytest-mypy-plugins-shim` Substitute for "pytest-mypy-plugins" for Python implementations which aren't supported by mypy. Apr 12, 2021 N/A pytest>=6.0.0 :pypi:`pytest-mypy-testing` Pytest plugin to check mypy output. Feb 25, 2023 N/A pytest>=7,<8 :pypi:`pytest-mysql` MySQL process and client fixtures for pytest Mar 27, 2023 5 - Production/Stable pytest (>=6.2) - :pypi:`pytest-ndb` Open Source Software Health Report Jul 19, 2023 N/A pytest + :pypi:`pytest-ndb` pytest notebook debugger Oct 15, 2023 N/A pytest :pypi:`pytest-needle` pytest plugin for visual testing websites using selenium Dec 10, 2018 4 - Beta pytest (<5.0.0,>=3.0.0) :pypi:`pytest-neo` pytest-neo is a plugin for pytest that shows tests like screen of Matrix. Jan 08, 2022 3 - Alpha pytest (>=6.2.0) :pypi:`pytest-netdut` "Automated software testing for switches using pytest" Sep 21, 2023 N/A pytest <7.3,>=3.5.0 @@ -846,6 +847,7 @@ This list contains 1329 plugins. :pypi:`pytest-parametrize-cases` A more user-friendly way to write parametrized tests. Mar 13, 2022 N/A pytest (>=6.1.2) :pypi:`pytest-parametrized` Pytest decorator for parametrizing tests with default iterables. Sep 13, 2022 5 - Production/Stable pytest :pypi:`pytest-parametrize-suite` A simple pytest extension for creating a named test suite. Jan 19, 2023 5 - Production/Stable pytest + :pypi:`pytest-param-scope` pytest parametrize scope fixture workaround Oct 18, 2023 N/A pytest :pypi:`pytest-parawtf` Finally spell paramete?ri[sz]e correctly Dec 03, 2018 4 - Beta pytest (>=3.6.0) :pypi:`pytest-pass` Check out https://github.com/elilutsky/pytest-pass Dec 04, 2019 N/A N/A :pypi:`pytest-passrunner` Pytest plugin providing the 'run_on_pass' marker Feb 10, 2021 5 - Production/Stable pytest (>=4.6.0) @@ -885,10 +887,10 @@ This list contains 1329 plugins. :pypi:`pytest-plone` Pytest plugin to test Plone addons Jan 05, 2023 3 - Alpha pytest :pypi:`pytest-plt` Fixtures for quickly making Matplotlib plots in tests Aug 17, 2020 5 - Production/Stable pytest :pypi:`pytest-plugin-helpers` A plugin to help developing and testing other plugins Nov 23, 2019 4 - Beta pytest (>=3.5.0) - :pypi:`pytest-plus` PyTest Plus Plugin :: extends pytest functionality Dec 24, 2022 5 - Production/Stable pytest (>=6.0.1) + :pypi:`pytest-plus` PyTest Plus Plugin :: extends pytest functionality Oct 18, 2023 5 - Production/Stable pytest >=7.4.2 :pypi:`pytest-pmisc` Mar 21, 2019 5 - Production/Stable N/A :pypi:`pytest-pointers` Pytest plugin to define functions you test with special marks for better navigation and reports Dec 26, 2022 N/A N/A - :pypi:`pytest-pokie` Pokie plugin for pytest May 22, 2023 5 - Production/Stable N/A + :pypi:`pytest-pokie` Pokie plugin for pytest Oct 19, 2023 5 - Production/Stable N/A :pypi:`pytest-polarion-cfme` pytest plugin for collecting test cases and recording test results Nov 13, 2017 3 - Alpha N/A :pypi:`pytest-polarion-collect` pytest plugin for collecting polarion test cases data Jun 18, 2020 3 - Alpha pytest :pypi:`pytest-polecat` Provides Polecat pytest fixtures Aug 12, 2019 4 - Beta N/A @@ -999,7 +1001,7 @@ This list contains 1329 plugins. :pypi:`pytest-reportlog` Replacement for the --resultlog option, focused in simplicity and extensibility May 22, 2023 3 - Alpha pytest :pypi:`pytest-report-me` A pytest plugin to generate report. Dec 31, 2020 N/A pytest :pypi:`pytest-report-parameters` pytest plugin for adding tests' parameters to junit report Jun 18, 2020 3 - Alpha pytest (>=2.4.2) - :pypi:`pytest-reportportal` Agent for Reporting results of tests to the Report Portal Sep 25, 2023 N/A pytest >=3.8.0 + :pypi:`pytest-reportportal` Agent for Reporting results of tests to the Report Portal Oct 17, 2023 N/A pytest >=3.8.0 :pypi:`pytest-reports` An interesting python package Jun 07, 2023 N/A N/A :pypi:`pytest-reqs` pytest plugin to check pinned requirements May 12, 2019 N/A pytest (>=2.4.2) :pypi:`pytest-requests` A simple plugin to use with pytest Jun 24, 2019 4 - Beta pytest (>=3.5.0) @@ -1019,7 +1021,7 @@ This list contains 1329 plugins. :pypi:`pytest-responses` py.test integration for responses Oct 11, 2022 N/A pytest (>=2.5) :pypi:`pytest-rest-api` Aug 08, 2022 N/A pytest (>=7.1.2,<8.0.0) :pypi:`pytest-restrict` Pytest plugin to restrict the test types allowed Jul 10, 2023 5 - Production/Stable pytest - :pypi:`pytest-result-log` Write the execution result of the case to the log Apr 17, 2023 N/A pytest>=7.2.0 + :pypi:`pytest-result-log` A pytest plugin that records the start, end, and result information of each use case in a log file Oct 15, 2023 N/A pytest>=7.2.0 :pypi:`pytest-result-sender` Apr 20, 2023 N/A pytest>=7.3.1 :pypi:`pytest-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 @@ -1057,7 +1059,7 @@ This list contains 1329 plugins. :pypi:`pytest-sanic` a pytest plugin for Sanic Oct 25, 2021 N/A pytest (>=5.2) :pypi:`pytest-sanity` Dec 07, 2020 N/A N/A :pypi:`pytest-sa-pg` May 14, 2019 N/A N/A - :pypi:`pytest-sbase` A complete web automation framework for end-to-end testing. Oct 13, 2023 5 - Production/Stable N/A + :pypi:`pytest-sbase` A complete web automation framework for end-to-end testing. Oct 20, 2023 5 - Production/Stable N/A :pypi:`pytest-scenario` pytest plugin for test scenarios Feb 06, 2017 3 - Alpha N/A :pypi:`pytest-schedule` The job of test scheduling for humans. Jan 07, 2023 5 - Production/Stable N/A :pypi:`pytest-schema` 👍 Validate return values against a schema-like object in testing Mar 14, 2022 5 - Production/Stable pytest (>=3.5.0) @@ -1065,8 +1067,8 @@ This list contains 1329 plugins. :pypi:`pytest-securestore` An encrypted password store for use within pytest cases Nov 08, 2021 4 - Beta N/A :pypi:`pytest-select` A pytest plugin which allows to (de-)select tests from a file. Jan 18, 2019 3 - Alpha pytest (>=3.0) :pypi:`pytest-selenium` pytest plugin for Selenium May 28, 2023 5 - Production/Stable pytest>=6.0.0 - :pypi:`pytest-selenium-auto` pytest plugin to automatically capture screenshots upon selenium webdriver events Oct 03, 2023 N/A pytest >= 7.0.0 - :pypi:`pytest-seleniumbase` A complete web automation framework for end-to-end testing. Oct 13, 2023 5 - Production/Stable N/A + :pypi:`pytest-selenium-auto` pytest plugin to automatically capture screenshots upon selenium webdriver events Oct 18, 2023 N/A pytest >= 7.0.0 + :pypi:`pytest-seleniumbase` A complete web automation framework for end-to-end testing. Oct 20, 2023 5 - Production/Stable N/A :pypi:`pytest-selenium-enhancer` pytest plugin for Selenium Apr 29, 2022 5 - Production/Stable N/A :pypi:`pytest-selenium-pdiff` A pytest package implementing perceptualdiff for Selenium tests. Apr 06, 2017 2 - Pre-Alpha N/A :pypi:`pytest-selenium-screenshot` pytest plugin to automatically capture screenshots upon selenium webdriver events Aug 22, 2023 N/A pytest >= 7.0.0 @@ -1095,7 +1097,7 @@ This list contains 1329 plugins. :pypi:`pytest-simple-plugin` Simple pytest plugin Nov 27, 2019 N/A N/A :pypi:`pytest-simple-settings` simple-settings plugin for pytest Nov 17, 2020 4 - Beta pytest :pypi:`pytest-single-file-logging` Allow for multiple processes to log to a single file May 05, 2016 4 - Beta pytest (>=2.8.1) - :pypi:`pytest-skip-markers` Pytest Salt Plugin Jul 31, 2023 5 - Production/Stable pytest (>=7.1.0) + :pypi:`pytest-skip-markers` Pytest Salt Plugin Oct 20, 2023 5 - Production/Stable pytest >=7.1.0 :pypi:`pytest-skipper` A plugin that selects only tests with changes in execution path Mar 26, 2017 3 - Alpha pytest (>=3.0.6) :pypi:`pytest-skippy` Automatically skip tests that don't need to run! Jan 27, 2018 3 - Alpha pytest (>=2.3.4) :pypi:`pytest-skip-slow` A pytest plugin to skip \`@pytest.mark.slow\` tests by default. Feb 09, 2023 N/A pytest>=6.2.0 @@ -1204,7 +1206,7 @@ This list contains 1329 plugins. :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) - :pypi:`pytest-testmon` selects tests affected by changed files and methods Jul 13, 2023 4 - Beta pytest (<8,>=5) + :pypi:`pytest-testmon` selects tests affected by changed files and methods Oct 17, 2023 4 - Beta pytest <8,>=5 :pypi:`pytest-testmon-dev` selects tests affected by changed files and methods Mar 30, 2023 4 - Beta pytest (<8,>=5) :pypi:`pytest-testmon-oc` nOly selects tests affected by changed files and methods Jun 01, 2022 4 - Beta pytest (<8,>=5) :pypi:`pytest-testmon-skip-libraries` selects tests affected by changed files and methods Mar 03, 2023 4 - Beta pytest (<8,>=5) @@ -1287,6 +1289,7 @@ This list contains 1329 plugins. :pypi:`pytest-unhandled-exception-exit-code` Plugin for py.test set a different exit code on uncaught exceptions Jun 22, 2020 5 - Production/Stable pytest (>=2.3) :pypi:`pytest-unique` Pytest fixture to generate unique values. Sep 15, 2023 N/A pytest (>=7.4.2,<8.0.0) :pypi:`pytest-unittest-filter` A pytest plugin for filtering unittest-based test classes Jan 12, 2019 4 - Beta pytest (>=3.1.0) + :pypi:`pytest-unitvis` Oct 20, 2023 3 - Alpha pytest >=7.0.0 :pypi:`pytest-unmarked` Run only unmarked tests Aug 27, 2019 5 - Production/Stable N/A :pypi:`pytest-unordered` Test equality of unordered collections in pytest Nov 28, 2022 4 - Beta pytest (>=6.0.0) :pypi:`pytest-unstable` Set a test as unstable to return 0 even if it failed Sep 27, 2022 4 - Beta N/A @@ -1322,6 +1325,7 @@ This list contains 1329 plugins. :pypi:`pytest-web3-data` A pytest plugin to fetch test data from IPFS HTTP gateways during pytest execution. Oct 04, 2023 4 - Beta pytest :pypi:`pytest-webdriver` Selenium webdriver fixture for py.test May 28, 2019 5 - Production/Stable pytest :pypi:`pytest-wetest` Welian API Automation test framework pytest plugin Nov 10, 2018 4 - Beta N/A + :pypi:`pytest-when` Utility which makes mocking more readable and controllable Oct 18, 2023 N/A pytest>=7.3.1 :pypi:`pytest-whirlwind` Testing Tornado. Jun 12, 2020 N/A N/A :pypi:`pytest-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 @@ -2572,6 +2576,13 @@ This list contains 1329 plugins. A pytest plugin to send a report and printing summary of tests. + :pypi:`pytest-choose` + *last release*: Oct 17, 2023, + *status*: N/A, + *requires*: pytest >=7.0.0 + + Provide the pytest with the ability to collect use cases based on rules in text files + :pypi:`pytest-chunks` *last release*: Jul 05, 2022, *status*: N/A, @@ -3434,9 +3445,9 @@ This list contains 1329 plugins. Disable plugins per test :pypi:`pytest-discord` - *last release*: Jul 16, 2023, + *last release*: Oct 18, 2023, *status*: 4 - Beta, - *requires*: pytest (!=6.0.0,<8,>=3.3.2) + *requires*: pytest !=6.0.0,<8,>=3.3.2 A pytest plugin to notify test results to a Discord channel. @@ -4855,7 +4866,7 @@ This list contains 1329 plugins. Git repository fixture for py.test :pypi:`pytest-gitconfig` - *last release*: Oct 14, 2023, + *last release*: Oct 15, 2023, *status*: 4 - Beta, *requires*: pytest>=7.1.2 @@ -5422,7 +5433,7 @@ This list contains 1329 plugins. Reuse pytest.ini to store env variables :pypi:`pytest-inline` - *last release*: Oct 10, 2023, + *last release*: Oct 19, 2023, *status*: 4 - Beta, *requires*: pytest >=7.0.0 @@ -5975,7 +5986,7 @@ This list contains 1329 plugins. Generate local badges (shields) reporting your test suite status. :pypi:`pytest-localftpserver` - *last release*: Oct 04, 2022, + *last release*: Oct 14, 2023, *status*: 5 - Production/Stable, *requires*: pytest @@ -6346,9 +6357,9 @@ This list contains 1329 plugins. pytest plugin to display test execution output like a mochajs :pypi:`pytest-mock` - *last release*: Jun 15, 2023, + *last release*: Oct 19, 2023, *status*: 5 - Production/Stable, - *requires*: pytest (>=5.0) + *requires*: pytest >=5.0 Thin-wrapper around the mock package for easier use with pytest @@ -6619,11 +6630,11 @@ This list contains 1329 plugins. MySQL process and client fixtures for pytest :pypi:`pytest-ndb` - *last release*: Jul 19, 2023, + *last release*: Oct 15, 2023, *status*: N/A, *requires*: pytest - Open Source Software Health Report + pytest notebook debugger :pypi:`pytest-needle` *last release*: Dec 10, 2018, @@ -7052,6 +7063,13 @@ This list contains 1329 plugins. A simple pytest extension for creating a named test suite. + :pypi:`pytest-param-scope` + *last release*: Oct 18, 2023, + *status*: N/A, + *requires*: pytest + + pytest parametrize scope fixture workaround + :pypi:`pytest-parawtf` *last release*: Dec 03, 2018, *status*: 4 - Beta, @@ -7326,9 +7344,9 @@ This list contains 1329 plugins. A plugin to help developing and testing other plugins :pypi:`pytest-plus` - *last release*: Dec 24, 2022, + *last release*: Oct 18, 2023, *status*: 5 - Production/Stable, - *requires*: pytest (>=6.0.1) + *requires*: pytest >=7.4.2 PyTest Plus Plugin :: extends pytest functionality @@ -7347,7 +7365,7 @@ This list contains 1329 plugins. Pytest plugin to define functions you test with special marks for better navigation and reports :pypi:`pytest-pokie` - *last release*: May 22, 2023, + *last release*: Oct 19, 2023, *status*: 5 - Production/Stable, *requires*: N/A @@ -8124,7 +8142,7 @@ This list contains 1329 plugins. pytest plugin for adding tests' parameters to junit report :pypi:`pytest-reportportal` - *last release*: Sep 25, 2023, + *last release*: Oct 17, 2023, *status*: N/A, *requires*: pytest >=3.8.0 @@ -8264,11 +8282,11 @@ This list contains 1329 plugins. Pytest plugin to restrict the test types allowed :pypi:`pytest-result-log` - *last release*: Apr 17, 2023, + *last release*: Oct 15, 2023, *status*: N/A, *requires*: pytest>=7.2.0 - Write the execution result of the case to the log + A pytest plugin that records the start, end, and result information of each use case in a log file :pypi:`pytest-result-sender` *last release*: Apr 20, 2023, @@ -8530,7 +8548,7 @@ This list contains 1329 plugins. :pypi:`pytest-sbase` - *last release*: Oct 13, 2023, + *last release*: Oct 20, 2023, *status*: 5 - Production/Stable, *requires*: N/A @@ -8586,14 +8604,14 @@ This list contains 1329 plugins. pytest plugin for Selenium :pypi:`pytest-selenium-auto` - *last release*: Oct 03, 2023, + *last release*: Oct 18, 2023, *status*: N/A, *requires*: pytest >= 7.0.0 pytest plugin to automatically capture screenshots upon selenium webdriver events :pypi:`pytest-seleniumbase` - *last release*: Oct 13, 2023, + *last release*: Oct 20, 2023, *status*: 5 - Production/Stable, *requires*: N/A @@ -8796,9 +8814,9 @@ This list contains 1329 plugins. Allow for multiple processes to log to a single file :pypi:`pytest-skip-markers` - *last release*: Jul 31, 2023, + *last release*: Oct 20, 2023, *status*: 5 - Production/Stable, - *requires*: pytest (>=7.1.0) + *requires*: pytest >=7.1.0 Pytest Salt Plugin @@ -9559,9 +9577,9 @@ This list contains 1329 plugins. pytest reporting plugin for testlink :pypi:`pytest-testmon` - *last release*: Jul 13, 2023, + *last release*: Oct 17, 2023, *status*: 4 - Beta, - *requires*: pytest (<8,>=5) + *requires*: pytest <8,>=5 selects tests affected by changed files and methods @@ -10139,6 +10157,13 @@ This list contains 1329 plugins. A pytest plugin for filtering unittest-based test classes + :pypi:`pytest-unitvis` + *last release*: Oct 20, 2023, + *status*: 3 - Alpha, + *requires*: pytest >=7.0.0 + + + :pypi:`pytest-unmarked` *last release*: Aug 27, 2019, *status*: 5 - Production/Stable, @@ -10384,6 +10409,13 @@ This list contains 1329 plugins. Welian API Automation test framework pytest plugin + :pypi:`pytest-when` + *last release*: Oct 18, 2023, + *status*: N/A, + *requires*: pytest>=7.3.1 + + Utility which makes mocking more readable and controllable + :pypi:`pytest-whirlwind` *last release*: Jun 12, 2020, *status*: N/A, From 40e9abd66b3b8cafa11a08442f16849d92478fc7 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 23 Oct 2023 08:05:40 -0300 Subject: [PATCH 02/22] [pre-commit.ci] pre-commit autoupdate (#11510) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [pre-commit.ci] pre-commit autoupdate updates: - [github.com/pre-commit/mirrors-mypy: v1.5.1 → v1.6.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.5.1...v1.6.0) * Ignore two typing errors after updating to mypy 1.6.0 --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Bruno Oliveira --- .pre-commit-config.yaml | 2 +- src/_pytest/_py/path.py | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1b7b0278e..bb2a464ba 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -56,7 +56,7 @@ repos: hooks: - id: python-use-type-annotations - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.5.1 + rev: v1.6.0 hooks: - id: mypy files: ^(src/|testing/) diff --git a/src/_pytest/_py/path.py b/src/_pytest/_py/path.py index 41a7926c5..24348525a 100644 --- a/src/_pytest/_py/path.py +++ b/src/_pytest/_py/path.py @@ -755,7 +755,13 @@ class LocalPath: if ensure: self.dirpath().ensure(dir=1) if encoding: - return error.checked_call(io.open, self.strpath, mode, encoding=encoding) + # Using type ignore here because of this error: + # error: Argument 1 has incompatible type overloaded function; + # expected "Callable[[str, Any, Any], TextIOWrapper]" [arg-type] + # Which seems incorrect, given io.open supports the given argument types. + return error.checked_call( + io.open, self.strpath, mode, encoding=encoding # type:ignore[arg-type] + ) return error.checked_call(open, self.strpath, mode) def _fastjoin(self, name): @@ -1261,13 +1267,19 @@ class LocalPath: @classmethod def mkdtemp(cls, rootdir=None): """Return a Path object pointing to a fresh new temporary directory - (which we created ourself). + (which we created ourselves). """ import tempfile if rootdir is None: rootdir = cls.get_temproot() - return cls(error.checked_call(tempfile.mkdtemp, dir=str(rootdir))) + # Using type ignore here because of this error: + # error: Argument 1 has incompatible type overloaded function; expected "Callable[[str], str]" [arg-type] + # Which seems incorrect, given tempfile.mkdtemp supports the given argument types. + path = error.checked_call( + tempfile.mkdtemp, dir=str(rootdir) # type:ignore[arg-type] + ) + return cls(path) @classmethod def make_numbered_dir( From 304ab8495e11a0182fa2d65f4d7603ee3420db1c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Oct 2023 09:01:08 -0300 Subject: [PATCH 03/22] build(deps): Bump pytest-mock in /testing/plugins_integration (#11539) Bumps [pytest-mock](https://github.com/pytest-dev/pytest-mock) from 3.11.1 to 3.12.0. - [Release notes](https://github.com/pytest-dev/pytest-mock/releases) - [Changelog](https://github.com/pytest-dev/pytest-mock/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest-mock/compare/v3.11.1...v3.12.0) --- updated-dependencies: - dependency-name: pytest-mock 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 82d1a55a7..6fc3e8dc4 100644 --- a/testing/plugins_integration/requirements.txt +++ b/testing/plugins_integration/requirements.txt @@ -6,7 +6,7 @@ pytest-cov==4.1.0 pytest-django==4.5.2 pytest-flakes==4.0.5 pytest-html==4.0.2 -pytest-mock==3.11.1 +pytest-mock==3.12.0 pytest-rerunfailures==12.0 pytest-sugar==0.9.7 pytest-trio==0.7.0 From ee53433542463c91c12dace0ea7046087417cbbd Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Mon, 23 Oct 2023 09:56:33 -0300 Subject: [PATCH 04/22] Configure ReadTheDocs to fail on warnings (#11535) * Configure ReadTheDocs to fail on warnings Important to catch broken links and references. * Remove dead link to distutils configuration docs --- .readthedocs.yml | 4 ++++ doc/en/reference/customize.rst | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index b506c5f40..266d4e07a 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -9,6 +9,10 @@ python: path: . - requirements: doc/en/requirements.txt +sphinx: + configuration: doc/en/conf.py + fail_on_warning: true + build: os: ubuntu-20.04 tools: diff --git a/doc/en/reference/customize.rst b/doc/en/reference/customize.rst index b794d646b..24c0ed217 100644 --- a/doc/en/reference/customize.rst +++ b/doc/en/reference/customize.rst @@ -90,7 +90,7 @@ and can also be used to hold pytest configuration if they have a ``[pytest]`` se setup.cfg ~~~~~~~~~ -``setup.cfg`` files are general purpose configuration files, used originally by :doc:`distutils `, and can also be used to hold pytest configuration +``setup.cfg`` files are general purpose configuration files, used originally by ``distutils`` (now deprecated) and `setuptools `__, and can also be used to hold pytest configuration if they have a ``[tool:pytest]`` section. .. code-block:: ini From 395bbae8a28e2d5302d54ef94fc583b065d9a1c1 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Sat, 21 Oct 2023 15:35:07 -0300 Subject: [PATCH 05/22] Ensure logging tests always cleanup after themselves Logging has many global states, and we did foresee this by creating a ``cleanup_disabled_logging`` fixture, however one might still forget to use it and failures leak later -- sometimes not even in the same PR, because the order of the tests might change in the future, specially when running under xdist. This problem surfaced during pytest-dev/pytest#11530, where tests unrelated to the change started to fail. --- testing/logging/test_fixture.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/testing/logging/test_fixture.py b/testing/logging/test_fixture.py index 8eaa2de96..193535bac 100644 --- a/testing/logging/test_fixture.py +++ b/testing/logging/test_fixture.py @@ -1,5 +1,6 @@ # mypy: disable-error-code="attr-defined" import logging +from typing import Iterator import pytest from _pytest.logging import caplog_records_key @@ -9,8 +10,8 @@ logger = logging.getLogger(__name__) sublogger = logging.getLogger(__name__ + ".baz") -@pytest.fixture -def cleanup_disabled_logging(): +@pytest.fixture(autouse=True) +def cleanup_disabled_logging() -> Iterator[None]: """Simple fixture that ensures that a test doesn't disable logging. This is necessary because ``logging.disable()`` is global, so a test disabling logging @@ -42,7 +43,7 @@ def test_change_level(caplog): assert "CRITICAL" in caplog.text -def test_change_level_logging_disabled(caplog, cleanup_disabled_logging): +def test_change_level_logging_disabled(caplog): logging.disable(logging.CRITICAL) assert logging.root.manager.disable == logging.CRITICAL caplog.set_level(logging.WARNING) @@ -85,9 +86,7 @@ def test_change_level_undo(pytester: Pytester) -> None: result.stdout.no_fnmatch_line("*log from test2*") -def test_change_disabled_level_undo( - pytester: Pytester, cleanup_disabled_logging -) -> None: +def test_change_disabled_level_undo(pytester: Pytester) -> None: """Ensure that '_force_enable_logging' in 'set_level' is undone after the end of the test. Tests the logging output themselves (affected by disabled logging level). @@ -159,7 +158,7 @@ def test_with_statement(caplog): assert "CRITICAL" in caplog.text -def test_with_statement_logging_disabled(caplog, cleanup_disabled_logging): +def test_with_statement_logging_disabled(caplog): logging.disable(logging.CRITICAL) assert logging.root.manager.disable == logging.CRITICAL with caplog.at_level(logging.WARNING): @@ -197,9 +196,7 @@ def test_with_statement_logging_disabled(caplog, cleanup_disabled_logging): ("NOTVALIDLEVEL", logging.NOTSET), ], ) -def test_force_enable_logging_level_string( - caplog, cleanup_disabled_logging, level_str, expected_disable_level -): +def test_force_enable_logging_level_string(caplog, level_str, expected_disable_level): """Test _force_enable_logging using a level string. ``expected_disable_level`` is one level below ``level_str`` because the disabled log level From 7e69ce744909372c9686ab5efe5180de1799df73 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Sat, 21 Oct 2023 16:02:54 -0300 Subject: [PATCH 06/22] Add full type annotations to logging/test_fixture.py --- testing/logging/test_fixture.py | 47 +++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/testing/logging/test_fixture.py b/testing/logging/test_fixture.py index 193535bac..753cf5fcd 100644 --- a/testing/logging/test_fixture.py +++ b/testing/logging/test_fixture.py @@ -1,4 +1,5 @@ # mypy: disable-error-code="attr-defined" +# mypy: disallow-untyped-defs import logging from typing import Iterator @@ -28,7 +29,7 @@ def test_fixture_help(pytester: Pytester) -> None: result.stdout.fnmatch_lines(["*caplog*"]) -def test_change_level(caplog): +def test_change_level(caplog: pytest.LogCaptureFixture) -> None: caplog.set_level(logging.INFO) logger.debug("handler DEBUG level") logger.info("handler INFO level") @@ -43,7 +44,7 @@ def test_change_level(caplog): assert "CRITICAL" in caplog.text -def test_change_level_logging_disabled(caplog): +def test_change_level_logging_disabled(caplog: pytest.LogCaptureFixture) -> None: logging.disable(logging.CRITICAL) assert logging.root.manager.disable == logging.CRITICAL caplog.set_level(logging.WARNING) @@ -143,7 +144,7 @@ def test_change_level_undos_handler_level(pytester: Pytester) -> None: result.assert_outcomes(passed=3) -def test_with_statement(caplog): +def test_with_statement(caplog: pytest.LogCaptureFixture) -> None: with caplog.at_level(logging.INFO): logger.debug("handler DEBUG level") logger.info("handler INFO level") @@ -158,7 +159,7 @@ def test_with_statement(caplog): assert "CRITICAL" in caplog.text -def test_with_statement_logging_disabled(caplog): +def test_with_statement_logging_disabled(caplog: pytest.LogCaptureFixture) -> None: logging.disable(logging.CRITICAL) assert logging.root.manager.disable == logging.CRITICAL with caplog.at_level(logging.WARNING): @@ -196,7 +197,9 @@ def test_with_statement_logging_disabled(caplog): ("NOTVALIDLEVEL", logging.NOTSET), ], ) -def test_force_enable_logging_level_string(caplog, level_str, expected_disable_level): +def test_force_enable_logging_level_string( + caplog: pytest.LogCaptureFixture, level_str: str, expected_disable_level: int +) -> None: """Test _force_enable_logging using a level string. ``expected_disable_level`` is one level below ``level_str`` because the disabled log level @@ -215,7 +218,7 @@ def test_force_enable_logging_level_string(caplog, level_str, expected_disable_l assert test_logger.manager.disable == expected_disable_level -def test_log_access(caplog): +def test_log_access(caplog: pytest.LogCaptureFixture) -> None: caplog.set_level(logging.INFO) logger.info("boo %s", "arg") assert caplog.records[0].levelname == "INFO" @@ -223,7 +226,7 @@ def test_log_access(caplog): assert "boo arg" in caplog.text -def test_messages(caplog): +def test_messages(caplog: pytest.LogCaptureFixture) -> None: caplog.set_level(logging.INFO) logger.info("boo %s", "arg") logger.info("bar %s\nbaz %s", "arg1", "arg2") @@ -244,14 +247,14 @@ def test_messages(caplog): assert "Exception" not in caplog.messages[-1] -def test_record_tuples(caplog): +def test_record_tuples(caplog: pytest.LogCaptureFixture) -> None: caplog.set_level(logging.INFO) logger.info("boo %s", "arg") assert caplog.record_tuples == [(__name__, logging.INFO, "boo arg")] -def test_unicode(caplog): +def test_unicode(caplog: pytest.LogCaptureFixture) -> None: caplog.set_level(logging.INFO) logger.info("bÅ«") assert caplog.records[0].levelname == "INFO" @@ -259,7 +262,7 @@ def test_unicode(caplog): assert "bÅ«" in caplog.text -def test_clear(caplog): +def test_clear(caplog: pytest.LogCaptureFixture) -> None: caplog.set_level(logging.INFO) logger.info("bÅ«") assert len(caplog.records) @@ -270,7 +273,9 @@ def test_clear(caplog): @pytest.fixture -def logging_during_setup_and_teardown(caplog): +def logging_during_setup_and_teardown( + caplog: pytest.LogCaptureFixture, +) -> Iterator[None]: caplog.set_level("INFO") logger.info("a_setup_log") yield @@ -278,7 +283,9 @@ def logging_during_setup_and_teardown(caplog): assert [x.message for x in caplog.get_records("teardown")] == ["a_teardown_log"] -def test_caplog_captures_for_all_stages(caplog, logging_during_setup_and_teardown): +def test_caplog_captures_for_all_stages( + caplog: pytest.LogCaptureFixture, logging_during_setup_and_teardown: None +) -> None: assert not caplog.records assert not caplog.get_records("call") logger.info("a_call_log") @@ -287,25 +294,31 @@ def test_caplog_captures_for_all_stages(caplog, logging_during_setup_and_teardow assert [x.message for x in caplog.get_records("setup")] == ["a_setup_log"] # This reaches into private API, don't use this type of thing in real tests! - assert set(caplog._item.stash[caplog_records_key]) == {"setup", "call"} + caplog_records = caplog._item.stash[caplog_records_key] + assert set(caplog_records) == {"setup", "call"} -def test_clear_for_call_stage(caplog, logging_during_setup_and_teardown): +def test_clear_for_call_stage( + caplog: pytest.LogCaptureFixture, logging_during_setup_and_teardown: None +) -> None: logger.info("a_call_log") assert [x.message for x in caplog.get_records("call")] == ["a_call_log"] assert [x.message for x in caplog.get_records("setup")] == ["a_setup_log"] - assert set(caplog._item.stash[caplog_records_key]) == {"setup", "call"} + caplog_records = caplog._item.stash[caplog_records_key] + assert set(caplog_records) == {"setup", "call"} caplog.clear() assert caplog.get_records("call") == [] assert [x.message for x in caplog.get_records("setup")] == ["a_setup_log"] - assert set(caplog._item.stash[caplog_records_key]) == {"setup", "call"} + caplog_records = caplog._item.stash[caplog_records_key] + assert set(caplog_records) == {"setup", "call"} logging.info("a_call_log_after_clear") assert [x.message for x in caplog.get_records("call")] == ["a_call_log_after_clear"] assert [x.message for x in caplog.get_records("setup")] == ["a_setup_log"] - assert set(caplog._item.stash[caplog_records_key]) == {"setup", "call"} + caplog_records = caplog._item.stash[caplog_records_key] + assert set(caplog_records) == {"setup", "call"} def test_ini_controls_global_log_level(pytester: Pytester) -> None: From 38f7c1e3469369bfdad2a6b1019578c3e0522501 Mon Sep 17 00:00:00 2001 From: Carsten Grohmann Date: Mon, 23 Oct 2023 20:45:16 +0200 Subject: [PATCH 07/22] Use pytestconfig instead of request.config in cache example (#11542) to be consistent with the API documentation. --- changelog/11065.doc.rst | 3 +++ doc/en/how-to/cache.rst | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 changelog/11065.doc.rst diff --git a/changelog/11065.doc.rst b/changelog/11065.doc.rst new file mode 100644 index 000000000..70a3db92c --- /dev/null +++ b/changelog/11065.doc.rst @@ -0,0 +1,3 @@ +Use pytestconfig instead of request.config in cache example + +to be consistent with the API documentation. diff --git a/doc/en/how-to/cache.rst b/doc/en/how-to/cache.rst index 03ab0c777..1b2a454cc 100644 --- a/doc/en/how-to/cache.rst +++ b/doc/en/how-to/cache.rst @@ -213,12 +213,12 @@ across pytest invocations: @pytest.fixture - def mydata(request): - val = request.config.cache.get("example/value", None) + def mydata(pytestconfig): + val = pytestconfig.cache.get("example/value", None) if val is None: expensive_computation() val = 42 - request.config.cache.set("example/value", val) + pytestconfig.cache.set("example/value", val) return val From 667b9fd7fd4a1965c8a15849397498a7c905e0bd Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 24 Oct 2023 03:42:43 +0200 Subject: [PATCH 08/22] [pre-commit.ci] pre-commit autoupdate (#11543) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black: 23.9.1 → 23.10.1](https://github.com/psf/black/compare/23.9.1...23.10.1) - [github.com/pre-commit/mirrors-mypy: v1.6.0 → v1.6.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.6.0...v1.6.1) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bb2a464ba..0f7e4b2a7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/psf/black - rev: 23.9.1 + rev: 23.10.1 hooks: - id: black args: [--safe, --quiet] @@ -56,7 +56,7 @@ repos: hooks: - id: python-use-type-annotations - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.6.0 + rev: v1.6.1 hooks: - id: mypy files: ^(src/|testing/) From fbe3e29a55ea8f299659e2be1392ade8b3b9a642 Mon Sep 17 00:00:00 2001 From: Benjamin Schubert Date: Tue, 24 Oct 2023 12:42:21 +0100 Subject: [PATCH 09/22] Color the full diff that pytest shows as a diff (#11530) Related to #11520 --- AUTHORS | 1 + changelog/11520.improvement.rst | 1 + src/_pytest/_io/terminalwriter.py | 15 ++++++--- src/_pytest/assertion/util.py | 39 ++++++++++++++++++----- testing/conftest.py | 9 ++++++ testing/test_assertion.py | 52 +++++++++++++++++++++++++++++++ 6 files changed, 105 insertions(+), 12 deletions(-) create mode 100644 changelog/11520.improvement.rst diff --git a/AUTHORS b/AUTHORS index f3461addf..5ccff644c 100644 --- a/AUTHORS +++ b/AUTHORS @@ -56,6 +56,7 @@ Barney Gale Ben Gartner Ben Webb Benjamin Peterson +Benjamin Schubert Bernard Pratz Bo Wu Bob Ippolito diff --git a/changelog/11520.improvement.rst b/changelog/11520.improvement.rst new file mode 100644 index 000000000..46e4992dd --- /dev/null +++ b/changelog/11520.improvement.rst @@ -0,0 +1 @@ +Improved very verbose diff output to color it as a diff instead of only red. diff --git a/src/_pytest/_io/terminalwriter.py b/src/_pytest/_io/terminalwriter.py index eb1b46939..934278b93 100644 --- a/src/_pytest/_io/terminalwriter.py +++ b/src/_pytest/_io/terminalwriter.py @@ -3,6 +3,7 @@ import os import shutil import sys from typing import final +from typing import Literal from typing import Optional from typing import Sequence from typing import TextIO @@ -193,15 +194,21 @@ class TerminalWriter: for indent, new_line in zip(indents, new_lines): self.line(indent + new_line) - def _highlight(self, source: str) -> str: - """Highlight the given source code if we have markup support.""" + def _highlight( + self, source: str, lexer: Literal["diff", "python"] = "python" + ) -> str: + """Highlight the given source if we have markup support.""" from _pytest.config.exceptions import UsageError if not self.hasmarkup or not self.code_highlight: return source try: from pygments.formatters.terminal import TerminalFormatter - from pygments.lexers.python import PythonLexer + + if lexer == "python": + from pygments.lexers.python import PythonLexer as Lexer + elif lexer == "diff": + from pygments.lexers.diff import DiffLexer as Lexer from pygments import highlight import pygments.util except ImportError: @@ -210,7 +217,7 @@ class TerminalWriter: try: highlighted: str = highlight( source, - PythonLexer(), + Lexer(), TerminalFormatter( bg=os.getenv("PYTEST_THEME_MODE", "dark"), style=os.getenv("PYTEST_THEME"), diff --git a/src/_pytest/assertion/util.py b/src/_pytest/assertion/util.py index 057352cd3..b9123c97d 100644 --- a/src/_pytest/assertion/util.py +++ b/src/_pytest/assertion/util.py @@ -7,8 +7,10 @@ from typing import Any from typing import Callable from typing import Iterable from typing import List +from typing import Literal from typing import Mapping from typing import Optional +from typing import Protocol from typing import Sequence from unicodedata import normalize @@ -33,6 +35,11 @@ _assertion_pass: Optional[Callable[[int, str, str], None]] = None _config: Optional[Config] = None +class _HighlightFunc(Protocol): + def __call__(self, source: str, lexer: Literal["diff", "python"] = "python") -> str: + """Apply highlighting to the given source.""" + + def format_explanation(explanation: str) -> str: r"""Format an explanation. @@ -189,7 +196,8 @@ def assertrepr_compare( explanation = None try: if op == "==": - explanation = _compare_eq_any(left, right, verbose) + writer = config.get_terminal_writer() + explanation = _compare_eq_any(left, right, writer._highlight, verbose) elif op == "not in": if istext(left) and istext(right): explanation = _notin_text(left, right, verbose) @@ -225,7 +233,9 @@ def assertrepr_compare( return [summary] + explanation -def _compare_eq_any(left: Any, right: Any, verbose: int = 0) -> List[str]: +def _compare_eq_any( + left: Any, right: Any, highlighter: _HighlightFunc, verbose: int = 0 +) -> List[str]: explanation = [] if istext(left) and istext(right): explanation = _diff_text(left, right, verbose) @@ -245,7 +255,7 @@ def _compare_eq_any(left: Any, right: Any, verbose: int = 0) -> List[str]: # field values, not the type or field names. But this branch # intentionally only handles the same-type case, which was often # used in older code bases before dataclasses/attrs were available. - explanation = _compare_eq_cls(left, right, verbose) + explanation = _compare_eq_cls(left, right, highlighter, verbose) elif issequence(left) and issequence(right): explanation = _compare_eq_sequence(left, right, verbose) elif isset(left) and isset(right): @@ -254,7 +264,7 @@ def _compare_eq_any(left: Any, right: Any, verbose: int = 0) -> List[str]: explanation = _compare_eq_dict(left, right, verbose) if isiterable(left) and isiterable(right): - expl = _compare_eq_iterable(left, right, verbose) + expl = _compare_eq_iterable(left, right, highlighter, verbose) explanation.extend(expl) return explanation @@ -321,7 +331,10 @@ def _surrounding_parens_on_own_lines(lines: List[str]) -> None: def _compare_eq_iterable( - left: Iterable[Any], right: Iterable[Any], verbose: int = 0 + left: Iterable[Any], + right: Iterable[Any], + highligher: _HighlightFunc, + verbose: int = 0, ) -> List[str]: if verbose <= 0 and not running_on_ci(): return ["Use -v to get more diff"] @@ -346,7 +359,13 @@ 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( - line.rstrip() for line in difflib.ndiff(right_formatting, left_formatting) + highligher( + "\n".join( + line.rstrip() + for line in difflib.ndiff(right_formatting, left_formatting) + ), + lexer="diff", + ).splitlines() ) return explanation @@ -496,7 +515,9 @@ def _compare_eq_dict( return explanation -def _compare_eq_cls(left: Any, right: Any, verbose: int) -> List[str]: +def _compare_eq_cls( + left: Any, right: Any, highlighter: _HighlightFunc, verbose: int +) -> List[str]: if not has_default_eq(left): return [] if isdatacls(left): @@ -542,7 +563,9 @@ def _compare_eq_cls(left: Any, right: Any, verbose: int) -> List[str]: ] explanation += [ indent + line - for line in _compare_eq_any(field_left, field_right, verbose) + for line in _compare_eq_any( + field_left, field_right, highlighter, verbose + ) ] return explanation diff --git a/testing/conftest.py b/testing/conftest.py index 06116fee4..6a50e810f 100644 --- a/testing/conftest.py +++ b/testing/conftest.py @@ -160,6 +160,9 @@ def color_mapping(): "red": "\x1b[31m", "green": "\x1b[32m", "yellow": "\x1b[33m", + "light-gray": "\x1b[90m", + "light-red": "\x1b[91m", + "light-green": "\x1b[92m", "bold": "\x1b[1m", "reset": "\x1b[0m", "kw": "\x1b[94m", @@ -171,6 +174,7 @@ def color_mapping(): "endline": "\x1b[90m\x1b[39;49;00m", } RE_COLORS = {k: re.escape(v) for k, v in COLORS.items()} + NO_COLORS = {k: "" for k in COLORS.keys()} @classmethod def format(cls, lines: List[str]) -> List[str]: @@ -187,6 +191,11 @@ def color_mapping(): """Replace color names for use with LineMatcher.re_match_lines""" return [line.format(**cls.RE_COLORS) for line in lines] + @classmethod + def strip_colors(cls, lines: List[str]) -> List[str]: + """Entirely remove every color code""" + return [line.format(**cls.NO_COLORS) for line in lines] + return ColorMapping diff --git a/testing/test_assertion.py b/testing/test_assertion.py index d3caa5e48..62c465d8a 100644 --- a/testing/test_assertion.py +++ b/testing/test_assertion.py @@ -18,12 +18,19 @@ from _pytest.pytester import Pytester def mock_config(verbose=0): + class TerminalWriter: + def _highlight(self, source, lexer): + return source + class Config: def getoption(self, name): if name == "verbose": return verbose raise KeyError("Not mocked out: %s" % name) + def get_terminal_writer(self): + return TerminalWriter() + return Config() @@ -1784,3 +1791,48 @@ def test_reprcompare_verbose_long() -> None: "{'v0': 0, 'v1': 1, 'v2': 12, 'v3': 3, 'v4': 4, 'v5': 5, " "'v6': 6, 'v7': 7, 'v8': 8, 'v9': 9, 'v10': 10}" ) + + +@pytest.mark.parametrize("enable_colors", [True, False]) +@pytest.mark.parametrize( + ("test_code", "expected_lines"), + ( + ( + """ + def test(): + assert [0, 1] == [0, 2] + """, + [ + "{bold}{red}E {light-red}- [0, 2]{hl-reset}{endline}{reset}", + "{bold}{red}E {light-green}+ [0, 1]{hl-reset}{endline}{reset}", + ], + ), + ( + """ + def test(): + assert {f"number-is-{i}": i for i in range(1, 6)} == { + f"number-is-{i}": i for i in range(5) + } + """, + [ + "{bold}{red}E {light-gray} {hl-reset} {{{endline}{reset}", + "{bold}{red}E {light-gray} {hl-reset} 'number-is-1': 1,{endline}{reset}", + "{bold}{red}E {light-green}+ 'number-is-5': 5,{hl-reset}{endline}{reset}", + ], + ), + ), +) +def test_comparisons_handle_colors( + pytester: Pytester, color_mapping, enable_colors, test_code, expected_lines +) -> None: + p = pytester.makepyfile(test_code) + result = pytester.runpytest( + f"--color={'yes' if enable_colors else 'no'}", "-vv", str(p) + ) + formatter = ( + color_mapping.format_for_fnmatch + if enable_colors + else color_mapping.strip_colors + ) + + result.stdout.fnmatch_lines(formatter(expected_lines), consecutive=False) From c7e9b22f37821aa059a63a026ed4f25756fce8e0 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Tue, 24 Oct 2023 16:50:13 -0300 Subject: [PATCH 10/22] Merge pull request #11546 from pytest-dev/release-7.4.3 (#11549) Prepare release 7.4.3 (cherry picked from commit 53df6164b44269f85334eace9c473c3f3a04aae7) --- changelog/10447.bugfix.rst | 2 -- changelog/11239.bugfix.rst | 1 - changelog/11439.bugfix.rst | 1 - doc/en/announce/index.rst | 1 + doc/en/announce/release-7.4.3.rst | 19 +++++++++++++++++++ doc/en/changelog.rst | 15 +++++++++++++++ doc/en/getting-started.rst | 2 +- 7 files changed, 36 insertions(+), 5 deletions(-) delete mode 100644 changelog/10447.bugfix.rst delete mode 100644 changelog/11239.bugfix.rst delete mode 100644 changelog/11439.bugfix.rst create mode 100644 doc/en/announce/release-7.4.3.rst diff --git a/changelog/10447.bugfix.rst b/changelog/10447.bugfix.rst deleted file mode 100644 index fff94b28f..000000000 --- a/changelog/10447.bugfix.rst +++ /dev/null @@ -1,2 +0,0 @@ -markers are now considered in the reverse mro order to ensure base class markers are considered first -this resolves a regression. diff --git a/changelog/11239.bugfix.rst b/changelog/11239.bugfix.rst deleted file mode 100644 index a486224cd..000000000 --- a/changelog/11239.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed ``:=`` in asserts impacting unrelated test cases. diff --git a/changelog/11439.bugfix.rst b/changelog/11439.bugfix.rst deleted file mode 100644 index b5104b1bc..000000000 --- a/changelog/11439.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Handle an edge case where :data:`sys.stderr` might already be closed when :ref:`faulthandler` is tearing down. diff --git a/doc/en/announce/index.rst b/doc/en/announce/index.rst index 39fdfc137..854666f67 100644 --- a/doc/en/announce/index.rst +++ b/doc/en/announce/index.rst @@ -6,6 +6,7 @@ Release announcements :maxdepth: 2 + release-7.4.3 release-7.4.2 release-7.4.1 release-7.4.0 diff --git a/doc/en/announce/release-7.4.3.rst b/doc/en/announce/release-7.4.3.rst new file mode 100644 index 000000000..0f319c1e7 --- /dev/null +++ b/doc/en/announce/release-7.4.3.rst @@ -0,0 +1,19 @@ +pytest-7.4.3 +======================================= + +pytest 7.4.3 has just been released to PyPI. + +This is a bug-fix release, being a drop-in replacement. To upgrade:: + + pip install --upgrade pytest + +The full changelog is available at https://docs.pytest.org/en/stable/changelog.html. + +Thanks to all of the contributors to this release: + +* Bruno Oliveira +* Marc Mueller + + +Happy testing, +The pytest Development Team diff --git a/doc/en/changelog.rst b/doc/en/changelog.rst index ecfeeb662..121d1708d 100644 --- a/doc/en/changelog.rst +++ b/doc/en/changelog.rst @@ -28,6 +28,21 @@ with advance notice in the **Deprecations** section of releases. .. towncrier release notes start +pytest 7.4.3 (2023-10-24) +========================= + +Bug Fixes +--------- + +- `#10447 `_: Markers are now considered in the reverse mro order to ensure base class markers are considered first -- this resolves a regression. + + +- `#11239 `_: Fixed ``:=`` in asserts impacting unrelated test cases. + + +- `#11439 `_: Handled an edge case where :data:`sys.stderr` might already be closed when :ref:`faulthandler` is tearing down. + + pytest 7.4.2 (2023-09-07) ========================= diff --git a/doc/en/getting-started.rst b/doc/en/getting-started.rst index 8d37612df..3b9d773b0 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 7.4.2 + pytest 7.4.3 .. _`simpletest`: From dcd8b145d9049d2a885b5832d1974763fc42045c Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Wed, 25 Oct 2023 10:04:06 -0300 Subject: [PATCH 11/22] Add deploy instructions using the command-line (#11547) Tested this to trigger the deploy of #11546. --- scripts/prepare-release-pr.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/scripts/prepare-release-pr.py b/scripts/prepare-release-pr.py index a0e5e4d7f..8ffa66964 100644 --- a/scripts/prepare-release-pr.py +++ b/scripts/prepare-release-pr.py @@ -31,16 +31,22 @@ class InvalidFeatureRelease(Exception): SLUG = "pytest-dev/pytest" PR_BODY = """\ -Created by the [prepare release pr](https://github.com/pytest-dev/pytest/actions/workflows/prepare-release-pr.yml) -workflow. +Created by the [prepare release pr]\ +(https://github.com/pytest-dev/pytest/actions/workflows/prepare-release-pr.yml) workflow. -Once all builds pass and it has been **approved** by one or more maintainers, -start the [deploy](https://github.com/pytest-dev/pytest/actions/workflows/deploy.yml) workflow, using these parameters: +Once all builds pass and it has been **approved** by one or more maintainers, start the \ +[deploy](https://github.com/pytest-dev/pytest/actions/workflows/deploy.yml) workflow, using these parameters: * `Use workflow from`: `release-{version}`. * `Release version`: `{version}`. -After the `deploy` workflow has been approved by a core maintainer, the package will be uploaded to PyPI automatically. +Or execute on the command line: + +```console +gh workflow run deploy.yml -r release-{version} -f version={version} +``` + +After the workflow has been approved by a core maintainer, the package will be uploaded to PyPI automatically. """ From c1728948ac7bcd807a40f9aaae63f2f09f5df5b7 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Wed, 25 Oct 2023 13:19:47 -0300 Subject: [PATCH 12/22] Fix tag name generated by deploy workflow (#11550) Traditionally pytest publishes tags in the form `X.Y.Z`, however the deploy workflow (copied from somewhere else) published tags in the form `vX.Y.Z`. This is the root cause of #11548, because it tried to publish the release notes for tag `X.Y.Z` (which did not exist). Fix #11548 --- .github/workflows/deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 08e99e954..b00bbe006 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -53,8 +53,8 @@ jobs: run: | git config user.name "pytest bot" git config user.email "pytestbot@gmail.com" - git tag --annotate --message=v${{ github.event.inputs.version }} v${{ github.event.inputs.version }} ${{ github.sha }} - git push origin v${{ github.event.inputs.version }} + git tag --annotate --message=v${{ github.event.inputs.version }} ${{ github.event.inputs.version }} ${{ github.sha }} + git push origin ${{ github.event.inputs.version }} release-notes: From 247436819a49a4c21c0926ed0a12bfe7e8166237 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Fri, 27 Oct 2023 08:32:02 -0300 Subject: [PATCH 13/22] Update build-and-inspect-python-package action (#11561) This should fix the action for Python 3.12. Ref: hynek/build-and-inspect-python-package#72 --- .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 b00bbe006..efc30f7f6 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -26,7 +26,7 @@ jobs: persist-credentials: false - name: Build and Check Package - uses: hynek/build-and-inspect-python-package@v1.5 + uses: hynek/build-and-inspect-python-package@v1.5.3 deploy: if: github.repository == 'pytest-dev/pytest' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 450d8e99a..4a50761df 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@v1.5 + uses: hynek/build-and-inspect-python-package@v1.5.3 build: needs: [package] From ed8701a57fa40296e8dd302015cd5f805f2aede0 Mon Sep 17 00:00:00 2001 From: Ziad Kermadi Date: Fri, 27 Oct 2023 19:35:45 +0200 Subject: [PATCH 14/22] Mention -q and -s in the docs (#11558) Fixes #11507. --- doc/en/how-to/output.rst | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/doc/en/how-to/output.rst b/doc/en/how-to/output.rst index cf72a2d29..04f201610 100644 --- a/doc/en/how-to/output.rst +++ b/doc/en/how-to/output.rst @@ -16,6 +16,12 @@ Examples for modifying traceback printing: pytest -l # show local variables (shortcut) pytest --no-showlocals # hide local variables (if addopts enables them) + pytest --capture=fd # default, capture at the file descriptor level + pytest --capture=sys # capture at the sys level + pytest --capture=no # don't capture + pytest -s # don't capture (shortcut) + pytest --capture=tee-sys # capture to logs but also output to sys level streams + pytest --tb=auto # (default) 'long' tracebacks for the first and last # entry, but 'short' style for the other entries pytest --tb=long # exhaustive, informative traceback formatting @@ -36,6 +42,16 @@ option you make sure a trace is shown. Verbosity -------------------------------------------------- +Examples for modifying printing verbosity: + +.. code-block:: bash + + pytest --quiet # quiet - less verbose - mode + pytest -q # quiet - less verbose - mode (shortcut) + pytest -v # increase verbosity, display individual test names + pytest -vv # more verbose, display more details from the test output + pytest -vvv # not a standard , but may be used for even more detail in certain setups + The ``-v`` flag controls the verbosity of pytest output in various aspects: test session progress, assertion details when tests fail, fixtures details with ``--fixtures``, etc. From 7156a97f9a1471f35c48988f2153047db4fd5e95 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Fri, 27 Oct 2023 17:23:57 -0300 Subject: [PATCH 15/22] Fix crash using empty string for parametrized value more than once Fixes #11563. --- changelog/11563.bugfix.rst | 1 + src/_pytest/python.py | 2 +- testing/python/metafunc.py | 7 +++++++ 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 changelog/11563.bugfix.rst diff --git a/changelog/11563.bugfix.rst b/changelog/11563.bugfix.rst new file mode 100644 index 000000000..35b5e4f15 --- /dev/null +++ b/changelog/11563.bugfix.rst @@ -0,0 +1 @@ +Fixed crash when using an empty string for the same parametrized value more than once. diff --git a/src/_pytest/python.py b/src/_pytest/python.py index f54bbb379..0985c871d 100644 --- a/src/_pytest/python.py +++ b/src/_pytest/python.py @@ -1003,7 +1003,7 @@ class IdMaker: for index, id in enumerate(resolved_ids): if id_counts[id] > 1: suffix = "" - if id[-1].isdigit(): + if id and id[-1].isdigit(): suffix = "_" new_id = f"{id}{suffix}{id_suffixes[id]}" while new_id in set(resolved_ids): diff --git a/testing/python/metafunc.py b/testing/python/metafunc.py index 16ec37f9a..e93363a78 100644 --- a/testing/python/metafunc.py +++ b/testing/python/metafunc.py @@ -626,6 +626,13 @@ class TestMetafunc: ).make_unique_parameterset_ids() assert result == [expected] + def test_idmaker_duplicated_empty_str(self) -> None: + """Regression test for empty strings parametrized more than once (#11563).""" + result = IdMaker( + ("a",), [pytest.param(""), pytest.param("")], None, None, None, None, None + ).make_unique_parameterset_ids() + assert result == ["0", "1"] + def test_parametrize_ids_exception(self, pytester: Pytester) -> None: """ :param pytester: the instance of Pytester class, a temporary From d0a09d8627ae9076dafce5e6cd5eca681be3164e Mon Sep 17 00:00:00 2001 From: pytest bot Date: Sun, 29 Oct 2023 00:19:06 +0000 Subject: [PATCH 16/22] [automated] Update plugin list --- doc/en/reference/plugin_list.rst | 122 +++++++++++++++++++------------ 1 file changed, 77 insertions(+), 45 deletions(-) diff --git a/doc/en/reference/plugin_list.rst b/doc/en/reference/plugin_list.rst index 6ee6098cf..0e919ade9 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-analyzer` this plugin allows to analyze tests in pytest project, collect test metadata and sync it with testomat.io TCM system Sep 05, 2023 N/A pytest >=7.3.1 + :pypi:`pytest-analyzer` this plugin allows to analyze tests in pytest project, collect test metadata and sync it with testomat.io TCM system Oct 21, 2023 N/A pytest >=7.3.1 :pypi:`pytest-android` This fixture provides a configured "driver" for Android Automated Testing, using uiautomator2. Feb 21, 2019 3 - Alpha pytest :pypi:`pytest-anki` A pytest plugin for testing Anki add-ons Jul 31, 2022 4 - Beta pytest (>=3.5.0) :pypi:`pytest-annotate` pytest-annotate: Generate PyAnnotate annotations from your pytest tests. Jun 07, 2022 3 - Alpha pytest (<8.0.0,>=3.2.0) @@ -91,6 +91,7 @@ This list contains 1333 plugins. :pypi:`pytest-argus` pyest results colection plugin Jun 24, 2021 5 - Production/Stable pytest (>=6.2.4) :pypi:`pytest-arraydiff` pytest plugin to help with comparing array output from tests Jan 13, 2022 4 - Beta pytest (>=4.6) :pypi:`pytest-asgi-server` Convenient ASGI client/server fixtures for Pytest Dec 12, 2020 N/A pytest (>=5.4.1) + :pypi:`pytest-aspec` A rspec format reporter for pytest Oct 23, 2023 4 - Beta N/A :pypi:`pytest-asptest` test Answer Set Programming programs Apr 28, 2018 4 - Beta N/A :pypi:`pytest-assertcount` Plugin to count actual number of asserts in pytest Oct 23, 2022 N/A pytest (>=5.0.0) :pypi:`pytest-assertions` Pytest Assertions Apr 27, 2022 N/A N/A @@ -109,7 +110,7 @@ This list contains 1333 plugins. :pypi:`pytest-asyncio-network-simulator` pytest-asyncio-network-simulator: Plugin for pytest for simulator the network in tests Jul 31, 2018 3 - Alpha pytest (<3.7.0,>=3.3.2) :pypi:`pytest-async-mongodb` pytest plugin for async MongoDB Oct 18, 2017 5 - Production/Stable pytest (>=2.5.2) :pypi:`pytest-async-sqlalchemy` Database testing fixtures using the SQLAlchemy asyncio API Oct 07, 2021 4 - Beta pytest (>=6.0.0) - :pypi:`pytest-atf-allure` 基于allure-pytest进行自定义 Sep 14, 2023 N/A pytest (>=7.4.2,<8.0.0) + :pypi:`pytest-atf-allure` 基于allure-pytest进行自定义 Oct 22, 2023 N/A pytest (>=7.4.2,<8.0.0) :pypi:`pytest-atomic` Skip rest of tests if previous test failed. Nov 24, 2018 4 - Beta N/A :pypi:`pytest-attrib` pytest plugin to select tests based on attributes similar to the nose-attrib plugin May 24, 2016 4 - Beta N/A :pypi:`pytest-austin` Austin plugin for pytest Oct 11, 2020 4 - Beta N/A @@ -383,6 +384,7 @@ This list contains 1333 plugins. :pypi:`pytest-donde` record pytest session characteristics per test item (coverage and duration) into a persistent file and use them in your own plugin or script. Oct 01, 2023 4 - Beta pytest >=7.3.1 :pypi:`pytest-doorstop` A pytest plugin for adding test results into doorstop items. Jun 09, 2020 4 - Beta pytest (>=3.5.0) :pypi:`pytest-dotenv` A py.test plugin that parses environment files before running tests Jun 16, 2020 4 - Beta pytest (>=5.0.0) + :pypi:`pytest-dot-only-pkcopley` A Pytest marker for only running a single test Oct 27, 2023 N/A N/A :pypi:`pytest-draw` Pytest plugin for randomly selecting a specific number of tests Mar 21, 2023 3 - Alpha pytest :pypi:`pytest-drf` A Django REST framework plugin for pytest. Jul 12, 2022 5 - Production/Stable pytest (>=3.7) :pypi:`pytest-drivings` Tool to allow webdriver automation to be ran locally or remotely Jan 13, 2021 N/A N/A @@ -424,7 +426,7 @@ This list contains 1333 plugins. :pypi:`pytest-encoding` set your encoding and logger Aug 11, 2023 N/A pytest :pypi:`pytest-enhanced-reports` Enhanced test reports for pytest Dec 15, 2022 N/A N/A :pypi:`pytest-enhancements` Improvements for pytest (rejected upstream) Oct 30, 2019 4 - Beta N/A - :pypi:`pytest-env` py.test plugin that allows you to add environment variables. Aug 24, 2023 5 - Production/Stable pytest>=7.3.1 + :pypi:`pytest-env` pytest plugin that allows you to add environment variables. Oct 24, 2023 5 - Production/Stable pytest>=7.4.2 :pypi:`pytest-envfiles` A py.test plugin that parses environment files before running tests Oct 08, 2015 3 - Alpha N/A :pypi:`pytest-env-info` Push information about the running pytest into envvars Nov 25, 2017 4 - Beta pytest (>=3.1.1) :pypi:`pytest-envraw` py.test plugin that allows you to add environment variables. Aug 27, 2020 4 - Beta pytest (>=2.6.0) @@ -464,7 +466,7 @@ This list contains 1333 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 Aug 13, 2022 4 - Beta pytest (>=6.0) + :pypi:`pytest-fail-slow` Fail tests that take too long to run Oct 21, 2023 N/A pytest >=6.0 :pypi:`pytest-faker` Faker integration with the pytest framework. Dec 19, 2016 6 - Mature N/A :pypi:`pytest-falcon` Pytest helpers for Falcon. Sep 07, 2016 4 - Beta N/A :pypi:`pytest-falcon-client` Pytest \`client\` fixture for the Falcon Framework Mar 19, 2019 N/A N/A @@ -501,7 +503,7 @@ This list contains 1333 plugins. :pypi:`pytest-flakefinder` Runs tests multiple times to expose flakiness. Oct 26, 2022 4 - Beta pytest (>=2.7.1) :pypi:`pytest-flakes` pytest plugin to check source code with pyflakes Dec 02, 2021 5 - Production/Stable pytest (>=5) :pypi:`pytest-flaptastic` Flaptastic py.test plugin Mar 17, 2019 N/A N/A - :pypi:`pytest-flask` A set of py.test fixtures to test Flask applications. Feb 27, 2021 5 - Production/Stable pytest (>=5.2) + :pypi:`pytest-flask` A set of py.test fixtures to test Flask applications. Oct 23, 2023 5 - Production/Stable pytest >=5.2 :pypi:`pytest-flask-ligand` Pytest fixtures and helper functions to use for testing flask-ligand microservices. Apr 25, 2023 4 - Beta pytest (~=7.3) :pypi:`pytest-flask-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) @@ -531,7 +533,7 @@ This list contains 1333 plugins. :pypi:`pytest-gherkin` A flexible framework for executing BDD gherkin tests Jul 27, 2019 3 - Alpha pytest (>=5.0.0) :pypi:`pytest-gh-log-group` pytest plugin for gh actions Jan 11, 2022 3 - Alpha pytest :pypi:`pytest-ghostinspector` For finding/executing Ghost Inspector tests May 17, 2016 3 - Alpha N/A - :pypi:`pytest-girder` A set of pytest fixtures for testing Girder applications. Oct 09, 2023 N/A N/A + :pypi:`pytest-girder` A set of pytest fixtures for testing Girder applications. Oct 26, 2023 N/A N/A :pypi:`pytest-git` Git repository fixture for py.test May 28, 2019 5 - Production/Stable pytest :pypi:`pytest-gitconfig` Provide a gitconfig sandbox for testing Oct 15, 2023 4 - Beta pytest>=7.1.2 :pypi:`pytest-gitcov` Pytest plugin for reporting on coverage of the last git commit. Jan 11, 2020 2 - Pre-Alpha N/A @@ -568,7 +570,7 @@ This list contains 1333 plugins. :pypi:`pytest-historic-hook` Custom listener to store execution results into MYSQL DB, which is used for pytest-historic report Apr 08, 2020 N/A pytest :pypi:`pytest-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 Oct 14, 2023 3 - Alpha pytest ==7.3.1 + :pypi:`pytest-homeassistant-custom-component` Experimental package to automatically extract test plugins for Home Assistant custom components Oct 28, 2023 3 - Alpha pytest ==7.4.3 :pypi:`pytest-honey` A simple plugin to use with pytest Jan 07, 2022 4 - Beta pytest (>=3.5.0) :pypi:`pytest-honors` Report on tests that honor constraints, and guard against regressions Mar 06, 2020 4 - Beta N/A :pypi:`pytest-hot-reloading` Jun 23, 2023 N/A N/A @@ -584,7 +586,7 @@ This list contains 1333 plugins. :pypi:`pytest-html-object-storage` Pytest report plugin for send HTML report on object-storage Mar 04, 2022 5 - Production/Stable N/A :pypi:`pytest-html-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` Aug 31, 2022 N/A N/A + :pypi:`pytest-html-report-merger` Oct 23, 2023 N/A N/A :pypi:`pytest-html-thread` pytest plugin for generating HTML reports Dec 29, 2020 5 - Production/Stable N/A :pypi:`pytest-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' @@ -788,7 +790,7 @@ This list contains 1333 plugins. :pypi:`pytest-ndb` pytest notebook debugger Oct 15, 2023 N/A pytest :pypi:`pytest-needle` pytest plugin for visual testing websites using selenium Dec 10, 2018 4 - Beta pytest (<5.0.0,>=3.0.0) :pypi:`pytest-neo` pytest-neo is a plugin for pytest that shows tests like screen of Matrix. Jan 08, 2022 3 - Alpha pytest (>=6.2.0) - :pypi:`pytest-netdut` "Automated software testing for switches using pytest" Sep 21, 2023 N/A pytest <7.3,>=3.5.0 + :pypi:`pytest-netdut` "Automated software testing for switches using pytest" Oct 26, 2023 N/A pytest <7.3,>=3.5.0 :pypi:`pytest-network` A simple plugin to disable network on socket level. May 07, 2020 N/A N/A :pypi:`pytest-network-endpoints` Network endpoints plugin for pytest Mar 06, 2022 N/A pytest :pypi:`pytest-never-sleep` pytest plugin helps to avoid adding tests without mock \`time.sleep\` May 05, 2021 3 - Alpha pytest (>=3.5.1) @@ -937,7 +939,7 @@ This list contains 1333 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 Aug 27, 2023 N/A pytest + :pypi:`pytest-pyreport` PyReport is a lightweight reporting plugin for Pytest that provides concise HTML report Oct 21, 2023 N/A pytest :pypi:`pytest-pyright` Pytest plugin for type checking code with Pyright Aug 20, 2023 4 - Beta pytest >=7.0.0 :pypi:`pytest-pyspec` A plugin that transforms the pytest output into a result similar to the RSpec. It enables the use of docstrings to display results and also enables the use of the prefixes "describe", "with" and "it". Mar 12, 2023 5 - Production/Stable pytest (>=7.2.1,<8.0.0) :pypi:`pytest-pystack` Plugin to run pystack after a timeout for a test suite. May 07, 2023 N/A pytest (>=3.5.0) @@ -1003,6 +1005,7 @@ This list contains 1333 plugins. :pypi:`pytest-report-parameters` pytest plugin for adding tests' parameters to junit report Jun 18, 2020 3 - Alpha pytest (>=2.4.2) :pypi:`pytest-reportportal` Agent for Reporting results of tests to the Report Portal Oct 17, 2023 N/A pytest >=3.8.0 :pypi:`pytest-reports` An interesting python package Jun 07, 2023 N/A N/A + :pypi:`pytest-report-stream` A pytest plugin which allows to stream test reports at runtime Oct 22, 2023 4 - Beta N/A :pypi:`pytest-reqs` pytest plugin to check pinned requirements May 12, 2019 N/A pytest (>=2.4.2) :pypi:`pytest-requests` A simple plugin to use with pytest Jun 24, 2019 4 - Beta pytest (>=3.5.0) :pypi:`pytest-requestselapsed` collect and show http requests elapsed time Aug 14, 2022 N/A N/A @@ -1030,6 +1033,7 @@ This list contains 1333 plugins. :pypi:`pytest-reusable-testcases` Apr 28, 2023 N/A N/A :pypi:`pytest-reverse` Pytest plugin to reverse test order. Jul 10, 2023 5 - Production/Stable pytest :pypi:`pytest-rich` Leverage rich for richer test session output Mar 03, 2022 4 - Beta pytest (>=7.0) + :pypi:`pytest-richer` Pytest plugin providing a Rich based reporter. Oct 27, 2023 3 - Alpha pytest :pypi:`pytest-rich-reporter` A pytest plugin using Rich for beautiful test result formatting. Feb 17, 2022 1 - Planning pytest (>=5.0.0) :pypi:`pytest-richtrace` A pytest plugin that displays the names and information of the pytest hook functions as they are executed. Jun 20, 2023 N/A N/A :pypi:`pytest-ringo` pytest plugin to test webapplications using the Ringo webframework Sep 27, 2017 3 - Alpha N/A @@ -1059,7 +1063,7 @@ This list contains 1333 plugins. :pypi:`pytest-sanic` a pytest plugin for Sanic Oct 25, 2021 N/A pytest (>=5.2) :pypi:`pytest-sanity` Dec 07, 2020 N/A N/A :pypi:`pytest-sa-pg` May 14, 2019 N/A N/A - :pypi:`pytest-sbase` A complete web automation framework for end-to-end testing. Oct 20, 2023 5 - Production/Stable N/A + :pypi:`pytest-sbase` A complete web automation framework for end-to-end testing. Oct 27, 2023 5 - Production/Stable N/A :pypi:`pytest-scenario` pytest plugin for test scenarios Feb 06, 2017 3 - Alpha N/A :pypi:`pytest-schedule` The job of test scheduling for humans. Jan 07, 2023 5 - Production/Stable N/A :pypi:`pytest-schema` 👍 Validate return values against a schema-like object in testing Mar 14, 2022 5 - Production/Stable pytest (>=3.5.0) @@ -1068,7 +1072,7 @@ This list contains 1333 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 May 28, 2023 5 - Production/Stable pytest>=6.0.0 :pypi:`pytest-selenium-auto` pytest plugin to automatically capture screenshots upon selenium webdriver events Oct 18, 2023 N/A pytest >= 7.0.0 - :pypi:`pytest-seleniumbase` A complete web automation framework for end-to-end testing. Oct 20, 2023 5 - Production/Stable N/A + :pypi:`pytest-seleniumbase` A complete web automation framework for end-to-end testing. Oct 27, 2023 5 - Production/Stable N/A :pypi:`pytest-selenium-enhancer` pytest plugin for Selenium Apr 29, 2022 5 - Production/Stable N/A :pypi:`pytest-selenium-pdiff` A pytest package implementing perceptualdiff for Selenium tests. Apr 06, 2017 2 - Pre-Alpha N/A :pypi:`pytest-selenium-screenshot` pytest plugin to automatically capture screenshots upon selenium webdriver events Aug 22, 2023 N/A pytest >= 7.0.0 @@ -1140,8 +1144,8 @@ This list contains 1333 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 Sep 06, 2023 N/A pytest (>5.4.0,<8) - :pypi:`pytest-splunk-addon-ui-smartx` Library to support testing Splunk Add-on UX Oct 02, 2023 N/A N/A + :pypi:`pytest-splunk-addon` A Dynamic test tool for Splunk Apps and Add-ons Oct 23, 2023 N/A pytest (>5.4.0,<8) + :pypi:`pytest-splunk-addon-ui-smartx` Library to support testing Splunk Add-on UX Oct 27, 2023 N/A N/A :pypi:`pytest-splunk-env` pytest fixtures for interaction with Splunk Enterprise and Splunk Cloud Oct 22, 2020 N/A pytest (>=6.1.1,<7.0.0) :pypi:`pytest-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 @@ -1289,7 +1293,6 @@ This list contains 1333 plugins. :pypi:`pytest-unhandled-exception-exit-code` Plugin for py.test set a different exit code on uncaught exceptions Jun 22, 2020 5 - Production/Stable pytest (>=2.3) :pypi:`pytest-unique` Pytest fixture to generate unique values. Sep 15, 2023 N/A pytest (>=7.4.2,<8.0.0) :pypi:`pytest-unittest-filter` A pytest plugin for filtering unittest-based test classes Jan 12, 2019 4 - Beta pytest (>=3.1.0) - :pypi:`pytest-unitvis` Oct 20, 2023 3 - Alpha pytest >=7.0.0 :pypi:`pytest-unmarked` Run only unmarked tests Aug 27, 2019 5 - Production/Stable N/A :pypi:`pytest-unordered` Test equality of unordered collections in pytest Nov 28, 2022 4 - Beta pytest (>=6.0.0) :pypi:`pytest-unstable` Set a test as unstable to return 0 even if it failed Sep 27, 2022 4 - Beta N/A @@ -1309,6 +1312,7 @@ This list contains 1333 plugins. :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 + :pypi:`pytest-visual` Oct 24, 2023 3 - Alpha pytest >=7.0.0 :pypi:`pytest-vnc` VNC client for Pytest Feb 25, 2023 N/A pytest :pypi:`pytest-voluptuous` Pytest plugin for asserting data against voluptuous schema. Jun 09, 2020 N/A pytest :pypi:`pytest-vscodedebug` A pytest plugin to easily enable debugging tests within Visual Studio Code Dec 04, 2020 4 - Beta N/A @@ -1363,7 +1367,7 @@ This list contains 1333 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-zebrunner` Pytest connector for Zebrunner reporting Dec 12, 2022 5 - Production/Stable pytest (>=4.5.0) + :pypi:`pytest-zebrunner` Pytest connector for Zebrunner reporting Oct 27, 2023 5 - Production/Stable pytest (>=4.5.0) :pypi:`pytest-zest` Zesty additions to pytest. Nov 17, 2022 N/A N/A :pypi:`pytest-zigzag` Extend py.test for RPC OpenStack testing. Feb 27, 2019 4 - Beta pytest (~=3.6) :pypi:`pytest-zulip` Pytest report plugin for Zulip May 07, 2022 5 - Production/Stable pytest @@ -1604,7 +1608,7 @@ This list contains 1333 plugins. Static code checks used at Alphamoon :pypi:`pytest-analyzer` - *last release*: Sep 05, 2023, + *last release*: Oct 21, 2023, *status*: N/A, *requires*: pytest >=7.3.1 @@ -1771,6 +1775,13 @@ This list contains 1333 plugins. Convenient ASGI client/server fixtures for Pytest + :pypi:`pytest-aspec` + *last release*: Oct 23, 2023, + *status*: 4 - Beta, + *requires*: N/A + + A rspec format reporter for pytest + :pypi:`pytest-asptest` *last release*: Apr 28, 2018, *status*: 4 - Beta, @@ -1898,7 +1909,7 @@ This list contains 1333 plugins. Database testing fixtures using the SQLAlchemy asyncio API :pypi:`pytest-atf-allure` - *last release*: Sep 14, 2023, + *last release*: Oct 22, 2023, *status*: N/A, *requires*: pytest (>=7.4.2,<8.0.0) @@ -3815,6 +3826,13 @@ This list contains 1333 plugins. A py.test plugin that parses environment files before running tests + :pypi:`pytest-dot-only-pkcopley` + *last release*: Oct 27, 2023, + *status*: N/A, + *requires*: N/A + + A Pytest marker for only running a single test + :pypi:`pytest-draw` *last release*: Mar 21, 2023, *status*: 3 - Alpha, @@ -4103,11 +4121,11 @@ This list contains 1333 plugins. Improvements for pytest (rejected upstream) :pypi:`pytest-env` - *last release*: Aug 24, 2023, + *last release*: Oct 24, 2023, *status*: 5 - Production/Stable, - *requires*: pytest>=7.3.1 + *requires*: pytest>=7.4.2 - py.test plugin that allows you to add environment variables. + pytest plugin that allows you to add environment variables. :pypi:`pytest-envfiles` *last release*: Oct 08, 2015, @@ -4383,9 +4401,9 @@ This list contains 1333 plugins. A pytest plugin that helps better distinguishing real test failures from setup flakiness. :pypi:`pytest-fail-slow` - *last release*: Aug 13, 2022, - *status*: 4 - Beta, - *requires*: pytest (>=6.0) + *last release*: Oct 21, 2023, + *status*: N/A, + *requires*: pytest >=6.0 Fail tests that take too long to run @@ -4642,9 +4660,9 @@ This list contains 1333 plugins. Flaptastic py.test plugin :pypi:`pytest-flask` - *last release*: Feb 27, 2021, + *last release*: Oct 23, 2023, *status*: 5 - Production/Stable, - *requires*: pytest (>=5.2) + *requires*: pytest >=5.2 A set of py.test fixtures to test Flask applications. @@ -4852,7 +4870,7 @@ This list contains 1333 plugins. For finding/executing Ghost Inspector tests :pypi:`pytest-girder` - *last release*: Oct 09, 2023, + *last release*: Oct 26, 2023, *status*: N/A, *requires*: N/A @@ -5111,9 +5129,9 @@ This list contains 1333 plugins. A pytest plugin for use with homeassistant custom components. :pypi:`pytest-homeassistant-custom-component` - *last release*: Oct 14, 2023, + *last release*: Oct 28, 2023, *status*: 3 - Alpha, - *requires*: pytest ==7.3.1 + *requires*: pytest ==7.4.3 Experimental package to automatically extract test plugins for Home Assistant custom components @@ -5223,7 +5241,7 @@ This list contains 1333 plugins. Generates a static html report based on pytest framework :pypi:`pytest-html-report-merger` - *last release*: Aug 31, 2022, + *last release*: Oct 23, 2023, *status*: N/A, *requires*: N/A @@ -6651,7 +6669,7 @@ This list contains 1333 plugins. pytest-neo is a plugin for pytest that shows tests like screen of Matrix. :pypi:`pytest-netdut` - *last release*: Sep 21, 2023, + *last release*: Oct 26, 2023, *status*: N/A, *requires*: pytest <7.3,>=3.5.0 @@ -7694,7 +7712,7 @@ This list contains 1333 plugins. Pyramid server fixture for py.test :pypi:`pytest-pyreport` - *last release*: Aug 27, 2023, + *last release*: Oct 21, 2023, *status*: N/A, *requires*: pytest @@ -8155,6 +8173,13 @@ This list contains 1333 plugins. An interesting python package + :pypi:`pytest-report-stream` + *last release*: Oct 22, 2023, + *status*: 4 - Beta, + *requires*: N/A + + A pytest plugin which allows to stream test reports at runtime + :pypi:`pytest-reqs` *last release*: May 12, 2019, *status*: N/A, @@ -8344,6 +8369,13 @@ This list contains 1333 plugins. Leverage rich for richer test session output + :pypi:`pytest-richer` + *last release*: Oct 27, 2023, + *status*: 3 - Alpha, + *requires*: pytest + + Pytest plugin providing a Rich based reporter. + :pypi:`pytest-rich-reporter` *last release*: Feb 17, 2022, *status*: 1 - Planning, @@ -8548,7 +8580,7 @@ This list contains 1333 plugins. :pypi:`pytest-sbase` - *last release*: Oct 20, 2023, + *last release*: Oct 27, 2023, *status*: 5 - Production/Stable, *requires*: N/A @@ -8611,7 +8643,7 @@ This list contains 1333 plugins. pytest plugin to automatically capture screenshots upon selenium webdriver events :pypi:`pytest-seleniumbase` - *last release*: Oct 20, 2023, + *last release*: Oct 27, 2023, *status*: 5 - Production/Stable, *requires*: N/A @@ -9115,14 +9147,14 @@ This list contains 1333 plugins. :pypi:`pytest-splunk-addon` - *last release*: Sep 06, 2023, + *last release*: Oct 23, 2023, *status*: N/A, *requires*: pytest (>5.4.0,<8) A Dynamic test tool for Splunk Apps and Add-ons :pypi:`pytest-splunk-addon-ui-smartx` - *last release*: Oct 02, 2023, + *last release*: Oct 27, 2023, *status*: N/A, *requires*: N/A @@ -10157,13 +10189,6 @@ This list contains 1333 plugins. A pytest plugin for filtering unittest-based test classes - :pypi:`pytest-unitvis` - *last release*: Oct 20, 2023, - *status*: 3 - Alpha, - *requires*: pytest >=7.0.0 - - - :pypi:`pytest-unmarked` *last release*: Aug 27, 2019, *status*: 5 - Production/Stable, @@ -10297,6 +10322,13 @@ This list contains 1333 plugins. Virtualenv fixture for py.test + :pypi:`pytest-visual` + *last release*: Oct 24, 2023, + *status*: 3 - Alpha, + *requires*: pytest >=7.0.0 + + + :pypi:`pytest-vnc` *last release*: Feb 25, 2023, *status*: N/A, @@ -10676,7 +10708,7 @@ This list contains 1333 plugins. OWASP ZAP plugin for py.test. :pypi:`pytest-zebrunner` - *last release*: Dec 12, 2022, + *last release*: Oct 27, 2023, *status*: 5 - Production/Stable, *requires*: pytest (>=4.5.0) From 4ecf313604af484731af17f1225921f99e4e8959 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Sun, 29 Oct 2023 21:55:17 +0200 Subject: [PATCH 17/22] doc/reference: fix sidebar TOC depth Previously, the sidebar TOC had unlimited depth, making it useless and interfering with the content. This seems to have regressed in pytest 7.2.x going by the RTD version selector. --- doc/en/reference/reference.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/en/reference/reference.rst b/doc/en/reference/reference.rst index d8efbbbaa..7764b03eb 100644 --- a/doc/en/reference/reference.rst +++ b/doc/en/reference/reference.rst @@ -1,3 +1,5 @@ +:tocdepth: 3 + .. _`api-reference`: API Reference From 0d74a1c8a00c25d78404cb7db0bc9e0c31939ce0 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Mon, 30 Oct 2023 00:00:27 +0200 Subject: [PATCH 18/22] doc: allow Sphinx 6.x and 7.x (#11568) They seem to work fine, let's allow them. --- doc/en/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/en/requirements.txt b/doc/en/requirements.txt index 0ee999e0f..36801746a 100644 --- a/doc/en/requirements.txt +++ b/doc/en/requirements.txt @@ -2,7 +2,7 @@ pallets-sphinx-themes pluggy>=1.2.0 pygments-pytest>=2.3.0 sphinx-removed-in>=0.2.0 -sphinx>=5,<6 +sphinx>=5,<8 sphinxcontrib-trio sphinxcontrib-svg2pdfconverter # Pin packaging because it no longer handles 'latest' version, which From 1ea10c20dfeafd05e608943f7fa671be09e2854f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 3 Nov 2023 08:27:47 -0300 Subject: [PATCH 19/22] build(deps): Bump django in /testing/plugins_integration (#11579) Bumps [django](https://github.com/django/django) from 4.2.6 to 4.2.7. - [Commits](https://github.com/django/django/compare/4.2.6...4.2.7) --- updated-dependencies: - dependency-name: django dependency-type: direct:production ... 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 6fc3e8dc4..69b48fe2a 100644 --- a/testing/plugins_integration/requirements.txt +++ b/testing/plugins_integration/requirements.txt @@ -1,5 +1,5 @@ anyio[curio,trio]==4.0.0 -django==4.2.6 +django==4.2.7 pytest-asyncio==0.21.1 pytest-bdd==7.0.0 pytest-cov==4.1.0 From 13e5ef010250ae98b8b2aa76952d447274d20e25 Mon Sep 17 00:00:00 2001 From: neilmartin2000 <143754352+neilmartin2000@users.noreply.github.com> Date: Fri, 3 Nov 2023 12:05:05 -0600 Subject: [PATCH 20/22] Created link to PEP-8 in documentation (#11582) --- AUTHORS | 1 + CONTRIBUTING.rst | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/AUTHORS b/AUTHORS index 5ccff644c..212d4a883 100644 --- a/AUTHORS +++ b/AUTHORS @@ -275,6 +275,7 @@ Miro Hrončok Nathaniel Compton Nathaniel Waisbrot Ned Batchelder +Neil Martin Neven Mundar Nicholas Devenish Nicholas Murphy diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index e2230cbbd..6f55c230c 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -199,7 +199,7 @@ Short version #. Fork the repository. #. Fetch tags from upstream if necessary (if you cloned only main `git fetch --tags https://github.com/pytest-dev/pytest`). #. Enable and install `pre-commit `_ to ensure style-guides and code checks are followed. -#. Follow **PEP-8** for naming and `black `_ for formatting. +#. Follow `PEP-8 `_ for naming. #. Tests are run using ``tox``:: tox -e linting,py39 @@ -282,7 +282,7 @@ Here is a simple overview, with pytest-specific bits: This command will run tests via the "tox" tool against Python 3.9 and also perform "lint" coding-style checks. -#. You can now edit your local working copy and run the tests again as necessary. Please follow PEP-8 for naming. +#. You can now edit your local working copy and run the tests again as necessary. Please follow `PEP-8 `_ for naming. You can pass different options to ``tox``. For example, to run tests on Python 3.9 and pass options to pytest (e.g. enter pdb on failure) to pytest you can do:: From 1e02797d153522b5495e16d1d28b01aedf8d48f3 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Sat, 4 Nov 2023 07:24:57 -0300 Subject: [PATCH 21/22] Improve pytest.raises docs (#11578) --- doc/en/how-to/assert.rst | 78 ++++++++++++++++++++++++++++------ doc/en/reference/reference.rst | 4 +- src/_pytest/python_api.py | 32 +++++++++++--- 3 files changed, 93 insertions(+), 21 deletions(-) diff --git a/doc/en/how-to/assert.rst b/doc/en/how-to/assert.rst index cc53d001f..1401064d7 100644 --- a/doc/en/how-to/assert.rst +++ b/doc/en/how-to/assert.rst @@ -98,6 +98,27 @@ and if you need to have access to the actual exception info you may use: the actual exception raised. The main attributes of interest are ``.type``, ``.value`` and ``.traceback``. +Note that ``pytest.raises`` will match the exception type or any subclasses (like the standard ``except`` statement). +If you want to check if a block of code is raising an exact exception type, you need to check that explicitly: + + +.. code-block:: python + + def test_recursion_depth(): + def foo(): + raise NotImplementedError + + with pytest.raises(RuntimeError) as excinfo: + foo() + assert type(excinfo.value) is RuntimeError + +The :func:`pytest.raises` call will succeed, even though the function raises :class:`NotImplementedError`, because +:class:`NotImplementedError` is a subclass of :class:`RuntimeError`; however the following `assert` statement will +catch the problem. + +Matching exception messages +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + You can pass a ``match`` keyword parameter to the context-manager to test that a regular expression matches on the string representation of an exception (similar to the ``TestCase.assertRaisesRegex`` method from ``unittest``): @@ -115,9 +136,15 @@ that a regular expression matches on the string representation of an exception with pytest.raises(ValueError, match=r".* 123 .*"): myfunc() -The regexp parameter of the ``match`` parameter is matched with the ``re.search`` -function, so in the above example ``match='123'`` would have worked as -well. +Notes: + +* The ``match`` parameter is matched with the :func:`re.search` + function, so in the above example ``match='123'`` would have worked as well. +* The ``match`` parameter also matches against `PEP-678 `__ ``__notes__``. + + +Matching exception groups +~~~~~~~~~~~~~~~~~~~~~~~~~ You can also use the :func:`excinfo.group_contains() ` method to test for exceptions returned as part of an ``ExceptionGroup``: @@ -165,32 +192,55 @@ exception at a specific level; exceptions contained directly in the top assert not excinfo.group_contains(RuntimeError, depth=2) assert not excinfo.group_contains(TypeError, depth=1) -There's an alternate form of the :func:`pytest.raises` function where you pass -a function that will be executed with the given ``*args`` and ``**kwargs`` and -assert that the given exception is raised: +Alternate form (legacy) +~~~~~~~~~~~~~~~~~~~~~~~ + +There is an alternate form where you pass +a function that will be executed, along ``*args`` and ``**kwargs``, and :func:`pytest.raises` +will execute the function with the arguments and assert that the given exception is raised: .. code-block:: python - pytest.raises(ExpectedException, func, *args, **kwargs) + def func(x): + if x <= 0: + raise ValueError("x needs to be larger than zero") + + + pytest.raises(ValueError, func, x=-1) The reporter will provide you with helpful output in case of failures such as *no exception* or *wrong exception*. -Note that it is also possible to specify a "raises" argument to -``pytest.mark.xfail``, which checks that the test is failing in a more +This form was the original :func:`pytest.raises` API, developed before the ``with`` statement was +added to the Python language. Nowadays, this form is rarely used, with the context-manager form (using ``with``) +being considered more readable. +Nonetheless, this form is fully supported and not deprecated in any way. + +xfail mark and pytest.raises +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +It is also possible to specify a ``raises`` argument to +:ref:`pytest.mark.xfail `, which checks that the test is failing in a more specific way than just having any exception raised: .. code-block:: python + def f(): + raise IndexError() + + @pytest.mark.xfail(raises=IndexError) def test_f(): f() -Using :func:`pytest.raises` is likely to be better for cases where you are -testing exceptions your own code is deliberately raising, whereas using -``@pytest.mark.xfail`` with a check function is probably better for something -like documenting unfixed bugs (where the test describes what "should" happen) -or bugs in dependencies. + +This will only "xfail" if the test fails by raising ``IndexError`` or subclasses. + +* Using :ref:`pytest.mark.xfail ` with the ``raises`` parameter is probably better for something + like documenting unfixed bugs (where the test describes what "should" happen) or bugs in dependencies. + +* Using :func:`pytest.raises` is likely to be better for cases where you are + testing exceptions your own code is deliberately raising, which is the majority of cases. .. _`assertwarns`: diff --git a/doc/en/reference/reference.rst b/doc/en/reference/reference.rst index 7764b03eb..0240e1f4a 100644 --- a/doc/en/reference/reference.rst +++ b/doc/en/reference/reference.rst @@ -249,7 +249,9 @@ Marks a test function as *expected to fail*. :keyword str reason: Reason why the test function is marked as xfail. :keyword Type[Exception] raises: - Exception subclass (or tuple of subclasses) expected to be raised by the test function; other exceptions will fail the test. + Exception class (or tuple of classes) expected to be raised by the test function; other exceptions will fail the test. + Note that subclasses of the classes passed will also result in a match (similar to how the ``except`` statement works). + :keyword bool run: Whether the test function should actually be executed. If ``False``, the function will always xfail and will not be executed (useful if a function is segfaulting). diff --git a/src/_pytest/python_api.py b/src/_pytest/python_api.py index 27826863e..07db0f234 100644 --- a/src/_pytest/python_api.py +++ b/src/_pytest/python_api.py @@ -804,11 +804,13 @@ def raises( # noqa: F811 def raises( # noqa: F811 expected_exception: Union[Type[E], Tuple[Type[E], ...]], *args: Any, **kwargs: Any ) -> Union["RaisesContext[E]", _pytest._code.ExceptionInfo[E]]: - r"""Assert that a code block/function call raises an exception. + r"""Assert that a code block/function call raises an exception type, or one of its subclasses. :param typing.Type[E] | typing.Tuple[typing.Type[E], ...] expected_exception: The expected exception type, or a tuple if one of multiple possible - exception types are expected. + exception types are expected. Note that subclasses of the passed exceptions + will also match. + :kwparam str | typing.Pattern[str] | None match: If specified, a string containing a regular expression, or a regular expression object, that is tested against the string @@ -826,13 +828,13 @@ def raises( # noqa: F811 .. currentmodule:: _pytest._code Use ``pytest.raises`` as a context manager, which will capture the exception of the given - type:: + type, or any of its subclasses:: >>> import pytest >>> with pytest.raises(ZeroDivisionError): ... 1/0 - If the code block does not raise the expected exception (``ZeroDivisionError`` in the example + If the code block does not raise the expected exception (:class:`ZeroDivisionError` in the example above), or no exception at all, the check will fail instead. You can also use the keyword argument ``match`` to assert that the @@ -845,7 +847,7 @@ def raises( # noqa: F811 ... raise ValueError("value must be 42") The ``match`` argument searches the formatted exception string, which includes any - `PEP-678 ` ``__notes__``: + `PEP-678 `__ ``__notes__``: >>> with pytest.raises(ValueError, match=r'had a note added'): # doctest: +SKIP ... e = ValueError("value must be 42") @@ -860,6 +862,20 @@ def raises( # noqa: F811 >>> assert exc_info.type is ValueError >>> assert exc_info.value.args[0] == "value must be 42" + .. warning:: + + Given that ``pytest.raises`` matches subclasses, be wary of using it to match :class:`Exception` like this:: + + with pytest.raises(Exception): # Careful, this will catch ANY exception raised. + some_function() + + Because :class:`Exception` is the base class of almost all exceptions, it is easy for this to hide + real bugs, where the user wrote this expecting a specific exception, but some other exception is being + raised due to a bug introduced during a refactoring. + + Avoid using ``pytest.raises`` to catch :class:`Exception` unless certain that you really want to catch + **any** exception raised. + .. note:: When using ``pytest.raises`` as a context manager, it's worthwhile to @@ -872,7 +888,7 @@ def raises( # noqa: F811 >>> with pytest.raises(ValueError) as exc_info: ... if value > 10: ... raise ValueError("value must be <= 10") - ... assert exc_info.type is ValueError # this will not execute + ... assert exc_info.type is ValueError # This will not execute. Instead, the following approach must be taken (note the difference in scope):: @@ -891,6 +907,10 @@ def raises( # noqa: F811 See :ref:`parametrizing_conditional_raising` for an example. + .. seealso:: + + :ref:`assertraises` for more examples and detailed discussion. + **Legacy form** It is possible to specify a callable by passing a to-be-called lambda:: From 70f03dbc3e6f5f7bd81a26d040a39f02f97d460f Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Sat, 4 Nov 2023 12:37:47 -0300 Subject: [PATCH 22/22] Adjustments to assert raises docs (#11586) Followup from #11578. --- doc/en/how-to/assert.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/en/how-to/assert.rst b/doc/en/how-to/assert.rst index 1401064d7..7d5076a50 100644 --- a/doc/en/how-to/assert.rst +++ b/doc/en/how-to/assert.rst @@ -104,13 +104,13 @@ If you want to check if a block of code is raising an exact exception type, you .. code-block:: python - def test_recursion_depth(): + def test_foo_not_implemented(): def foo(): raise NotImplementedError with pytest.raises(RuntimeError) as excinfo: foo() - assert type(excinfo.value) is RuntimeError + assert excinfo.type is RuntimeError The :func:`pytest.raises` call will succeed, even though the function raises :class:`NotImplementedError`, because :class:`NotImplementedError` is a subclass of :class:`RuntimeError`; however the following `assert` statement will