Merge remote-tracking branch 'refs/remotes/upstream/Improvement-catch-duplicate-values-when-determining-param-indices-in-metafunc-parametrize' into Improvement-catch-duplicate-values-when-determining-param-indices-in-metafunc-parametrize
This commit is contained in:
commit
ed6c38c490
1
AUTHORS
1
AUTHORS
|
@ -266,6 +266,7 @@ Michael Goerz
|
|||
Michael Krebs
|
||||
Michael Seifert
|
||||
Michal Wajszczuk
|
||||
Michał Górny
|
||||
Michał Zięba
|
||||
Mickey Pashov
|
||||
Mihai Capotă
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
Improved very verbose diff output to color it as a diff instead of only red.
|
||||
|
||||
Improved the error reporting to better separate each section.
|
||||
|
||||
Improved the error reporting to syntax-highlight Python code when Pygments is available.
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Fixed handling ``NO_COLOR`` and ``FORCE_COLOR`` to ignore an empty value.
|
|
@ -27,7 +27,7 @@ please refer to `the update script <https://github.com/pytest-dev/pytest/blob/ma
|
|||
creating a PDF, because otherwise the table gets far too wide for the
|
||||
page.
|
||||
|
||||
This list contains 1354 plugins.
|
||||
This list contains 1355 plugins.
|
||||
|
||||
.. only:: not latex
|
||||
|
||||
|
@ -86,7 +86,7 @@ This list contains 1354 plugins.
|
|||
:pypi:`pytest-appengine` AppEngine integration that works well with pytest-django Feb 27, 2017 N/A N/A
|
||||
:pypi:`pytest-appium` Pytest plugin for appium Dec 05, 2019 N/A N/A
|
||||
:pypi:`pytest-approvaltests` A plugin to use approvaltests with pytest May 08, 2022 4 - Beta pytest (>=7.0.1)
|
||||
:pypi:`pytest-approvaltests-geo` Extension for ApprovalTests.Python specific to geo data verification Sep 06, 2023 5 - Production/Stable pytest
|
||||
:pypi:`pytest-approvaltests-geo` Extension for ApprovalTests.Python specific to geo data verification Dec 12, 2023 5 - Production/Stable pytest
|
||||
:pypi:`pytest-archon` Rule your architecture like a real developer Jul 11, 2023 5 - Production/Stable pytest (>=7.2)
|
||||
:pypi:`pytest-argus` pyest results colection plugin Jun 24, 2021 5 - Production/Stable pytest (>=6.2.4)
|
||||
:pypi:`pytest-arraydiff` pytest plugin to help with comparing array output from tests Nov 27, 2023 4 - Beta pytest >=4.6
|
||||
|
@ -252,7 +252,7 @@ This list contains 1354 plugins.
|
|||
:pypi:`pytest-contexts` A plugin to run tests written with the Contexts framework using pytest May 19, 2021 4 - Beta N/A
|
||||
:pypi:`pytest-cookies` The pytest plugin for your Cookiecutter templates. 🍪 Mar 22, 2023 5 - Production/Stable pytest (>=3.9.0)
|
||||
:pypi:`pytest-copie` The pytest plugin for your copier templates 📒 Nov 14, 2023 3 - Alpha pytest
|
||||
:pypi:`pytest-copier` A pytest plugin to help testing Copier templates Dec 08, 2023 4 - Beta pytest>=7.3.2
|
||||
:pypi:`pytest-copier` A pytest plugin to help testing Copier templates Dec 11, 2023 4 - Beta pytest>=7.3.2
|
||||
:pypi:`pytest-couchdbkit` py.test extension for per-test couchdb databases using couchdbkit Apr 17, 2012 N/A N/A
|
||||
:pypi:`pytest-count` count erros and send email Jan 12, 2018 4 - Beta N/A
|
||||
:pypi:`pytest-cov` Pytest plugin for measuring coverage. May 24, 2023 5 - Production/Stable pytest (>=4.6)
|
||||
|
@ -328,7 +328,7 @@ This list contains 1354 plugins.
|
|||
:pypi:`pytest-diffeo` A package to prevent Dependency Confusion attacks against Yandex. Feb 10, 2023 N/A N/A
|
||||
:pypi:`pytest-diff-selector` Get tests affected by code changes (using git) Feb 24, 2022 4 - Beta pytest (>=6.2.2) ; extra == 'all'
|
||||
:pypi:`pytest-difido` PyTest plugin for generating Difido reports Oct 23, 2022 4 - Beta pytest (>=4.0.0)
|
||||
:pypi:`pytest-dir-equal` pytest-dir-equals is a pytest plugin providing helpers to assert directories equality allowing golden testing Dec 05, 2023 4 - Beta pytest>=7.3.2
|
||||
:pypi:`pytest-dir-equal` pytest-dir-equals is a pytest plugin providing helpers to assert directories equality allowing golden testing Dec 11, 2023 4 - Beta pytest>=7.3.2
|
||||
:pypi:`pytest-disable` pytest plugin to disable a test and skip it from testrun Sep 10, 2015 4 - Beta N/A
|
||||
:pypi:`pytest-disable-plugin` Disable plugins per test Feb 28, 2019 4 - Beta pytest (>=3.5.0)
|
||||
:pypi:`pytest-discord` A pytest plugin to notify test results to a Discord channel. Oct 18, 2023 4 - Beta pytest !=6.0.0,<8,>=3.3.2
|
||||
|
@ -377,9 +377,9 @@ This list contains 1354 plugins.
|
|||
:pypi:`pytest-doctest-custom` A py.test plugin for customizing string representations of doctest results. Jul 25, 2016 4 - Beta N/A
|
||||
:pypi:`pytest-doctest-ellipsis-markers` Setup additional values for ELLIPSIS_MARKER for doctests Jan 12, 2018 4 - Beta N/A
|
||||
:pypi:`pytest-doctest-import` A simple pytest plugin to import names and add them to the doctest namespace. Nov 13, 2018 4 - Beta pytest (>=3.3.0)
|
||||
:pypi:`pytest-doctestplus` Pytest plugin with advanced doctest features. Aug 11, 2023 3 - Alpha pytest >=4.6
|
||||
:pypi:`pytest-doctestplus` Pytest plugin with advanced doctest features. Dec 13, 2023 5 - Production/Stable pytest >=4.6
|
||||
:pypi:`pytest-dogu-report` pytest plugin for dogu report Jul 07, 2023 N/A N/A
|
||||
:pypi:`pytest-dogu-sdk` pytest plugin for the Dogu Dec 05, 2023 N/A N/A
|
||||
:pypi:`pytest-dogu-sdk` pytest plugin for the Dogu Dec 14, 2023 N/A N/A
|
||||
:pypi:`pytest-dolphin` Some extra stuff that we use ininternally Nov 30, 2016 4 - Beta pytest (==3.0.4)
|
||||
: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)
|
||||
|
@ -527,7 +527,7 @@ This list contains 1354 plugins.
|
|||
:pypi:`pytest-funparam` An alternative way to parametrize test cases. Dec 02, 2021 4 - Beta pytest >=4.6.0
|
||||
:pypi:`pytest-fxa` pytest plugin for Firefox Accounts Aug 28, 2018 5 - Production/Stable N/A
|
||||
:pypi:`pytest-fxtest` Oct 27, 2020 N/A N/A
|
||||
:pypi:`pytest-fzf` fzf-based test selector for pytest Nov 28, 2023 4 - Beta pytest >=6.0.0
|
||||
:pypi:`pytest-fzf` fzf-based test selector for pytest Dec 15, 2023 4 - Beta pytest >=6.0.0
|
||||
:pypi:`pytest-gather-fixtures` set up asynchronous pytest fixtures concurrently Apr 12, 2022 N/A pytest (>=6.0.0)
|
||||
:pypi:`pytest-gc` The garbage collector plugin for py.test Feb 01, 2018 N/A N/A
|
||||
:pypi:`pytest-gcov` Uses gcov to measure test coverage of a C library Feb 01, 2018 3 - Alpha N/A
|
||||
|
@ -536,7 +536,7 @@ This list contains 1354 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. Dec 05, 2023 N/A N/A
|
||||
:pypi:`pytest-girder` A set of pytest fixtures for testing Girder applications. Dec 14, 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
|
||||
|
@ -574,10 +574,10 @@ This list contains 1354 plugins.
|
|||
:pypi:`pytest-history` Pytest plugin to keep a history of your pytest runs Nov 20, 2023 N/A pytest (>=7.4.3,<8.0.0)
|
||||
:pypi:`pytest-home` Home directory fixtures Oct 09, 2023 5 - Production/Stable pytest
|
||||
:pypi:`pytest-homeassistant` A pytest plugin for use with homeassistant custom components. Aug 12, 2020 4 - Beta N/A
|
||||
:pypi:`pytest-homeassistant-custom-component` Experimental package to automatically extract test plugins for Home Assistant custom components Dec 09, 2023 3 - Alpha pytest ==7.4.3
|
||||
:pypi:`pytest-homeassistant-custom-component` Experimental package to automatically extract test plugins for Home Assistant custom components Dec 15, 2023 3 - Alpha pytest ==7.4.3
|
||||
:pypi:`pytest-honey` A simple plugin to use with pytest Jan 07, 2022 4 - Beta pytest (>=3.5.0)
|
||||
:pypi:`pytest-honors` Report on tests that honor constraints, and guard against regressions Mar 06, 2020 4 - Beta N/A
|
||||
:pypi:`pytest-hot-reloading` Dec 01, 2023 N/A N/A
|
||||
:pypi:`pytest-hot-reloading` Dec 13, 2023 N/A N/A
|
||||
:pypi:`pytest-hot-test` A plugin that tracks test changes Dec 10, 2022 4 - Beta pytest (>=3.5.0)
|
||||
:pypi:`pytest-houdini` pytest plugin for testing code in Houdini. Nov 10, 2023 N/A pytest
|
||||
:pypi:`pytest-hoverfly` Simplify working with Hoverfly from pytest Jan 30, 2023 N/A pytest (>=5.0)
|
||||
|
@ -594,7 +594,7 @@ This list contains 1354 plugins.
|
|||
: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'
|
||||
:pypi:`pytest-httpdbg` A pytest plugin to record HTTP(S) requests with stack trace Nov 03, 2023 3 - Alpha pytest >=7.0.0
|
||||
:pypi:`pytest-httpdbg` A pytest plugin to record HTTP(S) requests with stack trace Dec 09, 2023 3 - Alpha pytest >=7.0.0
|
||||
:pypi:`pytest-http-mocker` Pytest plugin for http mocking (via https://github.com/vilus/mocker) Oct 20, 2019 N/A N/A
|
||||
:pypi:`pytest-httpretty` A thin wrapper of HTTPretty for pytest Feb 16, 2014 3 - Alpha N/A
|
||||
:pypi:`pytest-httpserver` pytest-httpserver is a httpserver for pytest May 22, 2023 3 - Alpha N/A
|
||||
|
@ -604,11 +604,11 @@ This list contains 1354 plugins.
|
|||
:pypi:`pytest-hue` Visualise PyTest status via your Phillips Hue lights May 09, 2019 N/A N/A
|
||||
:pypi:`pytest-hylang` Pytest plugin to allow running tests written in hylang Mar 28, 2021 N/A pytest
|
||||
:pypi:`pytest-hypo-25` help hypo module for pytest Jan 12, 2020 3 - Alpha N/A
|
||||
:pypi:`pytest-iam` A fully functional OAUTH2 / OpenID Connect (OIDC) server to be used in your testsuite Aug 31, 2023 3 - Alpha pytest (>=7.0.0,<8.0.0)
|
||||
:pypi:`pytest-iam` A fully functional OAUTH2 / OpenID Connect (OIDC) server to be used in your testsuite Dec 15, 2023 3 - Alpha pytest (>=7.0.0,<8.0.0)
|
||||
:pypi:`pytest-ibutsu` A plugin to sent pytest results to an Ibutsu server Aug 05, 2022 4 - Beta pytest>=7.1
|
||||
:pypi:`pytest-icdiff` use icdiff for better error messages in pytest assertions Dec 05, 2023 4 - Beta pytest
|
||||
:pypi:`pytest-idapro` A pytest plugin for idapython. Allows a pytest setup to run tests outside and inside IDA in an automated manner by runnig pytest inside IDA and by mocking idapython api Nov 03, 2018 N/A N/A
|
||||
:pypi:`pytest-idem` A pytest plugin to help with testing idem projects Jun 23, 2023 5 - Production/Stable N/A
|
||||
:pypi:`pytest-idem` A pytest plugin to help with testing idem projects Dec 13, 2023 5 - Production/Stable N/A
|
||||
:pypi:`pytest-idempotent` Pytest plugin for testing function idempotence. Jul 25, 2022 N/A N/A
|
||||
:pypi:`pytest-ignore-flaky` ignore failures from flaky tests (pytest plugin) Oct 11, 2023 5 - Production/Stable pytest >=6.0
|
||||
:pypi:`pytest-ignore-test-results` A pytest plugin to ignore test results. Aug 17, 2023 2 - Pre-Alpha pytest>=7.0
|
||||
|
@ -622,8 +622,8 @@ This list contains 1354 plugins.
|
|||
: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 19, 2023 4 - Beta pytest >=7.0.0
|
||||
:pypi:`pytest-inmanta` A py.test plugin providing fixtures to simplify inmanta modules testing. Nov 29, 2023 5 - Production/Stable N/A
|
||||
:pypi:`pytest-inmanta-extensions` Inmanta tests package Oct 13, 2023 5 - Production/Stable N/A
|
||||
:pypi:`pytest-inmanta` A py.test plugin providing fixtures to simplify inmanta modules testing. Dec 13, 2023 5 - Production/Stable pytest
|
||||
:pypi:`pytest-inmanta-extensions` Inmanta tests package Dec 11, 2023 5 - Production/Stable N/A
|
||||
:pypi:`pytest-inmanta-lsm` Common fixtures for inmanta LSM related modules Nov 29, 2023 5 - Production/Stable N/A
|
||||
:pypi:`pytest-inmanta-yang` Common fixtures used in inmanta yang related modules Jun 16, 2022 4 - Beta N/A
|
||||
:pypi:`pytest-Inomaly` A simple image diff plugin for pytest Feb 13, 2018 4 - Beta N/A
|
||||
|
@ -833,7 +833,7 @@ This list contains 1354 plugins.
|
|||
:pypi:`pytest-ogsm-plugin` 针对特定项目定制化插件,优化了pytest报告展示方式,并添加了项目所需特定参数 May 16, 2023 N/A N/A
|
||||
:pypi:`pytest-ok` The ultimate pytest output plugin Apr 01, 2019 4 - Beta N/A
|
||||
:pypi:`pytest-only` Use @pytest.mark.only to run a single test Jun 14, 2022 5 - Production/Stable pytest (<7.1); python_version <= "3.6"
|
||||
:pypi:`pytest-oof` A Pytest plugin providing structured, programmatic access to a test run's results Dec 05, 2023 4 - Beta N/A
|
||||
:pypi:`pytest-oof` A Pytest plugin providing structured, programmatic access to a test run's results Dec 11, 2023 4 - Beta N/A
|
||||
:pypi:`pytest-oot` Run object-oriented tests in a simple format Sep 18, 2016 4 - Beta N/A
|
||||
:pypi:`pytest-openfiles` Pytest plugin for detecting inadvertent open file handles Apr 16, 2020 3 - Alpha pytest (>=4.6)
|
||||
:pypi:`pytest-opentelemetry` A pytest plugin for instrumenting test runs via OpenTelemetry Oct 01, 2023 N/A pytest
|
||||
|
@ -1028,7 +1028,7 @@ This list contains 1354 plugins.
|
|||
:pypi:`pytest-rerunfailures` pytest plugin to re-run tests to eliminate flaky failures Nov 22, 2023 5 - Production/Stable pytest >=7
|
||||
:pypi:`pytest-rerunfailures-all-logs` pytest plugin to re-run tests to eliminate flaky failures Mar 07, 2022 5 - Production/Stable N/A
|
||||
:pypi:`pytest-reserial` Pytest fixture for recording and replaying serial port traffic. Aug 31, 2023 4 - Beta pytest
|
||||
:pypi:`pytest-resilient-circuits` Resilient Circuits fixtures for PyTest Nov 22, 2023 N/A pytest ~=4.6 ; python_version == "2.7"
|
||||
:pypi:`pytest-resilient-circuits` Resilient Circuits fixtures for PyTest Dec 11, 2023 N/A pytest ~=4.6 ; python_version == "2.7"
|
||||
:pypi:`pytest-resource` Load resource fixture plugin to use with pytest Nov 14, 2018 4 - Beta N/A
|
||||
:pypi:`pytest-resource-path` Provides path for uniform access to test resources in isolated directory May 01, 2021 5 - Production/Stable pytest (>=3.5.0)
|
||||
:pypi:`pytest-resource-usage` Pytest plugin for reporting running time and peak memory usage Nov 06, 2022 5 - Production/Stable pytest>=7.0.0
|
||||
|
@ -1091,7 +1091,7 @@ This list contains 1354 plugins.
|
|||
:pypi:`pytest-sequence-markers` Pytest plugin for sequencing markers for execution of tests May 23, 2023 5 - Production/Stable N/A
|
||||
:pypi:`pytest-server-fixtures` Extensible server fixures for py.test May 28, 2019 5 - Production/Stable pytest
|
||||
:pypi:`pytest-serverless` Automatically mocks resources from serverless.yml in pytest using moto. May 09, 2022 4 - Beta N/A
|
||||
:pypi:`pytest-servers` pytest servers Oct 31, 2023 3 - Alpha pytest >=6.2
|
||||
:pypi:`pytest-servers` pytest servers Dec 15, 2023 3 - Alpha pytest >=6.2
|
||||
:pypi:`pytest-services` Services plugin for pytest testing framework Oct 30, 2020 6 - Mature N/A
|
||||
:pypi:`pytest-session2file` pytest-session2file (aka: pytest-session_to_file for v0.1.0 - v0.1.2) is a py.test plugin for capturing and saving to file the stdout of py.test. Jan 26, 2021 3 - Alpha pytest
|
||||
:pypi:`pytest-session-fixture-globalize` py.test plugin to make session fixtures behave as if written in conftest, even if it is written in some modules May 15, 2018 4 - Beta N/A
|
||||
|
@ -1156,7 +1156,7 @@ This list contains 1354 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 Nov 25, 2023 N/A pytest (>5.4.0,<8)
|
||||
:pypi:`pytest-splunk-addon` A Dynamic test tool for Splunk Apps and Add-ons Dec 14, 2023 N/A pytest (>5.4.0,<8)
|
||||
:pypi:`pytest-splunk-addon-ui-smartx` Library to support testing Splunk Add-on UX Dec 01, 2023 N/A N/A
|
||||
:pypi:`pytest-splunk-env` pytest fixtures for interaction with Splunk Enterprise and Splunk Cloud Oct 22, 2020 N/A pytest (>=6.1.1,<7.0.0)
|
||||
:pypi:`pytest-sqitch` sqitch for pytest Apr 06, 2020 4 - Beta N/A
|
||||
|
@ -1205,7 +1205,7 @@ This list contains 1354 plugins.
|
|||
:pypi:`pytest-tape` easy assertion with expected results saved to yaml files Mar 17, 2021 4 - Beta N/A
|
||||
:pypi:`pytest-target` Pytest plugin for remote target orchestration. Jan 21, 2021 3 - Alpha pytest (>=6.1.2,<7.0.0)
|
||||
:pypi:`pytest-tblineinfo` tblineinfo is a py.test plugin that insert the node id in the final py.test report when --tb=line option is used Dec 01, 2015 3 - Alpha pytest (>=2.0)
|
||||
:pypi:`pytest-tcp` A Pytest plugin for test prioritization Dec 04, 2023 4 - Beta pytest >=7.4.3
|
||||
:pypi:`pytest-tcp` A Pytest plugin for test prioritization Dec 10, 2023 4 - Beta pytest >=7.4.3
|
||||
:pypi:`pytest-tcpclient` A pytest plugin for testing TCP clients Nov 16, 2022 N/A pytest (<8,>=7.1.3)
|
||||
:pypi:`pytest-tdd` run pytest on a python module Aug 18, 2023 4 - Beta N/A
|
||||
:pypi:`pytest-teamcity-logblock` py.test plugin to introduce block structure in teamcity build log, if output is not captured May 15, 2018 4 - Beta N/A
|
||||
|
@ -1255,6 +1255,7 @@ This list contains 1354 plugins.
|
|||
:pypi:`pytest-threadleak` Detects thread leaks Jul 03, 2022 4 - Beta pytest (>=3.1.1)
|
||||
:pypi:`pytest-tick` Ticking on tests Aug 31, 2021 5 - Production/Stable pytest (>=6.2.5,<7.0.0)
|
||||
:pypi:`pytest-time` Jun 24, 2023 3 - Alpha pytest
|
||||
:pypi:`pytest-timeassert-ethan` execution duration Dec 12, 2023 N/A pytest
|
||||
:pypi:`pytest-timeit` A pytest plugin to time test function runs Oct 13, 2016 4 - Beta N/A
|
||||
:pypi:`pytest-timeout` pytest plugin to abort hanging tests Oct 08, 2023 5 - Production/Stable pytest >=5.0.0
|
||||
:pypi:`pytest-timeouts` Linux-only Pytest plugin to control durations of various test case execution phases Sep 21, 2019 5 - Production/Stable N/A
|
||||
|
@ -1324,7 +1325,7 @@ This list contains 1354 plugins.
|
|||
:pypi:`pytest-vcrpandas` Test from HTTP interactions to dataframe processed. Jan 12, 2019 4 - Beta pytest
|
||||
:pypi:`pytest-vcs` Sep 22, 2022 4 - Beta N/A
|
||||
:pypi:`pytest-venv` py.test fixture for creating a virtual environment Nov 23, 2023 4 - Beta pytest
|
||||
:pypi:`pytest-ver` Pytest module with Verification Protocol, Verification Report and Trace Matrix Nov 23, 2023 4 - Beta pytest
|
||||
:pypi:`pytest-ver` Pytest module with Verification Protocol, Verification Report and Trace Matrix Dec 12, 2023 4 - Beta pytest
|
||||
:pypi:`pytest-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
|
||||
|
@ -1758,7 +1759,7 @@ This list contains 1354 plugins.
|
|||
A plugin to use approvaltests with pytest
|
||||
|
||||
:pypi:`pytest-approvaltests-geo`
|
||||
*last release*: Sep 06, 2023,
|
||||
*last release*: Dec 12, 2023,
|
||||
*status*: 5 - Production/Stable,
|
||||
*requires*: pytest
|
||||
|
||||
|
@ -2920,7 +2921,7 @@ This list contains 1354 plugins.
|
|||
The pytest plugin for your copier templates 📒
|
||||
|
||||
:pypi:`pytest-copier`
|
||||
*last release*: Dec 08, 2023,
|
||||
*last release*: Dec 11, 2023,
|
||||
*status*: 4 - Beta,
|
||||
*requires*: pytest>=7.3.2
|
||||
|
||||
|
@ -3452,7 +3453,7 @@ This list contains 1354 plugins.
|
|||
PyTest plugin for generating Difido reports
|
||||
|
||||
:pypi:`pytest-dir-equal`
|
||||
*last release*: Dec 05, 2023,
|
||||
*last release*: Dec 11, 2023,
|
||||
*status*: 4 - Beta,
|
||||
*requires*: pytest>=7.3.2
|
||||
|
||||
|
@ -3795,8 +3796,8 @@ This list contains 1354 plugins.
|
|||
A simple pytest plugin to import names and add them to the doctest namespace.
|
||||
|
||||
:pypi:`pytest-doctestplus`
|
||||
*last release*: Aug 11, 2023,
|
||||
*status*: 3 - Alpha,
|
||||
*last release*: Dec 13, 2023,
|
||||
*status*: 5 - Production/Stable,
|
||||
*requires*: pytest >=4.6
|
||||
|
||||
Pytest plugin with advanced doctest features.
|
||||
|
@ -3809,7 +3810,7 @@ This list contains 1354 plugins.
|
|||
pytest plugin for dogu report
|
||||
|
||||
:pypi:`pytest-dogu-sdk`
|
||||
*last release*: Dec 05, 2023,
|
||||
*last release*: Dec 14, 2023,
|
||||
*status*: N/A,
|
||||
*requires*: N/A
|
||||
|
||||
|
@ -4845,7 +4846,7 @@ This list contains 1354 plugins.
|
|||
|
||||
|
||||
:pypi:`pytest-fzf`
|
||||
*last release*: Nov 28, 2023,
|
||||
*last release*: Dec 15, 2023,
|
||||
*status*: 4 - Beta,
|
||||
*requires*: pytest >=6.0.0
|
||||
|
||||
|
@ -4908,7 +4909,7 @@ This list contains 1354 plugins.
|
|||
For finding/executing Ghost Inspector tests
|
||||
|
||||
:pypi:`pytest-girder`
|
||||
*last release*: Dec 05, 2023,
|
||||
*last release*: Dec 14, 2023,
|
||||
*status*: N/A,
|
||||
*requires*: N/A
|
||||
|
||||
|
@ -5174,7 +5175,7 @@ This list contains 1354 plugins.
|
|||
A pytest plugin for use with homeassistant custom components.
|
||||
|
||||
:pypi:`pytest-homeassistant-custom-component`
|
||||
*last release*: Dec 09, 2023,
|
||||
*last release*: Dec 15, 2023,
|
||||
*status*: 3 - Alpha,
|
||||
*requires*: pytest ==7.4.3
|
||||
|
||||
|
@ -5195,7 +5196,7 @@ This list contains 1354 plugins.
|
|||
Report on tests that honor constraints, and guard against regressions
|
||||
|
||||
:pypi:`pytest-hot-reloading`
|
||||
*last release*: Dec 01, 2023,
|
||||
*last release*: Dec 13, 2023,
|
||||
*status*: N/A,
|
||||
*requires*: N/A
|
||||
|
||||
|
@ -5314,7 +5315,7 @@ This list contains 1354 plugins.
|
|||
Easily test your HTTP library against a local copy of httpbin
|
||||
|
||||
:pypi:`pytest-httpdbg`
|
||||
*last release*: Nov 03, 2023,
|
||||
*last release*: Dec 09, 2023,
|
||||
*status*: 3 - Alpha,
|
||||
*requires*: pytest >=7.0.0
|
||||
|
||||
|
@ -5384,7 +5385,7 @@ This list contains 1354 plugins.
|
|||
help hypo module for pytest
|
||||
|
||||
:pypi:`pytest-iam`
|
||||
*last release*: Aug 31, 2023,
|
||||
*last release*: Dec 15, 2023,
|
||||
*status*: 3 - Alpha,
|
||||
*requires*: pytest (>=7.0.0,<8.0.0)
|
||||
|
||||
|
@ -5412,7 +5413,7 @@ This list contains 1354 plugins.
|
|||
A pytest plugin for idapython. Allows a pytest setup to run tests outside and inside IDA in an automated manner by runnig pytest inside IDA and by mocking idapython api
|
||||
|
||||
:pypi:`pytest-idem`
|
||||
*last release*: Jun 23, 2023,
|
||||
*last release*: Dec 13, 2023,
|
||||
*status*: 5 - Production/Stable,
|
||||
*requires*: N/A
|
||||
|
||||
|
@ -5510,14 +5511,14 @@ This list contains 1354 plugins.
|
|||
A pytest plugin for writing inline tests.
|
||||
|
||||
:pypi:`pytest-inmanta`
|
||||
*last release*: Nov 29, 2023,
|
||||
*last release*: Dec 13, 2023,
|
||||
*status*: 5 - Production/Stable,
|
||||
*requires*: N/A
|
||||
*requires*: pytest
|
||||
|
||||
A py.test plugin providing fixtures to simplify inmanta modules testing.
|
||||
|
||||
:pypi:`pytest-inmanta-extensions`
|
||||
*last release*: Oct 13, 2023,
|
||||
*last release*: Dec 11, 2023,
|
||||
*status*: 5 - Production/Stable,
|
||||
*requires*: N/A
|
||||
|
||||
|
@ -6987,7 +6988,7 @@ This list contains 1354 plugins.
|
|||
Use @pytest.mark.only to run a single test
|
||||
|
||||
:pypi:`pytest-oof`
|
||||
*last release*: Dec 05, 2023,
|
||||
*last release*: Dec 11, 2023,
|
||||
*status*: 4 - Beta,
|
||||
*requires*: N/A
|
||||
|
||||
|
@ -8352,7 +8353,7 @@ This list contains 1354 plugins.
|
|||
Pytest fixture for recording and replaying serial port traffic.
|
||||
|
||||
:pypi:`pytest-resilient-circuits`
|
||||
*last release*: Nov 22, 2023,
|
||||
*last release*: Dec 11, 2023,
|
||||
*status*: N/A,
|
||||
*requires*: pytest ~=4.6 ; python_version == "2.7"
|
||||
|
||||
|
@ -8793,7 +8794,7 @@ This list contains 1354 plugins.
|
|||
Automatically mocks resources from serverless.yml in pytest using moto.
|
||||
|
||||
:pypi:`pytest-servers`
|
||||
*last release*: Oct 31, 2023,
|
||||
*last release*: Dec 15, 2023,
|
||||
*status*: 3 - Alpha,
|
||||
*requires*: pytest >=6.2
|
||||
|
||||
|
@ -9248,7 +9249,7 @@ This list contains 1354 plugins.
|
|||
|
||||
|
||||
:pypi:`pytest-splunk-addon`
|
||||
*last release*: Nov 25, 2023,
|
||||
*last release*: Dec 14, 2023,
|
||||
*status*: N/A,
|
||||
*requires*: pytest (>5.4.0,<8)
|
||||
|
||||
|
@ -9591,7 +9592,7 @@ This list contains 1354 plugins.
|
|||
tblineinfo is a py.test plugin that insert the node id in the final py.test report when --tb=line option is used
|
||||
|
||||
:pypi:`pytest-tcp`
|
||||
*last release*: Dec 04, 2023,
|
||||
*last release*: Dec 10, 2023,
|
||||
*status*: 4 - Beta,
|
||||
*requires*: pytest >=7.4.3
|
||||
|
||||
|
@ -9940,6 +9941,13 @@ This list contains 1354 plugins.
|
|||
|
||||
|
||||
|
||||
:pypi:`pytest-timeassert-ethan`
|
||||
*last release*: Dec 12, 2023,
|
||||
*status*: N/A,
|
||||
*requires*: pytest
|
||||
|
||||
execution duration
|
||||
|
||||
:pypi:`pytest-timeit`
|
||||
*last release*: Oct 13, 2016,
|
||||
*status*: 4 - Beta,
|
||||
|
@ -10424,7 +10432,7 @@ This list contains 1354 plugins.
|
|||
py.test fixture for creating a virtual environment
|
||||
|
||||
:pypi:`pytest-ver`
|
||||
*last release*: Nov 23, 2023,
|
||||
*last release*: Dec 12, 2023,
|
||||
*status*: 4 - Beta,
|
||||
*requires*: pytest
|
||||
|
||||
|
|
|
@ -1146,13 +1146,13 @@ When set to ``0``, pytest will not use color.
|
|||
|
||||
.. envvar:: NO_COLOR
|
||||
|
||||
When set (regardless of value), pytest will not use color in terminal output.
|
||||
When set to a non-empty string (regardless of value), pytest will not use color in terminal output.
|
||||
``PY_COLORS`` takes precedence over ``NO_COLOR``, which takes precedence over ``FORCE_COLOR``.
|
||||
See `no-color.org <https://no-color.org/>`__ for other libraries supporting this community standard.
|
||||
|
||||
.. envvar:: FORCE_COLOR
|
||||
|
||||
When set (regardless of value), pytest will use color in terminal output.
|
||||
When set to a non-empty string (regardless of value), pytest will use color in terminal output.
|
||||
``PY_COLORS`` and ``NO_COLOR`` take precedence over ``FORCE_COLOR``.
|
||||
|
||||
Exceptions
|
||||
|
|
|
@ -29,9 +29,9 @@ def should_do_markup(file: TextIO) -> bool:
|
|||
return True
|
||||
if os.environ.get("PY_COLORS") == "0":
|
||||
return False
|
||||
if "NO_COLOR" in os.environ:
|
||||
if os.environ.get("NO_COLOR"):
|
||||
return False
|
||||
if "FORCE_COLOR" in os.environ:
|
||||
if os.environ.get("FORCE_COLOR"):
|
||||
return True
|
||||
return (
|
||||
hasattr(file, "isatty") and file.isatty() and os.environ.get("TERM") != "dumb"
|
||||
|
@ -223,7 +223,15 @@ class TerminalWriter:
|
|||
style=os.getenv("PYTEST_THEME"),
|
||||
),
|
||||
)
|
||||
return highlighted
|
||||
# pygments terminal formatter may add a newline when there wasn't one.
|
||||
# We don't want this, remove.
|
||||
if highlighted[-1] == "\n" and source[-1] != "\n":
|
||||
highlighted = highlighted[:-1]
|
||||
|
||||
# Some lexers will not set the initial color explicitly
|
||||
# which may lead to the previous color being propagated to the
|
||||
# start of the expression, so reset first.
|
||||
return "\x1b[0m" + highlighted
|
||||
except pygments.util.ClassNotFound:
|
||||
raise UsageError(
|
||||
"PYTEST_THEME environment variable had an invalid value: '{}'. "
|
||||
|
|
|
@ -192,12 +192,12 @@ def assertrepr_compare(
|
|||
right_repr = saferepr(right, maxsize=maxsize, use_ascii=use_ascii)
|
||||
|
||||
summary = f"{left_repr} {op} {right_repr}"
|
||||
highlighter = config.get_terminal_writer()._highlight
|
||||
|
||||
explanation = None
|
||||
try:
|
||||
if op == "==":
|
||||
writer = config.get_terminal_writer()
|
||||
explanation = _compare_eq_any(left, right, writer._highlight, verbose)
|
||||
explanation = _compare_eq_any(left, right, highlighter, verbose)
|
||||
elif op == "not in":
|
||||
if istext(left) and istext(right):
|
||||
explanation = _notin_text(left, right, verbose)
|
||||
|
@ -206,16 +206,16 @@ def assertrepr_compare(
|
|||
explanation = ["Both sets are equal"]
|
||||
elif op == ">=":
|
||||
if isset(left) and isset(right):
|
||||
explanation = _compare_gte_set(left, right, verbose)
|
||||
explanation = _compare_gte_set(left, right, highlighter, verbose)
|
||||
elif op == "<=":
|
||||
if isset(left) and isset(right):
|
||||
explanation = _compare_lte_set(left, right, verbose)
|
||||
explanation = _compare_lte_set(left, right, highlighter, verbose)
|
||||
elif op == ">":
|
||||
if isset(left) and isset(right):
|
||||
explanation = _compare_gt_set(left, right, verbose)
|
||||
explanation = _compare_gt_set(left, right, highlighter, verbose)
|
||||
elif op == "<":
|
||||
if isset(left) and isset(right):
|
||||
explanation = _compare_lt_set(left, right, verbose)
|
||||
explanation = _compare_lt_set(left, right, highlighter, verbose)
|
||||
|
||||
except outcomes.Exit:
|
||||
raise
|
||||
|
@ -259,11 +259,11 @@ def _compare_eq_any(
|
|||
# used in older code bases before dataclasses/attrs were available.
|
||||
explanation = _compare_eq_cls(left, right, highlighter, verbose)
|
||||
elif issequence(left) and issequence(right):
|
||||
explanation = _compare_eq_sequence(left, right, verbose)
|
||||
explanation = _compare_eq_sequence(left, right, highlighter, verbose)
|
||||
elif isset(left) and isset(right):
|
||||
explanation = _compare_eq_set(left, right, verbose)
|
||||
explanation = _compare_eq_set(left, right, highlighter, verbose)
|
||||
elif isdict(left) and isdict(right):
|
||||
explanation = _compare_eq_dict(left, right, verbose)
|
||||
explanation = _compare_eq_dict(left, right, highlighter, verbose)
|
||||
|
||||
if isiterable(left) and isiterable(right):
|
||||
expl = _compare_eq_iterable(left, right, highlighter, verbose)
|
||||
|
@ -350,7 +350,10 @@ def _compare_eq_iterable(
|
|||
|
||||
|
||||
def _compare_eq_sequence(
|
||||
left: Sequence[Any], right: Sequence[Any], verbose: int = 0
|
||||
left: Sequence[Any],
|
||||
right: Sequence[Any],
|
||||
highlighter: _HighlightFunc,
|
||||
verbose: int = 0,
|
||||
) -> List[str]:
|
||||
comparing_bytes = isinstance(left, bytes) and isinstance(right, bytes)
|
||||
explanation: List[str] = []
|
||||
|
@ -373,7 +376,10 @@ def _compare_eq_sequence(
|
|||
left_value = left[i]
|
||||
right_value = right[i]
|
||||
|
||||
explanation += [f"At index {i} diff: {left_value!r} != {right_value!r}"]
|
||||
explanation.append(
|
||||
f"At index {i} diff:"
|
||||
f" {highlighter(repr(left_value))} != {highlighter(repr(right_value))}"
|
||||
)
|
||||
break
|
||||
|
||||
if comparing_bytes:
|
||||
|
@ -393,68 +399,91 @@ def _compare_eq_sequence(
|
|||
extra = saferepr(right[len_left])
|
||||
|
||||
if len_diff == 1:
|
||||
explanation += [f"{dir_with_more} contains one more item: {extra}"]
|
||||
explanation += [
|
||||
f"{dir_with_more} contains one more item: {highlighter(extra)}"
|
||||
]
|
||||
else:
|
||||
explanation += [
|
||||
"%s contains %d more items, first extra item: %s"
|
||||
% (dir_with_more, len_diff, extra)
|
||||
% (dir_with_more, len_diff, highlighter(extra))
|
||||
]
|
||||
return explanation
|
||||
|
||||
|
||||
def _compare_eq_set(
|
||||
left: AbstractSet[Any], right: AbstractSet[Any], verbose: int = 0
|
||||
left: AbstractSet[Any],
|
||||
right: AbstractSet[Any],
|
||||
highlighter: _HighlightFunc,
|
||||
verbose: int = 0,
|
||||
) -> List[str]:
|
||||
explanation = []
|
||||
explanation.extend(_set_one_sided_diff("left", left, right))
|
||||
explanation.extend(_set_one_sided_diff("right", right, left))
|
||||
explanation.extend(_set_one_sided_diff("left", left, right, highlighter))
|
||||
explanation.extend(_set_one_sided_diff("right", right, left, highlighter))
|
||||
return explanation
|
||||
|
||||
|
||||
def _compare_gt_set(
|
||||
left: AbstractSet[Any], right: AbstractSet[Any], verbose: int = 0
|
||||
left: AbstractSet[Any],
|
||||
right: AbstractSet[Any],
|
||||
highlighter: _HighlightFunc,
|
||||
verbose: int = 0,
|
||||
) -> List[str]:
|
||||
explanation = _compare_gte_set(left, right, verbose)
|
||||
explanation = _compare_gte_set(left, right, highlighter)
|
||||
if not explanation:
|
||||
return ["Both sets are equal"]
|
||||
return explanation
|
||||
|
||||
|
||||
def _compare_lt_set(
|
||||
left: AbstractSet[Any], right: AbstractSet[Any], verbose: int = 0
|
||||
left: AbstractSet[Any],
|
||||
right: AbstractSet[Any],
|
||||
highlighter: _HighlightFunc,
|
||||
verbose: int = 0,
|
||||
) -> List[str]:
|
||||
explanation = _compare_lte_set(left, right, verbose)
|
||||
explanation = _compare_lte_set(left, right, highlighter)
|
||||
if not explanation:
|
||||
return ["Both sets are equal"]
|
||||
return explanation
|
||||
|
||||
|
||||
def _compare_gte_set(
|
||||
left: AbstractSet[Any], right: AbstractSet[Any], verbose: int = 0
|
||||
left: AbstractSet[Any],
|
||||
right: AbstractSet[Any],
|
||||
highlighter: _HighlightFunc,
|
||||
verbose: int = 0,
|
||||
) -> List[str]:
|
||||
return _set_one_sided_diff("right", right, left)
|
||||
return _set_one_sided_diff("right", right, left, highlighter)
|
||||
|
||||
|
||||
def _compare_lte_set(
|
||||
left: AbstractSet[Any], right: AbstractSet[Any], verbose: int = 0
|
||||
left: AbstractSet[Any],
|
||||
right: AbstractSet[Any],
|
||||
highlighter: _HighlightFunc,
|
||||
verbose: int = 0,
|
||||
) -> List[str]:
|
||||
return _set_one_sided_diff("left", left, right)
|
||||
return _set_one_sided_diff("left", left, right, highlighter)
|
||||
|
||||
|
||||
def _set_one_sided_diff(
|
||||
posn: str, set1: AbstractSet[Any], set2: AbstractSet[Any]
|
||||
posn: str,
|
||||
set1: AbstractSet[Any],
|
||||
set2: AbstractSet[Any],
|
||||
highlighter: _HighlightFunc,
|
||||
) -> List[str]:
|
||||
explanation = []
|
||||
diff = set1 - set2
|
||||
if diff:
|
||||
explanation.append(f"Extra items in the {posn} set:")
|
||||
for item in diff:
|
||||
explanation.append(saferepr(item))
|
||||
explanation.append(highlighter(saferepr(item)))
|
||||
return explanation
|
||||
|
||||
|
||||
def _compare_eq_dict(
|
||||
left: Mapping[Any, Any], right: Mapping[Any, Any], verbose: int = 0
|
||||
left: Mapping[Any, Any],
|
||||
right: Mapping[Any, Any],
|
||||
highlighter: _HighlightFunc,
|
||||
verbose: int = 0,
|
||||
) -> List[str]:
|
||||
explanation: List[str] = []
|
||||
set_left = set(left)
|
||||
|
@ -465,12 +494,16 @@ def _compare_eq_dict(
|
|||
explanation += ["Omitting %s identical items, use -vv to show" % len(same)]
|
||||
elif same:
|
||||
explanation += ["Common items:"]
|
||||
explanation += pprint.pformat(same).splitlines()
|
||||
explanation += highlighter(pprint.pformat(same)).splitlines()
|
||||
diff = {k for k in common if left[k] != right[k]}
|
||||
if diff:
|
||||
explanation += ["Differing items:"]
|
||||
for k in diff:
|
||||
explanation += [saferepr({k: left[k]}) + " != " + saferepr({k: right[k]})]
|
||||
explanation += [
|
||||
highlighter(saferepr({k: left[k]}))
|
||||
+ " != "
|
||||
+ highlighter(saferepr({k: right[k]}))
|
||||
]
|
||||
extra_left = set_left - set_right
|
||||
len_extra_left = len(extra_left)
|
||||
if len_extra_left:
|
||||
|
@ -479,7 +512,7 @@ def _compare_eq_dict(
|
|||
% (len_extra_left, "" if len_extra_left == 1 else "s")
|
||||
)
|
||||
explanation.extend(
|
||||
pprint.pformat({k: left[k] for k in extra_left}).splitlines()
|
||||
highlighter(pprint.pformat({k: left[k] for k in extra_left})).splitlines()
|
||||
)
|
||||
extra_right = set_right - set_left
|
||||
len_extra_right = len(extra_right)
|
||||
|
@ -489,7 +522,7 @@ def _compare_eq_dict(
|
|||
% (len_extra_right, "" if len_extra_right == 1 else "s")
|
||||
)
|
||||
explanation.extend(
|
||||
pprint.pformat({k: right[k] for k in extra_right}).splitlines()
|
||||
highlighter(pprint.pformat({k: right[k] for k in extra_right})).splitlines()
|
||||
)
|
||||
return explanation
|
||||
|
||||
|
@ -528,17 +561,17 @@ def _compare_eq_cls(
|
|||
explanation.append("Omitting %s identical items, use -vv to show" % len(same))
|
||||
elif same:
|
||||
explanation += ["Matching attributes:"]
|
||||
explanation += pprint.pformat(same).splitlines()
|
||||
explanation += highlighter(pprint.pformat(same)).splitlines()
|
||||
if diff:
|
||||
explanation += ["Differing attributes:"]
|
||||
explanation += pprint.pformat(diff).splitlines()
|
||||
explanation += highlighter(pprint.pformat(diff)).splitlines()
|
||||
for field in diff:
|
||||
field_left = getattr(left, field)
|
||||
field_right = getattr(right, field)
|
||||
explanation += [
|
||||
"",
|
||||
"Drill down into differing attribute %s:" % field,
|
||||
("%s%s: %r != %r") % (indent, field, field_left, field_right),
|
||||
f"Drill down into differing attribute {field}:",
|
||||
f"{indent}{field}: {highlighter(repr(field_left))} != {highlighter(repr(field_right))}",
|
||||
]
|
||||
explanation += [
|
||||
indent + line
|
||||
|
|
|
@ -11,15 +11,18 @@ from datetime import timezone
|
|||
from io import StringIO
|
||||
from logging import LogRecord
|
||||
from pathlib import Path
|
||||
from types import TracebackType
|
||||
from typing import AbstractSet
|
||||
from typing import Dict
|
||||
from typing import final
|
||||
from typing import Generator
|
||||
from typing import Generic
|
||||
from typing import List
|
||||
from typing import Literal
|
||||
from typing import Mapping
|
||||
from typing import Optional
|
||||
from typing import Tuple
|
||||
from typing import Type
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import TypeVar
|
||||
from typing import Union
|
||||
|
@ -62,7 +65,7 @@ class DatetimeFormatter(logging.Formatter):
|
|||
:func:`time.strftime` in case of microseconds in format string.
|
||||
"""
|
||||
|
||||
def formatTime(self, record: LogRecord, datefmt=None) -> str:
|
||||
def formatTime(self, record: LogRecord, datefmt: Optional[str] = None) -> str:
|
||||
if datefmt and "%f" in datefmt:
|
||||
ct = self.converter(record.created)
|
||||
tz = timezone(timedelta(seconds=ct.tm_gmtoff), ct.tm_zone)
|
||||
|
@ -331,7 +334,7 @@ _HandlerType = TypeVar("_HandlerType", bound=logging.Handler)
|
|||
|
||||
|
||||
# Not using @contextmanager for performance reasons.
|
||||
class catching_logs:
|
||||
class catching_logs(Generic[_HandlerType]):
|
||||
"""Context manager that prepares the whole logging machinery properly."""
|
||||
|
||||
__slots__ = ("handler", "level", "orig_level")
|
||||
|
@ -340,7 +343,7 @@ class catching_logs:
|
|||
self.handler = handler
|
||||
self.level = level
|
||||
|
||||
def __enter__(self):
|
||||
def __enter__(self) -> _HandlerType:
|
||||
root_logger = logging.getLogger()
|
||||
if self.level is not None:
|
||||
self.handler.setLevel(self.level)
|
||||
|
@ -350,7 +353,12 @@ class catching_logs:
|
|||
root_logger.setLevel(min(self.orig_level, self.level))
|
||||
return self.handler
|
||||
|
||||
def __exit__(self, type, value, traceback):
|
||||
def __exit__(
|
||||
self,
|
||||
exc_type: Optional[Type[BaseException]],
|
||||
exc_val: Optional[BaseException],
|
||||
exc_tb: Optional[TracebackType],
|
||||
) -> None:
|
||||
root_logger = logging.getLogger()
|
||||
if self.level is not None:
|
||||
root_logger.setLevel(self.orig_level)
|
||||
|
@ -421,7 +429,7 @@ class LogCaptureFixture:
|
|||
return self._item.stash[caplog_handler_key]
|
||||
|
||||
def get_records(
|
||||
self, when: "Literal['setup', 'call', 'teardown']"
|
||||
self, when: Literal["setup", "call", "teardown"]
|
||||
) -> List[logging.LogRecord]:
|
||||
"""Get the logging records for one of the possible test phases.
|
||||
|
||||
|
@ -742,7 +750,7 @@ class LoggingPlugin:
|
|||
if old_stream:
|
||||
old_stream.close()
|
||||
|
||||
def _log_cli_enabled(self):
|
||||
def _log_cli_enabled(self) -> bool:
|
||||
"""Return whether live logging is enabled."""
|
||||
enabled = self._config.getoption(
|
||||
"--log-cli-level"
|
||||
|
|
|
@ -317,7 +317,7 @@ class CallInfo(Generic[TResult]):
|
|||
@classmethod
|
||||
def from_call(
|
||||
cls,
|
||||
func: "Callable[[], TResult]",
|
||||
func: Callable[[], TResult],
|
||||
when: Literal["collect", "setup", "call", "teardown"],
|
||||
reraise: Optional[
|
||||
Union[Type[BaseException], Tuple[Type[BaseException], ...]]
|
||||
|
|
|
@ -5,6 +5,7 @@ import shutil
|
|||
import sys
|
||||
from pathlib import Path
|
||||
from typing import Generator
|
||||
from typing import Optional
|
||||
from unittest import mock
|
||||
|
||||
import pytest
|
||||
|
@ -164,53 +165,67 @@ def test_attr_hasmarkup() -> None:
|
|||
assert "\x1b[0m" in s
|
||||
|
||||
|
||||
def assert_color_set():
|
||||
def assert_color(expected: bool, default: Optional[bool] = None) -> None:
|
||||
file = io.StringIO()
|
||||
tw = terminalwriter.TerminalWriter(file)
|
||||
assert tw.hasmarkup
|
||||
if default is None:
|
||||
default = not expected
|
||||
file.isatty = lambda: default # type: ignore
|
||||
tw = terminalwriter.TerminalWriter(file=file)
|
||||
assert tw.hasmarkup is expected
|
||||
tw.line("hello", bold=True)
|
||||
s = file.getvalue()
|
||||
assert len(s) > len("hello\n")
|
||||
assert "\x1b[1m" in s
|
||||
assert "\x1b[0m" in s
|
||||
|
||||
|
||||
def assert_color_not_set():
|
||||
f = io.StringIO()
|
||||
f.isatty = lambda: True # type: ignore
|
||||
tw = terminalwriter.TerminalWriter(file=f)
|
||||
assert not tw.hasmarkup
|
||||
tw.line("hello", bold=True)
|
||||
s = f.getvalue()
|
||||
assert s == "hello\n"
|
||||
if expected:
|
||||
assert len(s) > len("hello\n")
|
||||
assert "\x1b[1m" in s
|
||||
assert "\x1b[0m" in s
|
||||
else:
|
||||
assert s == "hello\n"
|
||||
|
||||
|
||||
def test_should_do_markup_PY_COLORS_eq_1(monkeypatch: MonkeyPatch) -> None:
|
||||
monkeypatch.setitem(os.environ, "PY_COLORS", "1")
|
||||
assert_color_set()
|
||||
assert_color(True)
|
||||
|
||||
|
||||
def test_should_not_do_markup_PY_COLORS_eq_0(monkeypatch: MonkeyPatch) -> None:
|
||||
monkeypatch.setitem(os.environ, "PY_COLORS", "0")
|
||||
assert_color_not_set()
|
||||
assert_color(False)
|
||||
|
||||
|
||||
def test_should_not_do_markup_NO_COLOR(monkeypatch: MonkeyPatch) -> None:
|
||||
monkeypatch.setitem(os.environ, "NO_COLOR", "1")
|
||||
assert_color_not_set()
|
||||
assert_color(False)
|
||||
|
||||
|
||||
def test_should_do_markup_FORCE_COLOR(monkeypatch: MonkeyPatch) -> None:
|
||||
monkeypatch.setitem(os.environ, "FORCE_COLOR", "1")
|
||||
assert_color_set()
|
||||
assert_color(True)
|
||||
|
||||
|
||||
def test_should_not_do_markup_NO_COLOR_and_FORCE_COLOR(
|
||||
@pytest.mark.parametrize(
|
||||
["NO_COLOR", "FORCE_COLOR", "expected"],
|
||||
[
|
||||
("1", "1", False),
|
||||
("", "1", True),
|
||||
("1", "", False),
|
||||
],
|
||||
)
|
||||
def test_NO_COLOR_and_FORCE_COLOR(
|
||||
monkeypatch: MonkeyPatch,
|
||||
NO_COLOR: str,
|
||||
FORCE_COLOR: str,
|
||||
expected: bool,
|
||||
) -> None:
|
||||
monkeypatch.setitem(os.environ, "NO_COLOR", "1")
|
||||
monkeypatch.setitem(os.environ, "FORCE_COLOR", "1")
|
||||
assert_color_not_set()
|
||||
monkeypatch.setitem(os.environ, "NO_COLOR", NO_COLOR)
|
||||
monkeypatch.setitem(os.environ, "FORCE_COLOR", FORCE_COLOR)
|
||||
assert_color(expected)
|
||||
|
||||
|
||||
def test_empty_NO_COLOR_and_FORCE_COLOR_ignored(monkeypatch: MonkeyPatch) -> None:
|
||||
monkeypatch.setitem(os.environ, "NO_COLOR", "")
|
||||
monkeypatch.setitem(os.environ, "FORCE_COLOR", "")
|
||||
assert_color(True, True)
|
||||
assert_color(False, False)
|
||||
|
||||
|
||||
class TestTerminalWriterLineWidth:
|
||||
|
@ -254,7 +269,7 @@ class TestTerminalWriterLineWidth:
|
|||
pytest.param(
|
||||
True,
|
||||
True,
|
||||
"{kw}assert{hl-reset} {number}0{hl-reset}{endline}\n",
|
||||
"{reset}{kw}assert{hl-reset} {number}0{hl-reset}{endline}\n",
|
||||
id="with markup and code_highlight",
|
||||
),
|
||||
pytest.param(
|
||||
|
|
|
@ -20,7 +20,7 @@ from _pytest.pytester import Pytester
|
|||
|
||||
def mock_config(verbose: int = 0, assertion_override: Optional[int] = None):
|
||||
class TerminalWriter:
|
||||
def _highlight(self, source, lexer):
|
||||
def _highlight(self, source, lexer="python"):
|
||||
return source
|
||||
|
||||
class Config:
|
||||
|
@ -1933,6 +1933,7 @@ def test_reprcompare_verbose_long() -> None:
|
|||
assert [0, 1] == [0, 2]
|
||||
""",
|
||||
[
|
||||
"{bold}{red}E At index 1 diff: {reset}{number}1{hl-reset}{endline} != {reset}{number}2*",
|
||||
"{bold}{red}E {light-red}- 2,{hl-reset}{endline}{reset}",
|
||||
"{bold}{red}E {light-green}+ 1,{hl-reset}{endline}{reset}",
|
||||
],
|
||||
|
@ -1945,7 +1946,13 @@ def test_reprcompare_verbose_long() -> None:
|
|||
}
|
||||
""",
|
||||
[
|
||||
"{bold}{red}E {light-gray} {hl-reset} {{{endline}{reset}",
|
||||
"{bold}{red}E Common items:{reset}",
|
||||
"{bold}{red}E {reset}{{{str}'{hl-reset}{str}number-is-1{hl-reset}{str}'{hl-reset}: {number}1*",
|
||||
"{bold}{red}E Left contains 1 more item:{reset}",
|
||||
"{bold}{red}E {reset}{{{str}'{hl-reset}{str}number-is-5{hl-reset}{str}'{hl-reset}: {number}5*",
|
||||
"{bold}{red}E Right contains 1 more item:{reset}",
|
||||
"{bold}{red}E {reset}{{{str}'{hl-reset}{str}number-is-0{hl-reset}{str}'{hl-reset}: {number}0*",
|
||||
"{bold}{red}E {reset}{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}",
|
||||
],
|
||||
|
|
|
@ -1268,13 +1268,13 @@ def test_color_yes(pytester: Pytester, color_mapping) -> None:
|
|||
"=*= FAILURES =*=",
|
||||
"{red}{bold}_*_ test_this _*_{reset}",
|
||||
"",
|
||||
" {kw}def{hl-reset} {function}test_this{hl-reset}():{endline}",
|
||||
" {reset}{kw}def{hl-reset} {function}test_this{hl-reset}():{endline}",
|
||||
"> fail(){endline}",
|
||||
"",
|
||||
"{bold}{red}test_color_yes.py{reset}:5: ",
|
||||
"_ _ * _ _*",
|
||||
"",
|
||||
" {kw}def{hl-reset} {function}fail{hl-reset}():{endline}",
|
||||
" {reset}{kw}def{hl-reset} {function}fail{hl-reset}():{endline}",
|
||||
"> {kw}assert{hl-reset} {number}0{hl-reset}{endline}",
|
||||
"{bold}{red}E assert 0{reset}",
|
||||
"",
|
||||
|
@ -1295,9 +1295,9 @@ def test_color_yes(pytester: Pytester, color_mapping) -> None:
|
|||
"=*= FAILURES =*=",
|
||||
"{red}{bold}_*_ test_this _*_{reset}",
|
||||
"{bold}{red}test_color_yes.py{reset}:5: in test_this",
|
||||
" fail(){endline}",
|
||||
" {reset}fail(){endline}",
|
||||
"{bold}{red}test_color_yes.py{reset}:2: in fail",
|
||||
" {kw}assert{hl-reset} {number}0{hl-reset}{endline}",
|
||||
" {reset}{kw}assert{hl-reset} {number}0{hl-reset}{endline}",
|
||||
"{bold}{red}E assert 0{reset}",
|
||||
"{red}=*= {red}{bold}1 failed{reset}{red} in *s{reset}{red} =*={reset}",
|
||||
]
|
||||
|
@ -2507,7 +2507,7 @@ class TestCodeHighlight:
|
|||
result.stdout.fnmatch_lines(
|
||||
color_mapping.format_for_fnmatch(
|
||||
[
|
||||
" {kw}def{hl-reset} {function}test_foo{hl-reset}():{endline}",
|
||||
" {reset}{kw}def{hl-reset} {function}test_foo{hl-reset}():{endline}",
|
||||
"> {kw}assert{hl-reset} {number}1{hl-reset} == {number}10{hl-reset}{endline}",
|
||||
"{bold}{red}E assert 1 == 10{reset}",
|
||||
]
|
||||
|
@ -2529,7 +2529,7 @@ class TestCodeHighlight:
|
|||
result.stdout.fnmatch_lines(
|
||||
color_mapping.format_for_fnmatch(
|
||||
[
|
||||
" {kw}def{hl-reset} {function}test_foo{hl-reset}():{endline}",
|
||||
" {reset}{kw}def{hl-reset} {function}test_foo{hl-reset}():{endline}",
|
||||
" {print}print{hl-reset}({str}'''{hl-reset}{str}{hl-reset}",
|
||||
"> {str} {hl-reset}{str}'''{hl-reset}); {kw}assert{hl-reset} {number}0{hl-reset}{endline}",
|
||||
"{bold}{red}E assert 0{reset}",
|
||||
|
@ -2552,7 +2552,7 @@ class TestCodeHighlight:
|
|||
result.stdout.fnmatch_lines(
|
||||
color_mapping.format_for_fnmatch(
|
||||
[
|
||||
" {kw}def{hl-reset} {function}test_foo{hl-reset}():{endline}",
|
||||
" {reset}{kw}def{hl-reset} {function}test_foo{hl-reset}():{endline}",
|
||||
"> {kw}assert{hl-reset} {number}1{hl-reset} == {number}10{hl-reset}{endline}",
|
||||
"{bold}{red}E assert 1 == 10{reset}",
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue