From 43213add579d1550031d5e4d4eff489c4096eb1d Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Mon, 15 Nov 2021 21:00:32 +0200 Subject: [PATCH 001/176] testing/test_session: add a regression test for an old bug Nothing tests this currently. Make sure it doesn't regress if/when the complex code in `Session.collect` is cleaned up. --- testing/test_session.py | 48 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/testing/test_session.py b/testing/test_session.py index 3ca6d390383..f73dc89ef33 100644 --- a/testing/test_session.py +++ b/testing/test_session.py @@ -335,6 +335,54 @@ def pytest_sessionfinish(): assert res.ret == ExitCode.NO_TESTS_COLLECTED +def test_collection_args_do_not_duplicate_modules(pytester: Pytester) -> None: + """Test that when multiple collection args are specified on the command line + for the same module, only a single Module collector is created. + + Regression test for #723, #3358. + """ + pytester.makepyfile( + **{ + "d/test_it": """ + def test_1(): pass + def test_2(): pass + """ + } + ) + + result = pytester.runpytest( + "--collect-only", + "d/test_it.py::test_1", + "d/test_it.py::test_2", + ) + result.stdout.fnmatch_lines( + [ + "", + " ", + " ", + ], + consecutive=True, + ) + + # Different, but related case. + result = pytester.runpytest( + "--collect-only", + "--keep-duplicates", + "d", + "d", + ) + result.stdout.fnmatch_lines( + [ + "", + " ", + " ", + " ", + " ", + ], + consecutive=True, + ) + + @pytest.mark.parametrize("path", ["root", "{relative}/root", "{environment}/root"]) def test_rootdir_option_arg( pytester: Pytester, monkeypatch: MonkeyPatch, path: str From d7e7c32a5f4aa569480582f5e73b8874b1a54482 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 6 Dec 2021 21:10:55 +0000 Subject: [PATCH 002/176] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black: 21.11b1 → 21.12b0](https://github.com/psf/black/compare/21.11b1...21.12b0) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 20cede3b7bb..1741136dfe0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/psf/black - rev: 21.11b1 + rev: 21.12b0 hooks: - id: black args: [--safe, --quiet] From dd53cc7e388d3c62956d0922ab5d0f3aa8f0adca Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 6 Dec 2021 21:12:32 +0000 Subject: [PATCH 003/176] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/_pytest/_argcomplete.py | 1 - src/_pytest/assertion/rewrite.py | 1 - src/_pytest/compat.py | 1 - src/_pytest/pathlib.py | 1 - 4 files changed, 4 deletions(-) diff --git a/src/_pytest/_argcomplete.py b/src/_pytest/_argcomplete.py index 41d9d9407c7..120f09ff68f 100644 --- a/src/_pytest/_argcomplete.py +++ b/src/_pytest/_argcomplete.py @@ -108,7 +108,6 @@ def __call__(self, prefix: str, **kwargs: Any) -> List[str]: def try_argcomplete(parser: argparse.ArgumentParser) -> None: argcomplete.autocomplete(parser, always_complete_options=False) - else: def try_argcomplete(parser: argparse.ArgumentParser) -> None: diff --git a/src/_pytest/assertion/rewrite.py b/src/_pytest/assertion/rewrite.py index 456681ab29e..50b367e25ef 100644 --- a/src/_pytest/assertion/rewrite.py +++ b/src/_pytest/assertion/rewrite.py @@ -324,7 +324,6 @@ def _write_pyc( return False return True - else: def _write_pyc( diff --git a/src/_pytest/compat.py b/src/_pytest/compat.py index 7703dee8c5a..5af01eb7d95 100644 --- a/src/_pytest/compat.py +++ b/src/_pytest/compat.py @@ -192,7 +192,6 @@ def getfuncargnames( def nullcontext(): yield - else: from contextlib import nullcontext as nullcontext # noqa: F401 diff --git a/src/_pytest/pathlib.py b/src/_pytest/pathlib.py index b44753e1a41..b23e51d4429 100644 --- a/src/_pytest/pathlib.py +++ b/src/_pytest/pathlib.py @@ -562,7 +562,6 @@ def import_path( def _is_same(f1: str, f2: str) -> bool: return Path(f1) == Path(f2) or os.path.samefile(f1, f2) - else: def _is_same(f1: str, f2: str) -> bool: From 0ad452bcbadffa2bb890c543c8b409d2df61c67d Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 7 Dec 2021 10:13:36 +0100 Subject: [PATCH 004/176] Prepare release version 7.0.0rc1 (#9375) (#9377) Co-authored-by: pytest bot (cherry picked from commit 85897eddc6d31c5825f5ca28f85e69b8d1506fc4) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- changelog/4320.doc.rst | 1 - changelog/5105.doc.rst | 1 - changelog/5196.feature.rst | 3 - changelog/7124.bugfix.rst | 1 - changelog/7132.feature.rst | 1 - changelog/7259.breaking.rst | 9 - changelog/7259.deprecation.rst | 12 - changelog/7259.feature.rst | 7 - changelog/7469.deprecation.rst | 13 - changelog/7469.feature.rst | 25 -- changelog/7480.improvement.rst | 5 - changelog/7856.feature.rst | 2 - changelog/7864.improvement.rst | 4 - changelog/8061.bugfix.rst | 1 - changelog/8133.trivial.rst | 1 - changelog/8144.feature.rst | 16 - changelog/8174.trivial.rst | 6 - changelog/8192.bugfix.rst | 3 - changelog/8242.deprecation.rst | 7 - changelog/8246.breaking.rst | 1 - changelog/8248.trivial.rst | 1 - changelog/8251.feature.rst | 11 - changelog/8258.bugfix.rst | 3 - changelog/8315.deprecation.rst | 5 - changelog/8317.bugfix.rst | 1 - changelog/8335.improvement.rst | 10 - changelog/8337.doc.rst | 1 - changelog/8367.bugfix.rst | 1 - changelog/8377.bugfix.rst | 2 - changelog/8384.bugfix.rst | 1 - changelog/8394.bugfix.rst | 1 - changelog/8403.improvement.rst | 5 - changelog/8421.feature.rst | 1 - changelog/8432.trivial.rst | 1 - changelog/8447.deprecation.rst | 4 - changelog/8456.bugfix.rst | 1 - changelog/8464.bugfix.rst | 1 - changelog/8503.bugfix.rst | 4 - changelog/8509.improvement.rst | 5 - changelog/8548.bugfix.rst | 1 - changelog/8592.deprecation.rst | 3 - changelog/8606.feature.rst | 5 - changelog/8645.deprecation.rst | 4 - changelog/8655.doc.rst | 1 - changelog/8733.breaking.rst | 5 - changelog/8761.feature.rst | 1 - changelog/8789.feature.rst | 1 - changelog/8796.bugfix.rst | 1 - changelog/8803.improvement.rst | 9 - changelog/8818.trivial.rst | 1 - changelog/8822.improvement.rst | 1 - changelog/8898.improvement.rst | 1 - changelog/8913.trivial.rst | 1 - changelog/8920.feature.rst | 2 - changelog/8948.deprecation.rst | 5 - changelog/8953.feature.rst | 2 - changelog/8954.feature.rst | 1 - changelog/8967.trivial.rst | 2 - changelog/8983.bugfix.rst | 2 - changelog/8990.bugfix.rst | 1 - changelog/9023.feature.rst | 4 - changelog/9061.breaking.rst | 15 - changelog/9062.improvement.rst | 1 - changelog/9077.bugfix.rst | 1 - changelog/9113.feature.rst | 2 - changelog/9114.feature.rst | 1 - changelog/9131.bugfix.rst | 1 - changelog/9163.bugfix.rst | 1 - changelog/9169.bugfix.rst | 1 - changelog/9202.trivial.rst | 1 - changelog/9205.improvement.rst | 1 - changelog/9210.doc.rst | 1 - changelog/9225.trivial.rst | 1 - changelog/9242.doc.rst | 1 - changelog/9272.bugfix.rst | 2 - changelog/9277.breaking.rst | 3 - changelog/9308.breaking.rst | 22 -- changelog/9341.doc.rst | 1 - changelog/9351.trivial.rst | 1 - doc/en/announce/index.rst | 1 + doc/en/announce/release-7.0.0rc1.rst | 74 ++++ doc/en/builtin.rst | 70 ++-- doc/en/changelog.rst | 476 ++++++++++++++++++++++++ doc/en/example/markers.rst | 34 +- doc/en/example/nonpython.rst | 8 +- doc/en/example/parametrize.rst | 35 +- doc/en/example/pythoncollection.rst | 17 +- doc/en/example/reportingdemo.rst | 3 +- doc/en/example/simple.rst | 32 +- doc/en/getting-started.rst | 5 +- doc/en/how-to/assert.rst | 6 +- doc/en/how-to/cache.rst | 12 +- doc/en/how-to/capture-stdout-stderr.rst | 3 +- doc/en/how-to/capture-warnings.rst | 3 +- doc/en/how-to/doctest.rst | 6 +- doc/en/how-to/fixtures.rst | 12 +- doc/en/how-to/output.rst | 9 +- doc/en/how-to/parametrize.rst | 6 +- doc/en/how-to/tmp_path.rst | 3 +- doc/en/how-to/unittest.rst | 3 +- doc/en/how-to/writing_plugins.rst | 3 +- doc/en/index.rst | 3 +- doc/en/reference/reference.rst | 1 + 103 files changed, 666 insertions(+), 448 deletions(-) delete mode 100644 changelog/4320.doc.rst delete mode 100644 changelog/5105.doc.rst delete mode 100644 changelog/5196.feature.rst delete mode 100644 changelog/7124.bugfix.rst delete mode 100644 changelog/7132.feature.rst delete mode 100644 changelog/7259.breaking.rst delete mode 100644 changelog/7259.deprecation.rst delete mode 100644 changelog/7259.feature.rst delete mode 100644 changelog/7469.deprecation.rst delete mode 100644 changelog/7469.feature.rst delete mode 100644 changelog/7480.improvement.rst delete mode 100644 changelog/7856.feature.rst delete mode 100644 changelog/7864.improvement.rst delete mode 100644 changelog/8061.bugfix.rst delete mode 100644 changelog/8133.trivial.rst delete mode 100644 changelog/8144.feature.rst delete mode 100644 changelog/8174.trivial.rst delete mode 100644 changelog/8192.bugfix.rst delete mode 100644 changelog/8242.deprecation.rst delete mode 100644 changelog/8246.breaking.rst delete mode 100644 changelog/8248.trivial.rst delete mode 100644 changelog/8251.feature.rst delete mode 100644 changelog/8258.bugfix.rst delete mode 100644 changelog/8315.deprecation.rst delete mode 100644 changelog/8317.bugfix.rst delete mode 100644 changelog/8335.improvement.rst delete mode 100644 changelog/8337.doc.rst delete mode 100644 changelog/8367.bugfix.rst delete mode 100644 changelog/8377.bugfix.rst delete mode 100644 changelog/8384.bugfix.rst delete mode 100644 changelog/8394.bugfix.rst delete mode 100644 changelog/8403.improvement.rst delete mode 100644 changelog/8421.feature.rst delete mode 100644 changelog/8432.trivial.rst delete mode 100644 changelog/8447.deprecation.rst delete mode 100644 changelog/8456.bugfix.rst delete mode 100644 changelog/8464.bugfix.rst delete mode 100644 changelog/8503.bugfix.rst delete mode 100644 changelog/8509.improvement.rst delete mode 100644 changelog/8548.bugfix.rst delete mode 100644 changelog/8592.deprecation.rst delete mode 100644 changelog/8606.feature.rst delete mode 100644 changelog/8645.deprecation.rst delete mode 100644 changelog/8655.doc.rst delete mode 100644 changelog/8733.breaking.rst delete mode 100644 changelog/8761.feature.rst delete mode 100644 changelog/8789.feature.rst delete mode 100644 changelog/8796.bugfix.rst delete mode 100644 changelog/8803.improvement.rst delete mode 100644 changelog/8818.trivial.rst delete mode 100644 changelog/8822.improvement.rst delete mode 100644 changelog/8898.improvement.rst delete mode 100644 changelog/8913.trivial.rst delete mode 100644 changelog/8920.feature.rst delete mode 100644 changelog/8948.deprecation.rst delete mode 100644 changelog/8953.feature.rst delete mode 100644 changelog/8954.feature.rst delete mode 100644 changelog/8967.trivial.rst delete mode 100644 changelog/8983.bugfix.rst delete mode 100644 changelog/8990.bugfix.rst delete mode 100644 changelog/9023.feature.rst delete mode 100644 changelog/9061.breaking.rst delete mode 100644 changelog/9062.improvement.rst delete mode 100644 changelog/9077.bugfix.rst delete mode 100644 changelog/9113.feature.rst delete mode 100644 changelog/9114.feature.rst delete mode 100644 changelog/9131.bugfix.rst delete mode 100644 changelog/9163.bugfix.rst delete mode 100644 changelog/9169.bugfix.rst delete mode 100644 changelog/9202.trivial.rst delete mode 100644 changelog/9205.improvement.rst delete mode 100644 changelog/9210.doc.rst delete mode 100644 changelog/9225.trivial.rst delete mode 100644 changelog/9242.doc.rst delete mode 100644 changelog/9272.bugfix.rst delete mode 100644 changelog/9277.breaking.rst delete mode 100644 changelog/9308.breaking.rst delete mode 100644 changelog/9341.doc.rst delete mode 100644 changelog/9351.trivial.rst create mode 100644 doc/en/announce/release-7.0.0rc1.rst diff --git a/changelog/4320.doc.rst b/changelog/4320.doc.rst deleted file mode 100644 index 70a4a743f36..00000000000 --- a/changelog/4320.doc.rst +++ /dev/null @@ -1 +0,0 @@ -Improved docs for `pytester.copy_example`. diff --git a/changelog/5105.doc.rst b/changelog/5105.doc.rst deleted file mode 100644 index 71c1edc9fc4..00000000000 --- a/changelog/5105.doc.rst +++ /dev/null @@ -1 +0,0 @@ -Add automatically generated :ref:`plugin-list`. The list is updated on a periodic schedule. diff --git a/changelog/5196.feature.rst b/changelog/5196.feature.rst deleted file mode 100644 index 5e6312b482d..00000000000 --- a/changelog/5196.feature.rst +++ /dev/null @@ -1,3 +0,0 @@ -Tests are now ordered by definition order in more cases. - -In a class hierarchy, tests from base classes are now consistently ordered before tests defined on their subclasses (reverse MRO order). diff --git a/changelog/7124.bugfix.rst b/changelog/7124.bugfix.rst deleted file mode 100644 index 191925d7a24..00000000000 --- a/changelog/7124.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed an issue where ``__main__.py`` would raise an ``ImportError`` when ``--doctest-modules`` was provided. diff --git a/changelog/7132.feature.rst b/changelog/7132.feature.rst deleted file mode 100644 index 9fb735ee153..00000000000 --- a/changelog/7132.feature.rst +++ /dev/null @@ -1 +0,0 @@ -Added two environment variables :envvar:`PYTEST_THEME` and :envvar:`PYTEST_THEME_MODE` to let the users customize the pygments theme used. diff --git a/changelog/7259.breaking.rst b/changelog/7259.breaking.rst deleted file mode 100644 index 48ecbcbb730..00000000000 --- a/changelog/7259.breaking.rst +++ /dev/null @@ -1,9 +0,0 @@ -The :ref:`Node.reportinfo() ` function first return value type has been expanded from `py.path.local | str` to `os.PathLike[str] | str`. - -Most plugins which refer to `reportinfo()` only define it as part of a custom :class:`pytest.Item` implementation. -Since `py.path.local` is a `os.PathLike[str]`, these plugins are unaffacted. - -Plugins and users which call `reportinfo()`, use the first return value and interact with it as a `py.path.local`, would need to adjust by calling `py.path.local(fspath)`. -Although preferably, avoid the legacy `py.path.local` and use `pathlib.Path`, or use `item.location` or `item.path`, instead. - -Note: pytest was not able to provide a deprecation period for this change. diff --git a/changelog/7259.deprecation.rst b/changelog/7259.deprecation.rst deleted file mode 100644 index ae857c0d826..00000000000 --- a/changelog/7259.deprecation.rst +++ /dev/null @@ -1,12 +0,0 @@ -``py.path.local`` arguments for hooks have been deprecated. See :ref:`the deprecation note ` for full details. - -``py.path.local`` arguments to Node constructors have been deprecated. See :ref:`the deprecation note ` for full details. - -.. note:: - The name of the :class:`~_pytest.nodes.Node` arguments and attributes (the - new attribute being ``path``) is **the opposite** of the situation for hooks - (the old argument being ``path``). - - This is an unfortunate artifact due to historical reasons, which should be - resolved in future versions as we slowly get rid of the :pypi:`py` - dependency (see :issue:`9283` for a longer discussion). diff --git a/changelog/7259.feature.rst b/changelog/7259.feature.rst deleted file mode 100644 index dd03b48969d..00000000000 --- a/changelog/7259.feature.rst +++ /dev/null @@ -1,7 +0,0 @@ -Added :meth:`cache.mkdir() `, which is similar to the existing :meth:`cache.makedir() `, -but returns a :class:`pathlib.Path` instead of a legacy ``py.path.local``. - -Added a ``paths`` type to :meth:`parser.addini() `, -as in ``parser.addini("mypaths", "my paths", type="paths")``, -which is similar to the existing ``pathlist``, -but returns a list of :class:`pathlib.Path` instead of legacy ``py.path.local``. diff --git a/changelog/7469.deprecation.rst b/changelog/7469.deprecation.rst deleted file mode 100644 index ea8c7c0b4f9..00000000000 --- a/changelog/7469.deprecation.rst +++ /dev/null @@ -1,13 +0,0 @@ -Directly constructing the following classes is now deprecated: - -- ``_pytest.mark.structures.Mark`` -- ``_pytest.mark.structures.MarkDecorator`` -- ``_pytest.mark.structures.MarkGenerator`` -- ``_pytest.python.Metafunc`` -- ``_pytest.runner.CallInfo`` -- ``_pytest._code.ExceptionInfo`` -- ``_pytest.config.argparsing.Parser`` -- ``_pytest.config.argparsing.OptionGroup`` -- ``_pytest.pytester.HookRecorder`` - -These constructors have always been considered private, but now issue a deprecation warning, which may become a hard error in pytest 8. diff --git a/changelog/7469.feature.rst b/changelog/7469.feature.rst deleted file mode 100644 index 4694e97e9d9..00000000000 --- a/changelog/7469.feature.rst +++ /dev/null @@ -1,25 +0,0 @@ -The types of objects used in pytest's API are now exported so they may be used in type annotations. - -The newly-exported types are: - -- ``pytest.Config`` for :class:`Config `. -- ``pytest.Mark`` for :class:`marks `. -- ``pytest.MarkDecorator`` for :class:`mark decorators `. -- ``pytest.MarkGenerator`` for the :class:`pytest.mark ` singleton. -- ``pytest.Metafunc`` for the :class:`metafunc ` argument to the :func:`pytest_generate_tests ` hook. -- ``pytest.CallInfo`` for the :class:`CallInfo ` type passed to various hooks. -- ``pytest.PytestPluginManager`` for :class:`PytestPluginManager `. -- ``pytest.ExceptionInfo`` for the :class:`ExceptionInfo ` type returned from :func:`pytest.raises` and passed to various hooks. -- ``pytest.Parser`` for the :class:`Parser ` type passed to the :func:`pytest_addoption ` hook. -- ``pytest.OptionGroup`` for the :class:`OptionGroup ` type returned from the :func:`parser.addgroup ` method. -- ``pytest.HookRecorder`` for the :class:`HookRecorder ` type returned from :class:`~pytest.Pytester`. -- ``pytest.RecordedHookCall`` for the :class:`RecordedHookCall ` type returned from :class:`~pytest.HookRecorder`. -- ``pytest.RunResult`` for the :class:`RunResult ` type returned from :class:`~pytest.Pytester`. -- ``pytest.LineMatcher`` for the :class:`LineMatcher ` type used in :class:`~pytest.RunResult` and others. -- ``pytest.TestReport`` for the :class:`TestReport ` type used in various hooks. -- ``pytest.CollectReport`` for the :class:`CollectReport ` type used in various hooks. - -Constructing most of them directly is not supported; they are only meant for use in type annotations. -Doing so will emit a deprecation warning, and may become a hard-error in pytest 8.0. - -Subclassing them is also not supported. This is not currently enforced at runtime, but is detected by type-checkers such as mypy. diff --git a/changelog/7480.improvement.rst b/changelog/7480.improvement.rst deleted file mode 100644 index 296e6e7fb54..00000000000 --- a/changelog/7480.improvement.rst +++ /dev/null @@ -1,5 +0,0 @@ -A deprecation scheduled to be removed in a major version X (e.g. pytest 7, 8, 9, ...) now uses warning category `PytestRemovedInXWarning`, -a subclass of :class:`~pytest.PytestDeprecationWarning`, -instead of :class:`PytestDeprecationWarning` directly. - -See :ref:`backwards-compatibility` for more details. diff --git a/changelog/7856.feature.rst b/changelog/7856.feature.rst deleted file mode 100644 index 22ed4c83bc3..00000000000 --- a/changelog/7856.feature.rst +++ /dev/null @@ -1,2 +0,0 @@ -:ref:`--import-mode=importlib ` now works with features that -depend on modules being on :py:data:`sys.modules`, such as :mod:`pickle` and :mod:`dataclasses`. diff --git a/changelog/7864.improvement.rst b/changelog/7864.improvement.rst deleted file mode 100644 index 195632346fe..00000000000 --- a/changelog/7864.improvement.rst +++ /dev/null @@ -1,4 +0,0 @@ -Improved error messages when parsing warning filters. - -Previously pytest would show an internal traceback, which besides being ugly sometimes would hide the cause -of the problem (for example an ``ImportError`` while importing a specific warning type). diff --git a/changelog/8061.bugfix.rst b/changelog/8061.bugfix.rst deleted file mode 100644 index 5686af66321..00000000000 --- a/changelog/8061.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed failing ``staticmethod`` test cases if they are inherited from a parent test class. diff --git a/changelog/8133.trivial.rst b/changelog/8133.trivial.rst deleted file mode 100644 index 7ceaae59765..00000000000 --- a/changelog/8133.trivial.rst +++ /dev/null @@ -1 +0,0 @@ -Migrate to ``setuptools_scm`` 6.x to use ``SETUPTOOLS_SCM_PRETEND_VERSION_FOR_PYTEST`` for more robust release tooling. diff --git a/changelog/8144.feature.rst b/changelog/8144.feature.rst deleted file mode 100644 index fe576eeffa8..00000000000 --- a/changelog/8144.feature.rst +++ /dev/null @@ -1,16 +0,0 @@ -The following hooks now receive an additional ``pathlib.Path`` argument, equivalent to an existing ``py.path.local`` argument: - -- :func:`pytest_ignore_collect <_pytest.hookspec.pytest_ignore_collect>` - The ``collection_path`` parameter (equivalent to existing ``path`` parameter). -- :func:`pytest_collect_file <_pytest.hookspec.pytest_collect_file>` - The ``file_path`` parameter (equivalent to existing ``path`` parameter). -- :func:`pytest_pycollect_makemodule <_pytest.hookspec.pytest_pycollect_makemodule>` - The ``module_path`` parameter (equivalent to existing ``path`` parameter). -- :func:`pytest_report_header <_pytest.hookspec.pytest_report_header>` - The ``start_path`` parameter (equivalent to existing ``startdir`` parameter). -- :func:`pytest_report_collectionfinish <_pytest.hookspec.pytest_report_collectionfinish>` - The ``start_path`` parameter (equivalent to existing ``startdir`` parameter). - -.. note:: - The name of the :class:`~_pytest.nodes.Node` arguments and attributes (the - new attribute being ``path``) is **the opposite** of the situation for hooks - (the old argument being ``path``). - - This is an unfortunate artifact due to historical reasons, which should be - resolved in future versions as we slowly get rid of the :pypi:`py` - dependency (see :issue:`9283` for a longer discussion). diff --git a/changelog/8174.trivial.rst b/changelog/8174.trivial.rst deleted file mode 100644 index 7649764618f..00000000000 --- a/changelog/8174.trivial.rst +++ /dev/null @@ -1,6 +0,0 @@ -The following changes have been made to internal pytest types/functions: - -- The ``path`` property of ``_pytest.code.Code`` returns ``Path`` instead of ``py.path.local``. -- The ``path`` property of ``_pytest.code.TracebackEntry`` returns ``Path`` instead of ``py.path.local``. -- The ``_pytest.code.getfslineno()`` function returns ``Path`` instead of ``py.path.local``. -- The ``_pytest.python.path_matches_patterns()`` function takes ``Path`` instead of ``py.path.local``. diff --git a/changelog/8192.bugfix.rst b/changelog/8192.bugfix.rst deleted file mode 100644 index 8920b200a21..00000000000 --- a/changelog/8192.bugfix.rst +++ /dev/null @@ -1,3 +0,0 @@ -``testdir.makefile`` now silently accepts values which don't start with ``.`` to maintain backward compatibility with older pytest versions. - -``pytester.makefile`` now issues a clearer error if the ``.`` is missing in the ``ext`` argument. diff --git a/changelog/8242.deprecation.rst b/changelog/8242.deprecation.rst deleted file mode 100644 index 3875c5867e3..00000000000 --- a/changelog/8242.deprecation.rst +++ /dev/null @@ -1,7 +0,0 @@ -Raising :class:`unittest.SkipTest` to skip collection of tests during the -pytest collection phase is deprecated. Use :func:`pytest.skip` instead. - -Note: This deprecation only relates to using :class:`unittest.SkipTest` during test -collection. You are probably not doing that. Ordinary usage of -:class:`unittest.SkipTest` / :meth:`unittest.TestCase.skipTest` / -:func:`unittest.skip` in unittest test cases is fully supported. diff --git a/changelog/8246.breaking.rst b/changelog/8246.breaking.rst deleted file mode 100644 index ba9e5c8beea..00000000000 --- a/changelog/8246.breaking.rst +++ /dev/null @@ -1 +0,0 @@ -``--version`` now writes version information to ``stdout`` rather than ``stderr``. diff --git a/changelog/8248.trivial.rst b/changelog/8248.trivial.rst deleted file mode 100644 index 3044071fa81..00000000000 --- a/changelog/8248.trivial.rst +++ /dev/null @@ -1 +0,0 @@ -Internal Restructure: let ``python.PyObjMixin`` inherit from ``nodes.Node`` to carry over typing information. diff --git a/changelog/8251.feature.rst b/changelog/8251.feature.rst deleted file mode 100644 index fe157cc98b7..00000000000 --- a/changelog/8251.feature.rst +++ /dev/null @@ -1,11 +0,0 @@ -Implement ``Node.path`` as a ``pathlib.Path``. Both the old ``fspath`` and this new attribute gets set no matter whether ``path`` or ``fspath`` (deprecated) is passed to the constructor. It is a replacement for the ``fspath`` attribute (which represents the same path as ``py.path.local``). While ``fspath`` is not deprecated yet -due to the ongoing migration of methods like :meth:`~_pytest.Item.reportinfo`, we expect to deprecate it in a future release. - -.. note:: - The name of the :class:`~_pytest.nodes.Node` arguments and attributes (the - new attribute being ``path``) is **the opposite** of the situation for hooks - (the old argument being ``path``). - - This is an unfortunate artifact due to historical reasons, which should be - resolved in future versions as we slowly get rid of the :pypi:`py` - dependency (see :issue:`9283` for a longer discussion). diff --git a/changelog/8258.bugfix.rst b/changelog/8258.bugfix.rst deleted file mode 100644 index 6518ec0b738..00000000000 --- a/changelog/8258.bugfix.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fixed issue where pytest's ``faulthandler`` support would not dump traceback on crashes -if the :mod:`faulthandler` module was already enabled during pytest startup (using -``python -X dev -m pytest`` for example). diff --git a/changelog/8315.deprecation.rst b/changelog/8315.deprecation.rst deleted file mode 100644 index b204dcedd9b..00000000000 --- a/changelog/8315.deprecation.rst +++ /dev/null @@ -1,5 +0,0 @@ -Several behaviors of :meth:`Parser.addoption ` are now -scheduled for removal in pytest 8 (deprecated since pytest 2.4.0): - -- ``parser.addoption(..., help=".. %default ..")`` - use ``%(default)s`` instead. -- ``parser.addoption(..., type="int/string/float/complex")`` - use ``type=int`` etc. instead. diff --git a/changelog/8317.bugfix.rst b/changelog/8317.bugfix.rst deleted file mode 100644 index 7312880a11f..00000000000 --- a/changelog/8317.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed an issue where illegal directory characters derived from ``getpass.getuser()`` raised an ``OSError``. diff --git a/changelog/8335.improvement.rst b/changelog/8335.improvement.rst deleted file mode 100644 index f6c0e3343f0..00000000000 --- a/changelog/8335.improvement.rst +++ /dev/null @@ -1,10 +0,0 @@ -Improved :func:`pytest.approx` assertion messages for sequences of numbers. - -The assertion messages now dumps a table with the index and the error of each diff. -Example:: - - > assert [1, 2, 3, 4] == pytest.approx([1, 3, 3, 5]) - E assert comparison failed for 2 values: - E Index | Obtained | Expected - E 1 | 2 | 3 +- 3.0e-06 - E 3 | 4 | 5 +- 5.0e-06 diff --git a/changelog/8337.doc.rst b/changelog/8337.doc.rst deleted file mode 100644 index f2483a6b481..00000000000 --- a/changelog/8337.doc.rst +++ /dev/null @@ -1 +0,0 @@ -Recommend `numpy.testing `__ module on :func:`pytest.approx` documentation. diff --git a/changelog/8367.bugfix.rst b/changelog/8367.bugfix.rst deleted file mode 100644 index f4b03670108..00000000000 --- a/changelog/8367.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fix ``Class.from_parent`` so it forwards extra keyword arguments to the constructor. diff --git a/changelog/8377.bugfix.rst b/changelog/8377.bugfix.rst deleted file mode 100644 index 3df54a949af..00000000000 --- a/changelog/8377.bugfix.rst +++ /dev/null @@ -1,2 +0,0 @@ -The test selection options ``pytest -k`` and ``pytest -m`` now support matching -names containing forward slash (``/``) characters. diff --git a/changelog/8384.bugfix.rst b/changelog/8384.bugfix.rst deleted file mode 100644 index 3b70987490e..00000000000 --- a/changelog/8384.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -The ``@pytest.mark.skip`` decorator now correctly handles its arguments. When the ``reason`` argument is accidentally given both positional and as a keyword (e.g. because it was confused with ``skipif``), a ``TypeError`` now occurs. Before, such tests were silently skipped, and the positional argument ignored. Additionally, ``reason`` is now documented correctly as positional or keyword (rather than keyword-only). diff --git a/changelog/8394.bugfix.rst b/changelog/8394.bugfix.rst deleted file mode 100644 index a0fb5bb71fd..00000000000 --- a/changelog/8394.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Use private names for internal fixtures that handle classic setup/teardown so that they don't show up with the default ``--fixtures`` invocation (but they still show up with ``--fixtures -v``). diff --git a/changelog/8403.improvement.rst b/changelog/8403.improvement.rst deleted file mode 100644 index ec392245f67..00000000000 --- a/changelog/8403.improvement.rst +++ /dev/null @@ -1,5 +0,0 @@ -By default, pytest will truncate long strings in assert errors so they don't clutter the output too much, -currently at ``240`` characters by default. - -However, in some cases the longer output helps, or is even crucial, to diagnose a failure. Using ``-v`` will -now increase the truncation threshold to ``2400`` characters, and ``-vv`` or higher will disable truncation entirely. diff --git a/changelog/8421.feature.rst b/changelog/8421.feature.rst deleted file mode 100644 index c729ca3950a..00000000000 --- a/changelog/8421.feature.rst +++ /dev/null @@ -1 +0,0 @@ -:func:`pytest.approx` now works on :class:`~decimal.Decimal` within mappings/dicts and sequences/lists. diff --git a/changelog/8432.trivial.rst b/changelog/8432.trivial.rst deleted file mode 100644 index af4c7a22617..00000000000 --- a/changelog/8432.trivial.rst +++ /dev/null @@ -1 +0,0 @@ -Improve error message when :func:`pytest.skip` is used at module level without passing `allow_module_level=True`. diff --git a/changelog/8447.deprecation.rst b/changelog/8447.deprecation.rst deleted file mode 100644 index 8386e3b7480..00000000000 --- a/changelog/8447.deprecation.rst +++ /dev/null @@ -1,4 +0,0 @@ -Defining a custom pytest node type which is both an :class:`pytest.Item ` and a :class:`pytest.Collector ` (e.g. :class:`pytest.File `) now issues a warning. -It was never sanely supported and triggers hard to debug errors. - -See :ref:`the deprecation note ` for full details. diff --git a/changelog/8456.bugfix.rst b/changelog/8456.bugfix.rst deleted file mode 100644 index da9370b7b1b..00000000000 --- a/changelog/8456.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -The :confval:`required_plugins` config option now works correctly when pre-releases of plugins are installed, rather than falsely claiming that those plugins aren't installed at all. diff --git a/changelog/8464.bugfix.rst b/changelog/8464.bugfix.rst deleted file mode 100644 index 017c4c078fb..00000000000 --- a/changelog/8464.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -``-c `` now also properly defines ``rootdir`` as the directory that contains ````. diff --git a/changelog/8503.bugfix.rst b/changelog/8503.bugfix.rst deleted file mode 100644 index 26f660bbf3f..00000000000 --- a/changelog/8503.bugfix.rst +++ /dev/null @@ -1,4 +0,0 @@ -:meth:`pytest.MonkeyPatch.syspath_prepend` no longer fails when -``setuptools`` is not installed. -It now only calls :func:`pkg_resources.fixup_namespace_packages` if -``pkg_resources`` was previously imported, because it is not needed otherwise. diff --git a/changelog/8509.improvement.rst b/changelog/8509.improvement.rst deleted file mode 100644 index 982888c1fea..00000000000 --- a/changelog/8509.improvement.rst +++ /dev/null @@ -1,5 +0,0 @@ -Fixed issue where :meth:`unittest.TestCase.setUpClass` is not called when a test has `/` in its name since pytest 6.2.0. - -This refers to the path part in pytest node IDs, e.g. ``TestClass::test_it`` in the node ID ``tests/test_file.py::TestClass::test_it``. - -Now, instead of assuming that the test name does not contain ``/``, it is assumed that test path does not contain ``::``. We plan to hopefully make both of these work in the future. diff --git a/changelog/8548.bugfix.rst b/changelog/8548.bugfix.rst deleted file mode 100644 index 9201169fc0b..00000000000 --- a/changelog/8548.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Introduce fix to handle precision width in ``log-cli-format`` in turn to fix output coloring for certain formats. diff --git a/changelog/8592.deprecation.rst b/changelog/8592.deprecation.rst deleted file mode 100644 index 733ad3586e5..00000000000 --- a/changelog/8592.deprecation.rst +++ /dev/null @@ -1,3 +0,0 @@ -:func:`pytest_cmdline_preparse <_pytest.hookspec.pytest_cmdline_preparse>` has been officially deprecated. It will be removed in a future release. Use :func:`pytest_load_initial_conftests <_pytest.hookspec.pytest_load_initial_conftests>` instead. - -See :ref:`the deprecation note ` for full details. diff --git a/changelog/8606.feature.rst b/changelog/8606.feature.rst deleted file mode 100644 index d918ecd1ec1..00000000000 --- a/changelog/8606.feature.rst +++ /dev/null @@ -1,5 +0,0 @@ -pytest invocations with ``--fixtures-per-test`` and ``--fixtures`` have been enriched with: - -- Fixture location path printed with the fixture name. -- First section of the fixture's docstring printed under the fixture name. -- Whole of fixture's docstring printed under the fixture name using ``--verbose`` option. diff --git a/changelog/8645.deprecation.rst b/changelog/8645.deprecation.rst deleted file mode 100644 index 722a5d764de..00000000000 --- a/changelog/8645.deprecation.rst +++ /dev/null @@ -1,4 +0,0 @@ -:func:`pytest.warns(None) ` is now deprecated because many people used -it to mean "this code does not emit warnings", but it actually had the effect of -checking that the code emits at least one warning of any type - like ``pytest.warns()`` -or ``pytest.warns(Warning)``. diff --git a/changelog/8655.doc.rst b/changelog/8655.doc.rst deleted file mode 100644 index 65051a74319..00000000000 --- a/changelog/8655.doc.rst +++ /dev/null @@ -1 +0,0 @@ -Help text for ``--pdbcls`` more accurately reflects the option's behavior. diff --git a/changelog/8733.breaking.rst b/changelog/8733.breaking.rst deleted file mode 100644 index fa2a43ac655..00000000000 --- a/changelog/8733.breaking.rst +++ /dev/null @@ -1,5 +0,0 @@ -Drop a workaround for `pyreadline `__ that made it work with ``--pdb``. - -The workaround was introduced in `#1281 `__ in 2015, however since then -`pyreadline seems to have gone unmaintained `__, is `generating -warnings `__, and will stop working on Python 3.10. diff --git a/changelog/8761.feature.rst b/changelog/8761.feature.rst deleted file mode 100644 index 88288c81002..00000000000 --- a/changelog/8761.feature.rst +++ /dev/null @@ -1 +0,0 @@ -New :ref:`version-tuple` attribute, which makes it simpler for users to do something depending on the pytest version (such as declaring hooks which are introduced in later versions). diff --git a/changelog/8789.feature.rst b/changelog/8789.feature.rst deleted file mode 100644 index 23215c97ef2..00000000000 --- a/changelog/8789.feature.rst +++ /dev/null @@ -1 +0,0 @@ -Switch TOML parser from ``toml`` to ``tomli`` for TOML v1.0.0 support in ``pyproject.toml``. diff --git a/changelog/8796.bugfix.rst b/changelog/8796.bugfix.rst deleted file mode 100644 index 1e83f4e2613..00000000000 --- a/changelog/8796.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed internal error when skipping doctests. diff --git a/changelog/8803.improvement.rst b/changelog/8803.improvement.rst deleted file mode 100644 index 1e4db257dfc..00000000000 --- a/changelog/8803.improvement.rst +++ /dev/null @@ -1,9 +0,0 @@ -It is now possible to add colors to custom log levels on cli log. - -By using :func:`add_color_level <_pytest.logging.add_color_level>` from a ``pytest_configure`` hook, colors can be added:: - - logging_plugin = config.pluginmanager.get_plugin('logging-plugin') - logging_plugin.log_cli_handler.formatter.add_color_level(logging.INFO, 'cyan') - logging_plugin.log_cli_handler.formatter.add_color_level(logging.SPAM, 'blue') - -See :ref:`log_colors` for more information. diff --git a/changelog/8818.trivial.rst b/changelog/8818.trivial.rst deleted file mode 100644 index e8c7a24c61b..00000000000 --- a/changelog/8818.trivial.rst +++ /dev/null @@ -1 +0,0 @@ -Ensure ``regendoc`` opts out of ``TOX_ENV`` cachedir selection to ensure independent example test runs. diff --git a/changelog/8822.improvement.rst b/changelog/8822.improvement.rst deleted file mode 100644 index a89bcd6baa7..00000000000 --- a/changelog/8822.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -When showing fixture paths in `--fixtures` or `--fixtures-by-test`, fixtures coming from pytest itself now display an elided path, rather than the full path to the file in the `site-packages` directory. diff --git a/changelog/8898.improvement.rst b/changelog/8898.improvement.rst deleted file mode 100644 index d725157cfc6..00000000000 --- a/changelog/8898.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -Complex numbers are now treated like floats and integers when generating parameterization IDs. diff --git a/changelog/8913.trivial.rst b/changelog/8913.trivial.rst deleted file mode 100644 index 0d971c475a5..00000000000 --- a/changelog/8913.trivial.rst +++ /dev/null @@ -1 +0,0 @@ -The private ``CallSpec2._arg2scopenum`` attribute has been removed after an internal refactoring. diff --git a/changelog/8920.feature.rst b/changelog/8920.feature.rst deleted file mode 100644 index 05bdab6da75..00000000000 --- a/changelog/8920.feature.rst +++ /dev/null @@ -1,2 +0,0 @@ -Added :class:`pytest.Stash`, a facility for plugins to store their data on :class:`~pytest.Config` and :class:`~_pytest.nodes.Node`\s in a type-safe and conflict-free manner. -See :ref:`plugin-stash` for details. diff --git a/changelog/8948.deprecation.rst b/changelog/8948.deprecation.rst deleted file mode 100644 index a39a92bc70e..00000000000 --- a/changelog/8948.deprecation.rst +++ /dev/null @@ -1,5 +0,0 @@ -:func:`pytest.skip(msg=...) `, :func:`pytest.fail(msg=...) ` and :func:`pytest.exit(msg=...) ` -signatures now accept a ``reason`` argument instead of ``msg``. Using ``msg`` still works, but is deprecated and will be removed in a future release. - -This was changed for consistency with :func:`pytest.mark.skip ` and :func:`pytest.mark.xfail ` which both accept -``reason`` as an argument. diff --git a/changelog/8953.feature.rst b/changelog/8953.feature.rst deleted file mode 100644 index aa60fa19ca2..00000000000 --- a/changelog/8953.feature.rst +++ /dev/null @@ -1,2 +0,0 @@ -:class:`RunResult <_pytest.pytester.RunResult>` method :meth:`assert_outcomes <_pytest.pytester.RunResult.assert_outcomes>` now accepts a -``warnings`` argument to assert the total number of warnings captured. diff --git a/changelog/8954.feature.rst b/changelog/8954.feature.rst deleted file mode 100644 index 7edb430075e..00000000000 --- a/changelog/8954.feature.rst +++ /dev/null @@ -1 +0,0 @@ -``--debug`` flag now accepts a :class:`str` file to route debug logs into, remains defaulted to `pytestdebug.log`. diff --git a/changelog/8967.trivial.rst b/changelog/8967.trivial.rst deleted file mode 100644 index d5f773241f5..00000000000 --- a/changelog/8967.trivial.rst +++ /dev/null @@ -1,2 +0,0 @@ -:func:`pytest_assertion_pass <_pytest.hookspec.pytest_assertion_pass>` is no longer considered experimental and -future changes to it will be considered more carefully. diff --git a/changelog/8983.bugfix.rst b/changelog/8983.bugfix.rst deleted file mode 100644 index 403d421d6bd..00000000000 --- a/changelog/8983.bugfix.rst +++ /dev/null @@ -1,2 +0,0 @@ -The test selection options ``pytest -k`` and ``pytest -m`` now support matching names containing backslash (`\\`) characters. -Backslashes are treated literally, not as escape characters (the values being matched against are already escaped). diff --git a/changelog/8990.bugfix.rst b/changelog/8990.bugfix.rst deleted file mode 100644 index ab63eb9a75e..00000000000 --- a/changelog/8990.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fix `pytest -vv` crashing with an internal exception `AttributeError: 'str' object has no attribute 'relative_to'` in some cases. diff --git a/changelog/9023.feature.rst b/changelog/9023.feature.rst deleted file mode 100644 index 86a819a84e0..00000000000 --- a/changelog/9023.feature.rst +++ /dev/null @@ -1,4 +0,0 @@ - -Full diffs are now always shown for equality assertions of iterables when -`CI` or ``BUILD_NUMBER`` is found in the environment, even when ``-v`` isn't -used. diff --git a/changelog/9061.breaking.rst b/changelog/9061.breaking.rst deleted file mode 100644 index bf639e13214..00000000000 --- a/changelog/9061.breaking.rst +++ /dev/null @@ -1,15 +0,0 @@ -Using :func:`pytest.approx` in a boolean context now raises an error hinting at the proper usage. - -It is apparently common for users to mistakenly use ``pytest.approx`` like this: - -.. code-block:: python - - assert pytest.approx(actual, expected) - -While the correct usage is: - -.. code-block:: python - - assert actual == pytest.approx(expected) - -The new error message helps catch those mistakes. diff --git a/changelog/9062.improvement.rst b/changelog/9062.improvement.rst deleted file mode 100644 index bfc7cf00a46..00000000000 --- a/changelog/9062.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -``--stepwise-skip`` now implicitly enables ``--stepwise`` and can be used on its own. diff --git a/changelog/9077.bugfix.rst b/changelog/9077.bugfix.rst deleted file mode 100644 index fcee5d385df..00000000000 --- a/changelog/9077.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed confusing error message when ``request.fspath`` / ``request.path`` was accessed from a session-scoped fixture. diff --git a/changelog/9113.feature.rst b/changelog/9113.feature.rst deleted file mode 100644 index f16e6ea63fd..00000000000 --- a/changelog/9113.feature.rst +++ /dev/null @@ -1,2 +0,0 @@ -:class:`RunResult <_pytest.pytester.RunResult>` method :meth:`assert_outcomes <_pytest.pytester.RunResult.assert_outcomes>` now accepts a -``deselected`` argument to assert the total number of deselected tests. diff --git a/changelog/9114.feature.rst b/changelog/9114.feature.rst deleted file mode 100644 index 0a576c3b735..00000000000 --- a/changelog/9114.feature.rst +++ /dev/null @@ -1 +0,0 @@ -Added :confval:`pythonpath` setting that adds listed paths to :data:`sys.path` for the duration of the test session. If you currently use the pytest-pythonpath or pytest-srcpaths plugins, you should be able to replace them with built-in `pythonpath` setting. diff --git a/changelog/9131.bugfix.rst b/changelog/9131.bugfix.rst deleted file mode 100644 index 837bb596db5..00000000000 --- a/changelog/9131.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed the URL used by ``--pastebin`` to use `bpa.st `__. diff --git a/changelog/9163.bugfix.rst b/changelog/9163.bugfix.rst deleted file mode 100644 index fb559d10fe8..00000000000 --- a/changelog/9163.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -The end line number and end column offset are now properly set for rewritten assert statements. diff --git a/changelog/9169.bugfix.rst b/changelog/9169.bugfix.rst deleted file mode 100644 index 83fce0a3893..00000000000 --- a/changelog/9169.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Support for the ``files`` API from ``importlib.resources`` within rewritten files. diff --git a/changelog/9202.trivial.rst b/changelog/9202.trivial.rst deleted file mode 100644 index 916d75074b9..00000000000 --- a/changelog/9202.trivial.rst +++ /dev/null @@ -1 +0,0 @@ -Add github action to upload coverage report to codecov instead of bash uploader. diff --git a/changelog/9205.improvement.rst b/changelog/9205.improvement.rst deleted file mode 100644 index edfc3008965..00000000000 --- a/changelog/9205.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -:meth:`pytest.Cache.set` now preserves key order when saving dicts. diff --git a/changelog/9210.doc.rst b/changelog/9210.doc.rst deleted file mode 100644 index 02a850c08c4..00000000000 --- a/changelog/9210.doc.rst +++ /dev/null @@ -1 +0,0 @@ -Remove incorrect docs about ``confcutdir`` being a configuration option: it can only be set through the ``--confcutdir`` command-line option. diff --git a/changelog/9225.trivial.rst b/changelog/9225.trivial.rst deleted file mode 100644 index 979f7fd0ce3..00000000000 --- a/changelog/9225.trivial.rst +++ /dev/null @@ -1 +0,0 @@ -Changed the command used to create sdist and wheel artifacts: using the build package instead of setup.py. diff --git a/changelog/9242.doc.rst b/changelog/9242.doc.rst deleted file mode 100644 index ef2afc744bf..00000000000 --- a/changelog/9242.doc.rst +++ /dev/null @@ -1 +0,0 @@ -Upgrade readthedocs configuration to use a `newer Ubuntu version `__` with better unicode support for PDF docs. diff --git a/changelog/9272.bugfix.rst b/changelog/9272.bugfix.rst deleted file mode 100644 index 0f242d40891..00000000000 --- a/changelog/9272.bugfix.rst +++ /dev/null @@ -1,2 +0,0 @@ -The nose compatibility module-level fixtures `setup()` and `teardown()` are now only called once per module, instead of for each test function. -They are now called even if object-level `setup`/`teardown` is defined. diff --git a/changelog/9277.breaking.rst b/changelog/9277.breaking.rst deleted file mode 100644 index 0296dcd7c99..00000000000 --- a/changelog/9277.breaking.rst +++ /dev/null @@ -1,3 +0,0 @@ -The ``pytest.Instance`` collector type has been removed. -Importing ``pytest.Instance`` or ``_pytest.python.Instance`` returns a dummy type and emits a deprecation warning. -See :ref:`instance-collector-deprecation` for details. diff --git a/changelog/9308.breaking.rst b/changelog/9308.breaking.rst deleted file mode 100644 index b03a854aa2f..00000000000 --- a/changelog/9308.breaking.rst +++ /dev/null @@ -1,22 +0,0 @@ -**PytestRemovedIn7Warning deprecation warnings are now errors by default.** - -Following our plan to remove deprecated features with as little disruption as -possible, all warnings of type ``PytestRemovedIn7Warning`` now generate errors -instead of warning messages by default. - -**The affected features will be effectively removed in pytest 7.1**, so please consult the -:ref:`deprecations` section in the docs for directions on how to update existing code. - -In the pytest ``7.0.X`` series, it is possible to change the errors back into warnings as a -stopgap measure by adding this to your ``pytest.ini`` file: - -.. code-block:: ini - - [pytest] - filterwarnings = - ignore::pytest.PytestRemovedIn7Warning - -But this will stop working when pytest ``7.1`` is released. - -**If you have concerns** about the removal of a specific feature, please add a -comment to :issue:`9308`. diff --git a/changelog/9341.doc.rst b/changelog/9341.doc.rst deleted file mode 100644 index 1b97a581247..00000000000 --- a/changelog/9341.doc.rst +++ /dev/null @@ -1 +0,0 @@ -Various methods commonly used for :ref:`non-python tests` are now correctly documented in the reference docs. They were undocumented previously. diff --git a/changelog/9351.trivial.rst b/changelog/9351.trivial.rst deleted file mode 100644 index 4fd8ac82704..00000000000 --- a/changelog/9351.trivial.rst +++ /dev/null @@ -1 +0,0 @@ -Correct minor typos in doc/en/example/special.rst. diff --git a/doc/en/announce/index.rst b/doc/en/announce/index.rst index f0c84cb4c47..ccda9d536e3 100644 --- a/doc/en/announce/index.rst +++ b/doc/en/announce/index.rst @@ -6,6 +6,7 @@ Release announcements :maxdepth: 2 + release-7.0.0rc1 release-6.2.5 release-6.2.4 release-6.2.3 diff --git a/doc/en/announce/release-7.0.0rc1.rst b/doc/en/announce/release-7.0.0rc1.rst new file mode 100644 index 00000000000..de9bcd42fd1 --- /dev/null +++ b/doc/en/announce/release-7.0.0rc1.rst @@ -0,0 +1,74 @@ +pytest-7.0.0rc1 +======================================= + +The pytest team is proud to announce the 7.0.0rc1 prerelease! + +This is a prerelease, not intended for production use, but to test the upcoming features and improvements +in order to catch any major problems before the final version is released to the major public. + +We appreciate your help testing this out before the final release, making sure to report any +regressions to our issue tracker: + +https://github.com/pytest-dev/pytest/issues + +When doing so, please include the string ``[prerelease]`` in the title. + +You can upgrade from PyPI via: + + pip install pytest==7.0.0rc1 + +Users are encouraged to take a look at the CHANGELOG carefully: + + https://docs.pytest.org/en/stable/changelog.html + +Thanks to all the contributors to this release: + +* Adam J. Stewart +* Alexander King +* Amin Alaee +* Andrew Neitsch +* Anthony Sottile +* Ben Davies +* Bernát Gábor +* Brian Okken +* Bruno Oliveira +* Cristian Vera +* David Szotten +* Eddie +* Emmanuel Arias +* Emmanuel Meric de Bellefon +* Eric Liu +* Florian Bruhin +* GergelyKalmar +* Graeme Smecher +* Harshna +* Hugo van Kemenade +* Jakub Kulík +* James Myatt +* Jeff Rasley +* Kale Kundert +* Miro Hrončok +* Naveen-Pratap +* Oleg Höfling +* Ran Benita +* Ronny Pfannschmidt +* Simon K +* Srip +* Sören Wegener +* Taneli Hukkinen +* Terje Runde +* Thomas Grainger +* Thomas Hisch +* William Jamir Silva +* Zac Hatfield-Dodds +* andrewdotn +* denivyruck +* ericluoliu +* oleg.hoefling +* symonk +* ziebam +* Éloi Rivard + + +Happy testing, +The pytest Development Team diff --git a/doc/en/builtin.rst b/doc/en/builtin.rst index e22a874b4d5..ba173ac196f 100644 --- a/doc/en/builtin.rst +++ b/doc/en/builtin.rst @@ -18,11 +18,11 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a $ pytest --fixtures -v =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python cachedir: .pytest_cache rootdir: /home/sweet/project collected 0 items - cache -- ../../../..$PYTHON_SITE/_pytest/cacheprovider.py:520 + cache -- .../_pytest/cacheprovider.py:510 Return a cache object that can persist state between testing sessions. cache.get(key, default) @@ -33,39 +33,39 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a Values can be any object handled by the json stdlib module. - capsys -- ../../../..$PYTHON_SITE/_pytest/capture.py:903 + capsys -- .../_pytest/capture.py:878 Enable text capturing of writes to ``sys.stdout`` and ``sys.stderr``. The captured output is made available via ``capsys.readouterr()`` method calls, which return a ``(out, err)`` namedtuple. ``out`` and ``err`` will be ``text`` objects. - capsysbinary -- ../../../..$PYTHON_SITE/_pytest/capture.py:920 + capsysbinary -- .../_pytest/capture.py:895 Enable bytes capturing of writes to ``sys.stdout`` and ``sys.stderr``. The captured output is made available via ``capsysbinary.readouterr()`` method calls, which return a ``(out, err)`` namedtuple. ``out`` and ``err`` will be ``bytes`` objects. - capfd -- ../../../..$PYTHON_SITE/_pytest/capture.py:937 + capfd -- .../_pytest/capture.py:912 Enable text capturing of writes to file descriptors ``1`` and ``2``. The captured output is made available via ``capfd.readouterr()`` method calls, which return a ``(out, err)`` namedtuple. ``out`` and ``err`` will be ``text`` objects. - capfdbinary -- ../../../..$PYTHON_SITE/_pytest/capture.py:954 + capfdbinary -- .../_pytest/capture.py:929 Enable bytes capturing of writes to file descriptors ``1`` and ``2``. The captured output is made available via ``capfd.readouterr()`` method calls, which return a ``(out, err)`` namedtuple. ``out`` and ``err`` will be ``byte`` objects. - doctest_namespace [session scope] -- ../../../..$PYTHON_SITE/_pytest/doctest.py:728 + doctest_namespace [session scope] -- .../_pytest/doctest.py:731 Fixture that returns a :py:class:`dict` that will be injected into the namespace of doctests. - pytestconfig [session scope] -- ../../../..$PYTHON_SITE/_pytest/fixtures.py:1372 + pytestconfig [session scope] -- .../_pytest/fixtures.py:1365 Session-scoped fixture that returns the session's :class:`pytest.Config` object. @@ -75,7 +75,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a if pytestconfig.getoption("verbose") > 0: ... - record_property -- ../../../..$PYTHON_SITE/_pytest/junitxml.py:282 + record_property -- .../_pytest/junitxml.py:282 Add extra properties to the calling test. User properties become part of the test report and are available to the @@ -89,13 +89,13 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a def test_function(record_property): record_property("example_key", 1) - record_xml_attribute -- ../../../..$PYTHON_SITE/_pytest/junitxml.py:305 + record_xml_attribute -- .../_pytest/junitxml.py:305 Add extra xml attributes to the tag for the calling test. The fixture is callable with ``name, value``. The value is automatically XML-encoded. - record_testsuite_property [session scope] -- ../../../..$PYTHON_SITE/_pytest/junitxml.py:343 + record_testsuite_property [session scope] -- .../_pytest/junitxml.py:343 Record a new ```` tag as child of the root ````. This is suitable to writing global information regarding the entire test @@ -114,10 +114,27 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a .. warning:: Currently this fixture **does not work** with the - `pytest-xdist `__ plugin. See issue - `#7767 `__ for details. + `pytest-xdist `__ plugin. See + :issue:`7767` for details. - caplog -- ../../../..$PYTHON_SITE/_pytest/logging.py:491 + tmpdir_factory [session scope] -- .../_pytest/legacypath.py:292 + Return a :class:`pytest.TempdirFactory` instance for the test session. + + tmpdir -- .../_pytest/legacypath.py:299 + Return a temporary directory path object which is unique to each test + function invocation, created as a sub directory of the base temporary + directory. + + By default, a new base temporary directory is created each test session, + and old bases are removed after 3 sessions, to aid in debugging. If + ``--basetemp`` is used then it is cleared each session. See :ref:`base + temporary directory`. + + The returned object is a `legacy_path`_ object. + + .. _legacy_path: https://py.readthedocs.io/en/latest/path.html + + caplog -- .../_pytest/logging.py:483 Access and control log capturing. Captured logs are available through the following properties/methods:: @@ -128,7 +145,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a * caplog.record_tuples -> list of (logger_name, level, message) tuples * caplog.clear() -> clear captured records and formatted log output string - monkeypatch -- ../../../..$PYTHON_SITE/_pytest/monkeypatch.py:29 + monkeypatch -- .../_pytest/monkeypatch.py:29 A convenient fixture for monkey-patching. The fixture provides these methods to modify objects, dictionaries or @@ -147,33 +164,16 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a fixture has finished. The ``raising`` parameter determines if a KeyError or AttributeError will be raised if the set/deletion operation has no target. - recwarn -- ../../../..$PYTHON_SITE/_pytest/recwarn.py:29 + recwarn -- .../_pytest/recwarn.py:29 Return a :class:`WarningsRecorder` instance that records all warnings emitted by test functions. See https://docs.python.org/library/how-to/capture-warnings.html for information on warning categories. - tmpdir_factory [session scope] -- ../../../..$PYTHON_SITE/_pytest/tmpdir.py:210 - Return a :class:`pytest.TempdirFactory` instance for the test session. - - tmp_path_factory [session scope] -- ../../../..$PYTHON_SITE/_pytest/tmpdir.py:217 + tmp_path_factory [session scope] -- .../_pytest/tmpdir.py:183 Return a :class:`pytest.TempPathFactory` instance for the test session. - tmpdir -- ../../../..$PYTHON_SITE/_pytest/tmpdir.py:232 - Return a temporary directory path object which is unique to each test - function invocation, created as a sub directory of the base temporary - directory. - - By default, a new base temporary directory is created each test session, - and old bases are removed after 3 sessions, to aid in debugging. If - ``--basetemp`` is used then it is cleared each session. See :ref:`base - temporary directory`. - - The returned object is a `legacy_path`_ object. - - .. _legacy_path: https://py.readthedocs.io/en/latest/path.html - - tmp_path -- ../../../..$PYTHON_SITE/_pytest/tmpdir.py:250 + tmp_path -- .../_pytest/tmpdir.py:198 Return a temporary directory path object which is unique to each test function invocation, created as a sub directory of the base temporary directory. diff --git a/doc/en/changelog.rst b/doc/en/changelog.rst index 6cec2935d9a..65b160d2bf6 100644 --- a/doc/en/changelog.rst +++ b/doc/en/changelog.rst @@ -28,6 +28,482 @@ with advance notice in the **Deprecations** section of releases. .. towncrier release notes start +pytest 7.0.0rc1 (2021-12-06) +============================ + +Breaking Changes +---------------- + +- `#7259 `_: The :ref:`Node.reportinfo() ` function first return value type has been expanded from `py.path.local | str` to `os.PathLike[str] | str`. + + Most plugins which refer to `reportinfo()` only define it as part of a custom :class:`pytest.Item` implementation. + Since `py.path.local` is a `os.PathLike[str]`, these plugins are unaffacted. + + Plugins and users which call `reportinfo()`, use the first return value and interact with it as a `py.path.local`, would need to adjust by calling `py.path.local(fspath)`. + Although preferably, avoid the legacy `py.path.local` and use `pathlib.Path`, or use `item.location` or `item.path`, instead. + + Note: pytest was not able to provide a deprecation period for this change. + + +- `#8246 `_: ``--version`` now writes version information to ``stdout`` rather than ``stderr``. + + +- `#8733 `_: Drop a workaround for `pyreadline `__ that made it work with ``--pdb``. + + The workaround was introduced in `#1281 `__ in 2015, however since then + `pyreadline seems to have gone unmaintained `__, is `generating + warnings `__, and will stop working on Python 3.10. + + +- `#9061 `_: Using :func:`pytest.approx` in a boolean context now raises an error hinting at the proper usage. + + It is apparently common for users to mistakenly use ``pytest.approx`` like this: + + .. code-block:: python + + assert pytest.approx(actual, expected) + + While the correct usage is: + + .. code-block:: python + + assert actual == pytest.approx(expected) + + The new error message helps catch those mistakes. + + +- `#9277 `_: The ``pytest.Instance`` collector type has been removed. + Importing ``pytest.Instance`` or ``_pytest.python.Instance`` returns a dummy type and emits a deprecation warning. + See :ref:`instance-collector-deprecation` for details. + + +- `#9308 `_: **PytestRemovedIn7Warning deprecation warnings are now errors by default.** + + Following our plan to remove deprecated features with as little disruption as + possible, all warnings of type ``PytestRemovedIn7Warning`` now generate errors + instead of warning messages by default. + + **The affected features will be effectively removed in pytest 7.1**, so please consult the + :ref:`deprecations` section in the docs for directions on how to update existing code. + + In the pytest ``7.0.X`` series, it is possible to change the errors back into warnings as a + stopgap measure by adding this to your ``pytest.ini`` file: + + .. code-block:: ini + + [pytest] + filterwarnings = + ignore::pytest.PytestRemovedIn7Warning + + But this will stop working when pytest ``7.1`` is released. + + **If you have concerns** about the removal of a specific feature, please add a + comment to :issue:`9308`. + + + +Deprecations +------------ + +- `#7259 `_: ``py.path.local`` arguments for hooks have been deprecated. See :ref:`the deprecation note ` for full details. + + ``py.path.local`` arguments to Node constructors have been deprecated. See :ref:`the deprecation note ` for full details. + + .. note:: + The name of the :class:`~_pytest.nodes.Node` arguments and attributes (the + new attribute being ``path``) is **the opposite** of the situation for hooks + (the old argument being ``path``). + + This is an unfortunate artifact due to historical reasons, which should be + resolved in future versions as we slowly get rid of the :pypi:`py` + dependency (see :issue:`9283` for a longer discussion). + + +- `#7469 `_: Directly constructing the following classes is now deprecated: + + - ``_pytest.mark.structures.Mark`` + - ``_pytest.mark.structures.MarkDecorator`` + - ``_pytest.mark.structures.MarkGenerator`` + - ``_pytest.python.Metafunc`` + - ``_pytest.runner.CallInfo`` + - ``_pytest._code.ExceptionInfo`` + - ``_pytest.config.argparsing.Parser`` + - ``_pytest.config.argparsing.OptionGroup`` + - ``_pytest.pytester.HookRecorder`` + + These constructors have always been considered private, but now issue a deprecation warning, which may become a hard error in pytest 8. + + +- `#8242 `_: Raising :class:`unittest.SkipTest` to skip collection of tests during the + pytest collection phase is deprecated. Use :func:`pytest.skip` instead. + + Note: This deprecation only relates to using :class:`unittest.SkipTest` during test + collection. You are probably not doing that. Ordinary usage of + :class:`unittest.SkipTest` / :meth:`unittest.TestCase.skipTest` / + :func:`unittest.skip` in unittest test cases is fully supported. + + +- `#8315 `_: Several behaviors of :meth:`Parser.addoption ` are now + scheduled for removal in pytest 8 (deprecated since pytest 2.4.0): + + - ``parser.addoption(..., help=".. %default ..")`` - use ``%(default)s`` instead. + - ``parser.addoption(..., type="int/string/float/complex")`` - use ``type=int`` etc. instead. + + +- `#8447 `_: Defining a custom pytest node type which is both an :class:`pytest.Item ` and a :class:`pytest.Collector ` (e.g. :class:`pytest.File `) now issues a warning. + It was never sanely supported and triggers hard to debug errors. + + See :ref:`the deprecation note ` for full details. + + +- `#8592 `_: :func:`pytest_cmdline_preparse <_pytest.hookspec.pytest_cmdline_preparse>` has been officially deprecated. It will be removed in a future release. Use :func:`pytest_load_initial_conftests <_pytest.hookspec.pytest_load_initial_conftests>` instead. + + See :ref:`the deprecation note ` for full details. + + +- `#8645 `_: :func:`pytest.warns(None) ` is now deprecated because many people used + it to mean "this code does not emit warnings", but it actually had the effect of + checking that the code emits at least one warning of any type - like ``pytest.warns()`` + or ``pytest.warns(Warning)``. + + +- `#8948 `_: :func:`pytest.skip(msg=...) `, :func:`pytest.fail(msg=...) ` and :func:`pytest.exit(msg=...) ` + signatures now accept a ``reason`` argument instead of ``msg``. Using ``msg`` still works, but is deprecated and will be removed in a future release. + + This was changed for consistency with :func:`pytest.mark.skip ` and :func:`pytest.mark.xfail ` which both accept + ``reason`` as an argument. + + + +Features +-------- + +- `#5196 `_: Tests are now ordered by definition order in more cases. + + In a class hierarchy, tests from base classes are now consistently ordered before tests defined on their subclasses (reverse MRO order). + + +- `#7132 `_: Added two environment variables :envvar:`PYTEST_THEME` and :envvar:`PYTEST_THEME_MODE` to let the users customize the pygments theme used. + + +- `#7259 `_: Added :meth:`cache.mkdir() `, which is similar to the existing :meth:`cache.makedir() `, + but returns a :class:`pathlib.Path` instead of a legacy ``py.path.local``. + + Added a ``paths`` type to :meth:`parser.addini() `, + as in ``parser.addini("mypaths", "my paths", type="paths")``, + which is similar to the existing ``pathlist``, + but returns a list of :class:`pathlib.Path` instead of legacy ``py.path.local``. + + +- `#7469 `_: The types of objects used in pytest's API are now exported so they may be used in type annotations. + + The newly-exported types are: + + - ``pytest.Config`` for :class:`Config `. + - ``pytest.Mark`` for :class:`marks `. + - ``pytest.MarkDecorator`` for :class:`mark decorators `. + - ``pytest.MarkGenerator`` for the :class:`pytest.mark ` singleton. + - ``pytest.Metafunc`` for the :class:`metafunc ` argument to the :func:`pytest_generate_tests ` hook. + - ``pytest.CallInfo`` for the :class:`CallInfo ` type passed to various hooks. + - ``pytest.PytestPluginManager`` for :class:`PytestPluginManager `. + - ``pytest.ExceptionInfo`` for the :class:`ExceptionInfo ` type returned from :func:`pytest.raises` and passed to various hooks. + - ``pytest.Parser`` for the :class:`Parser ` type passed to the :func:`pytest_addoption ` hook. + - ``pytest.OptionGroup`` for the :class:`OptionGroup ` type returned from the :func:`parser.addgroup ` method. + - ``pytest.HookRecorder`` for the :class:`HookRecorder ` type returned from :class:`~pytest.Pytester`. + - ``pytest.RecordedHookCall`` for the :class:`RecordedHookCall ` type returned from :class:`~pytest.HookRecorder`. + - ``pytest.RunResult`` for the :class:`RunResult ` type returned from :class:`~pytest.Pytester`. + - ``pytest.LineMatcher`` for the :class:`LineMatcher ` type used in :class:`~pytest.RunResult` and others. + - ``pytest.TestReport`` for the :class:`TestReport ` type used in various hooks. + - ``pytest.CollectReport`` for the :class:`CollectReport ` type used in various hooks. + + Constructing most of them directly is not supported; they are only meant for use in type annotations. + Doing so will emit a deprecation warning, and may become a hard-error in pytest 8.0. + + Subclassing them is also not supported. This is not currently enforced at runtime, but is detected by type-checkers such as mypy. + + +- `#7856 `_: :ref:`--import-mode=importlib ` now works with features that + depend on modules being on :py:data:`sys.modules`, such as :mod:`pickle` and :mod:`dataclasses`. + + +- `#8144 `_: The following hooks now receive an additional ``pathlib.Path`` argument, equivalent to an existing ``py.path.local`` argument: + + - :func:`pytest_ignore_collect <_pytest.hookspec.pytest_ignore_collect>` - The ``collection_path`` parameter (equivalent to existing ``path`` parameter). + - :func:`pytest_collect_file <_pytest.hookspec.pytest_collect_file>` - The ``file_path`` parameter (equivalent to existing ``path`` parameter). + - :func:`pytest_pycollect_makemodule <_pytest.hookspec.pytest_pycollect_makemodule>` - The ``module_path`` parameter (equivalent to existing ``path`` parameter). + - :func:`pytest_report_header <_pytest.hookspec.pytest_report_header>` - The ``start_path`` parameter (equivalent to existing ``startdir`` parameter). + - :func:`pytest_report_collectionfinish <_pytest.hookspec.pytest_report_collectionfinish>` - The ``start_path`` parameter (equivalent to existing ``startdir`` parameter). + + .. note:: + The name of the :class:`~_pytest.nodes.Node` arguments and attributes (the + new attribute being ``path``) is **the opposite** of the situation for hooks + (the old argument being ``path``). + + This is an unfortunate artifact due to historical reasons, which should be + resolved in future versions as we slowly get rid of the :pypi:`py` + dependency (see :issue:`9283` for a longer discussion). + + +- `#8251 `_: Implement ``Node.path`` as a ``pathlib.Path``. Both the old ``fspath`` and this new attribute gets set no matter whether ``path`` or ``fspath`` (deprecated) is passed to the constructor. It is a replacement for the ``fspath`` attribute (which represents the same path as ``py.path.local``). While ``fspath`` is not deprecated yet + due to the ongoing migration of methods like :meth:`~_pytest.Item.reportinfo`, we expect to deprecate it in a future release. + + .. note:: + The name of the :class:`~_pytest.nodes.Node` arguments and attributes (the + new attribute being ``path``) is **the opposite** of the situation for hooks + (the old argument being ``path``). + + This is an unfortunate artifact due to historical reasons, which should be + resolved in future versions as we slowly get rid of the :pypi:`py` + dependency (see :issue:`9283` for a longer discussion). + + +- `#8421 `_: :func:`pytest.approx` now works on :class:`~decimal.Decimal` within mappings/dicts and sequences/lists. + + +- `#8606 `_: pytest invocations with ``--fixtures-per-test`` and ``--fixtures`` have been enriched with: + + - Fixture location path printed with the fixture name. + - First section of the fixture's docstring printed under the fixture name. + - Whole of fixture's docstring printed under the fixture name using ``--verbose`` option. + + +- `#8761 `_: New :ref:`version-tuple` attribute, which makes it simpler for users to do something depending on the pytest version (such as declaring hooks which are introduced in later versions). + + +- `#8789 `_: Switch TOML parser from ``toml`` to ``tomli`` for TOML v1.0.0 support in ``pyproject.toml``. + + +- `#8920 `_: Added :class:`pytest.Stash`, a facility for plugins to store their data on :class:`~pytest.Config` and :class:`~_pytest.nodes.Node`\s in a type-safe and conflict-free manner. + See :ref:`plugin-stash` for details. + + +- `#8953 `_: :class:`RunResult <_pytest.pytester.RunResult>` method :meth:`assert_outcomes <_pytest.pytester.RunResult.assert_outcomes>` now accepts a + ``warnings`` argument to assert the total number of warnings captured. + + +- `#8954 `_: ``--debug`` flag now accepts a :class:`str` file to route debug logs into, remains defaulted to `pytestdebug.log`. + + +- `#9023 `_: Full diffs are now always shown for equality assertions of iterables when + `CI` or ``BUILD_NUMBER`` is found in the environment, even when ``-v`` isn't + used. + + +- `#9113 `_: :class:`RunResult <_pytest.pytester.RunResult>` method :meth:`assert_outcomes <_pytest.pytester.RunResult.assert_outcomes>` now accepts a + ``deselected`` argument to assert the total number of deselected tests. + + +- `#9114 `_: Added :confval:`pythonpath` setting that adds listed paths to :data:`sys.path` for the duration of the test session. If you currently use the pytest-pythonpath or pytest-srcpaths plugins, you should be able to replace them with built-in `pythonpath` setting. + + + +Improvements +------------ + +- `#7480 `_: A deprecation scheduled to be removed in a major version X (e.g. pytest 7, 8, 9, ...) now uses warning category `PytestRemovedInXWarning`, + a subclass of :class:`~pytest.PytestDeprecationWarning`, + instead of :class:`PytestDeprecationWarning` directly. + + See :ref:`backwards-compatibility` for more details. + + +- `#7864 `_: Improved error messages when parsing warning filters. + + Previously pytest would show an internal traceback, which besides being ugly sometimes would hide the cause + of the problem (for example an ``ImportError`` while importing a specific warning type). + + +- `#8335 `_: Improved :func:`pytest.approx` assertion messages for sequences of numbers. + + The assertion messages now dumps a table with the index and the error of each diff. + Example:: + + > assert [1, 2, 3, 4] == pytest.approx([1, 3, 3, 5]) + E assert comparison failed for 2 values: + E Index | Obtained | Expected + E 1 | 2 | 3 +- 3.0e-06 + E 3 | 4 | 5 +- 5.0e-06 + + +- `#8403 `_: By default, pytest will truncate long strings in assert errors so they don't clutter the output too much, + currently at ``240`` characters by default. + + However, in some cases the longer output helps, or is even crucial, to diagnose a failure. Using ``-v`` will + now increase the truncation threshold to ``2400`` characters, and ``-vv`` or higher will disable truncation entirely. + + +- `#8509 `_: Fixed issue where :meth:`unittest.TestCase.setUpClass` is not called when a test has `/` in its name since pytest 6.2.0. + + This refers to the path part in pytest node IDs, e.g. ``TestClass::test_it`` in the node ID ``tests/test_file.py::TestClass::test_it``. + + Now, instead of assuming that the test name does not contain ``/``, it is assumed that test path does not contain ``::``. We plan to hopefully make both of these work in the future. + + +- `#8803 `_: It is now possible to add colors to custom log levels on cli log. + + By using :func:`add_color_level <_pytest.logging.add_color_level>` from a ``pytest_configure`` hook, colors can be added:: + + logging_plugin = config.pluginmanager.get_plugin('logging-plugin') + logging_plugin.log_cli_handler.formatter.add_color_level(logging.INFO, 'cyan') + logging_plugin.log_cli_handler.formatter.add_color_level(logging.SPAM, 'blue') + + See :ref:`log_colors` for more information. + + +- `#8822 `_: When showing fixture paths in `--fixtures` or `--fixtures-by-test`, fixtures coming from pytest itself now display an elided path, rather than the full path to the file in the `site-packages` directory. + + +- `#8898 `_: Complex numbers are now treated like floats and integers when generating parameterization IDs. + + +- `#9062 `_: ``--stepwise-skip`` now implicitly enables ``--stepwise`` and can be used on its own. + + +- `#9205 `_: :meth:`pytest.Cache.set` now preserves key order when saving dicts. + + + +Bug Fixes +--------- + +- `#7124 `_: Fixed an issue where ``__main__.py`` would raise an ``ImportError`` when ``--doctest-modules`` was provided. + + +- `#8061 `_: Fixed failing ``staticmethod`` test cases if they are inherited from a parent test class. + + +- `#8192 `_: ``testdir.makefile`` now silently accepts values which don't start with ``.`` to maintain backward compatibility with older pytest versions. + + ``pytester.makefile`` now issues a clearer error if the ``.`` is missing in the ``ext`` argument. + + +- `#8258 `_: Fixed issue where pytest's ``faulthandler`` support would not dump traceback on crashes + if the :mod:`faulthandler` module was already enabled during pytest startup (using + ``python -X dev -m pytest`` for example). + + +- `#8317 `_: Fixed an issue where illegal directory characters derived from ``getpass.getuser()`` raised an ``OSError``. + + +- `#8367 `_: Fix ``Class.from_parent`` so it forwards extra keyword arguments to the constructor. + + +- `#8377 `_: The test selection options ``pytest -k`` and ``pytest -m`` now support matching + names containing forward slash (``/``) characters. + + +- `#8384 `_: The ``@pytest.mark.skip`` decorator now correctly handles its arguments. When the ``reason`` argument is accidentally given both positional and as a keyword (e.g. because it was confused with ``skipif``), a ``TypeError`` now occurs. Before, such tests were silently skipped, and the positional argument ignored. Additionally, ``reason`` is now documented correctly as positional or keyword (rather than keyword-only). + + +- `#8394 `_: Use private names for internal fixtures that handle classic setup/teardown so that they don't show up with the default ``--fixtures`` invocation (but they still show up with ``--fixtures -v``). + + +- `#8456 `_: The :confval:`required_plugins` config option now works correctly when pre-releases of plugins are installed, rather than falsely claiming that those plugins aren't installed at all. + + +- `#8464 `_: ``-c `` now also properly defines ``rootdir`` as the directory that contains ````. + + +- `#8503 `_: :meth:`pytest.MonkeyPatch.syspath_prepend` no longer fails when + ``setuptools`` is not installed. + It now only calls :func:`pkg_resources.fixup_namespace_packages` if + ``pkg_resources`` was previously imported, because it is not needed otherwise. + + +- `#8548 `_: Introduce fix to handle precision width in ``log-cli-format`` in turn to fix output coloring for certain formats. + + +- `#8796 `_: Fixed internal error when skipping doctests. + + +- `#8983 `_: The test selection options ``pytest -k`` and ``pytest -m`` now support matching names containing backslash (`\\`) characters. + Backslashes are treated literally, not as escape characters (the values being matched against are already escaped). + + +- `#8990 `_: Fix `pytest -vv` crashing with an internal exception `AttributeError: 'str' object has no attribute 'relative_to'` in some cases. + + +- `#9077 `_: Fixed confusing error message when ``request.fspath`` / ``request.path`` was accessed from a session-scoped fixture. + + +- `#9131 `_: Fixed the URL used by ``--pastebin`` to use `bpa.st `__. + + +- `#9163 `_: The end line number and end column offset are now properly set for rewritten assert statements. + + +- `#9169 `_: Support for the ``files`` API from ``importlib.resources`` within rewritten files. + + +- `#9272 `_: The nose compatibility module-level fixtures `setup()` and `teardown()` are now only called once per module, instead of for each test function. + They are now called even if object-level `setup`/`teardown` is defined. + + + +Improved Documentation +---------------------- + +- `#4320 `_: Improved docs for `pytester.copy_example`. + + +- `#5105 `_: Add automatically generated :ref:`plugin-list`. The list is updated on a periodic schedule. + + +- `#8337 `_: Recommend `numpy.testing `__ module on :func:`pytest.approx` documentation. + + +- `#8655 `_: Help text for ``--pdbcls`` more accurately reflects the option's behavior. + + +- `#9210 `_: Remove incorrect docs about ``confcutdir`` being a configuration option: it can only be set through the ``--confcutdir`` command-line option. + + +- `#9242 `_: Upgrade readthedocs configuration to use a `newer Ubuntu version `__` with better unicode support for PDF docs. + + +- `#9341 `_: Various methods commonly used for :ref:`non-python tests` are now correctly documented in the reference docs. They were undocumented previously. + + + +Trivial/Internal Changes +------------------------ + +- `#8133 `_: Migrate to ``setuptools_scm`` 6.x to use ``SETUPTOOLS_SCM_PRETEND_VERSION_FOR_PYTEST`` for more robust release tooling. + + +- `#8174 `_: The following changes have been made to internal pytest types/functions: + + - The ``path`` property of ``_pytest.code.Code`` returns ``Path`` instead of ``py.path.local``. + - The ``path`` property of ``_pytest.code.TracebackEntry`` returns ``Path`` instead of ``py.path.local``. + - The ``_pytest.code.getfslineno()`` function returns ``Path`` instead of ``py.path.local``. + - The ``_pytest.python.path_matches_patterns()`` function takes ``Path`` instead of ``py.path.local``. + + +- `#8248 `_: Internal Restructure: let ``python.PyObjMixin`` inherit from ``nodes.Node`` to carry over typing information. + + +- `#8432 `_: Improve error message when :func:`pytest.skip` is used at module level without passing `allow_module_level=True`. + + +- `#8818 `_: Ensure ``regendoc`` opts out of ``TOX_ENV`` cachedir selection to ensure independent example test runs. + + +- `#8913 `_: The private ``CallSpec2._arg2scopenum`` attribute has been removed after an internal refactoring. + + +- `#8967 `_: :func:`pytest_assertion_pass <_pytest.hookspec.pytest_assertion_pass>` is no longer considered experimental and + future changes to it will be considered more carefully. + + +- `#9202 `_: Add github action to upload coverage report to codecov instead of bash uploader. + + +- `#9225 `_: Changed the command used to create sdist and wheel artifacts: using the build package instead of setup.py. + + +- `#9351 `_: Correct minor typos in doc/en/example/special.rst. + + pytest 6.2.5 (2021-08-29) ========================= diff --git a/doc/en/example/markers.rst b/doc/en/example/markers.rst index 402b8e34626..3226c0871e0 100644 --- a/doc/en/example/markers.rst +++ b/doc/en/example/markers.rst @@ -45,7 +45,7 @@ You can then restrict a test run to only run tests marked with ``webtest``: $ pytest -v -m webtest =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python cachedir: .pytest_cache rootdir: /home/sweet/project collecting ... collected 4 items / 3 deselected / 1 selected @@ -60,7 +60,7 @@ Or the inverse, running all tests except the webtest ones: $ pytest -v -m "not webtest" =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python cachedir: .pytest_cache rootdir: /home/sweet/project collecting ... collected 4 items / 1 deselected / 3 selected @@ -82,7 +82,7 @@ tests based on their module, class, method, or function name: $ pytest -v test_server.py::TestClass::test_method =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python cachedir: .pytest_cache rootdir: /home/sweet/project collecting ... collected 1 item @@ -97,7 +97,7 @@ You can also select on the class: $ pytest -v test_server.py::TestClass =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python cachedir: .pytest_cache rootdir: /home/sweet/project collecting ... collected 1 item @@ -112,7 +112,7 @@ Or select multiple nodes: $ pytest -v test_server.py::TestClass test_server.py::test_send_http =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python cachedir: .pytest_cache rootdir: /home/sweet/project collecting ... collected 2 items @@ -156,7 +156,7 @@ The expression matching is now case-insensitive. $ pytest -v -k http # running with the above defined example module =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python cachedir: .pytest_cache rootdir: /home/sweet/project collecting ... collected 4 items / 3 deselected / 1 selected @@ -171,7 +171,7 @@ And you can also run all tests except the ones that match the keyword: $ pytest -k "not send_http" -v =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python cachedir: .pytest_cache rootdir: /home/sweet/project collecting ... collected 4 items / 1 deselected / 3 selected @@ -188,7 +188,7 @@ Or to select "http" and "quick" tests: $ pytest -k "http or quick" -v =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python cachedir: .pytest_cache rootdir: /home/sweet/project collecting ... collected 4 items / 2 deselected / 2 selected @@ -397,8 +397,7 @@ the test needs: $ pytest -E stage2 =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y - cachedir: .pytest_cache + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y rootdir: /home/sweet/project collected 1 item @@ -412,8 +411,7 @@ and here is one that specifies exactly the environment needed: $ pytest -E stage1 =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y - cachedir: .pytest_cache + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y rootdir: /home/sweet/project collected 1 item @@ -605,8 +603,7 @@ then you will see two tests skipped and two executed tests as expected: $ pytest -rs # this option reports skip reasons =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y - cachedir: .pytest_cache + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y rootdir: /home/sweet/project collected 4 items @@ -622,8 +619,7 @@ Note that if you specify a platform via the marker-command line option like this $ pytest -m linux =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y - cachedir: .pytest_cache + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y rootdir: /home/sweet/project collected 4 items / 3 deselected / 1 selected @@ -686,8 +682,7 @@ We can now use the ``-m option`` to select one set: $ pytest -m interface --tb=short =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y - cachedir: .pytest_cache + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y rootdir: /home/sweet/project collected 4 items / 2 deselected / 2 selected @@ -713,8 +708,7 @@ or to select both "event" and "interface" tests: $ pytest -m "interface or event" --tb=short =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y - cachedir: .pytest_cache + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y rootdir: /home/sweet/project collected 4 items / 1 deselected / 3 selected diff --git a/doc/en/example/nonpython.rst b/doc/en/example/nonpython.rst index 876c9c872f1..f79f15b4f79 100644 --- a/doc/en/example/nonpython.rst +++ b/doc/en/example/nonpython.rst @@ -28,8 +28,7 @@ now execute the test specification: nonpython $ pytest test_simple.yaml =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y - cachedir: .pytest_cache + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y rootdir: /home/sweet/project/nonpython collected 2 items @@ -65,7 +64,7 @@ consulted when reporting in ``verbose`` mode: nonpython $ pytest -v =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python cachedir: .pytest_cache rootdir: /home/sweet/project/nonpython collecting ... collected 2 items @@ -91,8 +90,7 @@ interesting to just look at the collection tree: nonpython $ pytest --collect-only =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y - cachedir: .pytest_cache + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y rootdir: /home/sweet/project/nonpython collected 2 items diff --git a/doc/en/example/parametrize.rst b/doc/en/example/parametrize.rst index 87ed1420694..66d72f3cc0d 100644 --- a/doc/en/example/parametrize.rst +++ b/doc/en/example/parametrize.rst @@ -160,8 +160,7 @@ objects, they are still using the default pytest representation: $ pytest test_time.py --collect-only =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y - cachedir: .pytest_cache + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y rootdir: /home/sweet/project collected 8 items @@ -223,8 +222,7 @@ this is a fully self-contained example which you can run with: $ pytest test_scenarios.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y - cachedir: .pytest_cache + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y rootdir: /home/sweet/project collected 4 items @@ -238,17 +236,16 @@ If you just collect tests you'll also nicely see 'advanced' and 'basic' as varia $ pytest --collect-only test_scenarios.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y - cachedir: .pytest_cache + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y rootdir: /home/sweet/project collected 4 items - - - - + + + + ======================== 4 tests collected in 0.12s ======================== @@ -317,8 +314,7 @@ Let's first see how it looks like at collection time: $ pytest test_backends.py --collect-only =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y - cachedir: .pytest_cache + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y rootdir: /home/sweet/project collected 2 items @@ -416,7 +412,7 @@ The result of this test will be successful: $ pytest -v test_indirect_list.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python cachedir: .pytest_cache rootdir: /home/sweet/project collecting ... collected 1 item @@ -506,8 +502,12 @@ Running it results in some skips if we don't have all the python interpreters in .. code-block:: pytest . $ pytest -rs -q multipython.py - ........................... [100%] - 27 passed in 0.12s + sssssssssssssssssssssssssss [100%] + ========================= short test summary info ========================== + SKIPPED [9] multipython.py:29: 'python3.5' not found + SKIPPED [9] multipython.py:29: 'python3.6' not found + SKIPPED [9] multipython.py:29: 'python3.7' not found + 27 skipped in 0.12s Indirect parametrization of optional implementations/imports -------------------------------------------------------------------- @@ -567,8 +567,7 @@ If you run this with reporting for skips enabled: $ pytest -rs test_module.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y - cachedir: .pytest_cache + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y rootdir: /home/sweet/project collected 2 items @@ -629,7 +628,7 @@ Then run ``pytest`` with verbose mode and with only the ``basic`` marker: $ pytest -v -m basic =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python cachedir: .pytest_cache rootdir: /home/sweet/project collecting ... collected 24 items / 21 deselected / 3 selected diff --git a/doc/en/example/pythoncollection.rst b/doc/en/example/pythoncollection.rst index 8b7f05bb76d..b9c2386ac51 100644 --- a/doc/en/example/pythoncollection.rst +++ b/doc/en/example/pythoncollection.rst @@ -147,15 +147,14 @@ The test collection would look like this: $ pytest --collect-only =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y - cachedir: .pytest_cache + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y rootdir: /home/sweet/project, configfile: pytest.ini collected 2 items - - + + ======================== 2 tests collected in 0.12s ======================== @@ -209,16 +208,15 @@ You can always peek at the collection tree without running tests like this: . $ pytest --collect-only pythoncollection.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y - cachedir: .pytest_cache + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y rootdir: /home/sweet/project, configfile: pytest.ini collected 3 items - - + + ======================== 3 tests collected in 0.12s ======================== @@ -291,8 +289,7 @@ file will be left out: $ pytest --collect-only =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y - cachedir: .pytest_cache + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y rootdir: /home/sweet/project, configfile: pytest.ini collected 0 items diff --git a/doc/en/example/reportingdemo.rst b/doc/en/example/reportingdemo.rst index ff814bd754a..cab93143615 100644 --- a/doc/en/example/reportingdemo.rst +++ b/doc/en/example/reportingdemo.rst @@ -9,8 +9,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: assertion $ pytest failure_demo.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y - cachedir: .pytest_cache + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y rootdir: /home/sweet/project/assertion collected 44 items diff --git a/doc/en/example/simple.rst b/doc/en/example/simple.rst index 3b9963f09d6..a70f3404992 100644 --- a/doc/en/example/simple.rst +++ b/doc/en/example/simple.rst @@ -232,8 +232,7 @@ directory with the above conftest.py: $ pytest =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y - cachedir: .pytest_cache + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y rootdir: /home/sweet/project collected 0 items @@ -297,8 +296,7 @@ and when running it will see a skipped "slow" test: $ pytest -rs # "-rs" means report details on the little 's' =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y - cachedir: .pytest_cache + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y rootdir: /home/sweet/project collected 2 items @@ -314,8 +312,7 @@ Or run it including the ``slow`` marked test: $ pytest --runslow =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y - cachedir: .pytest_cache + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y rootdir: /home/sweet/project collected 2 items @@ -458,8 +455,7 @@ which will add the string to the test header accordingly: $ pytest =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y - cachedir: .pytest_cache + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y project deps: mylib-1.1 rootdir: /home/sweet/project collected 0 items @@ -487,7 +483,7 @@ which will add info only when run with "--v": $ pytest -v =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python cachedir: .pytest_cache info1: did you know that ... did you? @@ -502,8 +498,7 @@ and nothing when run plainly: $ pytest =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y - cachedir: .pytest_cache + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y rootdir: /home/sweet/project collected 0 items @@ -542,8 +537,7 @@ Now we can profile which test functions execute the slowest: $ pytest --durations=3 =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y - cachedir: .pytest_cache + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y rootdir: /home/sweet/project collected 3 items @@ -648,8 +642,7 @@ If we run this: $ pytest -rx =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y - cachedir: .pytest_cache + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y rootdir: /home/sweet/project collected 4 items @@ -732,8 +725,7 @@ We can run this: $ pytest =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y - cachedir: .pytest_cache + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y rootdir: /home/sweet/project collected 7 items @@ -851,8 +843,7 @@ and run them: $ pytest test_module.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y - cachedir: .pytest_cache + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y rootdir: /home/sweet/project collected 2 items @@ -958,8 +949,7 @@ and run it: $ pytest -s test_module.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y - cachedir: .pytest_cache + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y rootdir: /home/sweet/project collected 3 items diff --git a/doc/en/getting-started.rst b/doc/en/getting-started.rst index a013645d1f5..6b2ff672c59 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 6.3.0.dev685+g581b021aa.d20210922 + pytest 7.0.0rc1 .. _`simpletest`: @@ -47,8 +47,7 @@ The test $ pytest =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y - cachedir: .pytest_cache + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y rootdir: /home/sweet/project collected 1 item diff --git a/doc/en/how-to/assert.rst b/doc/en/how-to/assert.rst index ab6cbdee7cf..cb70db6b8ed 100644 --- a/doc/en/how-to/assert.rst +++ b/doc/en/how-to/assert.rst @@ -29,8 +29,7 @@ you will see the return value of the function call: $ pytest test_assert1.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y - cachedir: .pytest_cache + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y rootdir: /home/sweet/project collected 1 item @@ -184,8 +183,7 @@ if you run this module: $ pytest test_assert2.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y - cachedir: .pytest_cache + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y rootdir: /home/sweet/project collected 1 item diff --git a/doc/en/how-to/cache.rst b/doc/en/how-to/cache.rst index 1ba048d955f..e7994645dd3 100644 --- a/doc/en/how-to/cache.rst +++ b/doc/en/how-to/cache.rst @@ -86,8 +86,7 @@ If you then run it with ``--lf``: $ pytest --lf =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y - cachedir: .pytest_cache + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y rootdir: /home/sweet/project collected 2 items run-last-failure: rerun previous 2 failures @@ -133,8 +132,7 @@ of ``FF`` and dots): $ pytest --ff =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y - cachedir: .pytest_cache + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y rootdir: /home/sweet/project collected 50 items run-last-failure: rerun previous 2 failures first @@ -277,8 +275,7 @@ You can always peek at the content of the cache using the $ pytest --cache-show =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y - cachedir: .pytest_cache + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y rootdir: /home/sweet/project cachedir: /home/sweet/project/.pytest_cache --------------------------- cache values for '*' --------------------------- @@ -300,8 +297,7 @@ filtering: $ pytest --cache-show example/* =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y - cachedir: .pytest_cache + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y rootdir: /home/sweet/project cachedir: /home/sweet/project/.pytest_cache ----------------------- cache values for 'example/*' ----------------------- diff --git a/doc/en/how-to/capture-stdout-stderr.rst b/doc/en/how-to/capture-stdout-stderr.rst index 14628df6164..9ccea719b64 100644 --- a/doc/en/how-to/capture-stdout-stderr.rst +++ b/doc/en/how-to/capture-stdout-stderr.rst @@ -83,8 +83,7 @@ of the failing function and hide the other one: $ pytest =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y - cachedir: .pytest_cache + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y rootdir: /home/sweet/project collected 2 items diff --git a/doc/en/how-to/capture-warnings.rst b/doc/en/how-to/capture-warnings.rst index 4c89905e2c6..7e877b4d3da 100644 --- a/doc/en/how-to/capture-warnings.rst +++ b/doc/en/how-to/capture-warnings.rst @@ -28,8 +28,7 @@ Running pytest now produces this output: $ pytest test_show_warnings.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y - cachedir: .pytest_cache + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y rootdir: /home/sweet/project collected 1 item diff --git a/doc/en/how-to/doctest.rst b/doc/en/how-to/doctest.rst index 29e689e1290..ce0b5a5f649 100644 --- a/doc/en/how-to/doctest.rst +++ b/doc/en/how-to/doctest.rst @@ -30,8 +30,7 @@ then you can just invoke ``pytest`` directly: $ pytest =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y - cachedir: .pytest_cache + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y rootdir: /home/sweet/project collected 1 item @@ -59,8 +58,7 @@ and functions, including from test modules: $ pytest --doctest-modules =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y - cachedir: .pytest_cache + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y rootdir: /home/sweet/project collected 2 items diff --git a/doc/en/how-to/fixtures.rst b/doc/en/how-to/fixtures.rst index e0ac36e792d..08013877455 100644 --- a/doc/en/how-to/fixtures.rst +++ b/doc/en/how-to/fixtures.rst @@ -432,8 +432,7 @@ marked ``smtp_connection`` fixture function. Running the test looks like this: $ pytest test_module.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y - cachedir: .pytest_cache + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y rootdir: /home/sweet/project collected 2 items @@ -1331,8 +1330,7 @@ Running the above tests results in the following test IDs being used: $ pytest --collect-only =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y - cachedir: .pytest_cache + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y rootdir: /home/sweet/project collected 11 items @@ -1384,7 +1382,7 @@ Running this test will *skip* the invocation of ``data_set`` with value ``2``: $ pytest test_fixture_marks.py -v =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python cachedir: .pytest_cache rootdir: /home/sweet/project collecting ... collected 3 items @@ -1434,7 +1432,7 @@ Here we declare an ``app`` fixture which receives the previously defined $ pytest -v test_appsetup.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python cachedir: .pytest_cache rootdir: /home/sweet/project collecting ... collected 2 items @@ -1514,7 +1512,7 @@ Let's run the tests in verbose mode and with looking at the print-output: $ pytest -v -s test_module.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python cachedir: .pytest_cache rootdir: /home/sweet/project collecting ... collected 8 items diff --git a/doc/en/how-to/output.rst b/doc/en/how-to/output.rst index 38de25edc7b..4b90988f49d 100644 --- a/doc/en/how-to/output.rst +++ b/doc/en/how-to/output.rst @@ -323,8 +323,7 @@ Example: $ pytest -ra =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y - cachedir: .pytest_cache + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y rootdir: /home/sweet/project collected 6 items @@ -381,8 +380,7 @@ More than one character can be used, so for example to only see failed and skipp $ pytest -rfs =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y - cachedir: .pytest_cache + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y rootdir: /home/sweet/project collected 6 items @@ -417,8 +415,7 @@ captured output: $ pytest -rpP =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y - cachedir: .pytest_cache + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y rootdir: /home/sweet/project collected 6 items diff --git a/doc/en/how-to/parametrize.rst b/doc/en/how-to/parametrize.rst index 240016601be..a0c9968428c 100644 --- a/doc/en/how-to/parametrize.rst +++ b/doc/en/how-to/parametrize.rst @@ -56,8 +56,7 @@ them in turn: $ pytest =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y - cachedir: .pytest_cache + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y rootdir: /home/sweet/project collected 3 items @@ -168,8 +167,7 @@ Let's run this: $ pytest =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y - cachedir: .pytest_cache + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y rootdir: /home/sweet/project collected 3 items diff --git a/doc/en/how-to/tmp_path.rst b/doc/en/how-to/tmp_path.rst index 3e95116dca9..ebd74d42e90 100644 --- a/doc/en/how-to/tmp_path.rst +++ b/doc/en/how-to/tmp_path.rst @@ -36,8 +36,7 @@ Running this would result in a passed test except for the last $ pytest test_tmp_path.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y - cachedir: .pytest_cache + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y rootdir: /home/sweet/project collected 1 item diff --git a/doc/en/how-to/unittest.rst b/doc/en/how-to/unittest.rst index e2a23a1a785..bff75110778 100644 --- a/doc/en/how-to/unittest.rst +++ b/doc/en/how-to/unittest.rst @@ -136,8 +136,7 @@ the ``self.db`` values in the traceback: $ pytest test_unittest_db.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y - cachedir: .pytest_cache + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y rootdir: /home/sweet/project collected 2 items diff --git a/doc/en/how-to/writing_plugins.rst b/doc/en/how-to/writing_plugins.rst index 28ed8f5f76d..b2d2b6563d6 100644 --- a/doc/en/how-to/writing_plugins.rst +++ b/doc/en/how-to/writing_plugins.rst @@ -445,8 +445,7 @@ in our ``pytest.ini`` to tell pytest where to look for example files. $ pytest =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y - cachedir: .pytest_cache + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y rootdir: /home/sweet/project, configfile: pytest.ini collected 2 items diff --git a/doc/en/index.rst b/doc/en/index.rst index 2f771aa3c42..3d7c2f53709 100644 --- a/doc/en/index.rst +++ b/doc/en/index.rst @@ -44,8 +44,7 @@ To execute it: $ pytest =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y - cachedir: .pytest_cache + platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y rootdir: /home/sweet/project collected 1 item diff --git a/doc/en/reference/reference.rst b/doc/en/reference/reference.rst index 42897e3d18f..8f6f2ce7cb1 100644 --- a/doc/en/reference/reference.rst +++ b/doc/en/reference/reference.rst @@ -2019,6 +2019,7 @@ All the command-line flags can be obtained by running ``pytest --help``:: default value for --log-file-date-format log_auto_indent (string): default value for --log-auto-indent + pythonpath (paths): Add paths to sys.path faulthandler_timeout (string): Dump the traceback of all threads if a test takes more than TIMEOUT seconds to finish. From dc7091502d92b3f4c5b7eeaccd8a00255e9a4879 Mon Sep 17 00:00:00 2001 From: Yuval Shimon Date: Tue, 7 Dec 2021 11:31:03 +0200 Subject: [PATCH 005/176] Fixed error message prints function decorators when using assert in Python 3.9 and above. (#9359) --- AUTHORS | 1 + changelog/9355.bugfix.rst | 1 + src/_pytest/_code/source.py | 5 +++++ testing/code/test_source.py | 13 +++++++++++++ 4 files changed, 20 insertions(+) create mode 100644 changelog/9355.bugfix.rst diff --git a/AUTHORS b/AUTHORS index c57502ac22b..25b55e5aed2 100644 --- a/AUTHORS +++ b/AUTHORS @@ -348,6 +348,7 @@ Xixi Zhao Xuan Luong Xuecong Liao Yoav Caspi +Yuval Shimon Zac Hatfield-Dodds Zachary Kneupper Zoltán Máté diff --git a/changelog/9355.bugfix.rst b/changelog/9355.bugfix.rst new file mode 100644 index 00000000000..62ea79ea492 --- /dev/null +++ b/changelog/9355.bugfix.rst @@ -0,0 +1 @@ +Fixed error message prints function decorators when using assert in Python 3.9 and above. diff --git a/src/_pytest/_code/source.py b/src/_pytest/_code/source.py index 6f54057c0a9..208cfb80037 100644 --- a/src/_pytest/_code/source.py +++ b/src/_pytest/_code/source.py @@ -149,6 +149,11 @@ def get_statement_startend2(lineno: int, node: ast.AST) -> Tuple[int, Optional[i values: List[int] = [] for x in ast.walk(node): if isinstance(x, (ast.stmt, ast.ExceptHandler)): + # Before Python 3.8, the lineno of a decorated class or function pointed at the decorator. + # Since Python 3.8, the lineno points to the class/def, so need to include the decorators. + if isinstance(x, (ast.ClassDef, ast.FunctionDef, ast.AsyncFunctionDef)): + for d in x.decorator_list: + values.append(d.lineno - 1) values.append(x.lineno - 1) for name in ("finalbody", "orelse"): val: Optional[List[ast.stmt]] = getattr(x, name, None) diff --git a/testing/code/test_source.py b/testing/code/test_source.py index 53e1bb9856b..53202ee27e3 100644 --- a/testing/code/test_source.py +++ b/testing/code/test_source.py @@ -618,6 +618,19 @@ def something(): assert str(source) == "def func(): raise ValueError(42)" +def test_decorator() -> None: + s = """\ +def foo(f): + pass + +@foo +def bar(): + pass + """ + source = getstatement(3, s) + assert "@foo" in str(source) + + def XXX_test_expression_multiline() -> None: source = """\ something From 5cb50fa13cfc2485f4ea4fcac4eec295aa93f94b Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 7 Dec 2021 11:04:55 +0100 Subject: [PATCH 006/176] Fix changelog URL in 7.0.0rc1 announcement (#9379) The changelog does not exist at /stable because an rc isn't stable... --- doc/en/announce/release-7.0.0rc1.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/en/announce/release-7.0.0rc1.rst b/doc/en/announce/release-7.0.0rc1.rst index de9bcd42fd1..a5bf0ed3c44 100644 --- a/doc/en/announce/release-7.0.0rc1.rst +++ b/doc/en/announce/release-7.0.0rc1.rst @@ -19,7 +19,7 @@ You can upgrade from PyPI via: Users are encouraged to take a look at the CHANGELOG carefully: - https://docs.pytest.org/en/stable/changelog.html + https://docs.pytest.org/en/7.0.x/changelog.html Thanks to all the contributors to this release: From 21a186bbda5ce2407af6a626023879c8c5809431 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 7 Dec 2021 11:24:57 +0100 Subject: [PATCH 007/176] scripts: Use release branch for changelog URL (#9380) * scripts: Use release branch for changelog URL With a prerelease, /stable won't show the correct changelog. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- scripts/prepare-release-pr.py | 4 ++++ scripts/release.pre.rst | 2 +- scripts/release.py | 14 ++++++++++---- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/scripts/prepare-release-pr.py b/scripts/prepare-release-pr.py index f16e7b9625c..73088397d55 100644 --- a/scripts/prepare-release-pr.py +++ b/scripts/prepare-release-pr.py @@ -90,10 +90,13 @@ def prepare_release_pr( if prerelease: template_name = "release.pre.rst" + doc_version = release_branch elif is_feature_release: template_name = "release.minor.rst" + doc_version = "" # unused in template else: template_name = "release.patch.rst" + doc_version = "" # unused in template # important to use tox here because we have changed branches, so dependencies # might have changed as well @@ -104,6 +107,7 @@ def prepare_release_pr( "--", version, template_name, + doc_version, "--skip-check-links", ] print("Running", " ".join(cmdline)) diff --git a/scripts/release.pre.rst b/scripts/release.pre.rst index f0b054de3fc..960fae7e4f6 100644 --- a/scripts/release.pre.rst +++ b/scripts/release.pre.rst @@ -19,7 +19,7 @@ You can upgrade from PyPI via: Users are encouraged to take a look at the CHANGELOG carefully: - https://docs.pytest.org/en/stable/changelog.html + https://docs.pytest.org/en/{doc_version}/changelog.html Thanks to all the contributors to this release: diff --git a/scripts/release.py b/scripts/release.py index 19608991b61..19fef428428 100644 --- a/scripts/release.py +++ b/scripts/release.py @@ -10,7 +10,7 @@ from colorama import init -def announce(version, template_name): +def announce(version, template_name, doc_version): """Generates a new release announcement entry in the docs.""" # Get our list of authors stdout = check_output(["git", "describe", "--abbrev=0", "--tags"]) @@ -31,7 +31,9 @@ def announce(version, template_name): ) contributors_text = "\n".join(f"* {name}" for name in sorted(contributors)) + "\n" - text = template_text.format(version=version, contributors=contributors_text) + text = template_text.format( + version=version, contributors=contributors_text, doc_version=doc_version + ) target = Path(__file__).parent.joinpath(f"../doc/en/announce/release-{version}.rst") target.write_text(text, encoding="UTF-8") @@ -82,9 +84,9 @@ def check_links(): check_call(["tox", "-e", "docs-checklinks"]) -def pre_release(version, template_name, *, skip_check_links): +def pre_release(version, template_name, doc_version, *, skip_check_links): """Generates new docs, release announcements and creates a local tag.""" - announce(version, template_name) + announce(version, template_name, doc_version) regen(version) changelog(version, write_out=True) fix_formatting() @@ -112,11 +114,15 @@ def main(): parser.add_argument( "template_name", help="Name of template file to use for release announcement" ) + parser.add_argument( + "doc_version", help="For prereleases, the version to link to in the docs" + ) parser.add_argument("--skip-check-links", action="store_true", default=False) options = parser.parse_args() pre_release( options.version, options.template_name, + options.doc_version, skip_check_links=options.skip_check_links, ) From 49278c1df8ae3670f5ecc2ce7110453c1aedea4e Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Tue, 7 Dec 2021 15:04:27 +0200 Subject: [PATCH 008/176] RELEASING: should also tag dev0 for prereleases --- RELEASING.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RELEASING.rst b/RELEASING.rst index 25ce90d0f65..f9e4d5f153c 100644 --- a/RELEASING.rst +++ b/RELEASING.rst @@ -152,7 +152,7 @@ Both automatic and manual processes described above follow the same steps from t #. Open a PR for ``cherry-pick-release`` and merge it once CI passes. No need to wait for approvals if there were no conflicts on the previous step. -#. For major and minor releases, tag the release cherry-pick merge commit in main with +#. For major and minor releases (or the first prerelease of it), tag the release cherry-pick merge commit in main with a dev tag for the next feature release:: git checkout main From b691d31897fae46fda0cf0445f5386c54460f09a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric?= Date: Tue, 7 Dec 2021 10:59:12 -0500 Subject: [PATCH 009/176] fix typo --- doc/en/deprecations.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/en/deprecations.rst b/doc/en/deprecations.rst index ea9ef2aa35d..bcd13fd5bff 100644 --- a/doc/en/deprecations.rst +++ b/doc/en/deprecations.rst @@ -127,7 +127,7 @@ Passing ``msg=`` to ``pytest.skip``, ``pytest.fail`` or ``pytest.exit`` Passing the keyword argument ``msg`` to :func:`pytest.skip`, :func:`pytest.fail` or :func:`pytest.exit` is now deprecated and ``reason`` should be used instead. This change is to bring consistency between these -functions and the``@pytest.mark.skip`` and ``@pytest.mark.xfail`` markers which already accept a ``reason`` argument. +functions and the ``@pytest.mark.skip`` and ``@pytest.mark.xfail`` markers which already accept a ``reason`` argument. .. code-block:: python From 0b0e2d2dbb59ad20c7e70691dec56fc5e2b1047c Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Tue, 7 Dec 2021 21:56:46 +0200 Subject: [PATCH 010/176] Remove deprecated `_fillfuncargs` function --- doc/en/deprecations.rst | 14 ++++--- doc/en/how-to/plugins.rst | 3 -- src/_pytest/deprecated.py | 6 --- src/_pytest/fixtures.py | 37 ------------------ src/pytest/__init__.py | 2 - src/pytest/collect.py | 1 - testing/deprecated_test.py | 25 ------------ testing/python/fixtures.py | 4 -- testing/python/integration.py | 74 ----------------------------------- 9 files changed, 8 insertions(+), 158 deletions(-) diff --git a/doc/en/deprecations.rst b/doc/en/deprecations.rst index bcd13fd5bff..c0f32c3bc61 100644 --- a/doc/en/deprecations.rst +++ b/doc/en/deprecations.rst @@ -269,10 +269,18 @@ The ``pytest.collect`` module is no longer part of the public API, all its names should now be imported from ``pytest`` directly instead. +Removed Features +---------------- + +As stated in our :ref:`backwards-compatibility` policy, deprecated features are removed only in major releases after +an appropriate period of deprecation has passed. + + The ``pytest._fillfuncargs`` function ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. deprecated:: 6.0 +.. versionremoved:: 7.0 This function was kept for backward compatibility with an older plugin. @@ -281,12 +289,6 @@ it, use `function._request._fillfixtures()` instead, though note this is not a public API and may break in the future. -Removed Features ----------------- - -As stated in our :ref:`backwards-compatibility` policy, deprecated features are removed only in major releases after -an appropriate period of deprecation has passed. - ``--no-print-logs`` command-line option ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/doc/en/how-to/plugins.rst b/doc/en/how-to/plugins.rst index cae737e96ed..de31bc04a86 100644 --- a/doc/en/how-to/plugins.rst +++ b/doc/en/how-to/plugins.rst @@ -51,9 +51,6 @@ Here is a little annotated list for some popular plugins: * :pypi:`pytest-flakes`: check source code with pyflakes. -* :pypi:`oejskit`: - a plugin to run javascript unittests in live browsers. - To see a complete list of all plugins with their latest testing status against different pytest and Python versions, please visit :ref:`plugin-list`. diff --git a/src/_pytest/deprecated.py b/src/_pytest/deprecated.py index 5f1edd60727..88114fbf345 100644 --- a/src/_pytest/deprecated.py +++ b/src/_pytest/deprecated.py @@ -24,12 +24,6 @@ } -FILLFUNCARGS = UnformattedWarning( - PytestRemovedIn7Warning, - "{name} is deprecated, use " - "function._request._fillfixtures() instead if you cannot avoid reaching into internals.", -) - PYTEST_COLLECT_MODULE = UnformattedWarning( PytestRemovedIn7Warning, "pytest.collect.{name} was moved to pytest.{name}\n" diff --git a/src/_pytest/fixtures.py b/src/_pytest/fixtures.py index fddff931c51..e0409fcf2d7 100644 --- a/src/_pytest/fixtures.py +++ b/src/_pytest/fixtures.py @@ -52,7 +52,6 @@ from _pytest.config import Config from _pytest.config.argparsing import Parser from _pytest.deprecated import check_ispytest -from _pytest.deprecated import FILLFUNCARGS from _pytest.deprecated import YIELD_FIXTURE from _pytest.mark import Mark from _pytest.mark import ParameterSet @@ -73,7 +72,6 @@ from _pytest.scope import _ScopeName from _pytest.main import Session from _pytest.python import CallSpec2 - from _pytest.python import Function from _pytest.python import Metafunc @@ -352,41 +350,6 @@ def reorder_items_atscope( return items_done -def _fillfuncargs(function: "Function") -> None: - """Fill missing fixtures for a test function, old public API (deprecated).""" - warnings.warn(FILLFUNCARGS.format(name="pytest._fillfuncargs()"), stacklevel=2) - _fill_fixtures_impl(function) - - -def fillfixtures(function: "Function") -> None: - """Fill missing fixtures for a test function (deprecated).""" - warnings.warn( - FILLFUNCARGS.format(name="_pytest.fixtures.fillfixtures()"), stacklevel=2 - ) - _fill_fixtures_impl(function) - - -def _fill_fixtures_impl(function: "Function") -> None: - """Internal implementation to fill fixtures on the given function object.""" - try: - request = function._request - except AttributeError: - # XXX this special code path is only expected to execute - # with the oejskit plugin. It uses classes with funcargs - # and we thus have to work a bit to allow this. - fm = function.session._fixturemanager - assert function.parent is not None - fi = fm.getfixtureinfo(function.parent, function.obj, None) - function._fixtureinfo = fi - request = function._request = FixtureRequest(function, _ispytest=True) - fm.session._setupstate.setup(function) - request._fillfixtures() - # Prune out funcargs for jstests. - function.funcargs = {name: function.funcargs[name] for name in fi.argnames} - else: - request._fillfixtures() - - def get_direct_param_fixture_func(request): return request.param diff --git a/src/pytest/__init__.py b/src/pytest/__init__.py index 7a596cd3783..26b87c7f567 100644 --- a/src/pytest/__init__.py +++ b/src/pytest/__init__.py @@ -19,7 +19,6 @@ from _pytest.config.argparsing import OptionGroup from _pytest.config.argparsing import Parser from _pytest.debugging import pytestPDB as __pytestPDB -from _pytest.fixtures import _fillfuncargs from _pytest.fixtures import fixture from _pytest.fixtures import FixtureLookupError from _pytest.fixtures import FixtureRequest @@ -81,7 +80,6 @@ __all__ = [ "__version__", - "_fillfuncargs", "approx", "Cache", "CallInfo", diff --git a/src/pytest/collect.py b/src/pytest/collect.py index 4b2b5818066..71afe5d9cca 100644 --- a/src/pytest/collect.py +++ b/src/pytest/collect.py @@ -15,7 +15,6 @@ "Item", "Class", "File", - "_fillfuncargs", ] diff --git a/testing/deprecated_test.py b/testing/deprecated_test.py index 7d7e6d31240..e4dcfa67fb2 100644 --- a/testing/deprecated_test.py +++ b/testing/deprecated_test.py @@ -2,7 +2,6 @@ import sys import warnings from pathlib import Path -from unittest import mock import pytest from _pytest import deprecated @@ -28,30 +27,6 @@ def test_external_plugins_integrated(pytester: Pytester, plugin) -> None: pytester.parseconfig("-p", plugin) -def test_fillfuncargs_is_deprecated() -> None: - with pytest.warns( - pytest.PytestDeprecationWarning, - match=re.escape( - "pytest._fillfuncargs() is deprecated, use " - "function._request._fillfixtures() instead if you cannot avoid reaching into internals." - ), - ): - pytest._fillfuncargs(mock.Mock()) - - -def test_fillfixtures_is_deprecated() -> None: - import _pytest.fixtures - - with pytest.warns( - pytest.PytestDeprecationWarning, - match=re.escape( - "_pytest.fixtures.fillfixtures() is deprecated, use " - "function._request._fillfixtures() instead if you cannot avoid reaching into internals." - ), - ): - _pytest.fixtures.fillfixtures(mock.Mock()) - - def test_minus_k_dash_is_deprecated(pytester: Pytester) -> None: threepass = pytester.makepyfile( test_threepass=""" diff --git a/testing/python/fixtures.py b/testing/python/fixtures.py index f29ca1dfa59..3ce5cb34ddd 100644 --- a/testing/python/fixtures.py +++ b/testing/python/fixtures.py @@ -103,10 +103,6 @@ class T: @pytest.mark.pytester_example_path("fixtures/fill_fixtures") class TestFillFixtures: - def test_fillfuncargs_exposed(self): - # used by oejskit, kept for compatibility - assert pytest._fillfuncargs == fixtures._fillfuncargs - def test_funcarg_lookupfails(self, pytester: Pytester) -> None: pytester.copy_example() result = pytester.runpytest() # "--collect-only") diff --git a/testing/python/integration.py b/testing/python/integration.py index d138b726638..6b5c53c98c4 100644 --- a/testing/python/integration.py +++ b/testing/python/integration.py @@ -1,84 +1,10 @@ -from typing import Any - import pytest -from _pytest import runner from _pytest._code import getfslineno from _pytest.fixtures import getfixturemarker from _pytest.pytester import Pytester from _pytest.python import Function -class TestOEJSKITSpecials: - def test_funcarg_non_pycollectobj( - self, pytester: Pytester, recwarn - ) -> None: # rough jstests usage - pytester.makeconftest( - """ - import pytest - def pytest_pycollect_makeitem(collector, name, obj): - if name == "MyClass": - return MyCollector.from_parent(collector, name=name) - class MyCollector(pytest.Collector): - def reportinfo(self): - return self.path, 3, "xyz" - """ - ) - modcol = pytester.getmodulecol( - """ - import pytest - @pytest.fixture - def arg1(request): - return 42 - class MyClass(object): - pass - """ - ) - # this hook finds funcarg factories - rep = runner.collect_one_node(collector=modcol) - # TODO: Don't treat as Any. - clscol: Any = rep.result[0] - clscol.obj = lambda arg1: None - clscol.funcargs = {} - pytest._fillfuncargs(clscol) - assert clscol.funcargs["arg1"] == 42 - - def test_autouse_fixture( - self, pytester: Pytester, recwarn - ) -> None: # rough jstests usage - pytester.makeconftest( - """ - import pytest - def pytest_pycollect_makeitem(collector, name, obj): - if name == "MyClass": - return MyCollector.from_parent(collector, name=name) - class MyCollector(pytest.Collector): - def reportinfo(self): - return self.path, 3, "xyz" - """ - ) - modcol = pytester.getmodulecol( - """ - import pytest - @pytest.fixture(autouse=True) - def hello(): - pass - @pytest.fixture - def arg1(request): - return 42 - class MyClass(object): - pass - """ - ) - # this hook finds funcarg factories - rep = runner.collect_one_node(modcol) - # TODO: Don't treat as Any. - clscol: Any = rep.result[0] - clscol.obj = lambda: None - clscol.funcargs = {} - pytest._fillfuncargs(clscol) - assert not clscol.funcargs - - def test_wrapped_getfslineno() -> None: def func(): pass From 41d8fb09ca1d201ef126347c4bffe77f0e0245d2 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Tue, 7 Dec 2021 22:00:31 +0200 Subject: [PATCH 011/176] Remove deprecated `pytest_warning_captured` hook --- doc/en/deprecations.rst | 23 ++++++++++++---------- doc/en/reference/reference.rst | 1 - src/_pytest/config/__init__.py | 8 -------- src/_pytest/deprecated.py | 5 ----- src/_pytest/hookspec.py | 36 ---------------------------------- src/_pytest/warnings.py | 8 -------- testing/test_warnings.py | 8 ++++---- 7 files changed, 17 insertions(+), 72 deletions(-) diff --git a/doc/en/deprecations.rst b/doc/en/deprecations.rst index c0f32c3bc61..a966e6efce8 100644 --- a/doc/en/deprecations.rst +++ b/doc/en/deprecations.rst @@ -250,16 +250,6 @@ The ``yield_fixture`` function/decorator It has been so for a very long time, so can be search/replaced safely. -The ``pytest_warning_captured`` hook -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -.. deprecated:: 6.0 - -This hook has an `item` parameter which cannot be serialized by ``pytest-xdist``. - -Use the ``pytest_warning_recored`` hook instead, which replaces the ``item`` parameter -by a ``nodeid`` parameter. - The ``pytest.collect`` module ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -276,6 +266,19 @@ As stated in our :ref:`backwards-compatibility` policy, deprecated features are an appropriate period of deprecation has passed. +The ``pytest_warning_captured`` hook +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. deprecated:: 6.0 +.. versionremoved:: 7.0 + +This hook has an `item` parameter which cannot be serialized by ``pytest-xdist``. + +Use the ``pytest_warning_recored`` hook instead, which replaces the ``item`` parameter +by a ``nodeid`` parameter. + + + The ``pytest._fillfuncargs`` function ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/doc/en/reference/reference.rst b/doc/en/reference/reference.rst index 8f6f2ce7cb1..c132ae6d3dd 100644 --- a/doc/en/reference/reference.rst +++ b/doc/en/reference/reference.rst @@ -758,7 +758,6 @@ Session related reporting hooks: .. autofunction:: pytest_terminal_summary .. autofunction:: pytest_fixture_setup .. autofunction:: pytest_fixture_post_finalizer -.. autofunction:: pytest_warning_captured .. autofunction:: pytest_warning_recorded Central hook for reporting about test execution: diff --git a/src/_pytest/config/__init__.py b/src/_pytest/config/__init__.py index eadce78fa65..4cb22009a06 100644 --- a/src/_pytest/config/__init__.py +++ b/src/_pytest/config/__init__.py @@ -1330,14 +1330,6 @@ def issue_config_time_warning(self, warning: Warning, stacklevel: int) -> None: if records: frame = sys._getframe(stacklevel - 1) location = frame.f_code.co_filename, frame.f_lineno, frame.f_code.co_name - self.hook.pytest_warning_captured.call_historic( - kwargs=dict( - warning_message=records[0], - when="config", - item=None, - location=location, - ) - ) self.hook.pytest_warning_recorded.call_historic( kwargs=dict( warning_message=records[0], diff --git a/src/_pytest/deprecated.py b/src/_pytest/deprecated.py index 88114fbf345..0d0af725e84 100644 --- a/src/_pytest/deprecated.py +++ b/src/_pytest/deprecated.py @@ -46,11 +46,6 @@ "Please open an issue if you use this and want a replacement." ) -WARNING_CAPTURED_HOOK = PytestRemovedIn7Warning( - "The pytest_warning_captured is deprecated and will be removed in a future release.\n" - "Please use pytest_warning_recorded instead." -) - WARNING_CMDLINE_PREPARSE_HOOK = PytestRemovedIn8Warning( "The pytest_cmdline_preparse hook is deprecated and will be removed in a future release. \n" "Please use pytest_load_initial_conftests hook instead." diff --git a/src/_pytest/hookspec.py b/src/_pytest/hookspec.py index b65be981560..57f199499d5 100644 --- a/src/_pytest/hookspec.py +++ b/src/_pytest/hookspec.py @@ -13,7 +13,6 @@ from pluggy import HookspecMarker -from _pytest.deprecated import WARNING_CAPTURED_HOOK from _pytest.deprecated import WARNING_CMDLINE_PREPARSE_HOOK if TYPE_CHECKING: @@ -777,41 +776,6 @@ def pytest_terminal_summary( """ -@hookspec(historic=True, warn_on_impl=WARNING_CAPTURED_HOOK) -def pytest_warning_captured( - warning_message: "warnings.WarningMessage", - when: "Literal['config', 'collect', 'runtest']", - item: Optional["Item"], - location: Optional[Tuple[str, int, str]], -) -> None: - """(**Deprecated**) Process a warning captured by the internal pytest warnings plugin. - - .. deprecated:: 6.0 - - This hook is considered deprecated and will be removed in a future pytest version. - Use :func:`pytest_warning_recorded` instead. - - :param warnings.WarningMessage warning_message: - The captured warning. This is the same object produced by :py:func:`warnings.catch_warnings`, and contains - the same attributes as the parameters of :py:func:`warnings.showwarning`. - - :param str when: - Indicates when the warning was captured. Possible values: - - * ``"config"``: during pytest configuration/initialization stage. - * ``"collect"``: during test collection. - * ``"runtest"``: during test execution. - - :param pytest.Item|None item: - The item being executed if ``when`` is ``"runtest"``, otherwise ``None``. - - :param tuple location: - When available, holds information about the execution context of the captured - warning (filename, linenumber, function). ``function`` evaluates to - when the execution context is at the module level. - """ - - @hookspec(historic=True) def pytest_warning_recorded( warning_message: "warnings.WarningMessage", diff --git a/src/_pytest/warnings.py b/src/_pytest/warnings.py index c0c946cbde5..d5afbfeb64c 100644 --- a/src/_pytest/warnings.py +++ b/src/_pytest/warnings.py @@ -63,14 +63,6 @@ def catch_warnings_for_item( yield for warning_message in log: - ihook.pytest_warning_captured.call_historic( - kwargs=dict( - warning_message=warning_message, - when=when, - item=item, - location=None, - ) - ) ihook.pytest_warning_recorded.call_historic( kwargs=dict( warning_message=warning_message, diff --git a/testing/test_warnings.py b/testing/test_warnings.py index cac716680f4..45acb720d1d 100644 --- a/testing/test_warnings.py +++ b/testing/test_warnings.py @@ -239,7 +239,7 @@ def test_func(): @pytest.mark.filterwarnings("always::UserWarning") -def test_warning_captured_hook(pytester: Pytester) -> None: +def test_warning_recorded_hook(pytester: Pytester) -> None: pytester.makeconftest( """ def pytest_configure(config): @@ -276,9 +276,9 @@ def pytest_warning_recorded(self, warning_message, when, nodeid, location): expected = [ ("config warning", "config", ""), ("collect warning", "collect", ""), - ("setup warning", "runtest", "test_warning_captured_hook.py::test_func"), - ("call warning", "runtest", "test_warning_captured_hook.py::test_func"), - ("teardown warning", "runtest", "test_warning_captured_hook.py::test_func"), + ("setup warning", "runtest", "test_warning_recorded_hook.py::test_func"), + ("call warning", "runtest", "test_warning_recorded_hook.py::test_func"), + ("teardown warning", "runtest", "test_warning_recorded_hook.py::test_func"), ] for index in range(len(expected)): collected_result = collected[index] From 927d9d274fd6b5045beeb87fcafdccac939daf84 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Tue, 7 Dec 2021 22:08:12 +0200 Subject: [PATCH 012/176] Remove deprecated `-k -foobar` syntax --- src/_pytest/deprecated.py | 4 ---- src/_pytest/mark/__init__.py | 5 ----- testing/deprecated_test.py | 12 ------------ 3 files changed, 21 deletions(-) diff --git a/src/_pytest/deprecated.py b/src/_pytest/deprecated.py index 0d0af725e84..274e63b8e64 100644 --- a/src/_pytest/deprecated.py +++ b/src/_pytest/deprecated.py @@ -37,10 +37,6 @@ "Use @pytest.fixture instead; they are the same." ) -MINUS_K_DASH = PytestRemovedIn7Warning( - "The `-k '-expr'` syntax to -k is deprecated.\nUse `-k 'not expr'` instead." -) - MINUS_K_COLON = PytestRemovedIn7Warning( "The `-k 'expr:'` syntax to -k is deprecated.\n" "Please open an issue if you use this and want a replacement." diff --git a/src/_pytest/mark/__init__.py b/src/_pytest/mark/__init__.py index 7e082f2e6e0..2eb305109e0 100644 --- a/src/_pytest/mark/__init__.py +++ b/src/_pytest/mark/__init__.py @@ -24,7 +24,6 @@ from _pytest.config import UsageError from _pytest.config.argparsing import Parser from _pytest.deprecated import MINUS_K_COLON -from _pytest.deprecated import MINUS_K_DASH from _pytest.stash import StashKey if TYPE_CHECKING: @@ -189,10 +188,6 @@ def deselect_by_keyword(items: "List[Item]", config: Config) -> None: if not keywordexpr: return - if keywordexpr.startswith("-"): - # To be removed in pytest 8.0.0. - warnings.warn(MINUS_K_DASH, stacklevel=2) - keywordexpr = "not " + keywordexpr[1:] selectuntil = False if keywordexpr[-1:] == ":": # To be removed in pytest 8.0.0. diff --git a/testing/deprecated_test.py b/testing/deprecated_test.py index e4dcfa67fb2..18483a4e362 100644 --- a/testing/deprecated_test.py +++ b/testing/deprecated_test.py @@ -27,18 +27,6 @@ def test_external_plugins_integrated(pytester: Pytester, plugin) -> None: pytester.parseconfig("-p", plugin) -def test_minus_k_dash_is_deprecated(pytester: Pytester) -> None: - threepass = pytester.makepyfile( - test_threepass=""" - def test_one(): assert 1 - def test_two(): assert 1 - def test_three(): assert 1 - """ - ) - result = pytester.runpytest("-k=-test_two", threepass) - result.stdout.fnmatch_lines(["*The `-k '-expr'` syntax*deprecated*"]) - - def test_minus_k_colon_is_deprecated(pytester: Pytester) -> None: threepass = pytester.makepyfile( test_threepass=""" From 4a45a5e983c0fc5c881e379ae90483e649ac6595 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Tue, 7 Dec 2021 22:13:58 +0200 Subject: [PATCH 013/176] Remove deprecated `-k foobar:` syntax --- src/_pytest/deprecated.py | 5 ----- src/_pytest/mark/__init__.py | 13 +------------ testing/deprecated_test.py | 12 ------------ testing/test_mark.py | 19 ------------------- testing/test_terminal.py | 4 +--- 5 files changed, 2 insertions(+), 51 deletions(-) diff --git a/src/_pytest/deprecated.py b/src/_pytest/deprecated.py index 274e63b8e64..9094911f9b3 100644 --- a/src/_pytest/deprecated.py +++ b/src/_pytest/deprecated.py @@ -37,11 +37,6 @@ "Use @pytest.fixture instead; they are the same." ) -MINUS_K_COLON = PytestRemovedIn7Warning( - "The `-k 'expr:'` syntax to -k is deprecated.\n" - "Please open an issue if you use this and want a replacement." -) - WARNING_CMDLINE_PREPARSE_HOOK = PytestRemovedIn8Warning( "The pytest_cmdline_preparse hook is deprecated and will be removed in a future release. \n" "Please use pytest_load_initial_conftests hook instead." diff --git a/src/_pytest/mark/__init__.py b/src/_pytest/mark/__init__.py index 2eb305109e0..11e6e34d73a 100644 --- a/src/_pytest/mark/__init__.py +++ b/src/_pytest/mark/__init__.py @@ -1,5 +1,4 @@ """Generic mechanism for marking and selecting python functions.""" -import warnings from typing import AbstractSet from typing import Collection from typing import List @@ -23,7 +22,6 @@ from _pytest.config import hookimpl from _pytest.config import UsageError from _pytest.config.argparsing import Parser -from _pytest.deprecated import MINUS_K_COLON from _pytest.stash import StashKey if TYPE_CHECKING: @@ -188,23 +186,14 @@ def deselect_by_keyword(items: "List[Item]", config: Config) -> None: if not keywordexpr: return - selectuntil = False - if keywordexpr[-1:] == ":": - # To be removed in pytest 8.0.0. - warnings.warn(MINUS_K_COLON, stacklevel=2) - selectuntil = True - keywordexpr = keywordexpr[:-1] - expr = _parse_expression(keywordexpr, "Wrong expression passed to '-k'") remaining = [] deselected = [] for colitem in items: - if keywordexpr and not expr.evaluate(KeywordMatcher.from_item(colitem)): + if not expr.evaluate(KeywordMatcher.from_item(colitem)): deselected.append(colitem) else: - if selectuntil: - keywordexpr = None remaining.append(colitem) if deselected: diff --git a/testing/deprecated_test.py b/testing/deprecated_test.py index 18483a4e362..54a55190016 100644 --- a/testing/deprecated_test.py +++ b/testing/deprecated_test.py @@ -27,18 +27,6 @@ def test_external_plugins_integrated(pytester: Pytester, plugin) -> None: pytester.parseconfig("-p", plugin) -def test_minus_k_colon_is_deprecated(pytester: Pytester) -> None: - threepass = pytester.makepyfile( - test_threepass=""" - def test_one(): assert 1 - def test_two(): assert 1 - def test_three(): assert 1 - """ - ) - result = pytester.runpytest("-k", "test_two:", threepass) - result.stdout.fnmatch_lines(["*The `-k 'expr:'` syntax*deprecated*"]) - - def test_fscollector_gethookproxy_isinitpath(pytester: Pytester) -> None: module = pytester.getmodulecol( """ diff --git a/testing/test_mark.py b/testing/test_mark.py index da67d1ea7bc..65f2581bd63 100644 --- a/testing/test_mark.py +++ b/testing/test_mark.py @@ -823,25 +823,6 @@ def pytest_pycollect_makeitem(name): assert len(dlist) == 1 assert dlist[0].items[0].name == "test_1" - def test_select_starton(self, pytester: Pytester) -> None: - threepass = pytester.makepyfile( - test_threepass=""" - def test_one(): assert 1 - def test_two(): assert 1 - def test_three(): assert 1 - """ - ) - reprec = pytester.inline_run( - "-Wignore::pytest.PytestRemovedIn7Warning", "-k", "test_two:", threepass - ) - passed, skipped, failed = reprec.listoutcomes() - assert len(passed) == 2 - assert not failed - dlist = reprec.getcalls("pytest_deselected") - assert len(dlist) == 1 - item = dlist[0].items[0] - assert item.name == "test_one" - def test_keyword_extra(self, pytester: Pytester) -> None: p = pytester.makepyfile( """ diff --git a/testing/test_terminal.py b/testing/test_terminal.py index 23f597e3325..b1904816c95 100644 --- a/testing/test_terminal.py +++ b/testing/test_terminal.py @@ -682,9 +682,7 @@ def test_three(): pass """ ) - result = pytester.runpytest( - "-Wignore::pytest.PytestRemovedIn7Warning", "-k", "test_two:", testpath - ) + result = pytester.runpytest("-k", "test_t", testpath) result.stdout.fnmatch_lines( ["collected 3 items / 1 deselected / 2 selected", "*test_deselected.py ..*"] ) From 0f39f11d88d714146fd719d87483f0cb2c7fa827 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Tue, 7 Dec 2021 22:14:55 +0200 Subject: [PATCH 014/176] Remove deprecated `pytest.collect` module --- doc/en/deprecations.rst | 14 ++++++++------ src/_pytest/deprecated.py | 7 ------- src/pytest/__init__.py | 2 -- src/pytest/collect.py | 37 ------------------------------------- testing/deprecated_test.py | 7 ------- 5 files changed, 8 insertions(+), 59 deletions(-) delete mode 100644 src/pytest/collect.py diff --git a/doc/en/deprecations.rst b/doc/en/deprecations.rst index a966e6efce8..c748316cb73 100644 --- a/doc/en/deprecations.rst +++ b/doc/en/deprecations.rst @@ -250,21 +250,23 @@ The ``yield_fixture`` function/decorator It has been so for a very long time, so can be search/replaced safely. +Removed Features +---------------- + +As stated in our :ref:`backwards-compatibility` policy, deprecated features are removed only in major releases after +an appropriate period of deprecation has passed. + + The ``pytest.collect`` module ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. deprecated:: 6.0 +.. versionremoved:: 7.0 The ``pytest.collect`` module is no longer part of the public API, all its names should now be imported from ``pytest`` directly instead. -Removed Features ----------------- - -As stated in our :ref:`backwards-compatibility` policy, deprecated features are removed only in major releases after -an appropriate period of deprecation has passed. - The ``pytest_warning_captured`` hook ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/src/_pytest/deprecated.py b/src/_pytest/deprecated.py index 9094911f9b3..f68aea37e4d 100644 --- a/src/_pytest/deprecated.py +++ b/src/_pytest/deprecated.py @@ -11,7 +11,6 @@ from warnings import warn from _pytest.warning_types import PytestDeprecationWarning -from _pytest.warning_types import PytestRemovedIn7Warning from _pytest.warning_types import PytestRemovedIn8Warning from _pytest.warning_types import UnformattedWarning @@ -24,12 +23,6 @@ } -PYTEST_COLLECT_MODULE = UnformattedWarning( - PytestRemovedIn7Warning, - "pytest.collect.{name} was moved to pytest.{name}\n" - "Please update to the new name.", -) - # This can be* removed pytest 8, but it's harmless and common, so no rush to remove. # * If you're in the future: "could have been". YIELD_FIXTURE = PytestDeprecationWarning( diff --git a/src/pytest/__init__.py b/src/pytest/__init__.py index 26b87c7f567..beb8eba03a2 100644 --- a/src/pytest/__init__.py +++ b/src/pytest/__init__.py @@ -1,6 +1,5 @@ # PYTHON_ARGCOMPLETE_OK """pytest: unit and functional testing with Python.""" -from . import collect from _pytest import __version__ from _pytest import version_tuple from _pytest._code import ExceptionInfo @@ -86,7 +85,6 @@ "CaptureFixture", "Class", "cmdline", - "collect", "Collector", "CollectReport", "Config", diff --git a/src/pytest/collect.py b/src/pytest/collect.py deleted file mode 100644 index 71afe5d9cca..00000000000 --- a/src/pytest/collect.py +++ /dev/null @@ -1,37 +0,0 @@ -import sys -import warnings -from types import ModuleType -from typing import Any -from typing import List - -import pytest -from _pytest.deprecated import PYTEST_COLLECT_MODULE - -COLLECT_FAKEMODULE_ATTRIBUTES = [ - "Collector", - "Module", - "Function", - "Session", - "Item", - "Class", - "File", -] - - -class FakeCollectModule(ModuleType): - def __init__(self) -> None: - super().__init__("pytest.collect") - self.__all__ = list(COLLECT_FAKEMODULE_ATTRIBUTES) - self.__pytest = pytest - - def __dir__(self) -> List[str]: - return dir(super()) + self.__all__ - - def __getattr__(self, name: str) -> Any: - if name not in self.__all__: - raise AttributeError(name) - warnings.warn(PYTEST_COLLECT_MODULE.format(name=name), stacklevel=2) - return getattr(pytest, name) - - -sys.modules["pytest.collect"] = FakeCollectModule() diff --git a/testing/deprecated_test.py b/testing/deprecated_test.py index 54a55190016..c316b074c4b 100644 --- a/testing/deprecated_test.py +++ b/testing/deprecated_test.py @@ -10,13 +10,6 @@ from pytest import PytestDeprecationWarning -@pytest.mark.parametrize("attribute", pytest.collect.__all__) # type: ignore -# false positive due to dynamic attribute -def test_pytest_collect_module_deprecated(attribute) -> None: - with pytest.warns(DeprecationWarning, match=attribute): - getattr(pytest.collect, attribute) - - @pytest.mark.parametrize("plugin", sorted(deprecated.DEPRECATED_EXTERNAL_PLUGINS)) @pytest.mark.filterwarnings("default") def test_external_plugins_integrated(pytester: Pytester, plugin) -> None: From 3ba9c01f9bfd442f2bcc4711e15612aa5b518cc3 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Wed, 8 Dec 2021 06:46:44 -0300 Subject: [PATCH 015/176] Hide internal stack when using pytest.approx() in bool context (#9394) This makes the error traceback point directly to the offending usage, rather than to the internal `Approx.__bool__` method. --- src/_pytest/python_api.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/_pytest/python_api.py b/src/_pytest/python_api.py index 26f78c66ad4..cb72fde1e1f 100644 --- a/src/_pytest/python_api.py +++ b/src/_pytest/python_api.py @@ -101,6 +101,7 @@ def __eq__(self, actual) -> bool: ) def __bool__(self): + __tracebackhide__ = True raise AssertionError( "approx() is not supported in a boolean context.\nDid you mean: `assert a == approx(b)`?" ) From 7ae23ff8ae6acdca4862e728bf7187c30d076d6c Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Wed, 8 Dec 2021 04:46:55 -0500 Subject: [PATCH 016/176] fix python version in changelog message (#9390) --- changelog/9355.bugfix.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog/9355.bugfix.rst b/changelog/9355.bugfix.rst index 62ea79ea492..a2739369fe0 100644 --- a/changelog/9355.bugfix.rst +++ b/changelog/9355.bugfix.rst @@ -1 +1 @@ -Fixed error message prints function decorators when using assert in Python 3.9 and above. +Fixed error message prints function decorators when using assert in Python 3.8 and above. From e05e696fdac097ebad4a77a47f878c81fca39cb2 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Thu, 4 Nov 2021 00:21:35 +0200 Subject: [PATCH 017/176] Make PyCollector an implementation detail - don't use in hook type annotation The `pytest_pycollector_makeitem` argument `collector` is currently annotated with type `PyCollector`. As part of #7469, that would have required us to expose it in the public API. But really it's an implementation detail, not something we want to expose. So replace the annotation with the concrete python collector types that are passed. Strictly speaking, `pytest_pycollector_makeitem` is called from `PyCollector.collect()`, so the new type annotation is incorrect if another type subclasses `PyCollector`. But the set of python collectors is closed (mapping to language constructs), and the type is private, so there shouldn't be any other deriving classes, and we can consider it effectively sealed (unfortunately Python does not provide a way to express this - yet?). --- src/_pytest/hookspec.py | 4 ++-- src/_pytest/python.py | 15 ++++++++++----- src/_pytest/unittest.py | 4 ++-- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/_pytest/hookspec.py b/src/_pytest/hookspec.py index b65be981560..8aaa6e434da 100644 --- a/src/_pytest/hookspec.py +++ b/src/_pytest/hookspec.py @@ -34,10 +34,10 @@ from _pytest.nodes import Collector from _pytest.nodes import Item from _pytest.outcomes import Exit + from _pytest.python import Class from _pytest.python import Function from _pytest.python import Metafunc from _pytest.python import Module - from _pytest.python import PyCollector from _pytest.reports import CollectReport from _pytest.reports import TestReport from _pytest.runner import CallInfo @@ -360,7 +360,7 @@ def pytest_pycollect_makemodule( @hookspec(firstresult=True) def pytest_pycollect_makeitem( - collector: "PyCollector", name: str, obj: object + collector: Union["Module", "Class"], name: str, obj: object ) -> Union[None, "Item", "Collector", List[Union["Item", "Collector"]]]: """Return a custom item/collector for a Python object in a module, or None. diff --git a/src/_pytest/python.py b/src/_pytest/python.py index b557cd8fa77..b5e391fb210 100644 --- a/src/_pytest/python.py +++ b/src/_pytest/python.py @@ -224,11 +224,15 @@ def pytest_pycollect_makemodule(module_path: Path, parent) -> "Module": @hookimpl(trylast=True) -def pytest_pycollect_makeitem(collector: "PyCollector", name: str, obj: object): +def pytest_pycollect_makeitem( + collector: Union["Module", "Class"], name: str, obj: object +) -> Union[None, nodes.Item, nodes.Collector, List[Union[nodes.Item, nodes.Collector]]]: + assert isinstance(collector, (Class, Module)), type(collector) # Nothing was collected elsewhere, let's do it here. if safe_isclass(obj): if collector.istestclass(obj, name): - return Class.from_parent(collector, name=name, obj=obj) + klass: Class = Class.from_parent(collector, name=name, obj=obj) + return klass elif collector.istestfunction(obj, name): # mock seems to store unbound methods (issue473), normalize it. obj = getattr(obj, "__func__", obj) @@ -247,15 +251,16 @@ def pytest_pycollect_makeitem(collector: "PyCollector", name: str, obj: object): ) elif getattr(obj, "__test__", True): if is_generator(obj): - res = Function.from_parent(collector, name=name) + res: Function = Function.from_parent(collector, name=name) reason = "yield tests were removed in pytest 4.0 - {name} will be ignored".format( name=name ) res.add_marker(MARK_GEN.xfail(run=False, reason=reason)) res.warn(PytestCollectionWarning(reason)) + return res else: - res = list(collector._genfunctions(name, obj)) - return res + return list(collector._genfunctions(name, obj)) + return None class PyobjMixin(nodes.Node): diff --git a/src/_pytest/unittest.py b/src/_pytest/unittest.py index 108095bfcbe..a05c3b4bc43 100644 --- a/src/_pytest/unittest.py +++ b/src/_pytest/unittest.py @@ -27,7 +27,7 @@ from _pytest.outcomes import xfail from _pytest.python import Class from _pytest.python import Function -from _pytest.python import PyCollector +from _pytest.python import Module from _pytest.runner import CallInfo from _pytest.scope import Scope @@ -42,7 +42,7 @@ def pytest_pycollect_makeitem( - collector: PyCollector, name: str, obj: object + collector: Union[Module, Class], name: str, obj: object ) -> Optional["UnitTestCase"]: # Has unittest been imported and is obj a subclass of its TestCase? try: From ee93557ef33c03d7a792af1921806b54fe7c7a89 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Tue, 7 Dec 2021 22:18:01 +0200 Subject: [PATCH 018/176] Remove `PytestRemovedIn7Warning` Fix #8838. --- changelog/8838.breaking.rst | 15 +++++++++++++++ src/_pytest/warning_types.py | 7 ------- src/_pytest/warnings.py | 2 -- src/pytest/__init__.py | 2 -- testing/test_warnings.py | 7 ++++--- 5 files changed, 19 insertions(+), 14 deletions(-) create mode 100644 changelog/8838.breaking.rst diff --git a/changelog/8838.breaking.rst b/changelog/8838.breaking.rst new file mode 100644 index 00000000000..f5c1fead874 --- /dev/null +++ b/changelog/8838.breaking.rst @@ -0,0 +1,15 @@ +As per our policy, the following features have been deprecated in the 6.X series and are now +removed: + +* ``pytest._fillfuncargs`` function. + +* ``pytest_warning_captured`` hook - use ``pytest_warning_recorded`` instead. + +* ``-k -foobar`` syntax - use ``-k 'not foobar'`` instead. + +* ``-k foobar:`` syntax. + +* ``pytest.collect`` module - import from ``pytest`` directly. + +For more information consult +`Deprecations and Removals `__ in the docs. diff --git a/src/_pytest/warning_types.py b/src/_pytest/warning_types.py index 2a97a319789..ac79bb53acc 100644 --- a/src/_pytest/warning_types.py +++ b/src/_pytest/warning_types.py @@ -48,13 +48,6 @@ class PytestDeprecationWarning(PytestWarning, DeprecationWarning): __module__ = "pytest" -@final -class PytestRemovedIn7Warning(PytestDeprecationWarning): - """Warning class for features that will be removed in pytest 7.""" - - __module__ = "pytest" - - @final class PytestRemovedIn8Warning(PytestDeprecationWarning): """Warning class for features that will be removed in pytest 8.""" diff --git a/src/_pytest/warnings.py b/src/_pytest/warnings.py index d5afbfeb64c..154283632cf 100644 --- a/src/_pytest/warnings.py +++ b/src/_pytest/warnings.py @@ -49,8 +49,6 @@ def catch_warnings_for_item( warnings.filterwarnings("always", category=DeprecationWarning) warnings.filterwarnings("always", category=PendingDeprecationWarning) - warnings.filterwarnings("error", category=pytest.PytestRemovedIn7Warning) - apply_warning_filters(config_filters, cmdline_filters) # apply filters from "filterwarnings" marks diff --git a/src/pytest/__init__.py b/src/pytest/__init__.py index beb8eba03a2..9c284ac9615 100644 --- a/src/pytest/__init__.py +++ b/src/pytest/__init__.py @@ -66,7 +66,6 @@ from _pytest.warning_types import PytestConfigWarning from _pytest.warning_types import PytestDeprecationWarning from _pytest.warning_types import PytestExperimentalApiWarning -from _pytest.warning_types import PytestRemovedIn7Warning from _pytest.warning_types import PytestRemovedIn8Warning from _pytest.warning_types import PytestUnhandledCoroutineWarning from _pytest.warning_types import PytestUnhandledThreadExceptionWarning @@ -125,7 +124,6 @@ "PytestConfigWarning", "PytestDeprecationWarning", "PytestExperimentalApiWarning", - "PytestRemovedIn7Warning", "PytestRemovedIn8Warning", "Pytester", "PytestPluginManager", diff --git a/testing/test_warnings.py b/testing/test_warnings.py index 45acb720d1d..3ae9ea33181 100644 --- a/testing/test_warnings.py +++ b/testing/test_warnings.py @@ -517,6 +517,7 @@ def test_hidden_by_system(self, pytester: Pytester, monkeypatch) -> None: assert WARNINGS_SUMMARY_HEADER not in result.stdout.str() +@pytest.mark.skip("not relevant until pytest 8.0") @pytest.mark.parametrize("change_default", [None, "ini", "cmdline"]) def test_removed_in_x_warning_as_error(pytester: Pytester, change_default) -> None: """This ensures that PytestRemovedInXWarnings raised by pytest are turned into errors. @@ -528,7 +529,7 @@ def test_removed_in_x_warning_as_error(pytester: Pytester, change_default) -> No """ import warnings, pytest def test(): - warnings.warn(pytest.PytestRemovedIn7Warning("some warning")) + warnings.warn(pytest.PytestRemovedIn8Warning("some warning")) """ ) if change_default == "ini": @@ -536,12 +537,12 @@ def test(): """ [pytest] filterwarnings = - ignore::pytest.PytestRemovedIn7Warning + ignore::pytest.PytestRemovedIn8Warning """ ) args = ( - ("-Wignore::pytest.PytestRemovedIn7Warning",) + ("-Wignore::pytest.PytestRemovedIn8Warning",) if change_default == "cmdline" else () ) From c85b14391d9be2afd5f19b10ecd6b84eec9dba3d Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Sun, 12 Dec 2021 00:47:26 +0200 Subject: [PATCH 019/176] ci: add a workflow for backporting to other branches To backport a PR, e.g. 1000, to another branch, e.g. `7.0.x`, add a label `backport 7.0.x` to the PR. This will trigger a workflow which will create a branch `backport-1000-to-7.0.x` based on the `7.0.x` branch with a cherry-pick of the PR's merge commit, and create a new PR for it against the `7.0.x` branch. It is very simplistic, for instance it doesn't handle cherry-pick failure gracefully, doesn't validate the state of the PR, doesn't check if the branch already exists, etc. But we can improve on it later as needed. Finally, PRs created by github actions do not themselves trigger further actions, i.e. the PR isn't checked. You need to close & reopen the PR for the checks to trigger. There are workarounds for this but they are either less secure or require more setup. --- .github/workflows/backport.yml | 45 ++++++++++++++++++++++++++++++++++ CONTRIBUTING.rst | 7 ++++++ 2 files changed, 52 insertions(+) create mode 100644 .github/workflows/backport.yml diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml new file mode 100644 index 00000000000..c1a0554199f --- /dev/null +++ b/.github/workflows/backport.yml @@ -0,0 +1,45 @@ +name: backport + +on: + pull_request: + types: [labeled] + +# Set permissions at the job level. +permissions: {} + +jobs: + backport: + if: ${{ startsWith(github.event.label.name, 'backport ') }} + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + persist-credentials: true + + - name: Create backport PR + run: | + set -eux + + git config --global user.name "pytest bot" + git config --global user.email "pytestbot@gmail.com" + + label='${{ github.event.label.name }}' + target_branch="${label#backport }" + backport_branch=backport-${{ github.event.number }}-to-"${target_branch}" + subject="[$target_branch] $(gh pr view --json title -q .title ${{ github.event.number }})" + + git checkout origin/"${target_branch}" -b "${backport_branch}" + git cherry-pick -x --mainline 1 ${{ github.event.pull_request.merge_commit_sha }} + git commit --amend --message "$subject" + git push --set-upstream origin --force-with-lease "${backport_branch}" + gh pr create \ + --base "${target_branch}" \ + --title "${subject}" \ + --body "Backport of PR #${{ github.event.number }} to $target_branch branch. PR created by backport workflow." + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 24bca723c8b..e72cbfe2401 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -391,6 +391,13 @@ actual latest release). The procedure for this is: request, as described above. An exception to this is if the bug fix is not applicable to ``main`` anymore. +Automatic method: + +Add a ``backport 1.2.x`` label to the PR you want to backport. This will create +a backport PR against the ``1.2.x`` branch. + +Manual method: + #. ``git checkout origin/1.2.x -b backport-XXXX`` # use the main PR number here #. Locate the merge commit on the PR, in the *merged* message, for example: From 99a8be200a3b67f40d2620c309ac14cf28ad5516 Mon Sep 17 00:00:00 2001 From: pytest bot Date: Sun, 12 Dec 2021 00:12:01 +0000 Subject: [PATCH 020/176] [automated] Update plugin list --- doc/en/reference/plugin_list.rst | 136 +++++++++++++++++++++---------- 1 file changed, 92 insertions(+), 44 deletions(-) diff --git a/doc/en/reference/plugin_list.rst b/doc/en/reference/plugin_list.rst index ebf40091369..8760860f9a6 100644 --- a/doc/en/reference/plugin_list.rst +++ b/doc/en/reference/plugin_list.rst @@ -11,7 +11,7 @@ automatically. Packages classified as inactive are excluded. creating a PDF, because otherwise the table gets far too wide for the page. -This list contains 963 plugins. +This list contains 969 plugins. .. only:: not latex @@ -29,6 +29,7 @@ This list contains 963 plugins. :pypi:`pytest-aiofiles` pytest fixtures for writing aiofiles tests with pyfakefs May 14, 2017 5 - Production/Stable N/A :pypi:`pytest-aiohttp` pytest plugin for aiohttp support Dec 05, 2017 N/A pytest :pypi:`pytest-aiohttp-client` Pytest \`client\` fixture for the Aiohttp Nov 01, 2020 N/A pytest (>=6) + :pypi:`pytest-aiomoto` pytest-aiomoto Dec 10, 2021 N/A pytest (>=6.2.5,<7.0.0) :pypi:`pytest-aioresponses` py.test integration for aioresponses Jul 29, 2021 4 - Beta pytest (>=3.5.0) :pypi:`pytest-aioworkers` A plugin to test aioworkers project with pytest Dec 04, 2019 4 - Beta pytest (>=3.5.0) :pypi:`pytest-airflow` pytest support for airflow. Apr 03, 2019 3 - Alpha pytest (>=4.4.0) @@ -151,7 +152,7 @@ This list contains 963 plugins. :pypi:`pytest-cloud` Distributed tests planner plugin for pytest testing framework. Oct 05, 2020 6 - Mature N/A :pypi:`pytest-cloudflare-worker` pytest plugin for testing cloudflare workers Mar 30, 2021 4 - Beta pytest (>=6.0.0) :pypi:`pytest-cobra` PyTest plugin for testing Smart Contracts for Ethereum blockchain. Jun 29, 2019 3 - Alpha pytest (<4.0.0,>=3.7.1) - :pypi:`pytest-codeblocks` Test code blocks in your READMEs Oct 13, 2021 4 - Beta pytest (>=6) + :pypi:`pytest-codeblocks` Test code blocks in your READMEs Dec 11, 2021 4 - Beta pytest (>=6) :pypi:`pytest-codecheckers` pytest plugin to add source code sanity checks (pep8 and friends) Feb 13, 2010 N/A N/A :pypi:`pytest-codecov` Pytest plugin for uploading pytest-cov results to codecov.io Oct 27, 2021 4 - Beta pytest (>=4.6.0) :pypi:`pytest-codegen` Automatically create pytest test signatures Aug 23, 2020 2 - Pre-Alpha N/A @@ -177,7 +178,7 @@ This list contains 963 plugins. :pypi:`pytest-coverage` Jun 17, 2015 N/A N/A :pypi:`pytest-coverage-context` Coverage dynamic context support for PyTest, including sub-processes Jan 04, 2021 4 - Beta pytest (>=6.1.0) :pypi:`pytest-cov-exclude` Pytest plugin for excluding tests based on coverage data Apr 29, 2016 4 - Beta pytest (>=2.8.0,<2.9.0); extra == 'dev' - :pypi:`pytest-cpp` Use pytest's runner to discover and execute C++ tests Dec 03, 2021 5 - Production/Stable pytest (!=5.4.0,!=5.4.1) + :pypi:`pytest-cpp` Use pytest's runner to discover and execute C++ tests Dec 06, 2021 5 - Production/Stable pytest (!=5.4.0,!=5.4.1) :pypi:`pytest-cram` Run cram tests with pytest. Aug 08, 2020 N/A N/A :pypi:`pytest-crate` Manages CrateDB instances during your integration tests May 28, 2019 3 - Alpha pytest (>=4.0) :pypi:`pytest-cricri` A Cricri plugin for pytest. Jan 27, 2018 N/A pytest @@ -227,7 +228,7 @@ This list contains 963 plugins. :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. Mar 20, 2021 3 - Alpha pytest (!=6.0.0,<7,>=3.3.2) - :pypi:`pytest-django` A Django plugin for pytest. Dec 02, 2021 5 - Production/Stable pytest (>=5.4.0) + :pypi:`pytest-django` A Django plugin for pytest. Dec 07, 2021 5 - Production/Stable pytest (>=5.4.0) :pypi:`pytest-django-ahead` A Django plugin for pytest. Oct 27, 2016 5 - Production/Stable pytest (>=2.9) :pypi:`pytest-djangoapp` Nice pytest plugin to help you with Django pluggable application testing. Aug 04, 2021 4 - Beta N/A :pypi:`pytest-django-cache-xdist` A djangocachexdist plugin for pytest May 12, 2020 4 - Beta N/A @@ -265,7 +266,7 @@ This list contains 963 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. Nov 16, 2021 3 - Alpha pytest (>=4.6) + :pypi:`pytest-doctestplus` Pytest plugin with advanced doctest features. Dec 09, 2021 3 - Alpha pytest (>=4.6) :pypi:`pytest-doctest-ufunc` A plugin to run doctests in docstrings of Numpy ufuncs Aug 02, 2020 4 - Beta pytest (>=3.5.0) :pypi:`pytest-dolphin` Some extra stuff that we use ininternally Nov 30, 2016 4 - Beta pytest (==3.0.4) :pypi:`pytest-doorstop` A pytest plugin for adding test results into doorstop items. Jun 09, 2020 4 - Beta pytest (>=3.5.0) @@ -273,7 +274,7 @@ This list contains 963 plugins. :pypi:`pytest-drf` A Django REST framework plugin for pytest. Nov 12, 2020 5 - Production/Stable pytest (>=3.6) :pypi:`pytest-drivings` Tool to allow webdriver automation to be ran locally or remotely Jan 13, 2021 N/A N/A :pypi:`pytest-drop-dup-tests` A Pytest plugin to drop duplicated tests during collection May 23, 2020 4 - Beta pytest (>=2.7) - :pypi:`pytest-dummynet` A py.test plugin providing access to a dummynet. Oct 13, 2021 5 - Production/Stable pytest + :pypi:`pytest-dummynet` A py.test plugin providing access to a dummynet. Dec 10, 2021 5 - Production/Stable pytest :pypi:`pytest-dump2json` A pytest plugin for dumping test results to json. Jun 29, 2015 N/A N/A :pypi:`pytest-duration-insights` Jun 25, 2021 N/A N/A :pypi:`pytest-dynamicrerun` A pytest plugin to rerun tests dynamically based off of test outcome and output. Aug 15, 2020 4 - Beta N/A @@ -332,6 +333,7 @@ This list contains 963 plugins. :pypi:`pytest-factoryboy-state` Simple factoryboy random state management Dec 11, 2020 4 - Beta pytest (>=5.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 Dec 10, 2021 4 - Beta 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 @@ -372,7 +374,7 @@ This list contains 963 plugins. :pypi:`pytest-forward-compatibility` A pytest plugin to shim pytest commandline options for fowards compatibility Sep 29, 2020 N/A N/A :pypi:`pytest-freezegun` Wrap tests with fixtures in freeze_time Jul 19, 2020 4 - Beta pytest (>=3.0.0) :pypi:`pytest-freeze-reqs` Check if requirement files are frozen Apr 29, 2021 N/A N/A - :pypi:`pytest-frozen-uuids` Deterministically frozen UUID's for your tests Oct 19, 2021 N/A pytest (>=3.0) + :pypi:`pytest-frozen-uuids` Deterministically frozen UUID's for your tests Dec 08, 2021 N/A pytest (>=3.0) :pypi:`pytest-func-cov` Pytest plugin for measuring function coverage Apr 15, 2021 3 - Alpha pytest (>=5) :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 @@ -387,7 +389,7 @@ This list contains 963 plugins. :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 - :pypi:`pytest-github-actions-annotate-failures` pytest plugin to annotate failed tests with a workflow command for GitHub Actions Oct 24, 2021 N/A pytest (>=4.0.0) + :pypi:`pytest-github-actions-annotate-failures` pytest plugin to annotate failed tests with a workflow command for GitHub Actions Dec 08, 2021 N/A pytest (>=4.0.0) :pypi:`pytest-gitignore` py.test plugin to ignore the same files as git Jul 17, 2015 4 - Beta N/A :pypi:`pytest-glamor-allure` Extends allure-pytest functionality Nov 26, 2021 4 - Beta pytest :pypi:`pytest-gnupg-fixtures` Pytest fixtures for testing with gnupg. Mar 04, 2021 4 - Beta pytest @@ -407,7 +409,7 @@ This list contains 963 plugins. :pypi:`pytest-historic` Custom report to display pytest historical execution records Apr 08, 2020 N/A pytest :pypi:`pytest-historic-hook` Custom listener to store execution results into MYSQL DB, which is used for pytest-historic report Apr 08, 2020 N/A pytest :pypi:`pytest-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 Nov 20, 2021 3 - Alpha pytest (==6.2.5) + :pypi:`pytest-homeassistant-custom-component` Experimental package to automatically extract test plugins for Home Assistant custom components Dec 10, 2021 3 - Alpha pytest (==6.2.5) :pypi:`pytest-honors` Report on tests that honor constraints, and guard against regressions Mar 06, 2020 4 - Beta N/A :pypi:`pytest-hoverfly` Simplify working with Hoverfly from pytest Jul 12, 2021 N/A pytest (>=5.0) :pypi:`pytest-hoverfly-wrapper` Integrates the Hoverfly HTTP proxy into Pytest Aug 29, 2021 4 - Beta N/A @@ -444,6 +446,7 @@ This list contains 963 plugins. :pypi:`pytest-Inomaly` A simple image diff plugin for pytest Feb 13, 2018 4 - Beta N/A :pypi:`pytest-insta` A practical snapshot testing plugin for pytest Apr 07, 2021 N/A pytest (>=6.0.2,<7.0.0) :pypi:`pytest-instafail` pytest plugin to show failures instantly Jun 14, 2020 4 - Beta pytest (>=2.9) + :pypi:`pytest-instant` Fast-forward asyncio time (in tests) Dec 05, 2021 N/A N/A :pypi:`pytest-instrument` pytest plugin to instrument tests Apr 05, 2020 5 - Production/Stable pytest (>=5.1.0) :pypi:`pytest-integration` Organizing pytests by integration or not Apr 16, 2020 N/A N/A :pypi:`pytest-integration-mark` Automatic integration test marking and excluding plugin for pytest Jul 19, 2021 N/A pytest (>=5.2,<7.0) @@ -454,12 +457,13 @@ This list contains 963 plugins. :pypi:`pytest-ipdb` A py.test plug-in to enable drop to ipdb debugger on test failure. Sep 02, 2014 2 - Pre-Alpha N/A :pypi:`pytest-ipynb` THIS PROJECT IS ABANDONED Jan 29, 2019 3 - Alpha N/A :pypi:`pytest-isort` py.test plugin to check import ordering using isort Apr 27, 2021 5 - Production/Stable N/A + :pypi:`pytest-is-running` pytest plugin providing a function to check if pytest is running. Dec 06, 2021 5 - Production/Stable pytest :pypi:`pytest-it` Pytest plugin to display test reports as a plaintext spec, inspired by Rspec: https://github.com/mattduck/pytest-it. Jan 22, 2020 4 - Beta N/A :pypi:`pytest-iterassert` Nicer list and iterable assertion messages for pytest May 11, 2020 3 - Alpha N/A :pypi:`pytest-jasmine` Run jasmine tests from your pytest test suite Nov 04, 2017 1 - Planning N/A :pypi:`pytest-jest` A custom jest-pytest oriented Pytest reporter May 22, 2018 4 - Beta pytest (>=3.3.2) :pypi:`pytest-jira` py.test JIRA integration plugin, using markers Dec 02, 2021 3 - Alpha N/A - :pypi:`pytest-jira-xray` pytest plugin to integrate tests with JIRA XRAY Nov 28, 2021 3 - Alpha pytest + :pypi:`pytest-jira-xray` pytest plugin to integrate tests with JIRA XRAY Dec 10, 2021 3 - Alpha pytest :pypi:`pytest-jobserver` Limit parallel tests with posix jobserver. May 15, 2019 5 - Production/Stable pytest :pypi:`pytest-joke` Test failures are better served with humor. Oct 08, 2019 4 - Beta pytest (>=4.2.1) :pypi:`pytest-json` Generate JSON test reports Jan 18, 2016 4 - Beta N/A @@ -509,7 +513,7 @@ This list contains 963 plugins. :pypi:`pytest-markfiltration` UNKNOWN Nov 08, 2011 3 - Alpha N/A :pypi:`pytest-mark-no-py3` pytest plugin and bowler codemod to help migrate tests to Python 3 May 17, 2019 N/A pytest :pypi:`pytest-marks` UNKNOWN Nov 23, 2012 3 - Alpha N/A - :pypi:`pytest-matcher` Match test output against patterns stored in files Apr 23, 2020 5 - Production/Stable pytest (>=3.4) + :pypi:`pytest-matcher` Match test output against patterns stored in files Dec 10, 2021 5 - Production/Stable N/A :pypi:`pytest-match-skip` Skip matching marks. Matches partial marks using wildcards. May 15, 2019 4 - Beta pytest (>=4.4.1) :pypi:`pytest-mat-report` this is report Jan 20, 2021 N/A N/A :pypi:`pytest-matrix` Provide tools for generating tests from combinations of fixtures. Jun 24, 2020 5 - Production/Stable pytest (>=5.4.3,<6.0.0) @@ -592,7 +596,7 @@ This list contains 963 plugins. :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-opentmi` pytest plugin for publish results to opentmi Nov 04, 2021 5 - Production/Stable pytest (>=5.0) - :pypi:`pytest-operator` Fixtures for Operators Oct 26, 2021 N/A N/A + :pypi:`pytest-operator` Fixtures for Operators Dec 06, 2021 N/A N/A :pypi:`pytest-optional` include/exclude values of fixtures in pytest Oct 07, 2015 N/A N/A :pypi:`pytest-optional-tests` Easy declaration of optional tests (i.e., that are not run by default) Jul 09, 2019 4 - Beta pytest (>=4.5.0) :pypi:`pytest-orchestration` A pytest plugin for orchestrating tests Jul 18, 2019 N/A N/A @@ -621,7 +625,8 @@ This list contains 963 plugins. :pypi:`pytest-percent` Change the exit code of pytest test sessions when a required percent of tests pass. May 21, 2020 N/A pytest (>=5.2.0) :pypi:`pytest-perf` pytest-perf Jun 27, 2021 5 - Production/Stable pytest (>=4.6) ; extra == 'testing' :pypi:`pytest-performance` A simple plugin to ensure the execution of critical sections of code has not been impacted Sep 11, 2020 5 - Production/Stable pytest (>=3.7.0) - :pypi:`pytest-persistence` Pytest tool for persistent objects Nov 06, 2021 N/A N/A + :pypi:`pytest-persistence` Pytest tool for persistent objects Dec 07, 2021 N/A N/A + :pypi:`pytest-pg` Helps to run PostgreSQL in docker as pytest fixture Dec 10, 2021 5 - Production/Stable pytest :pypi:`pytest-pgsql` Pytest plugins and helpers for tests using a Postgres database. May 13, 2020 5 - Production/Stable pytest (>=3.0.0) :pypi:`pytest-phmdoctest` pytest plugin to test Python examples in Markdown using phmdoctest. Nov 10, 2021 4 - Beta pytest (>=6.2) ; extra == 'test' :pypi:`pytest-picked` Run the tests related to the changed files Dec 23, 2020 N/A pytest (>=3.5.0) @@ -657,6 +662,7 @@ This list contains 963 plugins. :pypi:`pytest-pretty-terminal` pytest plugin for generating prettier terminal output Nov 24, 2021 N/A pytest (>=3.4.1) :pypi:`pytest-pride` Minitest-style test colors Apr 02, 2016 3 - Alpha N/A :pypi:`pytest-print` pytest-print adds the printer fixture you can use to print messages to the user (directly to the pytest runner, not stdout) Jun 17, 2021 5 - Production/Stable pytest (>=6) + :pypi:`pytest-profiles` pytest plugin for configuration profiles Dec 09, 2021 4 - Beta pytest (>=3.7.0) :pypi:`pytest-profiling` Profiling plugin for py.test May 28, 2019 5 - Production/Stable pytest :pypi:`pytest-progress` pytest plugin for instant test progress status Nov 09, 2021 5 - Production/Stable pytest (>=2.7) :pypi:`pytest-prometheus` Report test pass / failures to a Prometheus PushGateway Oct 03, 2017 N/A N/A @@ -683,7 +689,7 @@ This list contains 963 plugins. :pypi:`pytest-pytorch` pytest plugin for a better developer experience when working with the PyTorch test suite May 25, 2021 4 - Beta pytest :pypi:`pytest-qasync` Pytest support for qasync. Jul 12, 2021 4 - Beta pytest (>=5.4.0) :pypi:`pytest-qatouch` Pytest plugin for uploading test results to your QA Touch Testrun. Jun 26, 2021 4 - Beta pytest (>=6.2.0) - :pypi:`pytest-qgis` A pytest plugin for testing QGIS python plugins Nov 25, 2021 5 - Production/Stable pytest (>=6.2.3) + :pypi:`pytest-qgis` A pytest plugin for testing QGIS python plugins Dec 07, 2021 5 - Production/Stable pytest (>=6.2.3) :pypi:`pytest-qml` Run QML Tests with pytest Dec 02, 2020 4 - Beta pytest (>=6.0.0) :pypi:`pytest-qr` pytest plugin to generate test result QR codes Nov 25, 2021 4 - Beta N/A :pypi:`pytest-qt` pytest support for PyQt and PySide applications Jun 13, 2021 5 - Production/Stable pytest (>=3.0.0) @@ -706,7 +712,7 @@ This list contains 963 plugins. :pypi:`pytest-reana` Pytest fixtures for REANA. Nov 22, 2021 3 - Alpha N/A :pypi:`pytest-recording` A pytest plugin that allows you recording of network interactions via VCR.py Jul 08, 2021 4 - Beta pytest (>=3.5.0) :pypi:`pytest-recordings` Provides pytest plugins for reporting request/response traffic, screenshots, and more to ReportPortal Aug 13, 2020 N/A N/A - :pypi:`pytest-redis` Redis fixtures and fixture factories for Pytest. Nov 03, 2021 5 - Production/Stable pytest + :pypi:`pytest-redis` Redis fixtures and fixture factories for Pytest. Dec 07, 2021 5 - Production/Stable pytest :pypi:`pytest-redislite` Pytest plugin for testing code using Redis Sep 19, 2021 4 - Beta pytest :pypi:`pytest-redmine` Pytest plugin for redmine Mar 19, 2018 1 - Planning N/A :pypi:`pytest-ref` A plugin to store reference files to ease regression testing Nov 23, 2019 4 - Beta pytest (>=3.5.0) @@ -766,13 +772,13 @@ This list contains 963 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. Dec 03, 2021 5 - Production/Stable N/A + :pypi:`pytest-sbase` A complete web automation framework for end-to-end testing. Dec 11, 2021 5 - Production/Stable N/A :pypi:`pytest-scenario` pytest plugin for test scenarios Feb 06, 2017 3 - Alpha N/A :pypi:`pytest-schema` 👍 Validate return values against a schema-like object in testing Aug 31, 2020 5 - Production/Stable pytest (>=3.5.0) :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 Sep 19, 2020 5 - Production/Stable pytest (>=5.0.0) - :pypi:`pytest-seleniumbase` A complete web automation framework for end-to-end testing. Dec 03, 2021 5 - Production/Stable N/A + :pypi:`pytest-seleniumbase` A complete web automation framework for end-to-end testing. Dec 11, 2021 5 - Production/Stable N/A :pypi:`pytest-selenium-enhancer` pytest plugin for Selenium Nov 26, 2020 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-send-email` Send pytest execution result email Dec 04, 2019 N/A N/A @@ -823,7 +829,7 @@ This list contains 963 plugins. :pypi:`pytest-split-tests` A Pytest plugin for running a subset of your tests by splitting them in to equally sized groups. Forked from Mark Adams' original project pytest-test-groups. Jul 30, 2021 5 - Production/Stable pytest (>=2.5) :pypi:`pytest-split-tests-tresorit` Feb 22, 2021 1 - Planning N/A :pypi:`pytest-splunk-addon` A Dynamic test tool for Splunk Apps and Add-ons Nov 29, 2021 N/A pytest (>5.4.0,<6.3) - :pypi:`pytest-splunk-addon-ui-smartx` Library to support testing Splunk Add-on UX Oct 07, 2021 N/A N/A + :pypi:`pytest-splunk-addon-ui-smartx` Library to support testing Splunk Add-on UX Dec 06, 2021 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 @@ -865,9 +871,9 @@ This list contains 963 plugins. :pypi:`pytest-testbook` A plugin to run tests written in Jupyter notebook Dec 11, 2016 3 - Alpha N/A :pypi:`pytest-testconfig` Test configuration plugin for pytest. Jan 11, 2020 4 - Beta pytest (>=3.5.0) :pypi:`pytest-testdirectory` A py.test plugin providing temporary directories in unit tests. Nov 06, 2018 5 - Production/Stable pytest - :pypi:`pytest-testdox` A testdox format reporter for pytest Oct 13, 2020 5 - Production/Stable pytest (>=3.7.0) + :pypi:`pytest-testdox` A testdox format reporter for pytest Dec 05, 2021 5 - Production/Stable pytest (>=4.6.0) :pypi:`pytest-test-groups` A Pytest plugin for running a subset of your tests by splitting them in to equally sized groups. Oct 25, 2016 5 - Production/Stable N/A - :pypi:`pytest-testinfra` Test infrastructures Jun 20, 2021 5 - Production/Stable pytest (!=3.0.2) + :pypi:`pytest-testinfra` Test infrastructures Dec 07, 2021 5 - Production/Stable pytest (!=3.0.2) :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 Oct 22, 2021 4 - Beta N/A :pypi:`pytest-testobject` Plugin to use TestObject Suites with Pytest Sep 24, 2019 4 - Beta pytest (>=3.1.1) @@ -957,7 +963,7 @@ This list contains 963 plugins. :pypi:`pytest-winnotify` Windows tray notifications for py.test results. Apr 22, 2016 N/A N/A :pypi:`pytest-with-docker` pytest with docker helpers. Nov 09, 2021 N/A pytest :pypi:`pytest-workflow` A pytest plugin for configuring workflow/pipeline tests using YAML files Dec 03, 2021 5 - Production/Stable pytest (>=5.4.0) - :pypi:`pytest-xdist` pytest xdist plugin for distributed testing and loop-on-failing modes Sep 21, 2021 5 - Production/Stable pytest (>=6.0.0) + :pypi:`pytest-xdist` pytest xdist plugin for distributed testing and loop-on-failing modes Dec 10, 2021 5 - Production/Stable pytest (>=6.2.0) :pypi:`pytest-xdist-debug-for-graingert` pytest xdist plugin for distributed testing and loop-on-failing modes Jul 24, 2019 5 - Production/Stable pytest (>=4.4.0) :pypi:`pytest-xdist-forked` forked from pytest-xdist Feb 10, 2020 5 - Production/Stable pytest (>=4.4.0) :pypi:`pytest-xdist-tracker` pytest plugin helps to reproduce failures for particular xdist node Nov 18, 2021 3 - Alpha pytest (>=3.5.1) @@ -1063,6 +1069,13 @@ This list contains 963 plugins. Pytest \`client\` fixture for the Aiohttp + :pypi:`pytest-aiomoto` + *last release*: Dec 10, 2021, + *status*: N/A, + *requires*: pytest (>=6.2.5,<7.0.0) + + pytest-aiomoto + :pypi:`pytest-aioresponses` *last release*: Jul 29, 2021, *status*: 4 - Beta, @@ -1918,7 +1931,7 @@ This list contains 963 plugins. PyTest plugin for testing Smart Contracts for Ethereum blockchain. :pypi:`pytest-codeblocks` - *last release*: Oct 13, 2021, + *last release*: Dec 11, 2021, *status*: 4 - Beta, *requires*: pytest (>=6) @@ -2100,7 +2113,7 @@ This list contains 963 plugins. Pytest plugin for excluding tests based on coverage data :pypi:`pytest-cpp` - *last release*: Dec 03, 2021, + *last release*: Dec 06, 2021, *status*: 5 - Production/Stable, *requires*: pytest (!=5.4.0,!=5.4.1) @@ -2450,7 +2463,7 @@ This list contains 963 plugins. A pytest plugin to notify test results to a Discord channel. :pypi:`pytest-django` - *last release*: Dec 02, 2021, + *last release*: Dec 07, 2021, *status*: 5 - Production/Stable, *requires*: pytest (>=5.4.0) @@ -2716,7 +2729,7 @@ This list contains 963 plugins. A simple pytest plugin to import names and add them to the doctest namespace. :pypi:`pytest-doctestplus` - *last release*: Nov 16, 2021, + *last release*: Dec 09, 2021, *status*: 3 - Alpha, *requires*: pytest (>=4.6) @@ -2772,7 +2785,7 @@ This list contains 963 plugins. A Pytest plugin to drop duplicated tests during collection :pypi:`pytest-dummynet` - *last release*: Oct 13, 2021, + *last release*: Dec 10, 2021, *status*: 5 - Production/Stable, *requires*: pytest @@ -3184,6 +3197,13 @@ This list contains 963 plugins. A pytest plugin that helps better distinguishing real test failures from setup flakiness. + :pypi:`pytest-fail-slow` + *last release*: Dec 10, 2021, + *status*: 4 - Beta, + *requires*: pytest (>=6.0) + + Fail tests that take too long to run + :pypi:`pytest-faker` *last release*: Dec 19, 2016, *status*: 6 - Mature, @@ -3465,7 +3485,7 @@ This list contains 963 plugins. Check if requirement files are frozen :pypi:`pytest-frozen-uuids` - *last release*: Oct 19, 2021, + *last release*: Dec 08, 2021, *status*: N/A, *requires*: pytest (>=3.0) @@ -3570,7 +3590,7 @@ This list contains 963 plugins. Plugin for py.test that associates tests with github issues using a marker. :pypi:`pytest-github-actions-annotate-failures` - *last release*: Oct 24, 2021, + *last release*: Dec 08, 2021, *status*: N/A, *requires*: pytest (>=4.0.0) @@ -3710,7 +3730,7 @@ This list contains 963 plugins. A pytest plugin for use with homeassistant custom components. :pypi:`pytest-homeassistant-custom-component` - *last release*: Nov 20, 2021, + *last release*: Dec 10, 2021, *status*: 3 - Alpha, *requires*: pytest (==6.2.5) @@ -3968,6 +3988,13 @@ This list contains 963 plugins. pytest plugin to show failures instantly + :pypi:`pytest-instant` + *last release*: Dec 05, 2021, + *status*: N/A, + *requires*: N/A + + Fast-forward asyncio time (in tests) + :pypi:`pytest-instrument` *last release*: Apr 05, 2020, *status*: 5 - Production/Stable, @@ -4038,6 +4065,13 @@ This list contains 963 plugins. py.test plugin to check import ordering using isort + :pypi:`pytest-is-running` + *last release*: Dec 06, 2021, + *status*: 5 - Production/Stable, + *requires*: pytest + + pytest plugin providing a function to check if pytest is running. + :pypi:`pytest-it` *last release*: Jan 22, 2020, *status*: 4 - Beta, @@ -4074,7 +4108,7 @@ This list contains 963 plugins. py.test JIRA integration plugin, using markers :pypi:`pytest-jira-xray` - *last release*: Nov 28, 2021, + *last release*: Dec 10, 2021, *status*: 3 - Alpha, *requires*: pytest @@ -4424,9 +4458,9 @@ This list contains 963 plugins. UNKNOWN :pypi:`pytest-matcher` - *last release*: Apr 23, 2020, + *last release*: Dec 10, 2021, *status*: 5 - Production/Stable, - *requires*: pytest (>=3.4) + *requires*: N/A Match test output against patterns stored in files @@ -5005,7 +5039,7 @@ This list contains 963 plugins. pytest plugin for publish results to opentmi :pypi:`pytest-operator` - *last release*: Oct 26, 2021, + *last release*: Dec 06, 2021, *status*: N/A, *requires*: N/A @@ -5208,12 +5242,19 @@ This list contains 963 plugins. A simple plugin to ensure the execution of critical sections of code has not been impacted :pypi:`pytest-persistence` - *last release*: Nov 06, 2021, + *last release*: Dec 07, 2021, *status*: N/A, *requires*: N/A Pytest tool for persistent objects + :pypi:`pytest-pg` + *last release*: Dec 10, 2021, + *status*: 5 - Production/Stable, + *requires*: pytest + + Helps to run PostgreSQL in docker as pytest fixture + :pypi:`pytest-pgsql` *last release*: May 13, 2020, *status*: 5 - Production/Stable, @@ -5459,6 +5500,13 @@ This list contains 963 plugins. pytest-print adds the printer fixture you can use to print messages to the user (directly to the pytest runner, not stdout) + :pypi:`pytest-profiles` + *last release*: Dec 09, 2021, + *status*: 4 - Beta, + *requires*: pytest (>=3.7.0) + + pytest plugin for configuration profiles + :pypi:`pytest-profiling` *last release*: May 28, 2019, *status*: 5 - Production/Stable, @@ -5642,7 +5690,7 @@ This list contains 963 plugins. Pytest plugin for uploading test results to your QA Touch Testrun. :pypi:`pytest-qgis` - *last release*: Nov 25, 2021, + *last release*: Dec 07, 2021, *status*: 5 - Production/Stable, *requires*: pytest (>=6.2.3) @@ -5803,7 +5851,7 @@ This list contains 963 plugins. Provides pytest plugins for reporting request/response traffic, screenshots, and more to ReportPortal :pypi:`pytest-redis` - *last release*: Nov 03, 2021, + *last release*: Dec 07, 2021, *status*: 5 - Production/Stable, *requires*: pytest @@ -6223,7 +6271,7 @@ This list contains 963 plugins. :pypi:`pytest-sbase` - *last release*: Dec 03, 2021, + *last release*: Dec 11, 2021, *status*: 5 - Production/Stable, *requires*: N/A @@ -6265,7 +6313,7 @@ This list contains 963 plugins. pytest plugin for Selenium :pypi:`pytest-seleniumbase` - *last release*: Dec 03, 2021, + *last release*: Dec 11, 2021, *status*: 5 - Production/Stable, *requires*: N/A @@ -6622,7 +6670,7 @@ This list contains 963 plugins. A Dynamic test tool for Splunk Apps and Add-ons :pypi:`pytest-splunk-addon-ui-smartx` - *last release*: Oct 07, 2021, + *last release*: Dec 06, 2021, *status*: N/A, *requires*: N/A @@ -6916,9 +6964,9 @@ This list contains 963 plugins. A py.test plugin providing temporary directories in unit tests. :pypi:`pytest-testdox` - *last release*: Oct 13, 2020, + *last release*: Dec 05, 2021, *status*: 5 - Production/Stable, - *requires*: pytest (>=3.7.0) + *requires*: pytest (>=4.6.0) A testdox format reporter for pytest @@ -6930,7 +6978,7 @@ This list contains 963 plugins. A Pytest plugin for running a subset of your tests by splitting them in to equally sized groups. :pypi:`pytest-testinfra` - *last release*: Jun 20, 2021, + *last release*: Dec 07, 2021, *status*: 5 - Production/Stable, *requires*: pytest (!=3.0.2) @@ -7560,9 +7608,9 @@ This list contains 963 plugins. A pytest plugin for configuring workflow/pipeline tests using YAML files :pypi:`pytest-xdist` - *last release*: Sep 21, 2021, + *last release*: Dec 10, 2021, *status*: 5 - Production/Stable, - *requires*: pytest (>=6.0.0) + *requires*: pytest (>=6.2.0) pytest xdist plugin for distributed testing and loop-on-failing modes From 897395afd584b54394ab0b747ff03c80da07871d Mon Sep 17 00:00:00 2001 From: Yuval Shimon Date: Sun, 12 Dec 2021 14:38:45 +0200 Subject: [PATCH 021/176] fix 9326 --- changelog/9326.bugfix.rst | 1 + src/_pytest/assertion/util.py | 23 ++++++++++++++++- ...test_compare_dataclasses_with_custom_eq.py | 17 +++++++++++++ testing/test_assertion.py | 25 ++++++++++++++++++- 4 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 changelog/9326.bugfix.rst create mode 100644 testing/example_scripts/dataclasses/test_compare_dataclasses_with_custom_eq.py diff --git a/changelog/9326.bugfix.rst b/changelog/9326.bugfix.rst new file mode 100644 index 00000000000..1aaa424d371 --- /dev/null +++ b/changelog/9326.bugfix.rst @@ -0,0 +1 @@ +Pytest will now avoid specialized assert formatting when it is detected that the default __eq__ is overridden diff --git a/src/_pytest/assertion/util.py b/src/_pytest/assertion/util.py index 19f1089c20a..ed5b01d1d53 100644 --- a/src/_pytest/assertion/util.py +++ b/src/_pytest/assertion/util.py @@ -135,6 +135,26 @@ def isiterable(obj: Any) -> bool: return False +def has_default_eq( + obj: object, +) -> bool: + """Check if an instance of an object contains the default eq + + First, we check if the object's __eq__ attribute has __code__, if so, we check the equally of the method code filename (__code__.co_filename) + to the default onces generated by the dataclass and attr module + for dataclasses the default co_filename is , for attrs class, the __eq__ should contain "attrs eq generated" + """ + # inspired from https://github.com/willmcgugan/rich/blob/07d51ffc1aee6f16bd2e5a25b4e82850fb9ed778/rich/pretty.py#L68 + if not hasattr(obj.__eq__, "__code__"): # the obj does not have a code attribute + return True + + code_filename = obj.__eq__.__code__.co_filename + if isattrs(obj): + return "attrs eq generated" in code_filename + if isdatacls(obj): + return code_filename == "" + + def assertrepr_compare(config, op: str, left: Any, right: Any) -> Optional[List[str]]: """Return specialised explanations for some operators/operands.""" verbose = config.getoption("verbose") @@ -427,6 +447,8 @@ def _compare_eq_dict( def _compare_eq_cls(left: Any, right: Any, verbose: int) -> List[str]: + if not has_default_eq(left): + return [] if isdatacls(left): all_fields = left.__dataclass_fields__ fields_to_check = [field for field, info in all_fields.items() if info.compare] @@ -437,7 +459,6 @@ def _compare_eq_cls(left: Any, right: Any, verbose: int) -> List[str]: fields_to_check = left._fields else: assert False - indent = " " same = [] diff = [] diff --git a/testing/example_scripts/dataclasses/test_compare_dataclasses_with_custom_eq.py b/testing/example_scripts/dataclasses/test_compare_dataclasses_with_custom_eq.py new file mode 100644 index 00000000000..e026fe3d192 --- /dev/null +++ b/testing/example_scripts/dataclasses/test_compare_dataclasses_with_custom_eq.py @@ -0,0 +1,17 @@ +from dataclasses import dataclass +from dataclasses import field + + +def test_dataclasses() -> None: + @dataclass + class SimpleDataObject: + field_a: int = field() + field_b: str = field() + + def __eq__(self, __o: object) -> bool: + return super().__eq__(__o) + + left = SimpleDataObject(1, "b") + right = SimpleDataObject(1, "c") + + assert left == right diff --git a/testing/test_assertion.py b/testing/test_assertion.py index e8717590d53..29320c54b64 100644 --- a/testing/test_assertion.py +++ b/testing/test_assertion.py @@ -899,6 +899,16 @@ def test_comparing_two_different_data_classes(self, pytester: Pytester) -> None: result = pytester.runpytest(p, "-vv") result.assert_outcomes(failed=0, passed=1) + @pytest.mark.skipif(sys.version_info < (3, 7), reason="Dataclasses in Python3.7+") + def test_data_classes_with_custom_eq(self, pytester: Pytester) -> None: + p = pytester.copy_example( + "dataclasses/test_compare_dataclasses_with_custom_eq.py" + ) + # issue 9362 + result = pytester.runpytest(p, "-vv") + result.assert_outcomes(failed=1, passed=0) + result.stdout.no_re_match_line(".*Differing attributes.*") + class TestAssert_reprcompare_attrsclass: def test_attrs(self) -> None: @@ -982,7 +992,6 @@ class SimpleDataObject: right = SimpleDataObject(1, "b") lines = callequal(left, right, verbose=2) - print(lines) assert lines is not None assert lines[2].startswith("Matching attributes:") assert "Omitting" not in lines[1] @@ -1007,6 +1016,20 @@ class SimpleDataObjectTwo: lines = callequal(left, right) assert lines is None + def test_attrs_with_custom_eq(self) -> None: + @attr.define + class SimpleDataObject: + field_a = attr.ib() + + def __eq__(self, other): + return self.field_a == other.field_a + + left = SimpleDataObject(1) + right = SimpleDataObject(2) + # issue 9362 + lines = callequal(left, right, verbose=2) + assert lines is None + class TestAssert_reprcompare_namedtuple: def test_namedtuple(self) -> None: From 31f42ef83fed3fef98ac17361aafa25f1397a266 Mon Sep 17 00:00:00 2001 From: Yuval Shimon Date: Sun, 12 Dec 2021 14:40:46 +0200 Subject: [PATCH 022/176] small fix --- src/_pytest/assertion/util.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/_pytest/assertion/util.py b/src/_pytest/assertion/util.py index ed5b01d1d53..ecc1274a80e 100644 --- a/src/_pytest/assertion/util.py +++ b/src/_pytest/assertion/util.py @@ -151,8 +151,7 @@ def has_default_eq( code_filename = obj.__eq__.__code__.co_filename if isattrs(obj): return "attrs eq generated" in code_filename - if isdatacls(obj): - return code_filename == "" + return code_filename == "" # dataclass def assertrepr_compare(config, op: str, left: Any, right: Any) -> Optional[List[str]]: From a67c547536b0800c21a86224f62feab6a368ddcf Mon Sep 17 00:00:00 2001 From: Yuval Shimon Date: Sun, 12 Dec 2021 14:45:47 +0200 Subject: [PATCH 023/176] fixing tests --- src/_pytest/assertion/util.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/_pytest/assertion/util.py b/src/_pytest/assertion/util.py index ecc1274a80e..d852a34797c 100644 --- a/src/_pytest/assertion/util.py +++ b/src/_pytest/assertion/util.py @@ -149,9 +149,11 @@ def has_default_eq( return True code_filename = obj.__eq__.__code__.co_filename + if isattrs(obj): - return "attrs eq generated" in code_filename - return code_filename == "" # dataclass + return "attrs generated eq" in code_filename + + return code_filename == "" # data class def assertrepr_compare(config, op: str, left: Any, right: Any) -> Optional[List[str]]: From 8c3b17263b77af051511547b2d0963368a5c833c Mon Sep 17 00:00:00 2001 From: Yuval Shimon Date: Sun, 12 Dec 2021 14:47:00 +0200 Subject: [PATCH 024/176] removing unnecessary changes --- src/_pytest/assertion/util.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/_pytest/assertion/util.py b/src/_pytest/assertion/util.py index d852a34797c..c0e4f4d20ac 100644 --- a/src/_pytest/assertion/util.py +++ b/src/_pytest/assertion/util.py @@ -460,6 +460,7 @@ def _compare_eq_cls(left: Any, right: Any, verbose: int) -> List[str]: fields_to_check = left._fields else: assert False + indent = " " same = [] diff = [] From 9166ff6cb52c64ed58b8ce0f32d05785a0e2ad96 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 12 Dec 2021 12:49:23 +0000 Subject: [PATCH 025/176] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/_pytest/assertion/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_pytest/assertion/util.py b/src/_pytest/assertion/util.py index c0e4f4d20ac..618a93ecadd 100644 --- a/src/_pytest/assertion/util.py +++ b/src/_pytest/assertion/util.py @@ -460,7 +460,7 @@ def _compare_eq_cls(left: Any, right: Any, verbose: int) -> List[str]: fields_to_check = left._fields else: assert False - + indent = " " same = [] diff = [] From df74e5c532e5cc3f8d00adb65b3578f0ba5db7ee Mon Sep 17 00:00:00 2001 From: Yuval Shimon Date: Sun, 12 Dec 2021 14:53:29 +0200 Subject: [PATCH 026/176] fixing pre-commit --- src/_pytest/assertion/util.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/_pytest/assertion/util.py b/src/_pytest/assertion/util.py index 618a93ecadd..860002f4d98 100644 --- a/src/_pytest/assertion/util.py +++ b/src/_pytest/assertion/util.py @@ -140,7 +140,8 @@ def has_default_eq( ) -> bool: """Check if an instance of an object contains the default eq - First, we check if the object's __eq__ attribute has __code__, if so, we check the equally of the method code filename (__code__.co_filename) + First, we check if the object's __eq__ attribute has __code__, + if so, we check the equally of the method code filename (__code__.co_filename) to the default onces generated by the dataclass and attr module for dataclasses the default co_filename is , for attrs class, the __eq__ should contain "attrs eq generated" """ From 2d7905b13be5eb83d9651117327aed02f004a445 Mon Sep 17 00:00:00 2001 From: Yuval Shimon Date: Sun, 12 Dec 2021 15:14:24 +0200 Subject: [PATCH 027/176] support pypy --- src/_pytest/assertion/util.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/_pytest/assertion/util.py b/src/_pytest/assertion/util.py index 860002f4d98..c26ff90dc53 100644 --- a/src/_pytest/assertion/util.py +++ b/src/_pytest/assertion/util.py @@ -146,15 +146,14 @@ def has_default_eq( for dataclasses the default co_filename is , for attrs class, the __eq__ should contain "attrs eq generated" """ # inspired from https://github.com/willmcgugan/rich/blob/07d51ffc1aee6f16bd2e5a25b4e82850fb9ed778/rich/pretty.py#L68 - if not hasattr(obj.__eq__, "__code__"): # the obj does not have a code attribute - return True + if hasattr(obj.__eq__, "__code__") and hasattr(obj.__eq__.__code__, "co_filename"): + code_filename = obj.__eq__.__code__.co_filename - code_filename = obj.__eq__.__code__.co_filename + if isattrs(obj): + return "attrs generated eq" in code_filename - if isattrs(obj): - return "attrs generated eq" in code_filename - - return code_filename == "" # data class + return code_filename == "" # data class + return True def assertrepr_compare(config, op: str, left: Any, right: Any) -> Optional[List[str]]: From 0c45065040c87e1076e7c0bb1c079eb8f924c134 Mon Sep 17 00:00:00 2001 From: Yuval Shimon Date: Sun, 12 Dec 2021 15:39:30 +0200 Subject: [PATCH 028/176] removing coverage on eq method --- testing/test_assertion.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testing/test_assertion.py b/testing/test_assertion.py index 29320c54b64..fe5a3d3bb2e 100644 --- a/testing/test_assertion.py +++ b/testing/test_assertion.py @@ -1021,8 +1021,8 @@ def test_attrs_with_custom_eq(self) -> None: class SimpleDataObject: field_a = attr.ib() - def __eq__(self, other): - return self.field_a == other.field_a + def __eq__(self, other): # pragma: no cover + return super().__eq__(other) left = SimpleDataObject(1) right = SimpleDataObject(2) From 0ea039db602c01ddc57eac40b1abd60704a7d00c Mon Sep 17 00:00:00 2001 From: Yuval Shimon Date: Sun, 12 Dec 2021 16:11:33 +0200 Subject: [PATCH 029/176] adding auto_detect=true test --- testing/test_assertion.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/testing/test_assertion.py b/testing/test_assertion.py index fe5a3d3bb2e..8a4525cb74a 100644 --- a/testing/test_assertion.py +++ b/testing/test_assertion.py @@ -1016,6 +1016,22 @@ class SimpleDataObjectTwo: lines = callequal(left, right) assert lines is None + def test_attrs_with_auto_detect_and_custom_eq(self) -> None: + @attr.s( + auto_detect=True + ) # attr.s doesn’t ignore a custom eq if auto_detect=True + class SimpleDataObject: + field_a = attr.ib() + + def __eq__(self, other): # pragma: no cover + return super().__eq__(other) + + left = SimpleDataObject(1) + right = SimpleDataObject(2) + # issue 9362 + lines = callequal(left, right, verbose=2) + assert lines is None + def test_attrs_with_custom_eq(self) -> None: @attr.define class SimpleDataObject: From 4d6e8a310b2e46051ed997ed8b8c44a59b065633 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 12 Dec 2021 14:26:36 +0000 Subject: [PATCH 030/176] build(deps): Bump django in /testing/plugins_integration Bumps [django](https://github.com/django/django) from 3.2.9 to 3.2.10. - [Release notes](https://github.com/django/django/releases) - [Commits](https://github.com/django/django/compare/3.2.9...3.2.10) --- updated-dependencies: - dependency-name: django dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- testing/plugins_integration/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/plugins_integration/requirements.txt b/testing/plugins_integration/requirements.txt index 90b253cc6d3..88fe6a3e3f4 100644 --- a/testing/plugins_integration/requirements.txt +++ b/testing/plugins_integration/requirements.txt @@ -1,5 +1,5 @@ anyio[curio,trio]==3.4.0 -django==3.2.9 +django==3.2.10 pytest-asyncio==0.16.0 pytest-bdd==5.0.0 pytest-cov==3.0.0 From 0e69c62eced97d73caed88b9a12e0b7de4c0d8e0 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Wed, 8 Dec 2021 16:19:09 +0200 Subject: [PATCH 031/176] doc: add a `hook` crossref type Allow writing :hook:`pytest_cmdline_main` instead of :func:`pytest_cmdline_main <_pytest.hookspec.pytest_cmdline_main>` --- doc/en/changelog.rst | 34 ++++++++++++------------ doc/en/conf.py | 7 +++++ doc/en/deprecations.rst | 18 ++++++------- doc/en/reference/reference.rst | 47 ++++++++++++++++++++++++++++++++++ src/_pytest/hookspec.py | 16 ++++++------ src/_pytest/main.py | 3 +-- src/_pytest/python.py | 2 +- 7 files changed, 90 insertions(+), 37 deletions(-) diff --git a/doc/en/changelog.rst b/doc/en/changelog.rst index 65b160d2bf6..c5ccc75e3af 100644 --- a/doc/en/changelog.rst +++ b/doc/en/changelog.rst @@ -156,7 +156,7 @@ Deprecations See :ref:`the deprecation note ` for full details. -- `#8592 `_: :func:`pytest_cmdline_preparse <_pytest.hookspec.pytest_cmdline_preparse>` has been officially deprecated. It will be removed in a future release. Use :func:`pytest_load_initial_conftests <_pytest.hookspec.pytest_load_initial_conftests>` instead. +- `#8592 `_: :hook:`pytest_cmdline_preparse` has been officially deprecated. It will be removed in a future release. Use :hook:`pytest_load_initial_conftests` instead. See :ref:`the deprecation note ` for full details. @@ -203,11 +203,11 @@ Features - ``pytest.Mark`` for :class:`marks `. - ``pytest.MarkDecorator`` for :class:`mark decorators `. - ``pytest.MarkGenerator`` for the :class:`pytest.mark ` singleton. - - ``pytest.Metafunc`` for the :class:`metafunc ` argument to the :func:`pytest_generate_tests ` hook. + - ``pytest.Metafunc`` for the :class:`metafunc ` argument to the :hook:`pytest_generate_tests` hook. - ``pytest.CallInfo`` for the :class:`CallInfo ` type passed to various hooks. - ``pytest.PytestPluginManager`` for :class:`PytestPluginManager `. - ``pytest.ExceptionInfo`` for the :class:`ExceptionInfo ` type returned from :func:`pytest.raises` and passed to various hooks. - - ``pytest.Parser`` for the :class:`Parser ` type passed to the :func:`pytest_addoption ` hook. + - ``pytest.Parser`` for the :class:`Parser ` type passed to the :hook:`pytest_addoption` hook. - ``pytest.OptionGroup`` for the :class:`OptionGroup ` type returned from the :func:`parser.addgroup ` method. - ``pytest.HookRecorder`` for the :class:`HookRecorder ` type returned from :class:`~pytest.Pytester`. - ``pytest.RecordedHookCall`` for the :class:`RecordedHookCall ` type returned from :class:`~pytest.HookRecorder`. @@ -228,11 +228,11 @@ Features - `#8144 `_: The following hooks now receive an additional ``pathlib.Path`` argument, equivalent to an existing ``py.path.local`` argument: - - :func:`pytest_ignore_collect <_pytest.hookspec.pytest_ignore_collect>` - The ``collection_path`` parameter (equivalent to existing ``path`` parameter). - - :func:`pytest_collect_file <_pytest.hookspec.pytest_collect_file>` - The ``file_path`` parameter (equivalent to existing ``path`` parameter). - - :func:`pytest_pycollect_makemodule <_pytest.hookspec.pytest_pycollect_makemodule>` - The ``module_path`` parameter (equivalent to existing ``path`` parameter). - - :func:`pytest_report_header <_pytest.hookspec.pytest_report_header>` - The ``start_path`` parameter (equivalent to existing ``startdir`` parameter). - - :func:`pytest_report_collectionfinish <_pytest.hookspec.pytest_report_collectionfinish>` - The ``start_path`` parameter (equivalent to existing ``startdir`` parameter). + - :hook:`pytest_ignore_collect` - The ``collection_path`` parameter (equivalent to existing ``path`` parameter). + - :hook:`pytest_collect_file` - The ``file_path`` parameter (equivalent to existing ``path`` parameter). + - :hook:`pytest_pycollect_makemodule` - The ``module_path`` parameter (equivalent to existing ``path`` parameter). + - :hook:`pytest_report_header` - The ``start_path`` parameter (equivalent to existing ``startdir`` parameter). + - :hook:`pytest_report_collectionfinish` - The ``start_path`` parameter (equivalent to existing ``startdir`` parameter). .. note:: The name of the :class:`~_pytest.nodes.Node` arguments and attributes (the @@ -491,7 +491,7 @@ Trivial/Internal Changes - `#8913 `_: The private ``CallSpec2._arg2scopenum`` attribute has been removed after an internal refactoring. -- `#8967 `_: :func:`pytest_assertion_pass <_pytest.hookspec.pytest_assertion_pass>` is no longer considered experimental and +- `#8967 `_: :hook:`pytest_assertion_pass` is no longer considered experimental and future changes to it will be considered more carefully. @@ -853,8 +853,8 @@ Deprecations if you use this and want a replacement. -- :issue:`7255`: The :func:`pytest_warning_captured <_pytest.hookspec.pytest_warning_captured>` hook is deprecated in favor - of :func:`pytest_warning_recorded <_pytest.hookspec.pytest_warning_recorded>`, and will be removed in a future version. +- :issue:`7255`: The :hook:`pytest_warning_captured` hook is deprecated in favor + of :hook:`pytest_warning_recorded`, and will be removed in a future version. - :issue:`7648`: The ``gethookproxy()`` and ``isinitpath()`` methods of ``FSCollector`` and ``Package`` are deprecated; @@ -962,7 +962,7 @@ Trivial/Internal Changes process, pytest now ignores builtin attributes (like ``__class__``, ``__delattr__`` and ``__new__``) without consulting the :confval:`python_classes` and :confval:`python_functions` configuration options and without passing them to plugins - using the :func:`pytest_pycollect_makeitem <_pytest.hookspec.pytest_pycollect_makeitem>` hook. + using the :hook:`pytest_pycollect_makeitem` hook. pytest 6.0.2 (2020-09-04) @@ -1751,7 +1751,7 @@ Bug Fixes - :issue:`6646`: Assertion rewriting hooks are (re)stored for the current item, which fixes them being still used after e.g. pytester's :func:`testdir.runpytest <_pytest.pytester.Testdir.runpytest>` etc. -- :issue:`6660`: :py:func:`pytest.exit` is handled when emitted from the :func:`pytest_sessionfinish <_pytest.hookspec.pytest_sessionfinish>` hook. This includes quitting from a debugger. +- :issue:`6660`: :py:func:`pytest.exit` is handled when emitted from the :hook:`pytest_sessionfinish` hook. This includes quitting from a debugger. - :issue:`6752`: When :py:func:`pytest.raises` is used as a function (as opposed to a context manager), @@ -1863,7 +1863,7 @@ Improvements - :issue:`6231`: Improve check for misspelling of :ref:`pytest.mark.parametrize ref`. -- :issue:`6257`: Handle :py:func:`pytest.exit` being used via :py:func:`~_pytest.hookspec.pytest_internalerror`, e.g. when quitting pdb from post mortem. +- :issue:`6257`: Handle :func:`pytest.exit` being used via :hook:`pytest_internalerror`, e.g. when quitting pdb from post mortem. @@ -2497,7 +2497,7 @@ Deprecations Features -------- -- :issue:`3457`: New :func:`~_pytest.hookspec.pytest_assertion_pass` +- :issue:`3457`: New :hook:`pytest_assertion_pass` hook, called with context information when an assertion *passes*. This hook is still **experimental** so use it with caution. @@ -5017,9 +5017,9 @@ Features - Console output falls back to "classic" mode when capturing is disabled (``-s``), otherwise the output gets garbled to the point of being useless. (:issue:`3038`) -- New :func:`~_pytest.hookspec.pytest_runtest_logfinish` +- New :hook:`pytest_runtest_logfinish` hook which is called when a test item has finished executing, analogous to - :func:`~_pytest.hookspec.pytest_runtest_logstart`. + :hook:`pytest_runtest_logstart`. (:issue:`3101`) - Improve performance when collecting tests using many fixtures. (:issue:`3107`) diff --git a/doc/en/conf.py b/doc/en/conf.py index bcf01aa4713..b316163532a 100644 --- a/doc/en/conf.py +++ b/doc/en/conf.py @@ -445,6 +445,13 @@ def setup(app: "sphinx.application.Sphinx") -> None: indextemplate="pair: %s; global variable interpreted by pytest", ) + app.add_crossref_type( + directivename="hook", + rolename="hook", + objname="pytest hook", + indextemplate="pair: %s; hook", + ) + configure_logging(app) # Make Sphinx mark classes with "final" when decorated with @final. diff --git a/doc/en/deprecations.rst b/doc/en/deprecations.rst index c748316cb73..6351d1f6e6a 100644 --- a/doc/en/deprecations.rst +++ b/doc/en/deprecations.rst @@ -81,11 +81,11 @@ no matter what argument was used in the constructor. We expect to deprecate the In order to support the transition from ``py.path.local`` to :mod:`pathlib`, the following hooks now receive additional arguments: -* :func:`pytest_ignore_collect(collection_path: pathlib.Path) <_pytest.hookspec.pytest_ignore_collect>` as equivalent to ``path`` -* :func:`pytest_collect_file(file_path: pathlib.Path) <_pytest.hookspec.pytest_collect_file>` as equivalent to ``path`` -* :func:`pytest_pycollect_makemodule(module_path: pathlib.Path) <_pytest.hookspec.pytest_pycollect_makemodule>` as equivalent to ``path`` -* :func:`pytest_report_header(start_path: pathlib.Path) <_pytest.hookspec.pytest_report_header>` as equivalent to ``startdir`` -* :func:`pytest_report_collectionfinish(start_path: pathlib.Path) <_pytest.hookspec.pytest_report_collectionfinish>` as equivalent to ``startdir`` +* :hook:`pytest_ignore_collect(collection_path: pathlib.Path) ` as equivalent to ``path`` +* :hook:`pytest_collect_file(file_path: pathlib.Path) ` as equivalent to ``path`` +* :hook:`pytest_pycollect_makemodule(module_path: pathlib.Path) ` as equivalent to ``path`` +* :hook:`pytest_report_header(start_path: pathlib.Path) ` as equivalent to ``startdir`` +* :hook:`pytest_report_collectionfinish(start_path: pathlib.Path) ` as equivalent to ``startdir`` The accompanying ``py.path.local`` based paths have been deprecated: plugins which manually invoke those hooks should only pass the new ``pathlib.Path`` arguments, and users should change their hook implementations to use the new ``pathlib.Path`` arguments. @@ -157,8 +157,8 @@ Implementing the ``pytest_cmdline_preparse`` hook .. deprecated:: 7.0 -Implementing the :func:`pytest_cmdline_preparse <_pytest.hookspec.pytest_cmdline_preparse>` hook has been officially deprecated. -Implement the :func:`pytest_load_initial_conftests <_pytest.hookspec.pytest_load_initial_conftests>` hook instead. +Implementing the :hook:`pytest_cmdline_preparse` hook has been officially deprecated. +Implement the :hook:`pytest_load_initial_conftests` hook instead. .. code-block:: python @@ -331,8 +331,8 @@ at some point, depending on the plans for the plugins and number of users using .. versionremoved:: 6.0 -The ``pytest_collect_directory`` has not worked properly for years (it was called -but the results were ignored). Users may consider using :func:`pytest_collection_modifyitems <_pytest.hookspec.pytest_collection_modifyitems>` instead. +The ``pytest_collect_directory`` hook has not worked properly for years (it was called +but the results were ignored). Users may consider using :hook:`pytest_collection_modifyitems` instead. TerminalReporter.writer ~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/doc/en/reference/reference.rst b/doc/en/reference/reference.rst index c132ae6d3dd..d4cbcbac08a 100644 --- a/doc/en/reference/reference.rst +++ b/doc/en/reference/reference.rst @@ -671,9 +671,13 @@ Bootstrapping hooks Bootstrapping hooks called for plugins registered early enough (internal and setuptools plugins). +.. hook:: pytest_load_initial_conftests .. autofunction:: pytest_load_initial_conftests +.. hook:: pytest_cmdline_preparse .. autofunction:: pytest_cmdline_preparse +.. hook:: pytest_cmdline_parse .. autofunction:: pytest_cmdline_parse +.. hook:: pytest_cmdline_main .. autofunction:: pytest_cmdline_main .. _`initialization-hooks`: @@ -683,13 +687,20 @@ Initialization hooks Initialization hooks called for plugins and ``conftest.py`` files. +.. hook:: pytest_addoption .. autofunction:: pytest_addoption +.. hook:: pytest_addhooks .. autofunction:: pytest_addhooks +.. hook:: pytest_configure .. autofunction:: pytest_configure +.. hook:: pytest_unconfigure .. autofunction:: pytest_unconfigure +.. hook:: pytest_sessionstart .. autofunction:: pytest_sessionstart +.. hook:: pytest_sessionfinish .. autofunction:: pytest_sessionfinish +.. hook:: pytest_plugin_registered .. autofunction:: pytest_plugin_registered Collection hooks @@ -697,21 +708,29 @@ Collection hooks ``pytest`` calls the following hooks for collecting files and directories: +.. hook:: pytest_collection .. autofunction:: pytest_collection +.. hook:: pytest_ignore_collect .. autofunction:: pytest_ignore_collect +.. hook:: pytest_collect_file .. autofunction:: pytest_collect_file +.. hook:: pytest_pycollect_makemodule .. autofunction:: pytest_pycollect_makemodule For influencing the collection of objects in Python modules you can use the following hook: +.. hook:: pytest_pycollect_makeitem .. autofunction:: pytest_pycollect_makeitem +.. hook:: pytest_generate_tests .. autofunction:: pytest_generate_tests +.. hook:: pytest_make_parametrize_id .. autofunction:: pytest_make_parametrize_id After collection is complete, you can modify the order of items, delete or otherwise amend the test items: +.. hook:: pytest_collection_modifyitems .. autofunction:: pytest_collection_modifyitems .. note:: @@ -725,13 +744,21 @@ Test running (runtest) hooks All runtest related hooks receive a :py:class:`pytest.Item ` object. +.. hook:: pytest_runtestloop .. autofunction:: pytest_runtestloop +.. hook:: pytest_runtest_protocol .. autofunction:: pytest_runtest_protocol +.. hook:: pytest_runtest_logstart .. autofunction:: pytest_runtest_logstart +.. hook:: pytest_runtest_logfinish .. autofunction:: pytest_runtest_logfinish +.. hook:: pytest_runtest_setup .. autofunction:: pytest_runtest_setup +.. hook:: pytest_runtest_call .. autofunction:: pytest_runtest_call +.. hook:: pytest_runtest_teardown .. autofunction:: pytest_runtest_teardown +.. hook:: pytest_runtest_makereport .. autofunction:: pytest_runtest_makereport For deeper understanding you may look at the default implementation of @@ -740,6 +767,7 @@ in ``_pytest.pdb`` which interacts with ``_pytest.capture`` and its input/output capturing in order to immediately drop into interactive debugging when a test failure occurs. +.. hook:: pytest_pyfunc_call .. autofunction:: pytest_pyfunc_call Reporting hooks @@ -747,26 +775,41 @@ Reporting hooks Session related reporting hooks: +.. hook:: pytest_collectstart .. autofunction:: pytest_collectstart +.. hook:: pytest_make_collect_report .. autofunction:: pytest_make_collect_report +.. hook:: pytest_itemcollected .. autofunction:: pytest_itemcollected +.. hook:: pytest_collectreport .. autofunction:: pytest_collectreport +.. hook:: pytest_deselected .. autofunction:: pytest_deselected +.. hook:: pytest_report_header .. autofunction:: pytest_report_header +.. hook:: pytest_report_collectionfinish .. autofunction:: pytest_report_collectionfinish +.. hook:: pytest_report_teststatus .. autofunction:: pytest_report_teststatus +.. hook:: pytest_terminal_summary .. autofunction:: pytest_terminal_summary +.. hook:: pytest_fixture_setup .. autofunction:: pytest_fixture_setup +.. hook:: pytest_fixture_post_finalizer .. autofunction:: pytest_fixture_post_finalizer +.. hook:: pytest_warning_recorded .. autofunction:: pytest_warning_recorded Central hook for reporting about test execution: +.. hook:: pytest_runtest_logreport .. autofunction:: pytest_runtest_logreport Assertion related hooks: +.. hook:: pytest_assertrepr_compare .. autofunction:: pytest_assertrepr_compare +.. hook:: pytest_assertion_pass .. autofunction:: pytest_assertion_pass @@ -776,9 +819,13 @@ Debugging/Interaction hooks There are few hooks which can be used for special reporting or interaction with exceptions: +.. hook:: pytest_internalerror .. autofunction:: pytest_internalerror +.. hook:: pytest_keyboard_interrupt .. autofunction:: pytest_keyboard_interrupt +.. hook:: pytest_exception_interact .. autofunction:: pytest_exception_interact +.. hook:: pytest_enter_pdb .. autofunction:: pytest_enter_pdb diff --git a/src/_pytest/hookspec.py b/src/_pytest/hookspec.py index bbb6f5e96c7..a03c0e9ab79 100644 --- a/src/_pytest/hookspec.py +++ b/src/_pytest/hookspec.py @@ -162,7 +162,7 @@ def pytest_cmdline_preparse(config: "Config", args: List[str]) -> None: """(**Deprecated**) modify command line arguments before option parsing. This hook is considered deprecated and will be removed in a future pytest version. Consider - using :func:`pytest_load_initial_conftests` instead. + using :hook:`pytest_load_initial_conftests` instead. .. note:: This hook will not be called for ``conftest.py`` files, only for setuptools plugins. @@ -466,7 +466,7 @@ def pytest_runtest_logstart( ) -> None: """Called at the start of running the runtest protocol for a single item. - See :func:`pytest_runtest_protocol` for a description of the runtest protocol. + See :hook:`pytest_runtest_protocol` for a description of the runtest protocol. :param str nodeid: Full node ID of the item. :param location: A tuple of ``(filename, lineno, testname)``. @@ -478,7 +478,7 @@ def pytest_runtest_logfinish( ) -> None: """Called at the end of running the runtest protocol for a single item. - See :func:`pytest_runtest_protocol` for a description of the runtest protocol. + See :hook:`pytest_runtest_protocol` for a description of the runtest protocol. :param str nodeid: Full node ID of the item. :param location: A tuple of ``(filename, lineno, testname)``. @@ -525,7 +525,7 @@ def pytest_runtest_makereport( """Called to create a :class:`~pytest.TestReport` for each of the setup, call and teardown runtest phases of a test item. - See :func:`pytest_runtest_protocol` for a description of the runtest protocol. + See :hook:`pytest_runtest_protocol` for a description of the runtest protocol. :param call: The :class:`~pytest.CallInfo` for the phase. @@ -537,7 +537,7 @@ def pytest_runtest_logreport(report: "TestReport") -> None: """Process the :class:`~pytest.TestReport` produced for each of the setup, call and teardown runtest phases of an item. - See :func:`pytest_runtest_protocol` for a description of the runtest protocol. + See :hook:`pytest_runtest_protocol` for a description of the runtest protocol. """ @@ -556,7 +556,7 @@ def pytest_report_from_serializable( data: Dict[str, Any], ) -> Optional[Union["CollectReport", "TestReport"]]: """Restore a report object previously serialized with - :func:`pytest_report_to_serializable`.""" + :hook:`pytest_report_to_serializable`.""" # ------------------------------------------------------------------------- @@ -859,10 +859,10 @@ def pytest_exception_interact( """Called when an exception was raised which can potentially be interactively handled. - May be called during collection (see :py:func:`pytest_make_collect_report`), + May be called during collection (see :hook:`pytest_make_collect_report`), in which case ``report`` is a :class:`CollectReport`. - May be called during runtest of an item (see :py:func:`pytest_runtest_protocol`), + May be called during runtest of an item (see :hook:`pytest_runtest_protocol`), in which case ``report`` is a :class:`TestReport`. This hook is not called if the exception that was raised is an internal diff --git a/src/_pytest/main.py b/src/_pytest/main.py index 57407fe5495..952c703509d 100644 --- a/src/_pytest/main.py +++ b/src/_pytest/main.py @@ -605,8 +605,7 @@ def perform_collect( ) -> Sequence[Union[nodes.Item, nodes.Collector]]: """Perform the collection phase for this session. - This is called by the default - :func:`pytest_collection <_pytest.hookspec.pytest_collection>` hook + This is called by the default :hook:`pytest_collection` hook implementation; see the documentation of this hook for more details. For testing purposes, it may also be called directly on a fresh ``Session``. diff --git a/src/_pytest/python.py b/src/_pytest/python.py index b5e391fb210..aa49aa26499 100644 --- a/src/_pytest/python.py +++ b/src/_pytest/python.py @@ -985,7 +985,7 @@ def id(self) -> str: @final class Metafunc: - """Objects passed to the :func:`pytest_generate_tests <_pytest.hookspec.pytest_generate_tests>` hook. + """Objects passed to the :hook:`pytest_generate_tests` hook. They help to inspect a test function and to generate tests according to test configuration or values specified in the class or module where a From a3cf2ad3bcc4e3b69613f19affe97d90b2426eba Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 13 Dec 2021 03:02:33 +0000 Subject: [PATCH 032/176] build(deps): Bump pytest-django in /testing/plugins_integration Bumps [pytest-django](https://github.com/pytest-dev/pytest-django) from 4.5.1 to 4.5.2. - [Release notes](https://github.com/pytest-dev/pytest-django/releases) - [Changelog](https://github.com/pytest-dev/pytest-django/blob/master/docs/changelog.rst) - [Commits](https://github.com/pytest-dev/pytest-django/compare/v4.5.1...v4.5.2) --- updated-dependencies: - dependency-name: pytest-django dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- testing/plugins_integration/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/plugins_integration/requirements.txt b/testing/plugins_integration/requirements.txt index 88fe6a3e3f4..64d0ab83d70 100644 --- a/testing/plugins_integration/requirements.txt +++ b/testing/plugins_integration/requirements.txt @@ -3,7 +3,7 @@ django==3.2.10 pytest-asyncio==0.16.0 pytest-bdd==5.0.0 pytest-cov==3.0.0 -pytest-django==4.5.1 +pytest-django==4.5.2 pytest-flakes==4.0.5 pytest-html==3.1.1 pytest-mock==3.6.1 From 913439f5e5691f391e2969b3c8f0a49e50dce43a Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Thu, 16 Dec 2021 09:07:14 -0300 Subject: [PATCH 033/176] Fix test_errors_in_xfail_skip_expressions for Python 3.10.1 Decided to remove the condition altogether as seems reasonable to state that our own test suite requires Python 3.10.1. Fix #9413 --- .github/workflows/main.yml | 4 ++-- testing/test_skipping.py | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 92e2dc6be7c..bbc48adb49a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -78,7 +78,7 @@ jobs: os: windows-latest tox_env: "py39-xdist" - name: "windows-py310" - python: "3.10-dev" + python: "3.10.1" os: windows-latest tox_env: "py310-xdist" @@ -108,7 +108,7 @@ jobs: os: ubuntu-latest tox_env: "py39-xdist" - name: "ubuntu-py310" - python: "3.10-dev" + python: "3.10.1" os: ubuntu-latest tox_env: "py310-xdist" - name: "ubuntu-pypy3" diff --git a/testing/test_skipping.py b/testing/test_skipping.py index a0b5cddabce..3010943607c 100644 --- a/testing/test_skipping.py +++ b/testing/test_skipping.py @@ -1143,8 +1143,6 @@ def test_func(): pypy_version_info = getattr(sys, "pypy_version_info", None) if pypy_version_info is not None and pypy_version_info < (6,): markline = markline[5:] - elif sys.version_info[:2] >= (3, 10): - markline = markline[11:] elif sys.version_info >= (3, 8) or hasattr(sys, "pypy_version_info"): markline = markline[4:] From a73a9a12a22b79422505b8057c8cddc7e1c7d3b0 Mon Sep 17 00:00:00 2001 From: pytest bot Date: Sun, 19 Dec 2021 00:12:37 +0000 Subject: [PATCH 034/176] [automated] Update plugin list --- doc/en/reference/plugin_list.rst | 86 ++++++++++++++++---------------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/doc/en/reference/plugin_list.rst b/doc/en/reference/plugin_list.rst index 8760860f9a6..843cfcd5405 100644 --- a/doc/en/reference/plugin_list.rst +++ b/doc/en/reference/plugin_list.rst @@ -274,7 +274,7 @@ This list contains 969 plugins. :pypi:`pytest-drf` A Django REST framework plugin for pytest. Nov 12, 2020 5 - Production/Stable pytest (>=3.6) :pypi:`pytest-drivings` Tool to allow webdriver automation to be ran locally or remotely Jan 13, 2021 N/A N/A :pypi:`pytest-drop-dup-tests` A Pytest plugin to drop duplicated tests during collection May 23, 2020 4 - Beta pytest (>=2.7) - :pypi:`pytest-dummynet` A py.test plugin providing access to a dummynet. Dec 10, 2021 5 - Production/Stable pytest + :pypi:`pytest-dummynet` A py.test plugin providing access to a dummynet. Dec 15, 2021 5 - Production/Stable pytest :pypi:`pytest-dump2json` A pytest plugin for dumping test results to json. Jun 29, 2015 N/A N/A :pypi:`pytest-duration-insights` Jun 25, 2021 N/A N/A :pypi:`pytest-dynamicrerun` A pytest plugin to rerun tests dynamically based off of test outcome and output. Aug 15, 2020 4 - Beta N/A @@ -322,6 +322,7 @@ This list contains 969 plugins. :pypi:`pytest-expect` py.test plugin to store test expectations and mark tests based on them Apr 21, 2016 4 - Beta N/A :pypi:`pytest-expecter` Better testing with expecter and pytest. Jul 08, 2020 5 - Production/Stable N/A :pypi:`pytest-expectr` This plugin is used to expect multiple assert using pytest framework. Oct 05, 2018 N/A pytest (>=2.4.2) + :pypi:`pytest-experiments` A pytest plugin to help developers of research-oriented software projects keep track of the results of their numerical experiments. Dec 13, 2021 4 - Beta pytest (>=6.2.5,<7.0.0) :pypi:`pytest-explicit` A Pytest plugin to ignore certain marked tests by default Jun 15, 2021 5 - Production/Stable pytest :pypi:`pytest-exploratory` Interactive console for pytest. Aug 03, 2021 N/A pytest (>=5.3) :pypi:`pytest-external-blockers` a special outcome for tests that are blocked for external reasons Oct 05, 2021 N/A pytest @@ -409,7 +410,7 @@ This list contains 969 plugins. :pypi:`pytest-historic` Custom report to display pytest historical execution records Apr 08, 2020 N/A pytest :pypi:`pytest-historic-hook` Custom listener to store execution results into MYSQL DB, which is used for pytest-historic report Apr 08, 2020 N/A pytest :pypi:`pytest-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 10, 2021 3 - Alpha pytest (==6.2.5) + :pypi:`pytest-homeassistant-custom-component` Experimental package to automatically extract test plugins for Home Assistant custom components Dec 18, 2021 3 - Alpha pytest (==6.2.5) :pypi:`pytest-honors` Report on tests that honor constraints, and guard against regressions Mar 06, 2020 4 - Beta N/A :pypi:`pytest-hoverfly` Simplify working with Hoverfly from pytest Jul 12, 2021 N/A pytest (>=5.0) :pypi:`pytest-hoverfly-wrapper` Integrates the Hoverfly HTTP proxy into Pytest Aug 29, 2021 4 - Beta N/A @@ -423,13 +424,13 @@ This list contains 969 plugins. :pypi:`pytest-httpbin` Easily test your HTTP library against a local copy of httpbin Feb 11, 2019 5 - Production/Stable N/A :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 Oct 18, 2021 3 - Alpha pytest ; extra == 'dev' + :pypi:`pytest-httpserver` pytest-httpserver is a httpserver for pytest Dec 15, 2021 3 - Alpha N/A :pypi:`pytest-httpx` Send responses to httpx. Nov 16, 2021 5 - Production/Stable pytest (==6.*) :pypi:`pytest-httpx-blockage` Disable httpx requests during a test run Nov 16, 2021 N/A pytest (>=6.2.5) :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-ibutsu` A plugin to sent pytest results to an Ibutsu server Jun 16, 2021 4 - Beta pytest + :pypi:`pytest-ibutsu` A plugin to sent pytest results to an Ibutsu server Dec 15, 2021 4 - Beta pytest :pypi:`pytest-icdiff` use icdiff for better error messages in pytest assertions Apr 08, 2020 4 - Beta N/A :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-idempotent` Pytest plugin for testing function idempotence. Nov 26, 2021 N/A N/A @@ -446,7 +447,6 @@ This list contains 969 plugins. :pypi:`pytest-Inomaly` A simple image diff plugin for pytest Feb 13, 2018 4 - Beta N/A :pypi:`pytest-insta` A practical snapshot testing plugin for pytest Apr 07, 2021 N/A pytest (>=6.0.2,<7.0.0) :pypi:`pytest-instafail` pytest plugin to show failures instantly Jun 14, 2020 4 - Beta pytest (>=2.9) - :pypi:`pytest-instant` Fast-forward asyncio time (in tests) Dec 05, 2021 N/A N/A :pypi:`pytest-instrument` pytest plugin to instrument tests Apr 05, 2020 5 - Production/Stable pytest (>=5.1.0) :pypi:`pytest-integration` Organizing pytests by integration or not Apr 16, 2020 N/A N/A :pypi:`pytest-integration-mark` Automatic integration test marking and excluding plugin for pytest Jul 19, 2021 N/A pytest (>=5.2,<7.0) @@ -485,7 +485,7 @@ This list contains 969 plugins. :pypi:`pytest-leaks` A pytest plugin to trace resource leaks. Nov 27, 2019 1 - Planning N/A :pypi:`pytest-level` Select tests of a given level or lower Oct 21, 2019 N/A pytest :pypi:`pytest-libfaketime` A python-libfaketime plugin for pytest. Dec 22, 2018 4 - Beta pytest (>=3.0.0) - :pypi:`pytest-libiio` A pytest plugin to manage interfacing with libiio contexts Oct 29, 2021 4 - Beta N/A + :pypi:`pytest-libiio` A pytest plugin to manage interfacing with libiio contexts Dec 15, 2021 4 - Beta N/A :pypi:`pytest-libnotify` Pytest plugin that shows notifications about the test run Apr 02, 2021 3 - Alpha pytest :pypi:`pytest-ligo` Jan 16, 2020 4 - Beta N/A :pypi:`pytest-lineno` A pytest plugin to show the line numbers of test functions Dec 04, 2020 N/A pytest @@ -495,7 +495,7 @@ This list contains 969 plugins. :pypi:`pytest-litf` A pytest plugin that stream output in LITF format Jan 18, 2021 4 - Beta pytest (>=3.1.1) :pypi:`pytest-live` Live results for pytest Mar 08, 2020 N/A pytest :pypi:`pytest-localftpserver` A PyTest plugin which provides an FTP fixture for your tests Aug 25, 2021 5 - Production/Stable pytest - :pypi:`pytest-localserver` py.test plugin to test server connections locally. Nov 19, 2021 4 - Beta N/A + :pypi:`pytest-localserver` py.test plugin to test server connections locally. Dec 13, 2021 4 - Beta N/A :pypi:`pytest-localstack` Pytest plugin for AWS integration tests Aug 22, 2019 4 - Beta pytest (>=3.3.0) :pypi:`pytest-lockable` lockable resource plugin for pytest Nov 09, 2021 5 - Production/Stable pytest :pypi:`pytest-locker` Used to lock object during testing. Essentially changing assertions from being hard coded to asserting that nothing changed Oct 29, 2021 N/A pytest (>=5.4) @@ -603,7 +603,7 @@ This list contains 969 plugins. :pypi:`pytest-order` pytest plugin to run your tests in a specific order May 30, 2021 4 - Beta pytest (>=5.0) :pypi:`pytest-ordering` pytest plugin to run your tests in a specific order Nov 14, 2018 4 - Beta pytest :pypi:`pytest-osxnotify` OS X notifications for py.test results. May 15, 2015 N/A N/A - :pypi:`pytest-otel` pytest-otel report OpenTelemetry traces about test executed Dec 03, 2021 N/A N/A + :pypi:`pytest-otel` pytest-otel report OpenTelemetry traces about test executed Dec 16, 2021 N/A N/A :pypi:`pytest-pact` A simple plugin to use with pytest Jan 07, 2019 4 - Beta N/A :pypi:`pytest-pahrametahrize` Parametrize your tests with a Boston accent. Nov 24, 2021 4 - Beta pytest (>=6.0,<7.0) :pypi:`pytest-parallel` a pytest plugin for parallel and concurrent testing Oct 10, 2021 3 - Alpha pytest (>=3.0.0) @@ -689,7 +689,7 @@ This list contains 969 plugins. :pypi:`pytest-pytorch` pytest plugin for a better developer experience when working with the PyTorch test suite May 25, 2021 4 - Beta pytest :pypi:`pytest-qasync` Pytest support for qasync. Jul 12, 2021 4 - Beta pytest (>=5.4.0) :pypi:`pytest-qatouch` Pytest plugin for uploading test results to your QA Touch Testrun. Jun 26, 2021 4 - Beta pytest (>=6.2.0) - :pypi:`pytest-qgis` A pytest plugin for testing QGIS python plugins Dec 07, 2021 5 - Production/Stable pytest (>=6.2.3) + :pypi:`pytest-qgis` A pytest plugin for testing QGIS python plugins Dec 16, 2021 5 - Production/Stable pytest (>=6.2.3) :pypi:`pytest-qml` Run QML Tests with pytest Dec 02, 2020 4 - Beta pytest (>=6.0.0) :pypi:`pytest-qr` pytest plugin to generate test result QR codes Nov 25, 2021 4 - Beta N/A :pypi:`pytest-qt` pytest support for PyQt and PySide applications Jun 13, 2021 5 - Production/Stable pytest (>=3.0.0) @@ -728,7 +728,7 @@ This list contains 969 plugins. :pypi:`pytest-reorder` Reorder tests depending on their paths and names. May 31, 2018 4 - Beta pytest :pypi:`pytest-repeat` pytest plugin for repeating tests Oct 31, 2020 5 - Production/Stable pytest (>=3.6) :pypi:`pytest-replay` Saves previous test runs and allow re-execute previous pytest runs to reproduce crashes or flaky tests Jun 09, 2021 4 - Beta pytest (>=3.0.0) - :pypi:`pytest-repo-health` A pytest plugin to report on repository standards conformance Nov 23, 2021 3 - Alpha pytest + :pypi:`pytest-repo-health` A pytest plugin to report on repository standards conformance Dec 16, 2021 3 - Alpha pytest :pypi:`pytest-report` Creates json report that is compatible with atom.io's linter message format May 11, 2016 4 - Beta N/A :pypi:`pytest-reporter` Generate Pytest reports with templates Jul 22, 2021 4 - Beta pytest :pypi:`pytest-reporter-html1` A basic HTML report template for Pytest Jun 08, 2021 4 - Beta N/A @@ -772,14 +772,14 @@ This list contains 969 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. Dec 11, 2021 5 - Production/Stable N/A + :pypi:`pytest-sbase` A complete web automation framework for end-to-end testing. Dec 17, 2021 5 - Production/Stable N/A :pypi:`pytest-scenario` pytest plugin for test scenarios Feb 06, 2017 3 - Alpha N/A :pypi:`pytest-schema` 👍 Validate return values against a schema-like object in testing Aug 31, 2020 5 - Production/Stable pytest (>=3.5.0) :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 Sep 19, 2020 5 - Production/Stable pytest (>=5.0.0) - :pypi:`pytest-seleniumbase` A complete web automation framework for end-to-end testing. Dec 11, 2021 5 - Production/Stable N/A - :pypi:`pytest-selenium-enhancer` pytest plugin for Selenium Nov 26, 2020 5 - Production/Stable N/A + :pypi:`pytest-seleniumbase` A complete web automation framework for end-to-end testing. Dec 17, 2021 5 - Production/Stable N/A + :pypi:`pytest-selenium-enhancer` pytest plugin for Selenium Dec 16, 2021 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-send-email` Send pytest execution result email Dec 04, 2019 N/A N/A :pypi:`pytest-sentry` A pytest plugin to send testrun information to Sentry.io Apr 21, 2021 N/A pytest @@ -828,7 +828,7 @@ This list contains 969 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 29, 2021 N/A pytest (>5.4.0,<6.3) + :pypi:`pytest-splunk-addon` A Dynamic test tool for Splunk Apps and Add-ons Dec 17, 2021 N/A pytest (>5.4.0,<6.3) :pypi:`pytest-splunk-addon-ui-smartx` Library to support testing Splunk Add-on UX Dec 06, 2021 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 @@ -879,8 +879,8 @@ This list contains 969 plugins. :pypi:`pytest-testobject` Plugin to use TestObject Suites with Pytest Sep 24, 2019 4 - Beta pytest (>=3.1.1) :pypi:`pytest-testrail` pytest plugin for creating TestRail runs and adding results Aug 27, 2020 N/A pytest (>=3.6) :pypi:`pytest-testrail2` A small example package Nov 17, 2020 N/A pytest (>=5) - :pypi:`pytest-testrail-api` Плагин Pytest, для интеграции с TestRail Nov 30, 2021 N/A pytest (>=5.5) - :pypi:`pytest-testrail-api-client` TestRail Api Python Client Dec 03, 2021 N/A pytest + :pypi:`pytest-testrail-api` Плагин Pytest, для интеграции с TestRail Dec 17, 2021 N/A pytest (>=5.5) + :pypi:`pytest-testrail-api-client` TestRail Api Python Client Dec 14, 2021 N/A pytest :pypi:`pytest-testrail-appetize` pytest plugin for creating TestRail runs and adding results Sep 29, 2021 N/A N/A :pypi:`pytest-testrail-client` pytest plugin for Testrail Sep 29, 2020 5 - Production/Stable N/A :pypi:`pytest-testrail-e2e` pytest plugin for creating TestRail runs and adding results Oct 11, 2021 N/A pytest (>=3.6) @@ -890,14 +890,14 @@ This list contains 969 plugins. :pypi:`pytest-testreport` Nov 12, 2021 4 - Beta pytest (>=3.5.0) :pypi:`pytest-testslide` TestSlide fixture for pytest Jan 07, 2021 5 - Production/Stable pytest (~=6.2) :pypi:`pytest-test-this` Plugin for py.test to run relevant tests, based on naively checking if a test contains a reference to the symbol you supply Sep 15, 2019 2 - Pre-Alpha pytest (>=2.3) - :pypi:`pytest-test-utils` Nov 30, 2021 N/A pytest (>=5) + :pypi:`pytest-test-utils` Dec 14, 2021 N/A pytest (>=5) :pypi:`pytest-tesults` Tesults plugin for pytest Jul 31, 2021 5 - Production/Stable pytest (>=3.5.0) :pypi:`pytest-tezos` pytest-ligo Jan 16, 2020 4 - Beta N/A :pypi:`pytest-thawgun` Pytest plugin for time travel May 26, 2020 3 - Alpha N/A :pypi:`pytest-threadleak` Detects thread leaks Sep 08, 2017 4 - Beta N/A :pypi:`pytest-tick` Ticking on tests Aug 31, 2021 5 - Production/Stable pytest (>=6.2.5,<7.0.0) :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 11, 2021 5 - Production/Stable pytest (>=5.0.0) + :pypi:`pytest-timeout` pytest plugin to abort hanging tests Dec 13, 2021 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 :pypi:`pytest-timer` A timer plugin for pytest Jun 02, 2021 N/A N/A :pypi:`pytest-timestamper` Pytest plugin to add a timestamp prefix to the pytest output Jun 06, 2021 N/A N/A @@ -2785,7 +2785,7 @@ This list contains 969 plugins. A Pytest plugin to drop duplicated tests during collection :pypi:`pytest-dummynet` - *last release*: Dec 10, 2021, + *last release*: Dec 15, 2021, *status*: 5 - Production/Stable, *requires*: pytest @@ -3120,6 +3120,13 @@ This list contains 969 plugins. This plugin is used to expect multiple assert using pytest framework. + :pypi:`pytest-experiments` + *last release*: Dec 13, 2021, + *status*: 4 - Beta, + *requires*: pytest (>=6.2.5,<7.0.0) + + A pytest plugin to help developers of research-oriented software projects keep track of the results of their numerical experiments. + :pypi:`pytest-explicit` *last release*: Jun 15, 2021, *status*: 5 - Production/Stable, @@ -3730,7 +3737,7 @@ This list contains 969 plugins. A pytest plugin for use with homeassistant custom components. :pypi:`pytest-homeassistant-custom-component` - *last release*: Dec 10, 2021, + *last release*: Dec 18, 2021, *status*: 3 - Alpha, *requires*: pytest (==6.2.5) @@ -3828,9 +3835,9 @@ This list contains 969 plugins. A thin wrapper of HTTPretty for pytest :pypi:`pytest-httpserver` - *last release*: Oct 18, 2021, + *last release*: Dec 15, 2021, *status*: 3 - Alpha, - *requires*: pytest ; extra == 'dev' + *requires*: N/A pytest-httpserver is a httpserver for pytest @@ -3870,7 +3877,7 @@ This list contains 969 plugins. help hypo module for pytest :pypi:`pytest-ibutsu` - *last release*: Jun 16, 2021, + *last release*: Dec 15, 2021, *status*: 4 - Beta, *requires*: pytest @@ -3988,13 +3995,6 @@ This list contains 969 plugins. pytest plugin to show failures instantly - :pypi:`pytest-instant` - *last release*: Dec 05, 2021, - *status*: N/A, - *requires*: N/A - - Fast-forward asyncio time (in tests) - :pypi:`pytest-instrument` *last release*: Apr 05, 2020, *status*: 5 - Production/Stable, @@ -4262,7 +4262,7 @@ This list contains 969 plugins. A python-libfaketime plugin for pytest. :pypi:`pytest-libiio` - *last release*: Oct 29, 2021, + *last release*: Dec 15, 2021, *status*: 4 - Beta, *requires*: N/A @@ -4332,7 +4332,7 @@ This list contains 969 plugins. A PyTest plugin which provides an FTP fixture for your tests :pypi:`pytest-localserver` - *last release*: Nov 19, 2021, + *last release*: Dec 13, 2021, *status*: 4 - Beta, *requires*: N/A @@ -5088,7 +5088,7 @@ This list contains 969 plugins. OS X notifications for py.test results. :pypi:`pytest-otel` - *last release*: Dec 03, 2021, + *last release*: Dec 16, 2021, *status*: N/A, *requires*: N/A @@ -5690,7 +5690,7 @@ This list contains 969 plugins. Pytest plugin for uploading test results to your QA Touch Testrun. :pypi:`pytest-qgis` - *last release*: Dec 07, 2021, + *last release*: Dec 16, 2021, *status*: 5 - Production/Stable, *requires*: pytest (>=6.2.3) @@ -5963,7 +5963,7 @@ This list contains 969 plugins. Saves previous test runs and allow re-execute previous pytest runs to reproduce crashes or flaky tests :pypi:`pytest-repo-health` - *last release*: Nov 23, 2021, + *last release*: Dec 16, 2021, *status*: 3 - Alpha, *requires*: pytest @@ -6271,7 +6271,7 @@ This list contains 969 plugins. :pypi:`pytest-sbase` - *last release*: Dec 11, 2021, + *last release*: Dec 17, 2021, *status*: 5 - Production/Stable, *requires*: N/A @@ -6313,14 +6313,14 @@ This list contains 969 plugins. pytest plugin for Selenium :pypi:`pytest-seleniumbase` - *last release*: Dec 11, 2021, + *last release*: Dec 17, 2021, *status*: 5 - Production/Stable, *requires*: N/A A complete web automation framework for end-to-end testing. :pypi:`pytest-selenium-enhancer` - *last release*: Nov 26, 2020, + *last release*: Dec 16, 2021, *status*: 5 - Production/Stable, *requires*: N/A @@ -6663,7 +6663,7 @@ This list contains 969 plugins. :pypi:`pytest-splunk-addon` - *last release*: Nov 29, 2021, + *last release*: Dec 17, 2021, *status*: N/A, *requires*: pytest (>5.4.0,<6.3) @@ -7020,14 +7020,14 @@ This list contains 969 plugins. A small example package :pypi:`pytest-testrail-api` - *last release*: Nov 30, 2021, + *last release*: Dec 17, 2021, *status*: N/A, *requires*: pytest (>=5.5) Плагин Pytest, для интеграции с TestRail :pypi:`pytest-testrail-api-client` - *last release*: Dec 03, 2021, + *last release*: Dec 14, 2021, *status*: N/A, *requires*: pytest @@ -7097,7 +7097,7 @@ This list contains 969 plugins. Plugin for py.test to run relevant tests, based on naively checking if a test contains a reference to the symbol you supply :pypi:`pytest-test-utils` - *last release*: Nov 30, 2021, + *last release*: Dec 14, 2021, *status*: N/A, *requires*: pytest (>=5) @@ -7146,7 +7146,7 @@ This list contains 969 plugins. A pytest plugin to time test function runs :pypi:`pytest-timeout` - *last release*: Oct 11, 2021, + *last release*: Dec 13, 2021, *status*: 5 - Production/Stable, *requires*: pytest (>=5.0.0) From e358bc65a8ae7bc2e21ff547767c7705089f76a9 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 20 Dec 2021 20:42:31 +0000 Subject: [PATCH 035/176] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/mirrors-mypy: v0.910-1 → v0.920](https://github.com/pre-commit/mirrors-mypy/compare/v0.910-1...v0.920) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1741136dfe0..1a740045015 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -48,7 +48,7 @@ repos: hooks: - id: python-use-type-annotations - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.910-1 + rev: v0.920 hooks: - id: mypy files: ^(src/|testing/) From c69b84f2367b44c0692589aef037deeca9e11a4a Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Tue, 21 Dec 2021 20:42:32 -0500 Subject: [PATCH 036/176] fix typing issues in mypy 0.920 --- src/_pytest/capture.py | 2 +- src/_pytest/junitxml.py | 2 +- src/_pytest/logging.py | 19 ++++++++++++------- testing/code/test_source.py | 3 +-- testing/test_assertrewrite.py | 2 +- testing/test_legacypath.py | 2 +- testing/test_pastebin.py | 5 ++++- testing/test_recwarn.py | 4 ++-- 8 files changed, 23 insertions(+), 16 deletions(-) diff --git a/src/_pytest/capture.py b/src/_pytest/capture.py index 884f035e299..d82ee9552f1 100644 --- a/src/_pytest/capture.py +++ b/src/_pytest/capture.py @@ -112,7 +112,7 @@ def _reopen_stdio(f, mode): buffering = -1 return io.TextIOWrapper( - open(os.dup(f.fileno()), mode, buffering), # type: ignore[arg-type] + open(os.dup(f.fileno()), mode, buffering), f.encoding, f.errors, f.newlines, diff --git a/src/_pytest/junitxml.py b/src/_pytest/junitxml.py index 13688251f6a..8249dccffed 100644 --- a/src/_pytest/junitxml.py +++ b/src/_pytest/junitxml.py @@ -92,7 +92,7 @@ def __init__(self, nodeid: Union[str, TestReport], xml: "LogXML") -> None: self.xml = xml self.add_stats = self.xml.add_stats self.family = self.xml.family - self.duration = 0 + self.duration = 0.0 self.properties: List[Tuple[str, str]] = [] self.nodes: List[ET.Element] = [] self.attrs: Dict[str, str] = {} diff --git a/src/_pytest/logging.py b/src/_pytest/logging.py index 31ad8301076..796a1c3f8af 100644 --- a/src/_pytest/logging.py +++ b/src/_pytest/logging.py @@ -1,4 +1,5 @@ """Access and control log capturing.""" +import io import logging import os import re @@ -13,6 +14,7 @@ from typing import Mapping from typing import Optional from typing import Tuple +from typing import TYPE_CHECKING from typing import TypeVar from typing import Union @@ -34,6 +36,11 @@ from _pytest.stash import StashKey from _pytest.terminal import TerminalReporter +if TYPE_CHECKING: + logging_StreamHandler = logging.StreamHandler[StringIO] +else: + logging_StreamHandler = logging.StreamHandler + DEFAULT_LOG_FORMAT = "%(levelname)-8s %(name)s:%(filename)s:%(lineno)d %(message)s" DEFAULT_LOG_DATE_FORMAT = "%H:%M:%S" @@ -322,11 +329,9 @@ def __exit__(self, type, value, traceback): root_logger.removeHandler(self.handler) -class LogCaptureHandler(logging.StreamHandler): +class LogCaptureHandler(logging_StreamHandler): """A logging handler that stores log records and the log text.""" - stream: StringIO - def __init__(self) -> None: """Create a new log handler.""" super().__init__(StringIO()) @@ -621,7 +626,8 @@ def set_log_path(self, fname: str) -> None: if not fpath.parent.exists(): fpath.parent.mkdir(exist_ok=True, parents=True) - stream = fpath.open(mode="w", encoding="UTF-8") + # https://github.com/python/mypy/issues/11193 + stream: io.TextIOWrapper = fpath.open(mode="w", encoding="UTF-8") # type: ignore[assignment] if sys.version_info >= (3, 7): old_stream = self.log_file_handler.setStream(stream) else: @@ -633,8 +639,7 @@ def set_log_path(self, fname: str) -> None: finally: self.log_file_handler.release() if old_stream: - # https://github.com/python/typeshed/pull/5663 - old_stream.close() # type:ignore[attr-defined] + old_stream.close() def _log_cli_enabled(self): """Return whether live logging is enabled.""" @@ -758,7 +763,7 @@ def handleError(self, record: logging.LogRecord) -> None: pass -class _LiveLoggingStreamHandler(logging.StreamHandler): +class _LiveLoggingStreamHandler(logging_StreamHandler): """A logging StreamHandler used by the live logging feature: it will write a newline before the first log message in each test. diff --git a/testing/code/test_source.py b/testing/code/test_source.py index 53202ee27e3..b7b3c17115a 100644 --- a/testing/code/test_source.py +++ b/testing/code/test_source.py @@ -332,8 +332,7 @@ def test_findsource(monkeypatch) -> None: lines = ["if 1:\n", " def x():\n", " pass\n"] co = compile("".join(lines), filename, "exec") - # Type ignored because linecache.cache is private. - monkeypatch.setitem(linecache.cache, filename, (1, None, lines, filename)) # type: ignore[attr-defined] + monkeypatch.setitem(linecache.cache, filename, (1, None, lines, filename)) src, lineno = findsource(co) assert src is not None diff --git a/testing/test_assertrewrite.py b/testing/test_assertrewrite.py index 61f5760e725..a88c7eba33e 100644 --- a/testing/test_assertrewrite.py +++ b/testing/test_assertrewrite.py @@ -1057,7 +1057,7 @@ def atomic_write_failed(fn, mode="r", overwrite=False): e = OSError() e.errno = 10 raise e - yield # type:ignore[unreachable] + yield monkeypatch.setattr( _pytest.assertion.rewrite, "atomic_write", atomic_write_failed diff --git a/testing/test_legacypath.py b/testing/test_legacypath.py index 9ab139df467..1d3fdb4bd9c 100644 --- a/testing/test_legacypath.py +++ b/testing/test_legacypath.py @@ -14,7 +14,7 @@ def test_item_fspath(pytester: pytest.Pytester) -> None: items2, hookrec = pytester.inline_genitems(item.nodeid) (item2,) = items2 assert item2.name == item.name - assert item2.fspath == item.fspath # type: ignore[attr-defined] + assert item2.fspath == item.fspath assert item2.path == item.path diff --git a/testing/test_pastebin.py b/testing/test_pastebin.py index b338519ae17..86b231f8b5e 100644 --- a/testing/test_pastebin.py +++ b/testing/test_pastebin.py @@ -1,3 +1,4 @@ +import email.message import io from typing import List from typing import Union @@ -98,7 +99,9 @@ def mocked_urlopen_fail(self, monkeypatch: MonkeyPatch): def mocked(url, data): calls.append((url, data)) - raise urllib.error.HTTPError(url, 400, "Bad request", {}, io.BytesIO()) + raise urllib.error.HTTPError( + url, 400, "Bad request", email.message.Message(), io.BytesIO() + ) monkeypatch.setattr(urllib.request, "urlopen", mocked) return calls diff --git a/testing/test_recwarn.py b/testing/test_recwarn.py index d3f218f1660..c5a8ae90fc1 100644 --- a/testing/test_recwarn.py +++ b/testing/test_recwarn.py @@ -114,13 +114,13 @@ def test_deprecated_call_preserves(self) -> None: # Type ignored because `onceregistry` and `filters` are not # documented API. onceregistry = warnings.onceregistry.copy() # type: ignore - filters = warnings.filters[:] # type: ignore + filters = warnings.filters[:] warn = warnings.warn warn_explicit = warnings.warn_explicit self.test_deprecated_call_raises() self.test_deprecated_call() assert onceregistry == warnings.onceregistry # type: ignore - assert filters == warnings.filters # type: ignore + assert filters == warnings.filters assert warn is warnings.warn assert warn_explicit is warnings.warn_explicit From 8071ad6b909353b5921cbd97acf008bdfb3122d9 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Thu, 16 Dec 2021 13:51:17 +0200 Subject: [PATCH 037/176] doc: fix a reference in "Writing hook functions" --- doc/en/how-to/writing_hook_functions.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/en/how-to/writing_hook_functions.rst b/doc/en/how-to/writing_hook_functions.rst index 663bceb6321..f615fced861 100644 --- a/doc/en/how-to/writing_hook_functions.rst +++ b/doc/en/how-to/writing_hook_functions.rst @@ -321,7 +321,7 @@ Plugins often need to store data on :class:`~pytest.Item`\s in one hook implementation, and access it in another. One common solution is to just assign some private attribute directly on the item, but type-checkers like mypy frown upon this, and it may also cause conflicts with other plugins. -So pytest offers a better way to do this, :attr:`_pytest.nodes.Node.stash `. +So pytest offers a better way to do this, :attr:`item.stash <_pytest.nodes.Node.stash>`. To use the "stash" in your plugins, first create "stash keys" somewhere at the top level of your plugin: From 10e21dadeec16caef955d0cb1e222d532e33a5ff Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Sat, 25 Dec 2021 12:03:15 +0200 Subject: [PATCH 038/176] python: skip nose setup/teardown fixtures if non-callable Since commit 89f0b5b5a2f485f77999d15cb9437ad9234003a1 cases as in the added test started to fail, like they do for the standard pytest names (`setup_module` etc). But the name `setup` in particular is way too common for us to start taking it over more aggressively, so restore the previous behavior which required the object to be callable. Fix #9391. --- src/_pytest/python.py | 6 ++++++ testing/test_nose.py | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/src/_pytest/python.py b/src/_pytest/python.py index aa49aa26499..197d36ee9df 100644 --- a/src/_pytest/python.py +++ b/src/_pytest/python.py @@ -522,12 +522,18 @@ def _inject_setup_module_fixture(self) -> None: self.obj, ("setUpModule", "setup_module") ) if setup_module is None and has_nose: + # The name "setup" is too common - only treat as fixture if callable. setup_module = _get_first_non_fixture_func(self.obj, ("setup",)) + if not callable(setup_module): + setup_module = None teardown_module = _get_first_non_fixture_func( self.obj, ("tearDownModule", "teardown_module") ) if teardown_module is None and has_nose: teardown_module = _get_first_non_fixture_func(self.obj, ("teardown",)) + # Same as "setup" above - only treat as fixture if callable. + if not callable(teardown_module): + teardown_module = None if setup_module is None and teardown_module is None: return diff --git a/testing/test_nose.py b/testing/test_nose.py index edca0f4463e..1ded8854bb7 100644 --- a/testing/test_nose.py +++ b/testing/test_nose.py @@ -477,3 +477,22 @@ def test_raises_baseexception_caught(): "* 1 failed, 2 passed *", ] ) + + +def test_nose_setup_skipped_if_non_callable(pytester: Pytester) -> None: + """Regression test for #9391.""" + p = pytester.makepyfile( + __init__="", + setup=""" + """, + teardown=""" + """, + test_it=""" + from . import setup, teardown + + def test_it(): + pass + """, + ) + result = pytester.runpytest(p, "-p", "nose") + assert result.ret == 0 From 3128080806f884ffdf303312f2a433f3334c05ee Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Sat, 25 Dec 2021 10:37:07 +0200 Subject: [PATCH 039/176] pytest: bring back direct imports of TempdirFactory, Testdir The monkeypatch approach doesn't work for `import pytest; pytest.TempdirFactory`. Fix #9432. --- src/_pytest/legacypath.py | 95 ++++++++++++++++++++------------------- src/pytest/__init__.py | 4 ++ 2 files changed, 53 insertions(+), 46 deletions(-) diff --git a/src/_pytest/legacypath.py b/src/_pytest/legacypath.py index 743c06d55c4..4c2db941257 100644 --- a/src/_pytest/legacypath.py +++ b/src/_pytest/legacypath.py @@ -10,13 +10,26 @@ import attr from iniconfig import SectionWrapper -import pytest +from _pytest.cacheprovider import Cache from _pytest.compat import final from _pytest.compat import LEGACY_PATH from _pytest.compat import legacy_path +from _pytest.config import Config +from _pytest.config import hookimpl +from _pytest.config import PytestPluginManager from _pytest.deprecated import check_ispytest +from _pytest.fixtures import fixture +from _pytest.fixtures import FixtureRequest +from _pytest.main import Session +from _pytest.monkeypatch import MonkeyPatch +from _pytest.nodes import Collector +from _pytest.nodes import Item from _pytest.nodes import Node +from _pytest.pytester import HookRecorder +from _pytest.pytester import Pytester +from _pytest.pytester import RunResult from _pytest.terminal import TerminalReporter +from _pytest.tmpdir import TempPathFactory if TYPE_CHECKING: from typing_extensions import Final @@ -35,10 +48,10 @@ class Testdir: __test__ = False - CLOSE_STDIN: "Final" = pytest.Pytester.CLOSE_STDIN - TimeoutExpired: "Final" = pytest.Pytester.TimeoutExpired + CLOSE_STDIN: "Final" = Pytester.CLOSE_STDIN + TimeoutExpired: "Final" = Pytester.TimeoutExpired - def __init__(self, pytester: pytest.Pytester, *, _ispytest: bool = False) -> None: + def __init__(self, pytester: Pytester, *, _ispytest: bool = False) -> None: check_ispytest(_ispytest) self._pytester = pytester @@ -64,10 +77,10 @@ def plugins(self, plugins): self._pytester.plugins = plugins @property - def monkeypatch(self) -> pytest.MonkeyPatch: + def monkeypatch(self) -> MonkeyPatch: return self._pytester._monkeypatch - def make_hook_recorder(self, pluginmanager) -> pytest.HookRecorder: + def make_hook_recorder(self, pluginmanager) -> HookRecorder: """See :meth:`Pytester.make_hook_recorder`.""" return self._pytester.make_hook_recorder(pluginmanager) @@ -131,9 +144,7 @@ def copy_example(self, name=None) -> LEGACY_PATH: """See :meth:`Pytester.copy_example`.""" return legacy_path(self._pytester.copy_example(name)) - def getnode( - self, config: pytest.Config, arg - ) -> Optional[Union[pytest.Item, pytest.Collector]]: + def getnode(self, config: Config, arg) -> Optional[Union[Item, Collector]]: """See :meth:`Pytester.getnode`.""" return self._pytester.getnode(config, arg) @@ -141,9 +152,7 @@ def getpathnode(self, path): """See :meth:`Pytester.getpathnode`.""" return self._pytester.getpathnode(path) - def genitems( - self, colitems: List[Union[pytest.Item, pytest.Collector]] - ) -> List[pytest.Item]: + def genitems(self, colitems: List[Union[Item, Collector]]) -> List[Item]: """See :meth:`Pytester.genitems`.""" return self._pytester.genitems(colitems) @@ -165,19 +174,19 @@ def inline_run(self, *args, plugins=(), no_reraise_ctrlc: bool = False): *args, plugins=plugins, no_reraise_ctrlc=no_reraise_ctrlc ) - def runpytest_inprocess(self, *args, **kwargs) -> pytest.RunResult: + def runpytest_inprocess(self, *args, **kwargs) -> RunResult: """See :meth:`Pytester.runpytest_inprocess`.""" return self._pytester.runpytest_inprocess(*args, **kwargs) - def runpytest(self, *args, **kwargs) -> pytest.RunResult: + def runpytest(self, *args, **kwargs) -> RunResult: """See :meth:`Pytester.runpytest`.""" return self._pytester.runpytest(*args, **kwargs) - def parseconfig(self, *args) -> pytest.Config: + def parseconfig(self, *args) -> Config: """See :meth:`Pytester.parseconfig`.""" return self._pytester.parseconfig(*args) - def parseconfigure(self, *args) -> pytest.Config: + def parseconfigure(self, *args) -> Config: """See :meth:`Pytester.parseconfigure`.""" return self._pytester.parseconfigure(*args) @@ -196,8 +205,8 @@ def getmodulecol(self, source, configargs=(), withinit=False): ) def collect_by_name( - self, modcol: pytest.Collector, name: str - ) -> Optional[Union[pytest.Item, pytest.Collector]]: + self, modcol: Collector, name: str + ) -> Optional[Union[Item, Collector]]: """See :meth:`Pytester.collect_by_name`.""" return self._pytester.collect_by_name(modcol, name) @@ -212,11 +221,11 @@ def popen( """See :meth:`Pytester.popen`.""" return self._pytester.popen(cmdargs, stdout, stderr, stdin, **kw) - def run(self, *cmdargs, timeout=None, stdin=CLOSE_STDIN) -> pytest.RunResult: + def run(self, *cmdargs, timeout=None, stdin=CLOSE_STDIN) -> RunResult: """See :meth:`Pytester.run`.""" return self._pytester.run(*cmdargs, timeout=timeout, stdin=stdin) - def runpython(self, script) -> pytest.RunResult: + def runpython(self, script) -> RunResult: """See :meth:`Pytester.runpython`.""" return self._pytester.runpython(script) @@ -224,7 +233,7 @@ def runpython_c(self, command): """See :meth:`Pytester.runpython_c`.""" return self._pytester.runpython_c(command) - def runpytest_subprocess(self, *args, timeout=None) -> pytest.RunResult: + def runpytest_subprocess(self, *args, timeout=None) -> RunResult: """See :meth:`Pytester.runpytest_subprocess`.""" return self._pytester.runpytest_subprocess(*args, timeout=timeout) @@ -245,13 +254,10 @@ def __str__(self) -> str: return str(self.tmpdir) -pytest.Testdir = Testdir # type: ignore[attr-defined] - - class LegacyTestdirPlugin: @staticmethod - @pytest.fixture - def testdir(pytester: pytest.Pytester) -> Testdir: + @fixture + def testdir(pytester: Pytester) -> Testdir: """ Identical to :fixture:`pytester`, and provides an instance whose methods return legacy ``LEGACY_PATH`` objects instead when applicable. @@ -267,10 +273,10 @@ class TempdirFactory: """Backward compatibility wrapper that implements :class:``_pytest.compat.LEGACY_PATH`` for :class:``TempPathFactory``.""" - _tmppath_factory: pytest.TempPathFactory + _tmppath_factory: TempPathFactory def __init__( - self, tmppath_factory: pytest.TempPathFactory, *, _ispytest: bool = False + self, tmppath_factory: TempPathFactory, *, _ispytest: bool = False ) -> None: check_ispytest(_ispytest) self._tmppath_factory = tmppath_factory @@ -284,19 +290,16 @@ def getbasetemp(self) -> LEGACY_PATH: return legacy_path(self._tmppath_factory.getbasetemp().resolve()) -pytest.TempdirFactory = TempdirFactory # type: ignore[attr-defined] - - class LegacyTmpdirPlugin: @staticmethod - @pytest.fixture(scope="session") - def tmpdir_factory(request: pytest.FixtureRequest) -> TempdirFactory: + @fixture(scope="session") + def tmpdir_factory(request: FixtureRequest) -> TempdirFactory: """Return a :class:`pytest.TempdirFactory` instance for the test session.""" # Set dynamically by pytest_configure(). return request.config._tmpdirhandler # type: ignore @staticmethod - @pytest.fixture + @fixture def tmpdir(tmp_path: Path) -> LEGACY_PATH: """Return a temporary directory path object which is unique to each test function invocation, created as a sub directory of the base temporary @@ -314,7 +317,7 @@ def tmpdir(tmp_path: Path) -> LEGACY_PATH: return legacy_path(tmp_path) -def Cache_makedir(self: pytest.Cache, name: str) -> LEGACY_PATH: +def Cache_makedir(self: Cache, name: str) -> LEGACY_PATH: """Return a directory path object with the given name. Same as :func:`mkdir`, but returns a legacy py path instance. @@ -322,7 +325,7 @@ def Cache_makedir(self: pytest.Cache, name: str) -> LEGACY_PATH: return legacy_path(self.mkdir(name)) -def FixtureRequest_fspath(self: pytest.FixtureRequest) -> LEGACY_PATH: +def FixtureRequest_fspath(self: FixtureRequest) -> LEGACY_PATH: """(deprecated) The file system path of the test module which collected this test.""" return legacy_path(self.path) @@ -337,7 +340,7 @@ def TerminalReporter_startdir(self: TerminalReporter) -> LEGACY_PATH: return legacy_path(self.startpath) -def Config_invocation_dir(self: pytest.Config) -> LEGACY_PATH: +def Config_invocation_dir(self: Config) -> LEGACY_PATH: """The directory from which pytest was invoked. Prefer to use :attr:`invocation_params.dir `, @@ -348,7 +351,7 @@ def Config_invocation_dir(self: pytest.Config) -> LEGACY_PATH: return legacy_path(str(self.invocation_params.dir)) -def Config_rootdir(self: pytest.Config) -> LEGACY_PATH: +def Config_rootdir(self: Config) -> LEGACY_PATH: """The path to the :ref:`rootdir `. Prefer to use :attr:`rootpath`, which is a :class:`pathlib.Path`. @@ -358,7 +361,7 @@ def Config_rootdir(self: pytest.Config) -> LEGACY_PATH: return legacy_path(str(self.rootpath)) -def Config_inifile(self: pytest.Config) -> Optional[LEGACY_PATH]: +def Config_inifile(self: Config) -> Optional[LEGACY_PATH]: """The path to the :ref:`configfile `. Prefer to use :attr:`inipath`, which is a :class:`pathlib.Path`. @@ -368,7 +371,7 @@ def Config_inifile(self: pytest.Config) -> Optional[LEGACY_PATH]: return legacy_path(str(self.inipath)) if self.inipath else None -def Session_stardir(self: pytest.Session) -> LEGACY_PATH: +def Session_stardir(self: Session) -> LEGACY_PATH: """The path from which pytest was invoked. Prefer to use ``startpath`` which is a :class:`pathlib.Path`. @@ -400,8 +403,10 @@ def Node_fspath_set(self: Node, value: LEGACY_PATH) -> None: self.path = Path(value) -@pytest.hookimpl -def pytest_configure(config: pytest.Config) -> None: +@hookimpl +def pytest_configure(config: Config) -> None: + import pytest + mp = pytest.MonkeyPatch() config.add_cleanup(mp.undo) @@ -452,10 +457,8 @@ def pytest_configure(config: pytest.Config) -> None: mp.setattr(Node, "fspath", property(Node_fspath, Node_fspath_set), raising=False) -@pytest.hookimpl -def pytest_plugin_registered( - plugin: object, manager: pytest.PytestPluginManager -) -> None: +@hookimpl +def pytest_plugin_registered(plugin: object, manager: PytestPluginManager) -> None: # pytester is not loaded by default and is commonly loaded from a conftest, # so checking for it in `pytest_configure` is not enough. is_pytester = plugin is manager.get_plugin("pytester") diff --git a/src/pytest/__init__.py b/src/pytest/__init__.py index 9c284ac9615..777d3774064 100644 --- a/src/pytest/__init__.py +++ b/src/pytest/__init__.py @@ -23,6 +23,8 @@ from _pytest.fixtures import FixtureRequest from _pytest.fixtures import yield_fixture from _pytest.freeze_support import freeze_includes +from _pytest.legacypath import TempdirFactory +from _pytest.legacypath import Testdir from _pytest.logging import LogCaptureFixture from _pytest.main import Session from _pytest.mark import Mark @@ -142,7 +144,9 @@ "Stash", "StashKey", "version_tuple", + "TempdirFactory", "TempPathFactory", + "Testdir", "TestReport", "UsageError", "WarningsRecorder", From 05d46ca850c17661e0ccf50191aca3cd7a164f50 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Sat, 25 Dec 2021 13:53:30 +0200 Subject: [PATCH 040/176] doc/reference: add 4 missing hooks to reference Fix #9434. --- doc/en/reference/reference.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/doc/en/reference/reference.rst b/doc/en/reference/reference.rst index d4cbcbac08a..ce97ad5f710 100644 --- a/doc/en/reference/reference.rst +++ b/doc/en/reference/reference.rst @@ -727,6 +727,11 @@ you can use the following hook: .. hook:: pytest_make_parametrize_id .. autofunction:: pytest_make_parametrize_id +Hooks for influencing test skipping: + +.. hook:: pytest_markeval_namespace +.. autofunction:: pytest_markeval_namespace + After collection is complete, you can modify the order of items, delete or otherwise amend the test items: @@ -791,6 +796,10 @@ Session related reporting hooks: .. autofunction:: pytest_report_collectionfinish .. hook:: pytest_report_teststatus .. autofunction:: pytest_report_teststatus +.. hook:: pytest_report_to_serializable +.. autofunction:: pytest_report_to_serializable +.. hook:: pytest_report_from_serializable +.. autofunction:: pytest_report_from_serializable .. hook:: pytest_terminal_summary .. autofunction:: pytest_terminal_summary .. hook:: pytest_fixture_setup @@ -827,6 +836,8 @@ reporting or interaction with exceptions: .. autofunction:: pytest_exception_interact .. hook:: pytest_enter_pdb .. autofunction:: pytest_enter_pdb +.. hook:: pytest_leave_pdb +.. autofunction:: pytest_leave_pdb Objects From 427f035b760c57f9ed1d456952be4056066c52a7 Mon Sep 17 00:00:00 2001 From: pytest bot Date: Sun, 26 Dec 2021 00:14:18 +0000 Subject: [PATCH 041/176] [automated] Update plugin list --- doc/en/reference/plugin_list.rst | 122 +++++++++++++++++++++---------- 1 file changed, 85 insertions(+), 37 deletions(-) diff --git a/doc/en/reference/plugin_list.rst b/doc/en/reference/plugin_list.rst index 843cfcd5405..7e89ac61778 100644 --- a/doc/en/reference/plugin_list.rst +++ b/doc/en/reference/plugin_list.rst @@ -11,14 +11,14 @@ automatically. Packages classified as inactive are excluded. creating a PDF, because otherwise the table gets far too wide for the page. -This list contains 969 plugins. +This list contains 975 plugins. .. only:: not latex =============================================== ======================================================================================================================================================================== ============== ===================== ================================================ name summary last release status requires =============================================== ======================================================================================================================================================================== ============== ===================== ================================================ - :pypi:`pytest-accept` A pytest-plugin for updating doctest outputs Nov 22, 2021 N/A pytest (>=6,<7) + :pypi:`pytest-accept` A pytest-plugin for updating doctest outputs Dec 22, 2021 N/A pytest (>=6,<7) :pypi:`pytest-adaptavist` pytest plugin for generating test execution results within Jira Test Management (tm4j) Nov 30, 2021 N/A pytest (>=5.4.0) :pypi:`pytest-addons-test` 用于测试pytest的插件 Aug 02, 2021 N/A pytest (>=6.2.4,<7.0.0) :pypi:`pytest-adf` Pytest plugin for writing Azure Data Factory integration tests May 10, 2021 4 - Beta pytest (>=3.5.0) @@ -34,7 +34,7 @@ This list contains 969 plugins. :pypi:`pytest-aioworkers` A plugin to test aioworkers project with pytest Dec 04, 2019 4 - Beta pytest (>=3.5.0) :pypi:`pytest-airflow` pytest support for airflow. Apr 03, 2019 3 - Alpha pytest (>=4.4.0) :pypi:`pytest-airflow-utils` Nov 15, 2021 N/A N/A - :pypi:`pytest-alembic` A pytest plugin for verifying alembic migrations. Dec 02, 2021 N/A pytest (>=1.0) + :pypi:`pytest-alembic` A pytest plugin for verifying alembic migrations. Dec 21, 2021 N/A pytest (>=1.0) :pypi:`pytest-allclose` Pytest fixture extending Numpy's allclose function Jul 30, 2019 5 - Production/Stable pytest :pypi:`pytest-allure-adaptor` Plugin for py.test to generate allure xml reports Jan 10, 2018 N/A pytest (>=2.7.3) :pypi:`pytest-allure-adaptor2` Plugin for py.test to generate allure xml reports Oct 14, 2020 N/A pytest (>=2.7.3) @@ -103,7 +103,7 @@ This list contains 969 plugins. :pypi:`pytest-blame` A pytest plugin helps developers to debug by providing useful commits history. May 04, 2019 N/A pytest (>=4.4.0) :pypi:`pytest-blender` Blender Pytest plugin. Oct 29, 2021 N/A pytest (==6.2.5) ; extra == 'dev' :pypi:`pytest-blink1` Pytest plugin to emit notifications via the Blink(1) RGB LED Jan 07, 2018 4 - Beta N/A - :pypi:`pytest-blockage` Disable network requests during a test run. Feb 13, 2019 N/A pytest + :pypi:`pytest-blockage` Disable network requests during a test run. Dec 21, 2021 N/A pytest :pypi:`pytest-blocker` pytest plugin to mark a test as blocker and skip all other tests Sep 07, 2015 4 - Beta N/A :pypi:`pytest-board` Local continuous test runner with pytest and watchdog. Jan 20, 2019 N/A N/A :pypi:`pytest-bpdb` A py.test plug-in to enable drop to bpdb debugger on test failure. Jan 19, 2015 2 - Pre-Alpha N/A @@ -152,7 +152,7 @@ This list contains 969 plugins. :pypi:`pytest-cloud` Distributed tests planner plugin for pytest testing framework. Oct 05, 2020 6 - Mature N/A :pypi:`pytest-cloudflare-worker` pytest plugin for testing cloudflare workers Mar 30, 2021 4 - Beta pytest (>=6.0.0) :pypi:`pytest-cobra` PyTest plugin for testing Smart Contracts for Ethereum blockchain. Jun 29, 2019 3 - Alpha pytest (<4.0.0,>=3.7.1) - :pypi:`pytest-codeblocks` Test code blocks in your READMEs Dec 11, 2021 4 - Beta pytest (>=6) + :pypi:`pytest-codeblocks` Test code blocks in your READMEs Dec 21, 2021 4 - Beta pytest (>=6) :pypi:`pytest-codecheckers` pytest plugin to add source code sanity checks (pep8 and friends) Feb 13, 2010 N/A N/A :pypi:`pytest-codecov` Pytest plugin for uploading pytest-cov results to codecov.io Oct 27, 2021 4 - Beta pytest (>=4.6.0) :pypi:`pytest-codegen` Automatically create pytest test signatures Aug 23, 2020 2 - Pre-Alpha N/A @@ -248,6 +248,7 @@ This list contains 969 plugins. :pypi:`pytest-django-sqlcounts` py.test plugin for reporting the number of SQLs executed per django testcase. Jun 16, 2015 4 - Beta N/A :pypi:`pytest-django-testing-postgresql` Use a temporary PostgreSQL database with pytest-django Dec 05, 2019 3 - Alpha N/A :pypi:`pytest-doc` A documentation plugin for py.test. Jun 28, 2015 5 - Production/Stable N/A + :pypi:`pytest-docfiles` pytest plugin to test codeblocks in your documentation. Dec 22, 2021 4 - Beta pytest (>=3.7.0) :pypi:`pytest-docgen` An RST Documentation Generator for pytest-based test suites Apr 17, 2020 N/A N/A :pypi:`pytest-docker` Simple pytest fixtures for Docker and docker-compose based tests Jun 14, 2021 N/A pytest (<7.0,>=4.0) :pypi:`pytest-docker-butla` Jun 16, 2019 3 - Alpha N/A @@ -319,6 +320,7 @@ This list contains 969 plugins. :pypi:`pytest-exceptional` Better exceptions Mar 16, 2017 4 - Beta N/A :pypi:`pytest-exception-script` Walk your code through exception script to check it's resiliency to failures. Aug 04, 2020 3 - Alpha pytest :pypi:`pytest-executable` pytest plugin for testing executables Nov 10, 2021 4 - Beta pytest (<6.3,>=4.3) + :pypi:`pytest-execution-timer` A timer for the phases of Pytest's execution. Dec 24, 2021 4 - Beta N/A :pypi:`pytest-expect` py.test plugin to store test expectations and mark tests based on them Apr 21, 2016 4 - Beta N/A :pypi:`pytest-expecter` Better testing with expecter and pytest. Jul 08, 2020 5 - Production/Stable N/A :pypi:`pytest-expectr` This plugin is used to expect multiple assert using pytest framework. Oct 05, 2018 N/A pytest (>=2.4.2) @@ -410,7 +412,7 @@ This list contains 969 plugins. :pypi:`pytest-historic` Custom report to display pytest historical execution records Apr 08, 2020 N/A pytest :pypi:`pytest-historic-hook` Custom listener to store execution results into MYSQL DB, which is used for pytest-historic report Apr 08, 2020 N/A pytest :pypi:`pytest-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 18, 2021 3 - Alpha pytest (==6.2.5) + :pypi:`pytest-homeassistant-custom-component` Experimental package to automatically extract test plugins for Home Assistant custom components Dec 24, 2021 3 - Alpha pytest (==6.2.5) :pypi:`pytest-honors` Report on tests that honor constraints, and guard against regressions Mar 06, 2020 4 - Beta N/A :pypi:`pytest-hoverfly` Simplify working with Hoverfly from pytest Jul 12, 2021 N/A pytest (>=5.0) :pypi:`pytest-hoverfly-wrapper` Integrates the Hoverfly HTTP proxy into Pytest Aug 29, 2021 4 - Beta N/A @@ -421,11 +423,11 @@ This list contains 969 plugins. :pypi:`pytest-html-reporter` Generates a static html report based on pytest framework Apr 25, 2021 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 Feb 11, 2019 5 - Production/Stable N/A + :pypi:`pytest-httpbin` Easily test your HTTP library against a local copy of httpbin Dec 25, 2021 5 - Production/Stable N/A :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 Dec 15, 2021 3 - Alpha N/A - :pypi:`pytest-httpx` Send responses to httpx. Nov 16, 2021 5 - Production/Stable pytest (==6.*) + :pypi:`pytest-httpx` Send responses to httpx. Dec 23, 2021 5 - Production/Stable pytest (==6.*) :pypi:`pytest-httpx-blockage` Disable httpx requests during a test run Nov 16, 2021 N/A pytest (>=6.2.5) :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 @@ -433,7 +435,7 @@ This list contains 969 plugins. :pypi:`pytest-ibutsu` A plugin to sent pytest results to an Ibutsu server Dec 15, 2021 4 - Beta pytest :pypi:`pytest-icdiff` use icdiff for better error messages in pytest assertions Apr 08, 2020 4 - Beta N/A :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-idempotent` Pytest plugin for testing function idempotence. Nov 26, 2021 N/A N/A + :pypi:`pytest-idempotent` Pytest plugin for testing function idempotence. Dec 24, 2021 N/A N/A :pypi:`pytest-ignore-flaky` ignore failures from flaky tests (pytest plugin) Apr 23, 2021 5 - Production/Stable N/A :pypi:`pytest-image-diff` Jul 28, 2021 3 - Alpha pytest :pypi:`pytest-incremental` an incremental test runner (pytest plugin) Apr 24, 2021 5 - Production/Stable N/A @@ -538,7 +540,7 @@ This list contains 969 plugins. :pypi:`pytest-mock-helper` Help you mock HTTP call and generate mock code Jan 24, 2018 N/A pytest :pypi:`pytest-mockito` Base fixtures for mockito Jul 11, 2018 4 - Beta N/A :pypi:`pytest-mockredis` An in-memory mock of a Redis server that runs in a separate thread. This is to be used for unit-tests that require a Redis database. Jan 02, 2018 2 - Pre-Alpha N/A - :pypi:`pytest-mock-resources` A pytest plugin for easily instantiating reproducible mock resources. Dec 03, 2021 N/A pytest (>=1.0) + :pypi:`pytest-mock-resources` A pytest plugin for easily instantiating reproducible mock resources. Dec 22, 2021 N/A pytest (>=1.0) :pypi:`pytest-mock-server` Mock server plugin for pytest Apr 06, 2020 4 - Beta N/A :pypi:`pytest-mockservers` A set of fixtures to test your requests to HTTP/UDP servers Mar 31, 2020 N/A pytest (>=4.3.0) :pypi:`pytest-modifyjunit` Utility for adding additional properties to junit xml for IDM QE Jan 10, 2019 N/A N/A @@ -546,7 +548,7 @@ This list contains 969 plugins. :pypi:`pytest-molecule` PyTest Molecule Plugin :: discover and run molecule tests Oct 06, 2021 5 - Production/Stable N/A :pypi:`pytest-mongo` MongoDB process and client fixtures plugin for Pytest. Jun 07, 2021 5 - Production/Stable pytest :pypi:`pytest-mongodb` pytest plugin for MongoDB fixtures Dec 07, 2019 5 - Production/Stable pytest (>=2.5.2) - :pypi:`pytest-monitor` Pytest plugin for analyzing resource usage. Aug 24, 2021 5 - Production/Stable pytest + :pypi:`pytest-monitor` Pytest plugin for analyzing resource usage. Dec 23, 2021 5 - Production/Stable pytest :pypi:`pytest-monkeyplus` pytest's monkeypatch subclass with extra functionalities Sep 18, 2012 5 - Production/Stable N/A :pypi:`pytest-monkeytype` pytest-monkeytype: Generate Monkeytype annotations from your pytest tests. Jul 29, 2020 4 - Beta N/A :pypi:`pytest-moto` Fixtures for integration tests of AWS services,uses moto mocking library. Aug 28, 2015 1 - Planning N/A @@ -626,7 +628,7 @@ This list contains 969 plugins. :pypi:`pytest-perf` pytest-perf Jun 27, 2021 5 - Production/Stable pytest (>=4.6) ; extra == 'testing' :pypi:`pytest-performance` A simple plugin to ensure the execution of critical sections of code has not been impacted Sep 11, 2020 5 - Production/Stable pytest (>=3.7.0) :pypi:`pytest-persistence` Pytest tool for persistent objects Dec 07, 2021 N/A N/A - :pypi:`pytest-pg` Helps to run PostgreSQL in docker as pytest fixture Dec 10, 2021 5 - Production/Stable pytest + :pypi:`pytest-pg` Helps to run PostgreSQL in docker as pytest fixture Dec 25, 2021 5 - Production/Stable pytest :pypi:`pytest-pgsql` Pytest plugins and helpers for tests using a Postgres database. May 13, 2020 5 - Production/Stable pytest (>=3.0.0) :pypi:`pytest-phmdoctest` pytest plugin to test Python examples in Markdown using phmdoctest. Nov 10, 2021 4 - Beta pytest (>=6.2) ; extra == 'test' :pypi:`pytest-picked` Run the tests related to the changed files Dec 23, 2020 N/A pytest (>=3.5.0) @@ -657,7 +659,7 @@ This list contains 969 plugins. :pypi:`pytest-pop` A pytest plugin to help with testing pop projects Aug 19, 2021 5 - Production/Stable pytest :pypi:`pytest-portion` Select a portion of the collected tests Jan 28, 2021 4 - Beta pytest (>=3.5.0) :pypi:`pytest-postgres` Run PostgreSQL in Docker container in Pytest. Mar 22, 2020 N/A pytest - :pypi:`pytest-postgresql` Postgresql fixtures and fixture factories for Pytest. Nov 05, 2021 5 - Production/Stable pytest (>=3.0.0) + :pypi:`pytest-postgresql` Postgresql fixtures and fixture factories for Pytest. Dec 22, 2021 5 - Production/Stable pytest (>=6.2.0) :pypi:`pytest-power` pytest plugin with powerful fixtures Dec 31, 2020 N/A pytest (>=5.4) :pypi:`pytest-pretty-terminal` pytest plugin for generating prettier terminal output Nov 24, 2021 N/A pytest (>=3.4.1) :pypi:`pytest-pride` Minitest-style test colors Apr 02, 2016 3 - Alpha N/A @@ -722,7 +724,7 @@ This list contains 969 plugins. :pypi:`pytest-relative-order` a pytest plugin that sorts tests using "before" and "after" markers May 17, 2021 4 - Beta N/A :pypi:`pytest-relaxed` Relaxed test discovery/organization for pytest Jun 14, 2019 5 - Production/Stable pytest (<5,>=3) :pypi:`pytest-remfiles` Pytest plugin to create a temporary directory with remote files Jul 01, 2019 5 - Production/Stable N/A - :pypi:`pytest-remotedata` Pytest plugin for controlling remote data access. Jul 20, 2019 3 - Alpha pytest (>=3.1) + :pypi:`pytest-remotedata` Pytest plugin for controlling remote data access. Dec 21, 2021 3 - Alpha pytest (>=4.6) :pypi:`pytest-remote-response` Pytest plugin for capturing and mocking connection requests. Jun 30, 2021 4 - Beta pytest (>=4.6) :pypi:`pytest-remove-stale-bytecode` py.test plugin to remove stale byte code files. Mar 04, 2020 4 - Beta pytest :pypi:`pytest-reorder` Reorder tests depending on their paths and names. May 31, 2018 4 - Beta pytest @@ -740,6 +742,7 @@ This list contains 969 plugins. :pypi:`pytest-reportportal` Agent for Reporting results of tests to the Report Portal Jun 18, 2021 N/A pytest (>=3.8.0) :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-requires` A pytest plugin to elegantly skip tests with optional requirements Dec 21, 2021 4 - Beta pytest (>=3.5.0) :pypi:`pytest-reraise` Make multi-threaded pytest test cases fail when they should Jun 17, 2021 5 - Production/Stable pytest (>=4.6) :pypi:`pytest-rerun` Re-run only changed files in specified branch Jul 08, 2019 N/A pytest (>=3.6) :pypi:`pytest-rerunfailures` pytest plugin to re-run tests to eliminate flaky failures Sep 17, 2021 5 - Production/Stable pytest (>=5.3) @@ -758,7 +761,7 @@ This list contains 969 plugins. :pypi:`pytest-rotest` Pytest integration with rotest Sep 08, 2019 N/A pytest (>=3.5.0) :pypi:`pytest-rpc` Extend py.test for RPC OpenStack testing. Feb 22, 2019 4 - Beta pytest (~=3.6) :pypi:`pytest-rst` Test code from RST documents with pytest Sep 21, 2021 N/A pytest - :pypi:`pytest-rt` pytest data collector plugin for Testgr Sep 04, 2021 N/A N/A + :pypi:`pytest-rt` pytest data collector plugin for Testgr Dec 22, 2021 N/A N/A :pypi:`pytest-rts` Coverage-based regression test selection (RTS) plugin for pytest May 17, 2021 N/A pytest :pypi:`pytest-run-changed` Pytest plugin that runs changed tests only Apr 02, 2021 3 - Alpha pytest :pypi:`pytest-runfailed` implement a --failed option for pytest Mar 24, 2016 N/A N/A @@ -772,13 +775,13 @@ This list contains 969 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. Dec 17, 2021 5 - Production/Stable N/A + :pypi:`pytest-sbase` A complete web automation framework for end-to-end testing. Dec 24, 2021 5 - Production/Stable N/A :pypi:`pytest-scenario` pytest plugin for test scenarios Feb 06, 2017 3 - Alpha N/A :pypi:`pytest-schema` 👍 Validate return values against a schema-like object in testing Aug 31, 2020 5 - Production/Stable pytest (>=3.5.0) :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 Sep 19, 2020 5 - Production/Stable pytest (>=5.0.0) - :pypi:`pytest-seleniumbase` A complete web automation framework for end-to-end testing. Dec 17, 2021 5 - Production/Stable N/A + :pypi:`pytest-seleniumbase` A complete web automation framework for end-to-end testing. Dec 24, 2021 5 - Production/Stable N/A :pypi:`pytest-selenium-enhancer` pytest plugin for Selenium Dec 16, 2021 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-send-email` Send pytest execution result email Dec 04, 2019 N/A N/A @@ -813,10 +816,12 @@ This list contains 969 plugins. :pypi:`pytest-snapci` py.test plugin for Snap-CI Nov 12, 2015 N/A N/A :pypi:`pytest-snapshot` A plugin for snapshot testing with pytest. Dec 02, 2021 4 - Beta pytest (>=3.0.0) :pypi:`pytest-snmpserver` May 12, 2021 N/A N/A - :pypi:`pytest-socket` Pytest Plugin to disable socket calls during tests Aug 28, 2021 4 - Beta pytest (>=3.6.3) + :pypi:`pytest-snowflake-bdd` Setup test data and run tests on snowflake in BDD style! Dec 19, 2021 4 - Beta pytest (>=6.2.0) + :pypi:`pytest-socket` Pytest Plugin to disable socket calls during tests Dec 23, 2021 4 - Beta pytest (>=3.6.3) :pypi:`pytest-soft-assertions` May 05, 2020 3 - Alpha pytest :pypi:`pytest-solr` Solr process and client fixtures for py.test. May 11, 2020 3 - Alpha pytest (>=3.0.0) :pypi:`pytest-sorter` A simple plugin to first execute tests that historically failed more Apr 20, 2021 4 - Beta pytest (>=3.1.1) + :pypi:`pytest-sosu` Unofficial PyTest plugin for Sauce Labs Dec 20, 2021 2 - Pre-Alpha pytest :pypi:`pytest-sourceorder` Test-ordering plugin for pytest Sep 01, 2021 4 - Beta pytest :pypi:`pytest-spark` pytest plugin to run the tests with support of pyspark. Feb 23, 2020 4 - Beta pytest :pypi:`pytest-spawner` py.test plugin to spawn process and communicate with them. Jul 31, 2015 4 - Beta N/A @@ -824,6 +829,7 @@ This list contains 969 plugins. :pypi:`pytest-sphinx` Doctest plugin for pytest with support for Sphinx-specific doctest-directives Aug 05, 2020 4 - Beta N/A :pypi:`pytest-spiratest` Exports unit tests as test runs in SpiraTest/Team/Plan Oct 13, 2021 N/A N/A :pypi:`pytest-splinter` Splinter plugin for pytest testing framework Dec 25, 2020 6 - Mature N/A + :pypi:`pytest-splinter4` Pytest plugin for the splinter automation library Dec 22, 2021 6 - Mature pytest (>=6.2.4) :pypi:`pytest-split` Pytest plugin which splits the test suite to equally sized sub suites based on test execution time. Nov 09, 2021 4 - Beta pytest (>=5,<7) :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) @@ -993,7 +999,7 @@ This list contains 969 plugins. :pypi:`pytest-accept` - *last release*: Nov 22, 2021, + *last release*: Dec 22, 2021, *status*: N/A, *requires*: pytest (>=6,<7) @@ -1105,7 +1111,7 @@ This list contains 969 plugins. :pypi:`pytest-alembic` - *last release*: Dec 02, 2021, + *last release*: Dec 21, 2021, *status*: N/A, *requires*: pytest (>=1.0) @@ -1588,7 +1594,7 @@ This list contains 969 plugins. Pytest plugin to emit notifications via the Blink(1) RGB LED :pypi:`pytest-blockage` - *last release*: Feb 13, 2019, + *last release*: Dec 21, 2021, *status*: N/A, *requires*: pytest @@ -1931,7 +1937,7 @@ This list contains 969 plugins. PyTest plugin for testing Smart Contracts for Ethereum blockchain. :pypi:`pytest-codeblocks` - *last release*: Dec 11, 2021, + *last release*: Dec 21, 2021, *status*: 4 - Beta, *requires*: pytest (>=6) @@ -2602,6 +2608,13 @@ This list contains 969 plugins. A documentation plugin for py.test. + :pypi:`pytest-docfiles` + *last release*: Dec 22, 2021, + *status*: 4 - Beta, + *requires*: pytest (>=3.7.0) + + pytest plugin to test codeblocks in your documentation. + :pypi:`pytest-docgen` *last release*: Apr 17, 2020, *status*: N/A, @@ -3099,6 +3112,13 @@ This list contains 969 plugins. pytest plugin for testing executables + :pypi:`pytest-execution-timer` + *last release*: Dec 24, 2021, + *status*: 4 - Beta, + *requires*: N/A + + A timer for the phases of Pytest's execution. + :pypi:`pytest-expect` *last release*: Apr 21, 2016, *status*: 4 - Beta, @@ -3737,7 +3757,7 @@ This list contains 969 plugins. A pytest plugin for use with homeassistant custom components. :pypi:`pytest-homeassistant-custom-component` - *last release*: Dec 18, 2021, + *last release*: Dec 24, 2021, *status*: 3 - Alpha, *requires*: pytest (==6.2.5) @@ -3814,7 +3834,7 @@ This list contains 969 plugins. Fixture "http" for http requests :pypi:`pytest-httpbin` - *last release*: Feb 11, 2019, + *last release*: Dec 25, 2021, *status*: 5 - Production/Stable, *requires*: N/A @@ -3842,7 +3862,7 @@ This list contains 969 plugins. pytest-httpserver is a httpserver for pytest :pypi:`pytest-httpx` - *last release*: Nov 16, 2021, + *last release*: Dec 23, 2021, *status*: 5 - Production/Stable, *requires*: pytest (==6.*) @@ -3898,7 +3918,7 @@ This list contains 969 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-idempotent` - *last release*: Nov 26, 2021, + *last release*: Dec 24, 2021, *status*: N/A, *requires*: N/A @@ -4633,7 +4653,7 @@ This list contains 969 plugins. An in-memory mock of a Redis server that runs in a separate thread. This is to be used for unit-tests that require a Redis database. :pypi:`pytest-mock-resources` - *last release*: Dec 03, 2021, + *last release*: Dec 22, 2021, *status*: N/A, *requires*: pytest (>=1.0) @@ -4689,7 +4709,7 @@ This list contains 969 plugins. pytest plugin for MongoDB fixtures :pypi:`pytest-monitor` - *last release*: Aug 24, 2021, + *last release*: Dec 23, 2021, *status*: 5 - Production/Stable, *requires*: pytest @@ -5249,7 +5269,7 @@ This list contains 969 plugins. Pytest tool for persistent objects :pypi:`pytest-pg` - *last release*: Dec 10, 2021, + *last release*: Dec 25, 2021, *status*: 5 - Production/Stable, *requires*: pytest @@ -5466,9 +5486,9 @@ This list contains 969 plugins. Run PostgreSQL in Docker container in Pytest. :pypi:`pytest-postgresql` - *last release*: Nov 05, 2021, + *last release*: Dec 22, 2021, *status*: 5 - Production/Stable, - *requires*: pytest (>=3.0.0) + *requires*: pytest (>=6.2.0) Postgresql fixtures and fixture factories for Pytest. @@ -5921,9 +5941,9 @@ This list contains 969 plugins. Pytest plugin to create a temporary directory with remote files :pypi:`pytest-remotedata` - *last release*: Jul 20, 2019, + *last release*: Dec 21, 2021, *status*: 3 - Alpha, - *requires*: pytest (>=3.1) + *requires*: pytest (>=4.6) Pytest plugin for controlling remote data access. @@ -6046,6 +6066,13 @@ This list contains 969 plugins. A simple plugin to use with pytest + :pypi:`pytest-requires` + *last release*: Dec 21, 2021, + *status*: 4 - Beta, + *requires*: pytest (>=3.5.0) + + A pytest plugin to elegantly skip tests with optional requirements + :pypi:`pytest-reraise` *last release*: Jun 17, 2021, *status*: 5 - Production/Stable, @@ -6173,7 +6200,7 @@ This list contains 969 plugins. Test code from RST documents with pytest :pypi:`pytest-rt` - *last release*: Sep 04, 2021, + *last release*: Dec 22, 2021, *status*: N/A, *requires*: N/A @@ -6271,7 +6298,7 @@ This list contains 969 plugins. :pypi:`pytest-sbase` - *last release*: Dec 17, 2021, + *last release*: Dec 24, 2021, *status*: 5 - Production/Stable, *requires*: N/A @@ -6313,7 +6340,7 @@ This list contains 969 plugins. pytest plugin for Selenium :pypi:`pytest-seleniumbase` - *last release*: Dec 17, 2021, + *last release*: Dec 24, 2021, *status*: 5 - Production/Stable, *requires*: N/A @@ -6557,8 +6584,15 @@ This list contains 969 plugins. + :pypi:`pytest-snowflake-bdd` + *last release*: Dec 19, 2021, + *status*: 4 - Beta, + *requires*: pytest (>=6.2.0) + + Setup test data and run tests on snowflake in BDD style! + :pypi:`pytest-socket` - *last release*: Aug 28, 2021, + *last release*: Dec 23, 2021, *status*: 4 - Beta, *requires*: pytest (>=3.6.3) @@ -6585,6 +6619,13 @@ This list contains 969 plugins. A simple plugin to first execute tests that historically failed more + :pypi:`pytest-sosu` + *last release*: Dec 20, 2021, + *status*: 2 - Pre-Alpha, + *requires*: pytest + + Unofficial PyTest plugin for Sauce Labs + :pypi:`pytest-sourceorder` *last release*: Sep 01, 2021, *status*: 4 - Beta, @@ -6634,6 +6675,13 @@ This list contains 969 plugins. Splinter plugin for pytest testing framework + :pypi:`pytest-splinter4` + *last release*: Dec 22, 2021, + *status*: 6 - Mature, + *requires*: pytest (>=6.2.4) + + Pytest plugin for the splinter automation library + :pypi:`pytest-split` *last release*: Nov 09, 2021, *status*: 4 - Beta, From 5599c5ad4589994c7816364139d6bedae4c5fd46 Mon Sep 17 00:00:00 2001 From: Hasan Ramezani Date: Sat, 25 Dec 2021 12:04:59 +0100 Subject: [PATCH 042/176] Drop Python3.6 in CI, setup.cfg, and readme. --- .github/workflows/main.yml | 10 ---------- README.rst | 2 +- changelog/9437.breaking.rst | 1 + doc/en/getting-started.rst | 2 +- doc/en/index.rst | 4 ++-- setup.cfg | 3 +-- tox.ini | 1 - 7 files changed, 6 insertions(+), 17 deletions(-) create mode 100644 changelog/9437.breaking.rst diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bbc48adb49a..0416b8cf406 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -31,14 +31,12 @@ jobs: fail-fast: false matrix: name: [ - "windows-py36", "windows-py37", "windows-py37-pluggy", "windows-py38", "windows-py39", "windows-py310", - "ubuntu-py36", "ubuntu-py37", "ubuntu-py37-pluggy", "ubuntu-py37-freeze", @@ -56,10 +54,6 @@ jobs: ] include: - - name: "windows-py36" - python: "3.6" - os: windows-latest - tox_env: "py36-xdist" - name: "windows-py37" python: "3.7" os: windows-latest @@ -82,10 +76,6 @@ jobs: os: windows-latest tox_env: "py310-xdist" - - name: "ubuntu-py36" - python: "3.6" - os: ubuntu-latest - tox_env: "py36-xdist" - name: "ubuntu-py37" python: "3.7" os: ubuntu-latest diff --git a/README.rst b/README.rst index 14733765173..47e780ad63d 100644 --- a/README.rst +++ b/README.rst @@ -100,7 +100,7 @@ Features - Can run `unittest `_ (or trial), `nose `_ test suites out of the box -- Python 3.6+ and PyPy3 +- Python 3.7+ and PyPy3 - Rich plugin architecture, with over 850+ `external plugins `_ and thriving community diff --git a/changelog/9437.breaking.rst b/changelog/9437.breaking.rst new file mode 100644 index 00000000000..60d4337f420 --- /dev/null +++ b/changelog/9437.breaking.rst @@ -0,0 +1 @@ +Dropped support for Python 3.6, which reached `end-of-life `__ at 2021-12-23. diff --git a/doc/en/getting-started.rst b/doc/en/getting-started.rst index 6b2ff672c59..40060a60da4 100644 --- a/doc/en/getting-started.rst +++ b/doc/en/getting-started.rst @@ -9,7 +9,7 @@ Get Started Install ``pytest`` ---------------------------------------- -``pytest`` requires: Python 3.6, 3.7, 3.8, 3.9, or PyPy3. +``pytest`` requires: Python 3.7, 3.8, 3.9, or PyPy3. 1. Run the following command in your command line: diff --git a/doc/en/index.rst b/doc/en/index.rst index 3d7c2f53709..46d501ede83 100644 --- a/doc/en/index.rst +++ b/doc/en/index.rst @@ -17,7 +17,7 @@ The ``pytest`` framework makes it easy to write small, readable tests, and can scale to support complex functional testing for applications and libraries. -**Pythons**: ``pytest`` requires: Python 3.6, 3.7, 3.8, 3.9, or PyPy3. +**Pythons**: ``pytest`` requires: Python 3.7, 3.8, 3.9, or PyPy3. **PyPI package name**: :pypi:`pytest` @@ -78,7 +78,7 @@ Features - Can run :ref:`unittest ` (including trial) and :ref:`nose ` test suites out of the box -- Python 3.6+ and PyPy 3 +- Python 3.7+ and PyPy 3 - Rich plugin architecture, with over 800+ :ref:`external plugins ` and thriving community diff --git a/setup.cfg b/setup.cfg index 26a5d2e63e5..fe6ea4095bc 100644 --- a/setup.cfg +++ b/setup.cfg @@ -17,7 +17,6 @@ classifiers = Operating System :: POSIX Programming Language :: Python :: 3 Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 @@ -51,7 +50,7 @@ install_requires = atomicwrites>=1.0;sys_platform=="win32" colorama;sys_platform=="win32" importlib-metadata>=0.12;python_version<"3.8" -python_requires = >=3.6 +python_requires = >=3.7 package_dir = =src setup_requires = diff --git a/tox.ini b/tox.ini index 9d26051ebb7..42e1ee1c777 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,6 @@ minversion = 3.20.0 distshare = {homedir}/.tox/distshare envlist = linting - py36 py37 py38 py39 From 0da4760715bebb130cc8bb84bdd6715cc9a2e0c4 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Mon, 27 Dec 2021 11:22:00 +0200 Subject: [PATCH 043/176] code: accept any `os.PathLike[str]` in `Traceback.cut` Before 7.0.0rc1, the function accepted `Union[str, py.path.local]`, and `py.path.local` compares equal to the string path, so a user was able to pass the path as a string and it would work. In 7.0.0rc1 we changed the `py.path.local` to `Path` which doesn't compare equal to the string path, which breaks compatibility (e.g. the `sybil` package). This restores compatibility for this function by accepting any `os.PathLike[str]` and only comparing the string representations. --- src/_pytest/_code/code.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/_pytest/_code/code.py b/src/_pytest/_code/code.py index b19ee7c64d9..291d8890c6b 100644 --- a/src/_pytest/_code/code.py +++ b/src/_pytest/_code/code.py @@ -1,5 +1,6 @@ import ast import inspect +import os import re import sys import traceback @@ -343,10 +344,10 @@ def f(cur: TracebackType) -> Iterable[TracebackEntry]: def cut( self, - path: Optional[Union[Path, str]] = None, + path: Optional[Union["os.PathLike[str]", str]] = None, lineno: Optional[int] = None, firstlineno: Optional[int] = None, - excludepath: Optional[Path] = None, + excludepath: Optional["os.PathLike[str]"] = None, ) -> "Traceback": """Return a Traceback instance wrapping part of this Traceback. @@ -357,15 +358,17 @@ def cut( for formatting reasons (removing some uninteresting bits that deal with handling of the exception/traceback). """ + path_ = None if path is None else os.fspath(path) + excludepath_ = None if excludepath is None else os.fspath(excludepath) for x in self: code = x.frame.code codepath = code.path - if path is not None and codepath != path: + if path is not None and str(codepath) != path_: continue if ( excludepath is not None and isinstance(codepath, Path) - and excludepath in codepath.parents + and excludepath_ in (str(p) for p in codepath.parents) # type: ignore[operator] ): continue if lineno is not None and x.lineno != lineno: From 55debfad1f690d11da3b33022d55c49060460e44 Mon Sep 17 00:00:00 2001 From: "Kian Meng, Ang" Date: Mon, 27 Dec 2021 20:23:15 +0800 Subject: [PATCH 044/176] Fix typos (#9424) --- AUTHORS | 1 + doc/en/announce/release-2.5.0.rst | 2 +- doc/en/changelog.rst | 14 +++++++------- doc/en/history.rst | 2 +- doc/en/how-to/skipping.rst | 2 +- doc/en/reference/fixtures.rst | 2 +- src/_pytest/_code/code.py | 2 +- src/_pytest/assertion/rewrite.py | 2 +- src/_pytest/assertion/util.py | 2 +- src/_pytest/config/__init__.py | 2 +- src/_pytest/config/compat.py | 2 +- src/_pytest/junitxml.py | 2 +- src/_pytest/mark/expression.py | 2 +- src/_pytest/pytester.py | 2 +- src/_pytest/python.py | 2 +- testing/acceptance_test.py | 2 +- testing/code/test_source.py | 2 +- testing/test_compat.py | 4 ++-- testing/test_config.py | 4 ++-- testing/test_doctest.py | 4 ++-- testing/test_runner.py | 2 +- testing/test_stash.py | 2 +- testing/test_warnings.py | 4 ++-- tox.ini | 4 ++-- 24 files changed, 35 insertions(+), 34 deletions(-) diff --git a/AUTHORS b/AUTHORS index 25b55e5aed2..9413f9c2e74 100644 --- a/AUTHORS +++ b/AUTHORS @@ -185,6 +185,7 @@ Katerina Koukiou Keri Volans Kevin Cox Kevin J. Foley +Kian-Meng Ang Kodi B. Arfer Kostis Anagnostopoulos Kristoffer Nordström diff --git a/doc/en/announce/release-2.5.0.rst b/doc/en/announce/release-2.5.0.rst index bc83fdc122c..c6cdcdd8a83 100644 --- a/doc/en/announce/release-2.5.0.rst +++ b/doc/en/announce/release-2.5.0.rst @@ -11,7 +11,7 @@ clear information about the circumstances and a simple example which reproduces the problem. The issue tracker is of course not empty now. We have many remaining -"enhacement" issues which we'll hopefully can tackle in 2014 with your +"enhancement" issues which we'll hopefully can tackle in 2014 with your help. For those who use older Python versions, please note that pytest is not diff --git a/doc/en/changelog.rst b/doc/en/changelog.rst index c5ccc75e3af..15ac02d83ae 100644 --- a/doc/en/changelog.rst +++ b/doc/en/changelog.rst @@ -538,7 +538,7 @@ Bug Fixes the ``tmp_path``/``tmpdir`` fixture). Now the directories are created with private permissions. - pytest used to silenty use a pre-existing ``/tmp/pytest-of-`` directory, + pytest used to silently use a pre-existing ``/tmp/pytest-of-`` directory, even if owned by another user. This means another user could pre-create such a directory and gain control of another user's temporary directory. Now such a condition results in an error. @@ -1304,7 +1304,7 @@ Improvements is not displayed by default for passing tests. This change makes the mistake visible during testing. - You may supress this behavior temporarily or permanently by setting + You may suppress this behavior temporarily or permanently by setting ``logging.raiseExceptions = False``. @@ -1759,7 +1759,7 @@ Bug Fixes it was swallowed and ignored (regression in pytest 5.1.0). -- :issue:`6801`: Do not display empty lines inbetween traceback for unexpected exceptions with doctests. +- :issue:`6801`: Do not display empty lines in between traceback for unexpected exceptions with doctests. - :issue:`6802`: The :fixture:`testdir fixture ` works within doctests now. @@ -4628,7 +4628,7 @@ Bug Fixes - Fixed a bug where stdout and stderr were logged twice by junitxml when a test was marked xfail. (:issue:`3491`) -- Fix ``usefixtures`` mark applyed to unittest tests by correctly instantiating +- Fix ``usefixtures`` mark applied to unittest tests by correctly instantiating ``FixtureInfo``. (:issue:`3498`) - Fix assertion rewriter compatibility with libraries that monkey patch @@ -8009,7 +8009,7 @@ Bug fixes: or through plugin hooks. Also introduce a "--strict" option which will treat unregistered markers as errors allowing to avoid typos and maintain a well described set of markers - for your test suite. See exaples at http://pytest.org/en/stable/how-to/mark.html + for your test suite. See examples at http://pytest.org/en/stable/how-to/mark.html and its links. - issue50: introduce "-m marker" option to select tests based on markers (this is a stricter and more predictable version of '-k' in that "-m" @@ -8321,7 +8321,7 @@ Bug fixes: - fix issue57 -f|--looponfail to work with xpassing tests (thanks Ronny) - fix issue92 collectonly reporter and --pastebin (thanks Benjamin Peterson) - fix py.code.compile(source) to generate unique filenames -- fix assertion re-interp problems on PyPy, by defering code +- fix assertion re-interp problems on PyPy, by deferring code compilation to the (overridable) Frame.eval class. (thanks Amaury Forgeot) - fix py.path.local.pyimport() to work with directories - streamline py.path.local.mkdtemp implementation and usage @@ -8395,7 +8395,7 @@ Bug fixes: - improve support for raises and other dynamically compiled code by manipulating python's linecache.cache instead of the previous rather hacky way of creating custom code objects. This makes - it seemlessly work on Jython and PyPy where it previously didn't. + it seamlessly work on Jython and PyPy where it previously didn't. - fix issue96: make capturing more resilient against Control-C interruptions (involved somewhat substantial refactoring diff --git a/doc/en/history.rst b/doc/en/history.rst index 796a42486ca..bb5aa493022 100644 --- a/doc/en/history.rst +++ b/doc/en/history.rst @@ -139,7 +139,7 @@ project: which adds ``pytest`` (rather than ``py.test``) as the recommended command-line entry point -Due to this history, it's diffcult to answer the question when pytest was started. +Due to this history, it's difficult to answer the question when pytest was started. It depends what point should really be seen as the start of it all. One possible interpretation is to pick Europython 2004, i.e. around June/July 2004. diff --git a/doc/en/how-to/skipping.rst b/doc/en/how-to/skipping.rst index 9b74628d59f..e2f59c77ae8 100644 --- a/doc/en/how-to/skipping.rst +++ b/doc/en/how-to/skipping.rst @@ -369,7 +369,7 @@ Here is a simple test file with the several usages: Running it with the report-on-xfail option gives this output: -.. FIXME: Use $ instead of ! again to reenable regendoc once it's fixed: +.. FIXME: Use $ instead of ! again to re-enable regendoc once it's fixed: https://github.com/pytest-dev/pytest/issues/8807 .. code-block:: pytest diff --git a/doc/en/reference/fixtures.rst b/doc/en/reference/fixtures.rst index 35b79021209..da2c5e009c3 100644 --- a/doc/en/reference/fixtures.rst +++ b/doc/en/reference/fixtures.rst @@ -208,7 +208,7 @@ the one defined in ``tests/test_top.py`` would be unavailable to it because it would have to step down a level (step inside a circle) to find it. The first fixture the test finds is the one that will be used, so -:ref:`fixtures can be overriden ` if you need to change or +:ref:`fixtures can be overridden ` if you need to change or extend what one does for a particular scope. You can also use the ``conftest.py`` file to implement diff --git a/src/_pytest/_code/code.py b/src/_pytest/_code/code.py index b19ee7c64d9..12ce135529c 100644 --- a/src/_pytest/_code/code.py +++ b/src/_pytest/_code/code.py @@ -895,7 +895,7 @@ def _truncate_recursive_traceback( max_frames=max_frames, total=len(traceback), ) - # Type ignored because adding two instaces of a List subtype + # Type ignored because adding two instances of a List subtype # currently incorrectly has type List instead of the subtype. traceback = traceback[:max_frames] + traceback[-max_frames:] # type: ignore else: diff --git a/src/_pytest/assertion/rewrite.py b/src/_pytest/assertion/rewrite.py index 50b367e25ef..e9ecedfaa52 100644 --- a/src/_pytest/assertion/rewrite.py +++ b/src/_pytest/assertion/rewrite.py @@ -513,7 +513,7 @@ def _call_assertion_pass(lineno: int, orig: str, expl: str) -> None: def _check_if_assertion_pass_impl() -> bool: """Check if any plugins implement the pytest_assertion_pass hook - in order not to generate explanation unecessarily (might be expensive).""" + in order not to generate explanation unnecessarily (might be expensive).""" return True if util._assertion_pass else False diff --git a/src/_pytest/assertion/util.py b/src/_pytest/assertion/util.py index c26ff90dc53..14512a7c5ca 100644 --- a/src/_pytest/assertion/util.py +++ b/src/_pytest/assertion/util.py @@ -142,7 +142,7 @@ def has_default_eq( First, we check if the object's __eq__ attribute has __code__, if so, we check the equally of the method code filename (__code__.co_filename) - to the default onces generated by the dataclass and attr module + to the default one generated by the dataclass and attr module for dataclasses the default co_filename is , for attrs class, the __eq__ should contain "attrs eq generated" """ # inspired from https://github.com/willmcgugan/rich/blob/07d51ffc1aee6f16bd2e5a25b4e82850fb9ed778/rich/pretty.py#L68 diff --git a/src/_pytest/config/__init__.py b/src/_pytest/config/__init__.py index 4cb22009a06..1bdd8effba2 100644 --- a/src/_pytest/config/__init__.py +++ b/src/_pytest/config/__init__.py @@ -970,7 +970,7 @@ def inipath(self) -> Optional[Path]: def add_cleanup(self, func: Callable[[], None]) -> None: """Add a function to be called when the config object gets out of - use (usually coninciding with pytest_unconfigure).""" + use (usually coinciding with pytest_unconfigure).""" self._cleanup.append(func) def _do_configure(self) -> None: diff --git a/src/_pytest/config/compat.py b/src/_pytest/config/compat.py index 8f82dd9f9d7..ba267d21505 100644 --- a/src/_pytest/config/compat.py +++ b/src/_pytest/config/compat.py @@ -23,7 +23,7 @@ class PathAwareHookProxy: this helper wraps around hook callers until pluggy supports fixingcalls, this one will do - it currently doesnt return full hook caller proxies for fixed hooks, + it currently doesn't return full hook caller proxies for fixed hooks, this may have to be changed later depending on bugs """ diff --git a/src/_pytest/junitxml.py b/src/_pytest/junitxml.py index 8249dccffed..1b9e3bfecac 100644 --- a/src/_pytest/junitxml.py +++ b/src/_pytest/junitxml.py @@ -256,7 +256,7 @@ def append_skipped(self, report: TestReport) -> None: def finalize(self) -> None: data = self.to_xml() self.__dict__.clear() - # Type ignored becuase mypy doesn't like overriding a method. + # Type ignored because mypy doesn't like overriding a method. # Also the return value doesn't match... self.to_xml = lambda: data # type: ignore[assignment] diff --git a/src/_pytest/mark/expression.py b/src/_pytest/mark/expression.py index 9d57e944b92..92220d7723a 100644 --- a/src/_pytest/mark/expression.py +++ b/src/_pytest/mark/expression.py @@ -190,7 +190,7 @@ def __len__(self) -> int: class Expression: """A compiled match expression as used by -k and -m. - The expression can be evaulated against different matchers. + The expression can be evaluated against different matchers. """ __slots__ = ("code",) diff --git a/src/_pytest/pytester.py b/src/_pytest/pytester.py index 42e71ff917e..84547535d5f 100644 --- a/src/_pytest/pytester.py +++ b/src/_pytest/pytester.py @@ -1288,7 +1288,7 @@ def collect_by_name( ) -> Optional[Union[Item, Collector]]: """Return the collection node for name from the module collection. - Searchs a module collection node for a collection node matching the + Searches a module collection node for a collection node matching the given name. :param modcol: A module collection node; see :py:meth:`getmodulecol`. diff --git a/src/_pytest/python.py b/src/_pytest/python.py index 197d36ee9df..8db9e748975 100644 --- a/src/_pytest/python.py +++ b/src/_pytest/python.py @@ -1655,7 +1655,7 @@ def __init__( # this will be redeemed later for mark in callspec.marks: # feel free to cry, this was broken for years before - # and keywords cant fix it per design + # and keywords can't fix it per design self.keywords[mark.name] = mark self.own_markers.extend(normalize_mark_list(callspec.marks)) if keywords: diff --git a/testing/acceptance_test.py b/testing/acceptance_test.py index bfd1fe6e668..8b8d4a4a6ed 100644 --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -1281,7 +1281,7 @@ def test_simple(): reason="Windows raises `OSError: [Errno 22] Invalid argument` instead", ) def test_no_brokenpipeerror_message(pytester: Pytester) -> None: - """Ensure that the broken pipe error message is supressed. + """Ensure that the broken pipe error message is suppressed. In some Python versions, it reaches sys.unraisablehook, in others a BrokenPipeError exception is propagated, but either way it prints diff --git a/testing/code/test_source.py b/testing/code/test_source.py index b7b3c17115a..fd2c9fc9719 100644 --- a/testing/code/test_source.py +++ b/testing/code/test_source.py @@ -483,7 +483,7 @@ def deco_fixture(): src = inspect.getsource(deco_fixture) assert src == " @pytest.fixture\n def deco_fixture():\n assert False\n" - # currenly Source does not unwrap decorators, testing the + # currently Source does not unwrap decorators, testing the # existing behavior here for explicitness, but perhaps we should revisit/change this # in the future assert str(Source(deco_fixture)).startswith("@functools.wraps(function)") diff --git a/testing/test_compat.py b/testing/test_compat.py index 9f48a31d689..8471a1a50f6 100644 --- a/testing/test_compat.py +++ b/testing/test_compat.py @@ -156,11 +156,11 @@ def raise_baseexception(self): @property def raise_exception(self): - raise Exception("exception should be catched") + raise Exception("exception should be caught") @property def raise_fail_outcome(self): - pytest.fail("fail should be catched") + pytest.fail("fail should be caught") def test_helper_failures() -> None: diff --git a/testing/test_config.py b/testing/test_config.py index 4435591164f..9a57b919dd9 100644 --- a/testing/test_config.py +++ b/testing/test_config.py @@ -386,7 +386,7 @@ def pytest_configure(config): pytest.param( """ [some_other_header] - required_plugins = wont be triggered + required_plugins = won't be triggered [pytest] """, "1.5", @@ -807,7 +807,7 @@ def test_confcutdir_check_isdir(self, pytester: Pytester) -> None: with pytest.raises(pytest.UsageError, match=exp_match): pytester.parseconfig("--confcutdir", pytester.path.joinpath("file")) with pytest.raises(pytest.UsageError, match=exp_match): - pytester.parseconfig("--confcutdir", pytester.path.joinpath("inexistant")) + pytester.parseconfig("--confcutdir", pytester.path.joinpath("nonexistent")) p = pytester.mkdir("dir") config = pytester.parseconfig("--confcutdir", p) diff --git a/testing/test_doctest.py b/testing/test_doctest.py index ca215e070fa..e85f44f93f4 100644 --- a/testing/test_doctest.py +++ b/testing/test_doctest.py @@ -80,7 +80,7 @@ def test_collect_module_two_doctest_no_modulelevel( '# Empty' def my_func(): ">>> magic = 42 " - def unuseful(): + def useless(): ''' # This is a function # >>> # it doesn't have any doctest @@ -564,7 +564,7 @@ def my_func(): >>> magic - 42 0 ''' - def unuseful(): + def useless(): pass def another(): ''' diff --git a/testing/test_runner.py b/testing/test_runner.py index a34cd98f964..2e2c462d978 100644 --- a/testing/test_runner.py +++ b/testing/test_runner.py @@ -287,7 +287,7 @@ def teardown_class(cls): def test_func(): import sys - # on python2 exc_info is keept till a function exits + # on python2 exc_info is kept till a function exits # so we would end up calling test functions while # sys.exc_info would return the indexerror # from guessing the lastitem diff --git a/testing/test_stash.py b/testing/test_stash.py index bb294f5da35..2c9df4832e4 100644 --- a/testing/test_stash.py +++ b/testing/test_stash.py @@ -56,7 +56,7 @@ def test_stash() -> None: with pytest.raises(AttributeError): stash.foo = "nope" # type: ignore[attr-defined] - # No interaction with anoter stash. + # No interaction with another stash. stash2 = Stash() key3 = StashKey[int]() assert key2 not in stash2 diff --git a/testing/test_warnings.py b/testing/test_warnings.py index 3ae9ea33181..734e1ebb5cd 100644 --- a/testing/test_warnings.py +++ b/testing/test_warnings.py @@ -289,7 +289,7 @@ def pytest_warning_recorded(self, warning_message, when, nodeid, location): assert collected_result[2] == expected_result[2], str(collected) # NOTE: collected_result[3] is location, which differs based on the platform you are on - # thus, the best we can do here is assert the types of the paremeters match what we expect + # thus, the best we can do here is assert the types of the parameters match what we expect # and not try and preload it in the expected array if collected_result[3] is not None: assert type(collected_result[3][0]) is str, str(collected) @@ -708,7 +708,7 @@ def test_issue4445_preparse(self, pytester: Pytester, capwarn) -> None: pytester.parseconfig("--help") # with stacklevel=2 the warning should originate from config._preparse and is - # thrown by an errorneous conftest.py + # thrown by an erroneous conftest.py assert len(capwarn.captured) == 1 warning, location = capwarn.captured.pop() file, _, func = location diff --git a/tox.ini b/tox.ini index 9d26051ebb7..6d30e0b0dca 100644 --- a/tox.ini +++ b/tox.ini @@ -130,7 +130,7 @@ commands = {envpython} tox_run.py [testenv:release] -decription = do a release, required posarg of the version number +description = do a release, required posarg of the version number basepython = python3 usedevelop = True passenv = * @@ -144,7 +144,7 @@ deps = commands = python scripts/release.py {posargs} [testenv:prepare-release-pr] -decription = prepare a release PR from a manual trigger in GitHub actions +description = prepare a release PR from a manual trigger in GitHub actions usedevelop = {[testenv:release]usedevelop} passenv = {[testenv:release]passenv} deps = {[testenv:release]deps} From 0db1ff0d82322fffd8667103e87a42dd1a3b5a9a Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Mon, 27 Dec 2021 15:23:20 +0200 Subject: [PATCH 045/176] doc: document {Code,TracebackEntry}.path changes as breaking Closes #9423. --- doc/en/changelog.rst | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/doc/en/changelog.rst b/doc/en/changelog.rst index 15ac02d83ae..6896072e1ab 100644 --- a/doc/en/changelog.rst +++ b/doc/en/changelog.rst @@ -173,6 +173,12 @@ Deprecations This was changed for consistency with :func:`pytest.mark.skip ` and :func:`pytest.mark.xfail ` which both accept ``reason`` as an argument. +- `#8174 `_: The following changes have been made to types reachable through :attr:`pytest.ExceptionInfo.traceback`: + + - The ``path`` property of ``_pytest.code.Code`` returns ``Path`` instead of ``py.path.local``. + - The ``path`` property of ``_pytest.code.TracebackEntry`` returns ``Path`` instead of ``py.path.local``. + + There was no deprecation period for this change (sorry!). Features @@ -473,10 +479,9 @@ Trivial/Internal Changes - `#8174 `_: The following changes have been made to internal pytest types/functions: - - The ``path`` property of ``_pytest.code.Code`` returns ``Path`` instead of ``py.path.local``. - - The ``path`` property of ``_pytest.code.TracebackEntry`` returns ``Path`` instead of ``py.path.local``. - The ``_pytest.code.getfslineno()`` function returns ``Path`` instead of ``py.path.local``. - The ``_pytest.python.path_matches_patterns()`` function takes ``Path`` instead of ``py.path.local``. + - The ``_pytest._code.Traceback.cut()`` function accepts any ``os.PathLike[str]``, not just ``py.path.local``. - `#8248 `_: Internal Restructure: let ``python.PyObjMixin`` inherit from ``nodes.Node`` to carry over typing information. From 1522afa1cd237d0ae269da229e79088061f6a3f4 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Tue, 28 Dec 2021 11:01:23 +0200 Subject: [PATCH 046/176] ci: run plugins job with python 3.9 instead of 3.7 Latest Django release dropped support for 3.7. --- .github/workflows/main.yml | 2 +- tox.ini | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bbc48adb49a..08a9aa3756b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -127,7 +127,7 @@ jobs: use_coverage: true - name: "plugins" - python: "3.7" + python: "3.9" os: ubuntu-latest tox_env: "plugins" diff --git a/tox.ini b/tox.ini index 6d30e0b0dca..82c688e8aed 100644 --- a/tox.ini +++ b/tox.ini @@ -100,9 +100,9 @@ commands = [testenv:plugins] # use latest versions of all plugins, including pre-releases pip_pre=true -# use latest pip and new dependency resolver (#7783) +# use latest pip to get new dependency resolver (#7783) download=true -install_command=python -m pip --use-feature=2020-resolver install {opts} {packages} +install_command=python -m pip install {opts} {packages} changedir = testing/plugins_integration deps = -rtesting/plugins_integration/requirements.txt setenv = From 3d7cd77017eaca7cf9fd76bd9756a2be2fc6a01a Mon Sep 17 00:00:00 2001 From: Hasan Ramezani Date: Sat, 25 Dec 2021 21:25:42 +0100 Subject: [PATCH 047/176] Update syntax to Python3.7+. --- .pre-commit-config.yaml | 4 ++-- doc/en/how-to/skipping.rst | 4 ++-- src/_pytest/assertion/rewrite.py | 5 ++--- src/_pytest/compat.py | 12 +----------- src/_pytest/logging.py | 12 +----------- src/_pytest/pytester.py | 2 +- testing/test_debugging.py | 3 +-- testing/test_parseopt.py | 2 +- 8 files changed, 11 insertions(+), 33 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1a740045015..f853528d537 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -32,12 +32,12 @@ repos: rev: v2.6.0 hooks: - id: reorder-python-imports - args: ['--application-directories=.:src', --py36-plus] + args: ['--application-directories=.:src', --py37-plus] - repo: https://github.com/asottile/pyupgrade rev: v2.29.1 hooks: - id: pyupgrade - args: [--py36-plus] + args: [--py37-plus] - repo: https://github.com/asottile/setup-cfg-fmt rev: v1.20.0 hooks: diff --git a/doc/en/how-to/skipping.rst b/doc/en/how-to/skipping.rst index 9b74628d59f..9e58dc49e29 100644 --- a/doc/en/how-to/skipping.rst +++ b/doc/en/how-to/skipping.rst @@ -84,14 +84,14 @@ It is also possible to skip the whole module using If you wish to skip something conditionally then you can use ``skipif`` instead. Here is an example of marking a test function to be skipped -when run on an interpreter earlier than Python3.6: +when run on an interpreter earlier than Python3.10: .. code-block:: python import sys - @pytest.mark.skipif(sys.version_info < (3, 7), reason="requires python3.7 or higher") + @pytest.mark.skipif(sys.version_info < (3, 10), reason="requires python3.10 or higher") def test_function(): ... diff --git a/src/_pytest/assertion/rewrite.py b/src/_pytest/assertion/rewrite.py index 50b367e25ef..cacbe359b0c 100644 --- a/src/_pytest/assertion/rewrite.py +++ b/src/_pytest/assertion/rewrite.py @@ -293,9 +293,8 @@ def _write_pyc_fp( # import. However, there's little reason to deviate. fp.write(importlib.util.MAGIC_NUMBER) # https://www.python.org/dev/peps/pep-0552/ - if sys.version_info >= (3, 7): - flags = b"\x00\x00\x00\x00" - fp.write(flags) + flags = b"\x00\x00\x00\x00" + fp.write(flags) # as of now, bytecode header expects 32-bit numbers for size and mtime (#4903) mtime = int(source_stat.st_mtime) & 0xFFFFFFFF size = source_stat.st_size & 0xFFFFFFFF diff --git a/src/_pytest/compat.py b/src/_pytest/compat.py index 5af01eb7d95..3193a9a2293 100644 --- a/src/_pytest/compat.py +++ b/src/_pytest/compat.py @@ -4,7 +4,7 @@ import inspect import os import sys -from contextlib import contextmanager +from contextlib import nullcontext as nullcontext # noqa: F401 from inspect import Parameter from inspect import signature from pathlib import Path @@ -186,16 +186,6 @@ def getfuncargnames( return arg_names -if sys.version_info < (3, 7): - - @contextmanager - def nullcontext(): - yield - -else: - from contextlib import nullcontext as nullcontext # noqa: F401 - - def get_default_arg_names(function: Callable[..., Any]) -> Tuple[str, ...]: # Note: this code intentionally mirrors the code at the beginning of # getfuncargnames, to get the arguments which were excluded from its result diff --git a/src/_pytest/logging.py b/src/_pytest/logging.py index 796a1c3f8af..bc4a23f6abb 100644 --- a/src/_pytest/logging.py +++ b/src/_pytest/logging.py @@ -3,7 +3,6 @@ import logging import os import re -import sys from contextlib import contextmanager from io import StringIO from pathlib import Path @@ -628,16 +627,7 @@ def set_log_path(self, fname: str) -> None: # https://github.com/python/mypy/issues/11193 stream: io.TextIOWrapper = fpath.open(mode="w", encoding="UTF-8") # type: ignore[assignment] - if sys.version_info >= (3, 7): - old_stream = self.log_file_handler.setStream(stream) - else: - old_stream = self.log_file_handler.stream - self.log_file_handler.acquire() - try: - self.log_file_handler.flush() - self.log_file_handler.stream = stream - finally: - self.log_file_handler.release() + old_stream = self.log_file_handler.setStream(stream) if old_stream: old_stream.close() diff --git a/src/_pytest/pytester.py b/src/_pytest/pytester.py index 42e71ff917e..38eaef2fcc6 100644 --- a/src/_pytest/pytester.py +++ b/src/_pytest/pytester.py @@ -128,7 +128,7 @@ def get_open_files(self) -> List[Tuple[str, str]]: stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, check=True, - universal_newlines=True, + text=True, ).stdout def isopen(line: str) -> bool: diff --git a/testing/test_debugging.py b/testing/test_debugging.py index a822bb57f58..f3c271710d2 100644 --- a/testing/test_debugging.py +++ b/testing/test_debugging.py @@ -913,8 +913,7 @@ def test_foo(): class TestDebuggingBreakpoints: def test_supports_breakpoint_module_global(self) -> None: """Test that supports breakpoint global marks on Python 3.7+.""" - if sys.version_info >= (3, 7): - assert SUPPORTS_BREAKPOINT_BUILTIN is True + assert SUPPORTS_BREAKPOINT_BUILTIN is True @pytest.mark.skipif( not SUPPORTS_BREAKPOINT_BUILTIN, reason="Requires breakpoint() builtin" diff --git a/testing/test_parseopt.py b/testing/test_parseopt.py index 28529d04378..992f49bc53c 100644 --- a/testing/test_parseopt.py +++ b/testing/test_parseopt.py @@ -295,7 +295,7 @@ def test_argcomplete(pytester: Pytester, monkeypatch: MonkeyPatch) -> None: stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, check=True, - universal_newlines=True, + text=True, ).stdout except (OSError, subprocess.CalledProcessError): pytest.skip("bash is not available") From 400915067f1f867a79fbb21e19db1dd1b0de213f Mon Sep 17 00:00:00 2001 From: Hasan Ramezani Date: Sun, 26 Dec 2021 20:46:42 +0100 Subject: [PATCH 048/176] Move nullcontext import to src._pytest.logging. --- src/_pytest/compat.py | 1 - src/_pytest/logging.py | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/_pytest/compat.py b/src/_pytest/compat.py index 3193a9a2293..e4c2a5fdac1 100644 --- a/src/_pytest/compat.py +++ b/src/_pytest/compat.py @@ -4,7 +4,6 @@ import inspect import os import sys -from contextlib import nullcontext as nullcontext # noqa: F401 from inspect import Parameter from inspect import signature from pathlib import Path diff --git a/src/_pytest/logging.py b/src/_pytest/logging.py index bc4a23f6abb..0163554bae4 100644 --- a/src/_pytest/logging.py +++ b/src/_pytest/logging.py @@ -4,6 +4,7 @@ import os import re from contextlib import contextmanager +from contextlib import nullcontext from io import StringIO from pathlib import Path from typing import AbstractSet @@ -21,7 +22,6 @@ from _pytest._io import TerminalWriter from _pytest.capture import CaptureManager from _pytest.compat import final -from _pytest.compat import nullcontext from _pytest.config import _strtobool from _pytest.config import Config from _pytest.config import create_terminal_writer From 77042f77ccbeb87efcdd2ab3db49cca8c85cf593 Mon Sep 17 00:00:00 2001 From: Hasan Ramezani Date: Sun, 26 Dec 2021 20:52:14 +0100 Subject: [PATCH 049/176] Remove breakpoint support checking since all python versions support it. --- testing/test_debugging.py | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/testing/test_debugging.py b/testing/test_debugging.py index f3c271710d2..a95b542adec 100644 --- a/testing/test_debugging.py +++ b/testing/test_debugging.py @@ -8,14 +8,6 @@ from _pytest.monkeypatch import MonkeyPatch from _pytest.pytester import Pytester -try: - # Type ignored for Python <= 3.6. - breakpoint # type: ignore -except NameError: - SUPPORTS_BREAKPOINT_BUILTIN = False -else: - SUPPORTS_BREAKPOINT_BUILTIN = True - _ENVIRON_PYTHONBREAKPOINT = os.environ.get("PYTHONBREAKPOINT", "") @@ -911,13 +903,6 @@ def test_foo(): class TestDebuggingBreakpoints: - def test_supports_breakpoint_module_global(self) -> None: - """Test that supports breakpoint global marks on Python 3.7+.""" - assert SUPPORTS_BREAKPOINT_BUILTIN is True - - @pytest.mark.skipif( - not SUPPORTS_BREAKPOINT_BUILTIN, reason="Requires breakpoint() builtin" - ) @pytest.mark.parametrize("arg", ["--pdb", ""]) def test_sys_breakpointhook_configure_and_unconfigure( self, pytester: Pytester, arg: str @@ -951,9 +936,6 @@ def test_nothing(): pass result = pytester.runpytest_subprocess(*args) result.stdout.fnmatch_lines(["*1 passed in *"]) - @pytest.mark.skipif( - not SUPPORTS_BREAKPOINT_BUILTIN, reason="Requires breakpoint() builtin" - ) def test_pdb_custom_cls(self, pytester: Pytester, custom_debugger_hook) -> None: p1 = pytester.makepyfile( """ @@ -968,9 +950,6 @@ def test_nothing(): assert custom_debugger_hook == ["init", "set_trace"] @pytest.mark.parametrize("arg", ["--pdb", ""]) - @pytest.mark.skipif( - not SUPPORTS_BREAKPOINT_BUILTIN, reason="Requires breakpoint() builtin" - ) def test_environ_custom_class( self, pytester: Pytester, custom_debugger_hook, arg: str ) -> None: @@ -1001,9 +980,6 @@ def test_nothing(): pass result = pytester.runpytest_subprocess(*args) result.stdout.fnmatch_lines(["*1 passed in *"]) - @pytest.mark.skipif( - not SUPPORTS_BREAKPOINT_BUILTIN, reason="Requires breakpoint() builtin" - ) @pytest.mark.skipif( not _ENVIRON_PYTHONBREAKPOINT == "", reason="Requires breakpoint() default value", @@ -1024,9 +1000,6 @@ def test_1(): assert "reading from stdin while output" not in rest TestPDB.flush(child) - @pytest.mark.skipif( - not SUPPORTS_BREAKPOINT_BUILTIN, reason="Requires breakpoint() builtin" - ) def test_pdb_not_altered(self, pytester: Pytester) -> None: p1 = pytester.makepyfile( """ From b72ad0fa8e6f4461316572cda40917703521ae43 Mon Sep 17 00:00:00 2001 From: Hasan Ramezani Date: Sun, 26 Dec 2021 20:59:03 +0100 Subject: [PATCH 050/176] Remove has_flags conditions from src._pytest.assertion.rewrite._read_pyc --- src/_pytest/assertion/rewrite.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/_pytest/assertion/rewrite.py b/src/_pytest/assertion/rewrite.py index cacbe359b0c..e4007af2594 100644 --- a/src/_pytest/assertion/rewrite.py +++ b/src/_pytest/assertion/rewrite.py @@ -375,31 +375,29 @@ def _read_pyc( except OSError: return None with fp: - # https://www.python.org/dev/peps/pep-0552/ - has_flags = sys.version_info >= (3, 7) try: stat_result = os.stat(source) mtime = int(stat_result.st_mtime) size = stat_result.st_size - data = fp.read(16 if has_flags else 12) + data = fp.read(16) except OSError as e: trace(f"_read_pyc({source}): OSError {e}") return None # Check for invalid or out of date pyc file. - if len(data) != (16 if has_flags else 12): + if len(data) != (16): trace("_read_pyc(%s): invalid pyc (too short)" % source) return None if data[:4] != importlib.util.MAGIC_NUMBER: trace("_read_pyc(%s): invalid pyc (bad magic number)" % source) return None - if has_flags and data[4:8] != b"\x00\x00\x00\x00": + if data[4:8] != b"\x00\x00\x00\x00": trace("_read_pyc(%s): invalid pyc (unsupported flags)" % source) return None - mtime_data = data[8 if has_flags else 4 : 12 if has_flags else 8] + mtime_data = data[8:12] if int.from_bytes(mtime_data, "little") != mtime & 0xFFFFFFFF: trace("_read_pyc(%s): out of date" % source) return None - size_data = data[12 if has_flags else 8 : 16 if has_flags else 12] + size_data = data[12:16] if int.from_bytes(size_data, "little") != size & 0xFFFFFFFF: trace("_read_pyc(%s): invalid pyc (incorrect size)" % source) return None From e5bf3784a43422921a6018d54ce2555bc6273089 Mon Sep 17 00:00:00 2001 From: Hasan Ramezani Date: Tue, 28 Dec 2021 12:06:55 +0100 Subject: [PATCH 051/176] Update required Python version in docs. --- README.rst | 2 +- doc/en/getting-started.rst | 2 +- doc/en/index.rst | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.rst b/README.rst index 47e780ad63d..f0fe3563219 100644 --- a/README.rst +++ b/README.rst @@ -100,7 +100,7 @@ Features - Can run `unittest `_ (or trial), `nose `_ test suites out of the box -- Python 3.7+ and PyPy3 +- Python 3.7+ or PyPy3 - Rich plugin architecture, with over 850+ `external plugins `_ and thriving community diff --git a/doc/en/getting-started.rst b/doc/en/getting-started.rst index 40060a60da4..47eed9c9354 100644 --- a/doc/en/getting-started.rst +++ b/doc/en/getting-started.rst @@ -9,7 +9,7 @@ Get Started Install ``pytest`` ---------------------------------------- -``pytest`` requires: Python 3.7, 3.8, 3.9, or PyPy3. +``pytest`` requires: Python 3.7+ or PyPy3. 1. Run the following command in your command line: diff --git a/doc/en/index.rst b/doc/en/index.rst index 46d501ede83..da0d3bd4220 100644 --- a/doc/en/index.rst +++ b/doc/en/index.rst @@ -17,7 +17,7 @@ The ``pytest`` framework makes it easy to write small, readable tests, and can scale to support complex functional testing for applications and libraries. -**Pythons**: ``pytest`` requires: Python 3.7, 3.8, 3.9, or PyPy3. +``pytest`` requires: Python 3.7+ or PyPy3. **PyPI package name**: :pypi:`pytest` @@ -78,7 +78,7 @@ Features - Can run :ref:`unittest ` (including trial) and :ref:`nose ` test suites out of the box -- Python 3.7+ and PyPy 3 +- Python 3.7+ or PyPy 3 - Rich plugin architecture, with over 800+ :ref:`external plugins ` and thriving community From 4eebfb2f19057d50a0400a71c356243e5fd42954 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 28 Dec 2021 15:16:38 +0000 Subject: [PATCH 052/176] build(deps): Bump django in /testing/plugins_integration Bumps [django](https://github.com/django/django) from 3.2.10 to 4.0. - [Release notes](https://github.com/django/django/releases) - [Commits](https://github.com/django/django/compare/3.2.10...4.0) --- updated-dependencies: - dependency-name: django dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- testing/plugins_integration/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/plugins_integration/requirements.txt b/testing/plugins_integration/requirements.txt index 64d0ab83d70..4583cf0d3a7 100644 --- a/testing/plugins_integration/requirements.txt +++ b/testing/plugins_integration/requirements.txt @@ -1,5 +1,5 @@ anyio[curio,trio]==3.4.0 -django==3.2.10 +django==4.0 pytest-asyncio==0.16.0 pytest-bdd==5.0.0 pytest-cov==3.0.0 From 0b7c3d1145d3f9508598aeebee7b1675c330df34 Mon Sep 17 00:00:00 2001 From: Hasan Ramezani Date: Tue, 28 Dec 2021 17:09:27 +0100 Subject: [PATCH 053/176] Remove Python 3.6 related warning from filterwarnings. --- pyproject.toml | 2 -- 1 file changed, 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 5d32b755c74..70a9406a66e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,8 +28,6 @@ filterwarnings = [ "default:the imp module is deprecated in favour of importlib:DeprecationWarning:nose.*", # distutils is deprecated in 3.10, scheduled for removal in 3.12 "ignore:The distutils package is deprecated:DeprecationWarning", - # produced by python3.6/site.py itself (3.6.7 on Travis, could not trigger it with 3.6.8)." - "ignore:.*U.*mode is deprecated:DeprecationWarning:(?!(pytest|_pytest))", # produced by pytest-xdist "ignore:.*type argument to addoption.*:DeprecationWarning", # produced on execnet (pytest-xdist) From 1fd3601caa71a58e04fd16d4433c24c05e00fefc Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Thu, 30 Dec 2021 12:37:18 +0200 Subject: [PATCH 054/176] Drop support for EOL Python 3.6 --- pyproject.toml | 2 +- src/_pytest/assertion/rewrite.py | 3 - src/_pytest/capture.py | 6 +- src/_pytest/python.py | 4 +- testing/deprecated_test.py | 4 -- testing/test_assertrewrite.py | 3 - testing/test_capture.py | 8 +-- testing/test_compat.py | 2 +- testing/test_error_diffs.py | 113 +++++++++++++++---------------- testing/test_pathlib.py | 1 - 10 files changed, 63 insertions(+), 83 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 70a9406a66e..3d683aebea7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -111,4 +111,4 @@ template = "changelog/_template.rst" showcontent = true [tool.black] -target-version = ['py36'] +target-version = ['py37'] diff --git a/src/_pytest/assertion/rewrite.py b/src/_pytest/assertion/rewrite.py index afdd35980b3..f0922870a4c 100644 --- a/src/_pytest/assertion/rewrite.py +++ b/src/_pytest/assertion/rewrite.py @@ -100,9 +100,6 @@ def find_spec( spec is None # this is a namespace package (without `__init__.py`) # there's nothing to rewrite there - # python3.6: `namespace` - # python3.7+: `None` - or spec.origin == "namespace" or spec.origin is None # we can only rewrite source files or not isinstance(spec.loader, importlib.machinery.SourceFileLoader) diff --git a/src/_pytest/capture.py b/src/_pytest/capture.py index d82ee9552f1..ee9de373325 100644 --- a/src/_pytest/capture.py +++ b/src/_pytest/capture.py @@ -68,8 +68,8 @@ def _colorama_workaround() -> None: pass -def _py36_windowsconsoleio_workaround(stream: TextIO) -> None: - """Workaround for Windows Unicode console handling on Python>=3.6. +def _windowsconsoleio_workaround(stream: TextIO) -> None: + """Workaround for Windows Unicode console handling. Python 3.6 implemented Unicode console handling for Windows. This works by reading/writing to the raw console handle using @@ -128,7 +128,7 @@ def _reopen_stdio(f, mode): def pytest_load_initial_conftests(early_config: Config): ns = early_config.known_args_namespace if ns.capture == "fd": - _py36_windowsconsoleio_workaround(sys.stdout) + _windowsconsoleio_workaround(sys.stdout) _colorama_workaround() pluginmanager = early_config.pluginmanager capman = CaptureManager(ns.capture) diff --git a/src/_pytest/python.py b/src/_pytest/python.py index 8db9e748975..0462665cd52 100644 --- a/src/_pytest/python.py +++ b/src/_pytest/python.py @@ -414,7 +414,7 @@ def collect(self) -> Iterable[Union[nodes.Item, nodes.Collector]]: for basecls in self.obj.__mro__: dicts.append(basecls.__dict__) - # In each class, nodes should be definition ordered. Since Python 3.6, + # In each class, nodes should be definition ordered. # __dict__ is definition ordered. seen: Set[str] = set() dict_values: List[List[Union[nodes.Item, nodes.Collector]]] = [] @@ -894,8 +894,6 @@ class InstanceDummy: pass -# Note: module __getattr__ only works on Python>=3.7. Unfortunately -# we can't provide this deprecation warning on Python 3.6. def __getattr__(name: str) -> object: if name == "Instance": warnings.warn(INSTANCE_COLLECTOR, 2) diff --git a/testing/deprecated_test.py b/testing/deprecated_test.py index c316b074c4b..07e69e6840f 100644 --- a/testing/deprecated_test.py +++ b/testing/deprecated_test.py @@ -234,10 +234,6 @@ def test_node_ctor_fspath_argument_is_deprecated(pytester: Pytester) -> None: ) -@pytest.mark.skipif( - sys.version_info < (3, 7), - reason="This deprecation can only be emitted on python>=3.7", -) def test_importing_instance_is_deprecated(pytester: Pytester) -> None: with pytest.warns( pytest.PytestDeprecationWarning, diff --git a/testing/test_assertrewrite.py b/testing/test_assertrewrite.py index a88c7eba33e..c568143f51c 100644 --- a/testing/test_assertrewrite.py +++ b/testing/test_assertrewrite.py @@ -1123,9 +1123,6 @@ def test_read_pyc(self, tmp_path: Path) -> None: assert _read_pyc(source, pyc) is None # no error - @pytest.mark.skipif( - sys.version_info < (3, 7), reason="Only the Python 3.7 format for simplicity" - ) def test_read_pyc_more_invalid(self, tmp_path: Path) -> None: from _pytest.assertion.rewrite import _read_pyc diff --git a/testing/test_capture.py b/testing/test_capture.py index 1bc1f2f8db2..f0c582b6651 100644 --- a/testing/test_capture.py +++ b/testing/test_capture.py @@ -1433,19 +1433,19 @@ def test_capattr(): not sys.platform.startswith("win"), reason="only on windows", ) -def test_py36_windowsconsoleio_workaround_non_standard_streams() -> None: +def test_windowsconsoleio_workaround_non_standard_streams() -> None: """ - Ensure _py36_windowsconsoleio_workaround function works with objects that + Ensure _windowsconsoleio_workaround function works with objects that do not implement the full ``io``-based stream protocol, for example execnet channels (#2666). """ - from _pytest.capture import _py36_windowsconsoleio_workaround + from _pytest.capture import _windowsconsoleio_workaround class DummyStream: def write(self, s): pass stream = cast(TextIO, DummyStream()) - _py36_windowsconsoleio_workaround(stream) + _windowsconsoleio_workaround(stream) def test_dontreadfrominput_has_encoding(pytester: Pytester) -> None: diff --git a/testing/test_compat.py b/testing/test_compat.py index 8471a1a50f6..88f0f33efc2 100644 --- a/testing/test_compat.py +++ b/testing/test_compat.py @@ -133,7 +133,7 @@ def test_is_generator_async_gen_syntax(pytester: Pytester) -> None: pytester.makepyfile( """ from _pytest.compat import is_generator - def test_is_generator_py36(): + def test_is_generator(): async def foo(): yield await foo() diff --git a/testing/test_error_diffs.py b/testing/test_error_diffs.py index 1668e929ab4..d880be0dabe 100644 --- a/testing/test_error_diffs.py +++ b/testing/test_error_diffs.py @@ -4,8 +4,6 @@ See https://github.com/pytest-dev/pytest/issues/3333 for details. """ -import sys - import pytest from _pytest.pytester import Pytester @@ -210,68 +208,63 @@ def test_this(): """, id='Test "not in" string', ), -] -if sys.version_info[:2] >= (3, 7): - TESTCASES.extend( - [ - pytest.param( - """ - from dataclasses import dataclass + pytest.param( + """ + from dataclasses import dataclass - @dataclass - class A: - a: int - b: str + @dataclass + class A: + a: int + b: str - def test_this(): - result = A(1, 'spam') - expected = A(2, 'spam') - assert result == expected - """, - """ - > assert result == expected - E AssertionError: assert A(a=1, b='spam') == A(a=2, b='spam') - E Matching attributes: - E ['b'] - E Differing attributes: - E ['a'] - E Drill down into differing attribute a: - E a: 1 != 2 - E +1 - E -2 - """, - id="Compare data classes", - ), - pytest.param( - """ - import attr + def test_this(): + result = A(1, 'spam') + expected = A(2, 'spam') + assert result == expected + """, + """ + > assert result == expected + E AssertionError: assert A(a=1, b='spam') == A(a=2, b='spam') + E Matching attributes: + E ['b'] + E Differing attributes: + E ['a'] + E Drill down into differing attribute a: + E a: 1 != 2 + E +1 + E -2 + """, + id="Compare data classes", + ), + pytest.param( + """ + import attr - @attr.s(auto_attribs=True) - class A: - a: int - b: str + @attr.s(auto_attribs=True) + class A: + a: int + b: str - def test_this(): - result = A(1, 'spam') - expected = A(1, 'eggs') - assert result == expected - """, - """ - > assert result == expected - E AssertionError: assert A(a=1, b='spam') == A(a=1, b='eggs') - E Matching attributes: - E ['a'] - E Differing attributes: - E ['b'] - E Drill down into differing attribute b: - E b: 'spam' != 'eggs' - E - eggs - E + spam - """, - id="Compare attrs classes", - ), - ] - ) + def test_this(): + result = A(1, 'spam') + expected = A(1, 'eggs') + assert result == expected + """, + """ + > assert result == expected + E AssertionError: assert A(a=1, b='spam') == A(a=1, b='eggs') + E Matching attributes: + E ['a'] + E Differing attributes: + E ['b'] + E Drill down into differing attribute b: + E b: 'spam' != 'eggs' + E - eggs + E + spam + """, + id="Compare attrs classes", + ), +] @pytest.mark.parametrize("code, expected", TESTCASES) diff --git a/testing/test_pathlib.py b/testing/test_pathlib.py index 5eb153e847d..24cd71b25a6 100644 --- a/testing/test_pathlib.py +++ b/testing/test_pathlib.py @@ -450,7 +450,6 @@ def test_samefile_false_negatives(tmp_path: Path, monkeypatch: MonkeyPatch) -> N class TestImportLibMode: - @pytest.mark.skipif(sys.version_info < (3, 7), reason="Dataclasses in Python3.7+") def test_importmode_importlib_with_dataclass(self, tmp_path: Path) -> None: """Ensure that importlib mode works with a module containing dataclasses (#7856).""" fn = tmp_path.joinpath("_src/tests/test_dataclass.py") From 61417b2551a81c02b7e853b1d8d5c7ba11bd9bf1 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Thu, 30 Dec 2021 12:37:18 +0200 Subject: [PATCH 055/176] Drop support for EOL Python 3.6 --- testing/python/approx.py | 2 -- testing/test_assertion.py | 7 ------- 2 files changed, 9 deletions(-) diff --git a/testing/python/approx.py b/testing/python/approx.py index 0d411d8a6da..f417a5992cc 100644 --- a/testing/python/approx.py +++ b/testing/python/approx.py @@ -1,5 +1,4 @@ import operator -import sys from contextlib import contextmanager from decimal import Decimal from fractions import Fraction @@ -810,7 +809,6 @@ def test_nonnumeric_false_if_unequal(self, x): assert 1.0 != approx([None]) assert None != approx([1.0]) # noqa: E711 - @pytest.mark.skipif(sys.version_info < (3, 7), reason="requires ordered dicts") def test_nonnumeric_dict_repr(self): """Dicts with non-numerics and infinites have no tolerances""" x1 = {"foo": 1.0000005, "bar": None, "foobar": inf} diff --git a/testing/test_assertion.py b/testing/test_assertion.py index 8a4525cb74a..317a2beb388 100644 --- a/testing/test_assertion.py +++ b/testing/test_assertion.py @@ -796,7 +796,6 @@ def test_mojibake(self) -> None: class TestAssert_reprcompare_dataclass: - @pytest.mark.skipif(sys.version_info < (3, 7), reason="Dataclasses in Python3.7+") def test_dataclasses(self, pytester: Pytester) -> None: p = pytester.copy_example("dataclasses/test_compare_dataclasses.py") result = pytester.runpytest(p) @@ -815,7 +814,6 @@ def test_dataclasses(self, pytester: Pytester) -> None: consecutive=True, ) - @pytest.mark.skipif(sys.version_info < (3, 7), reason="Dataclasses in Python3.7+") def test_recursive_dataclasses(self, pytester: Pytester) -> None: p = pytester.copy_example("dataclasses/test_compare_recursive_dataclasses.py") result = pytester.runpytest(p) @@ -834,7 +832,6 @@ def test_recursive_dataclasses(self, pytester: Pytester) -> None: consecutive=True, ) - @pytest.mark.skipif(sys.version_info < (3, 7), reason="Dataclasses in Python3.7+") def test_recursive_dataclasses_verbose(self, pytester: Pytester) -> None: p = pytester.copy_example("dataclasses/test_compare_recursive_dataclasses.py") result = pytester.runpytest(p, "-vv") @@ -867,7 +864,6 @@ def test_recursive_dataclasses_verbose(self, pytester: Pytester) -> None: consecutive=True, ) - @pytest.mark.skipif(sys.version_info < (3, 7), reason="Dataclasses in Python3.7+") def test_dataclasses_verbose(self, pytester: Pytester) -> None: p = pytester.copy_example("dataclasses/test_compare_dataclasses_verbose.py") result = pytester.runpytest(p, "-vv") @@ -881,7 +877,6 @@ def test_dataclasses_verbose(self, pytester: Pytester) -> None: ] ) - @pytest.mark.skipif(sys.version_info < (3, 7), reason="Dataclasses in Python3.7+") def test_dataclasses_with_attribute_comparison_off( self, pytester: Pytester ) -> None: @@ -891,7 +886,6 @@ def test_dataclasses_with_attribute_comparison_off( result = pytester.runpytest(p, "-vv") result.assert_outcomes(failed=0, passed=1) - @pytest.mark.skipif(sys.version_info < (3, 7), reason="Dataclasses in Python3.7+") def test_comparing_two_different_data_classes(self, pytester: Pytester) -> None: p = pytester.copy_example( "dataclasses/test_compare_two_different_dataclasses.py" @@ -899,7 +893,6 @@ def test_comparing_two_different_data_classes(self, pytester: Pytester) -> None: result = pytester.runpytest(p, "-vv") result.assert_outcomes(failed=0, passed=1) - @pytest.mark.skipif(sys.version_info < (3, 7), reason="Dataclasses in Python3.7+") def test_data_classes_with_custom_eq(self, pytester: Pytester) -> None: p = pytester.copy_example( "dataclasses/test_compare_dataclasses_with_custom_eq.py" From cbccc063027c1d255bfd665e62505a83bdd60eb3 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 27 Dec 2021 21:12:08 +0000 Subject: [PATCH 056/176] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/pre-commit-hooks: v4.0.1 → v4.1.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.0.1...v4.1.0) - [github.com/pre-commit/mirrors-mypy: v0.920 → v0.930](https://github.com/pre-commit/mirrors-mypy/compare/v0.920...v0.930) --- .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 f853528d537..57896c39532 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,7 +10,7 @@ repos: - id: blacken-docs additional_dependencies: [black==20.8b1] - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.0.1 + rev: v4.1.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer @@ -48,7 +48,7 @@ repos: hooks: - id: python-use-type-annotations - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.920 + rev: v0.930 hooks: - id: mypy files: ^(src/|testing/) From b0aabe4081403ad74e0c0a14a88a76930dbb9a66 Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Wed, 29 Dec 2021 17:52:16 -0500 Subject: [PATCH 057/176] fix mypy 0.930 errors --- src/_pytest/config/__init__.py | 5 +++-- src/_pytest/monkeypatch.py | 2 +- src/_pytest/pathlib.py | 3 +++ src/_pytest/python.py | 1 + testing/test_conftest.py | 4 ++++ testing/test_pathlib.py | 4 ++++ 6 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/_pytest/config/__init__.py b/src/_pytest/config/__init__.py index 1bdd8effba2..dee3d4974fb 100644 --- a/src/_pytest/config/__init__.py +++ b/src/_pytest/config/__init__.py @@ -1429,6 +1429,7 @@ def _getconftest_pathlist( ) except KeyError: return None + assert mod.__file__ is not None modpath = Path(mod.__file__).parent values: List[Path] = [] for relroot in relroots: @@ -1574,7 +1575,7 @@ def _strtobool(val: str) -> bool: @lru_cache(maxsize=50) def parse_warning_filter( arg: str, *, escape: bool -) -> Tuple[str, str, Type[Warning], str, int]: +) -> Tuple["warnings._ActionKind", str, Type[Warning], str, int]: """Parse a warnings filter string. This is copied from warnings._setoption with the following changes: @@ -1616,7 +1617,7 @@ def parse_warning_filter( parts.append("") action_, message, category_, module, lineno_ = (s.strip() for s in parts) try: - action: str = warnings._getaction(action_) # type: ignore[attr-defined] + action: "warnings._ActionKind" = warnings._getaction(action_) # type: ignore[attr-defined] except warnings._OptionError as e: raise UsageError(error_template.format(error=str(e))) try: diff --git a/src/_pytest/monkeypatch.py b/src/_pytest/monkeypatch.py index 31f95a95ab2..91d590fb3df 100644 --- a/src/_pytest/monkeypatch.py +++ b/src/_pytest/monkeypatch.py @@ -55,7 +55,7 @@ def resolve(name: str) -> object: parts = name.split(".") used = parts.pop(0) - found = __import__(used) + found: object = __import__(used) for part in parts: used += "." + part try: diff --git a/src/_pytest/pathlib.py b/src/_pytest/pathlib.py index b23e51d4429..def5fa94b2b 100644 --- a/src/_pytest/pathlib.py +++ b/src/_pytest/pathlib.py @@ -539,6 +539,9 @@ def import_path( ignore = os.environ.get("PY_IGNORE_IMPORTMISMATCH", "") if ignore != "1": module_file = mod.__file__ + if module_file is None: + raise ImportPathMismatchError(module_name, module_file, path) + if module_file.endswith((".pyc", ".pyo")): module_file = module_file[:-1] if module_file.endswith(os.path.sep + "__init__.py"): diff --git a/src/_pytest/python.py b/src/_pytest/python.py index 0462665cd52..90f035e8fb1 100644 --- a/src/_pytest/python.py +++ b/src/_pytest/python.py @@ -330,6 +330,7 @@ def reportinfo(self) -> Tuple[Union["os.PathLike[str]", str], Optional[int], str if isinstance(compat_co_firstlineno, int): # nose compatibility file_path = sys.modules[obj.__module__].__file__ + assert file_path is not None if file_path.endswith(".pyc"): file_path = file_path[:-1] path: Union["os.PathLike[str]", str] = file_path diff --git a/testing/test_conftest.py b/testing/test_conftest.py index 64c1014a533..92a5ffb72cf 100644 --- a/testing/test_conftest.py +++ b/testing/test_conftest.py @@ -114,6 +114,7 @@ def test_value_access_with_confmod(self, basedir: Path) -> None: "a", startdir, importmode="prepend", rootpath=Path(basedir) ) assert value == 1.5 + assert mod.__file__ is not None path = Path(mod.__file__) assert path.parent == basedir / "adir" / "b" assert path.stem == "conftest" @@ -197,12 +198,14 @@ def test_conftestcutdir(pytester: Pytester) -> None: values = conftest._getconftestmodules( conf.parent, importmode="prepend", rootpath=pytester.path ) + assert values[0].__file__ is not None assert values[0].__file__.startswith(str(conf)) # and all sub paths get updated properly values = conftest._getconftestmodules( p, importmode="prepend", rootpath=pytester.path ) assert len(values) == 1 + assert values[0].__file__ is not None assert values[0].__file__.startswith(str(conf)) @@ -214,6 +217,7 @@ def test_conftestcutdir_inplace_considered(pytester: Pytester) -> None: conf.parent, importmode="prepend", rootpath=pytester.path ) assert len(values) == 1 + assert values[0].__file__ is not None assert values[0].__file__.startswith(str(conf)) diff --git a/testing/test_pathlib.py b/testing/test_pathlib.py index 24cd71b25a6..fe5e08f212f 100644 --- a/testing/test_pathlib.py +++ b/testing/test_pathlib.py @@ -143,6 +143,10 @@ def test_smoke_test(self, path1: Path) -> None: assert obj.x == 42 # type: ignore[attr-defined] assert obj.__name__ == "execfile" + def test_import_path_missing_file(self, path1: Path) -> None: + with pytest.raises(ImportPathMismatchError): + import_path(path1 / "sampledir", root=path1) + def test_renamed_dir_creates_mismatch( self, tmp_path: Path, monkeypatch: MonkeyPatch ) -> None: From 819c67f58ebc0941996e84146d6057fc9cfdb34d Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Sat, 1 Jan 2022 23:36:10 +0200 Subject: [PATCH 058/176] Also test branches prefixed test-me- --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3cf726a1ae7..79ce0e2225b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -5,6 +5,7 @@ on: branches: - main - "[0-9]+.[0-9]+.x" + - "test-me-*" tags: - "[0-9]+.[0-9]+.[0-9]+" - "[0-9]+.[0-9]+.[0-9]+rc[0-9]+" From d60771f986d8abf4aacd0f8a162460dac466aa6d Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 3 Jan 2022 15:14:40 +0100 Subject: [PATCH 059/176] ci: Try backporting via pull_request_target (#9430) * ci: Try backporting via pull_request_target * ci: Security improvements --- .github/workflows/backport.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml index c1a0554199f..f7840d537cf 100644 --- a/.github/workflows/backport.yml +++ b/.github/workflows/backport.yml @@ -1,7 +1,13 @@ name: backport on: - pull_request: + # Note that `pull_request_target` has security implications: + # https://securitylab.github.com/research/github-actions-preventing-pwn-requests/ + # In particular: + # - Only allow triggers that can be used only be trusted users + # - Don't execute any code from the target branch + # - Don't use cache + pull_request_target: types: [labeled] # Set permissions at the job level. @@ -9,7 +15,7 @@ permissions: {} jobs: backport: - if: ${{ startsWith(github.event.label.name, 'backport ') }} + if: startsWith(github.event.label.name, 'backport ') && github.event.pull_request.merged runs-on: ubuntu-latest permissions: contents: write From 56081ca07590d049757cd32105e6310d35c1dfcf Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 3 Jan 2022 18:57:32 +0100 Subject: [PATCH 060/176] [automated] Update plugin list (#9468) Co-authored-by: pytest bot --- doc/en/reference/plugin_list.rst | 68 ++++++++++++++++---------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/doc/en/reference/plugin_list.rst b/doc/en/reference/plugin_list.rst index 7e89ac61778..2419abb2e5a 100644 --- a/doc/en/reference/plugin_list.rst +++ b/doc/en/reference/plugin_list.rst @@ -40,7 +40,7 @@ This list contains 975 plugins. :pypi:`pytest-allure-adaptor2` Plugin for py.test to generate allure xml reports Oct 14, 2020 N/A pytest (>=2.7.3) :pypi:`pytest-allure-dsl` pytest plugin to test case doc string dls instructions Oct 25, 2020 4 - Beta pytest :pypi:`pytest-allure-spec-coverage` The pytest plugin aimed to display test coverage of the specs(requirements) in Allure Oct 26, 2021 N/A pytest - :pypi:`pytest-alphamoon` Static code checks used at Alphamoon Oct 21, 2021 4 - Beta pytest (>=3.5.0) + :pypi:`pytest-alphamoon` Static code checks used at Alphamoon Dec 30, 2021 5 - Production/Stable pytest (>=3.5.0) :pypi:`pytest-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 Oct 14, 2021 4 - Beta pytest (>=3.5.0) :pypi:`pytest-annotate` pytest-annotate: Generate PyAnnotate annotations from your pytest tests. Nov 29, 2021 3 - Alpha pytest (<7.0.0,>=3.2.0) @@ -57,7 +57,7 @@ This list contains 975 plugins. :pypi:`pytest-appium` Pytest plugin for appium Dec 05, 2019 N/A N/A :pypi:`pytest-approvaltests` A plugin to use approvaltests with pytest Feb 07, 2021 4 - Beta pytest (>=3.5.0) :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 Dec 06, 2018 4 - Beta pytest + :pypi:`pytest-arraydiff` pytest plugin to help with comparing array output from tests Dec 31, 2021 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-asptest` test Answer Set Programming programs Apr 28, 2018 4 - Beta N/A :pypi:`pytest-assertutil` pytest-assertutil May 10, 2019 N/A N/A @@ -65,7 +65,7 @@ This list contains 975 plugins. :pypi:`pytest-assume` A pytest plugin that allows multiple failures per test Jun 24, 2021 N/A pytest (>=2.7) :pypi:`pytest-ast-back-to-python` A plugin for pytest devs to view how assertion rewriting recodes the AST Sep 29, 2019 4 - Beta N/A :pypi:`pytest-astropy` Meta-package containing dependencies for testing Sep 21, 2021 5 - Production/Stable pytest (>=4.6) - :pypi:`pytest-astropy-header` pytest plugin to add diagnostic information to the header of the test output Dec 18, 2019 3 - Alpha pytest (>=2.8) + :pypi:`pytest-astropy-header` pytest plugin to add diagnostic information to the header of the test output Dec 27, 2021 3 - Alpha pytest (>=4.6) :pypi:`pytest-ast-transformer` May 04, 2019 3 - Alpha pytest :pypi:`pytest-asyncio` Pytest support for asyncio. Oct 15, 2021 4 - Beta pytest (>=5.4.0) :pypi:`pytest-asyncio-cooperative` Run all your asynchronous tests cooperatively. Oct 12, 2021 4 - Beta N/A @@ -352,7 +352,7 @@ This list contains 975 plugins. :pypi:`pytest-filemarker` A pytest plugin that runs marked tests when files change. Dec 01, 2020 N/A pytest :pypi:`pytest-filter-case` run test cases filter by mark Nov 05, 2020 N/A N/A :pypi:`pytest-filter-subpackage` Pytest plugin for filtering based on sub-packages Jan 09, 2020 3 - Alpha pytest (>=3.0) - :pypi:`pytest-find-dependencies` A pytest plugin to find dependencies between tests Apr 21, 2021 4 - Beta pytest (>=3.5.0) + :pypi:`pytest-find-dependencies` A pytest plugin to find dependencies between tests Dec 26, 2021 4 - Beta pytest (>=3.5.0) :pypi:`pytest-finer-verdicts` A pytest plugin to treat non-assertion failures as test errors. Jun 18, 2020 N/A pytest (>=5.4.3) :pypi:`pytest-firefox` pytest plugin to manipulate firefox Aug 08, 2017 3 - Alpha pytest (>=3.0.2) :pypi:`pytest-fixture-config` Fixture configuration utils for py.test May 28, 2019 5 - Production/Stable pytest @@ -407,12 +407,12 @@ This list contains 975 plugins. :pypi:`pytest-helm-charts` A plugin to provide different types and configs of Kubernetes clusters that can be used for testing. Oct 26, 2021 4 - Beta pytest (>=6.1.2,<7.0.0) :pypi:`pytest-helper` Functions to help in using the pytest testing framework May 31, 2019 5 - Production/Stable N/A :pypi:`pytest-helpers` pytest helpers May 17, 2020 N/A pytest - :pypi:`pytest-helpers-namespace` Pytest Helpers Namespace Plugin Apr 29, 2021 5 - Production/Stable pytest (>=6.0.0) + :pypi:`pytest-helpers-namespace` Pytest Helpers Namespace Plugin Dec 29, 2021 5 - Production/Stable pytest (>=6.0.0) :pypi:`pytest-hidecaptured` Hide captured output May 04, 2018 4 - Beta pytest (>=2.8.5) :pypi:`pytest-historic` Custom report to display pytest historical execution records Apr 08, 2020 N/A pytest :pypi:`pytest-historic-hook` Custom listener to store execution results into MYSQL DB, which is used for pytest-historic report Apr 08, 2020 N/A pytest :pypi:`pytest-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 24, 2021 3 - Alpha pytest (==6.2.5) + :pypi:`pytest-homeassistant-custom-component` Experimental package to automatically extract test plugins for Home Assistant custom components Dec 30, 2021 3 - Alpha pytest (==6.2.5) :pypi:`pytest-honors` Report on tests that honor constraints, and guard against regressions Mar 06, 2020 4 - Beta N/A :pypi:`pytest-hoverfly` Simplify working with Hoverfly from pytest Jul 12, 2021 N/A pytest (>=5.0) :pypi:`pytest-hoverfly-wrapper` Integrates the Hoverfly HTTP proxy into Pytest Aug 29, 2021 4 - Beta N/A @@ -427,7 +427,7 @@ This list contains 975 plugins. :pypi:`pytest-http-mocker` Pytest plugin for http mocking (via https://github.com/vilus/mocker) Oct 20, 2019 N/A N/A :pypi:`pytest-httpretty` A thin wrapper of HTTPretty for pytest Feb 16, 2014 3 - Alpha N/A :pypi:`pytest-httpserver` pytest-httpserver is a httpserver for pytest Dec 15, 2021 3 - Alpha N/A - :pypi:`pytest-httpx` Send responses to httpx. Dec 23, 2021 5 - Production/Stable pytest (==6.*) + :pypi:`pytest-httpx` Send responses to httpx. Dec 27, 2021 5 - Production/Stable pytest (==6.*) :pypi:`pytest-httpx-blockage` Disable httpx requests during a test run Nov 16, 2021 N/A pytest (>=6.2.5) :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 @@ -536,7 +536,7 @@ This list contains 975 plugins. :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 May 06, 2021 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 Aug 10, 2021 5 - Production/Stable N/A + :pypi:`pytest-mock-generator` A pytest fixture wrapper for https://pypi.org/project/mock-generator Dec 30, 2021 5 - Production/Stable N/A :pypi:`pytest-mock-helper` Help you mock HTTP call and generate mock code Jan 24, 2018 N/A pytest :pypi:`pytest-mockito` Base fixtures for mockito Jul 11, 2018 4 - Beta N/A :pypi:`pytest-mockredis` An in-memory mock of a Redis server that runs in a separate thread. This is to be used for unit-tests that require a Redis database. Jan 02, 2018 2 - Pre-Alpha N/A @@ -628,7 +628,7 @@ This list contains 975 plugins. :pypi:`pytest-perf` pytest-perf Jun 27, 2021 5 - Production/Stable pytest (>=4.6) ; extra == 'testing' :pypi:`pytest-performance` A simple plugin to ensure the execution of critical sections of code has not been impacted Sep 11, 2020 5 - Production/Stable pytest (>=3.7.0) :pypi:`pytest-persistence` Pytest tool for persistent objects Dec 07, 2021 N/A N/A - :pypi:`pytest-pg` Helps to run PostgreSQL in docker as pytest fixture Dec 25, 2021 5 - Production/Stable pytest + :pypi:`pytest-pg` Helps to run PostgreSQL in docker as pytest fixture Dec 28, 2021 5 - Production/Stable pytest (>=6.0.0) :pypi:`pytest-pgsql` Pytest plugins and helpers for tests using a Postgres database. May 13, 2020 5 - Production/Stable pytest (>=3.0.0) :pypi:`pytest-phmdoctest` pytest plugin to test Python examples in Markdown using phmdoctest. Nov 10, 2021 4 - Beta pytest (>=6.2) ; extra == 'test' :pypi:`pytest-picked` Run the tests related to the changed files Dec 23, 2020 N/A pytest (>=3.5.0) @@ -663,7 +663,7 @@ This list contains 975 plugins. :pypi:`pytest-power` pytest plugin with powerful fixtures Dec 31, 2020 N/A pytest (>=5.4) :pypi:`pytest-pretty-terminal` pytest plugin for generating prettier terminal output Nov 24, 2021 N/A pytest (>=3.4.1) :pypi:`pytest-pride` Minitest-style test colors Apr 02, 2016 3 - Alpha N/A - :pypi:`pytest-print` pytest-print adds the printer fixture you can use to print messages to the user (directly to the pytest runner, not stdout) Jun 17, 2021 5 - Production/Stable pytest (>=6) + :pypi:`pytest-print` pytest-print adds the printer fixture you can use to print messages to the user (directly to the pytest runner, not stdout) Dec 28, 2021 5 - Production/Stable pytest (>=6) :pypi:`pytest-profiles` pytest plugin for configuration profiles Dec 09, 2021 4 - Beta pytest (>=3.7.0) :pypi:`pytest-profiling` Profiling plugin for py.test May 28, 2019 5 - Production/Stable pytest :pypi:`pytest-progress` pytest plugin for instant test progress status Nov 09, 2021 5 - Production/Stable pytest (>=2.7) @@ -775,13 +775,13 @@ This list contains 975 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. Dec 24, 2021 5 - Production/Stable N/A + :pypi:`pytest-sbase` A complete web automation framework for end-to-end testing. Dec 31, 2021 5 - Production/Stable N/A :pypi:`pytest-scenario` pytest plugin for test scenarios Feb 06, 2017 3 - Alpha N/A :pypi:`pytest-schema` 👍 Validate return values against a schema-like object in testing Aug 31, 2020 5 - Production/Stable pytest (>=3.5.0) :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 Sep 19, 2020 5 - Production/Stable pytest (>=5.0.0) - :pypi:`pytest-seleniumbase` A complete web automation framework for end-to-end testing. Dec 24, 2021 5 - Production/Stable N/A + :pypi:`pytest-seleniumbase` A complete web automation framework for end-to-end testing. Dec 31, 2021 5 - Production/Stable N/A :pypi:`pytest-selenium-enhancer` pytest plugin for Selenium Dec 16, 2021 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-send-email` Send pytest execution result email Dec 04, 2019 N/A N/A @@ -816,7 +816,7 @@ This list contains 975 plugins. :pypi:`pytest-snapci` py.test plugin for Snap-CI Nov 12, 2015 N/A N/A :pypi:`pytest-snapshot` A plugin for snapshot testing with pytest. Dec 02, 2021 4 - Beta pytest (>=3.0.0) :pypi:`pytest-snmpserver` May 12, 2021 N/A N/A - :pypi:`pytest-snowflake-bdd` Setup test data and run tests on snowflake in BDD style! Dec 19, 2021 4 - Beta pytest (>=6.2.0) + :pypi:`pytest-snowflake-bdd` Setup test data and run tests on snowflake in BDD style! Dec 30, 2021 4 - Beta pytest (>=6.2.0) :pypi:`pytest-socket` Pytest Plugin to disable socket calls during tests Dec 23, 2021 4 - Beta pytest (>=3.6.3) :pypi:`pytest-soft-assertions` May 05, 2020 3 - Alpha pytest :pypi:`pytest-solr` Solr process and client fixtures for py.test. May 11, 2020 3 - Alpha pytest (>=3.0.0) @@ -897,7 +897,7 @@ This list contains 975 plugins. :pypi:`pytest-testslide` TestSlide fixture for pytest Jan 07, 2021 5 - Production/Stable pytest (~=6.2) :pypi:`pytest-test-this` Plugin for py.test to run relevant tests, based on naively checking if a test contains a reference to the symbol you supply Sep 15, 2019 2 - Pre-Alpha pytest (>=2.3) :pypi:`pytest-test-utils` Dec 14, 2021 N/A pytest (>=5) - :pypi:`pytest-tesults` Tesults plugin for pytest Jul 31, 2021 5 - Production/Stable pytest (>=3.5.0) + :pypi:`pytest-tesults` Tesults plugin for pytest Dec 31, 2021 5 - Production/Stable pytest (>=3.5.0) :pypi:`pytest-tezos` pytest-ligo Jan 16, 2020 4 - Beta N/A :pypi:`pytest-thawgun` Pytest plugin for time travel May 26, 2020 3 - Alpha N/A :pypi:`pytest-threadleak` Detects thread leaks Sep 08, 2017 4 - Beta N/A @@ -959,7 +959,7 @@ This list contains 975 plugins. :pypi:`pytest-vyper` Plugin for the vyper smart contract language. May 28, 2020 2 - Pre-Alpha N/A :pypi:`pytest-wa-e2e-plugin` Pytest plugin for testing whatsapp bots with end to end tests Feb 18, 2020 4 - Beta pytest (>=3.5.0) :pypi:`pytest-watch` Local continuous test runner with pytest and watchdog. May 20, 2018 N/A N/A - :pypi:`pytest-watcher` Continiously runs pytest on changes in \*.py files Sep 18, 2021 3 - Alpha N/A + :pypi:`pytest-watcher` Continiously runs pytest on changes in \*.py files Dec 30, 2021 3 - Alpha N/A :pypi:`pytest-wdl` Pytest plugin for testing WDL workflows. Nov 17, 2020 5 - Production/Stable N/A :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 @@ -1153,8 +1153,8 @@ This list contains 975 plugins. The pytest plugin aimed to display test coverage of the specs(requirements) in Allure :pypi:`pytest-alphamoon` - *last release*: Oct 21, 2021, - *status*: 4 - Beta, + *last release*: Dec 30, 2021, + *status*: 5 - Production/Stable, *requires*: pytest (>=3.5.0) Static code checks used at Alphamoon @@ -1272,9 +1272,9 @@ This list contains 975 plugins. pyest results colection plugin :pypi:`pytest-arraydiff` - *last release*: Dec 06, 2018, + *last release*: Dec 31, 2021, *status*: 4 - Beta, - *requires*: pytest + *requires*: pytest (>=4.6) pytest plugin to help with comparing array output from tests @@ -1328,9 +1328,9 @@ This list contains 975 plugins. Meta-package containing dependencies for testing :pypi:`pytest-astropy-header` - *last release*: Dec 18, 2019, + *last release*: Dec 27, 2021, *status*: 3 - Alpha, - *requires*: pytest (>=2.8) + *requires*: pytest (>=4.6) pytest plugin to add diagnostic information to the header of the test output @@ -3337,7 +3337,7 @@ This list contains 975 plugins. Pytest plugin for filtering based on sub-packages :pypi:`pytest-find-dependencies` - *last release*: Apr 21, 2021, + *last release*: Dec 26, 2021, *status*: 4 - Beta, *requires*: pytest (>=3.5.0) @@ -3722,7 +3722,7 @@ This list contains 975 plugins. pytest helpers :pypi:`pytest-helpers-namespace` - *last release*: Apr 29, 2021, + *last release*: Dec 29, 2021, *status*: 5 - Production/Stable, *requires*: pytest (>=6.0.0) @@ -3757,7 +3757,7 @@ This list contains 975 plugins. A pytest plugin for use with homeassistant custom components. :pypi:`pytest-homeassistant-custom-component` - *last release*: Dec 24, 2021, + *last release*: Dec 30, 2021, *status*: 3 - Alpha, *requires*: pytest (==6.2.5) @@ -3862,7 +3862,7 @@ This list contains 975 plugins. pytest-httpserver is a httpserver for pytest :pypi:`pytest-httpx` - *last release*: Dec 23, 2021, + *last release*: Dec 27, 2021, *status*: 5 - Production/Stable, *requires*: pytest (==6.*) @@ -4625,7 +4625,7 @@ This list contains 975 plugins. A mock API server with configurable routes and responses available as a fixture. :pypi:`pytest-mock-generator` - *last release*: Aug 10, 2021, + *last release*: Dec 30, 2021, *status*: 5 - Production/Stable, *requires*: N/A @@ -5269,9 +5269,9 @@ This list contains 975 plugins. Pytest tool for persistent objects :pypi:`pytest-pg` - *last release*: Dec 25, 2021, + *last release*: Dec 28, 2021, *status*: 5 - Production/Stable, - *requires*: pytest + *requires*: pytest (>=6.0.0) Helps to run PostgreSQL in docker as pytest fixture @@ -5514,7 +5514,7 @@ This list contains 975 plugins. Minitest-style test colors :pypi:`pytest-print` - *last release*: Jun 17, 2021, + *last release*: Dec 28, 2021, *status*: 5 - Production/Stable, *requires*: pytest (>=6) @@ -6298,7 +6298,7 @@ This list contains 975 plugins. :pypi:`pytest-sbase` - *last release*: Dec 24, 2021, + *last release*: Dec 31, 2021, *status*: 5 - Production/Stable, *requires*: N/A @@ -6340,7 +6340,7 @@ This list contains 975 plugins. pytest plugin for Selenium :pypi:`pytest-seleniumbase` - *last release*: Dec 24, 2021, + *last release*: Dec 31, 2021, *status*: 5 - Production/Stable, *requires*: N/A @@ -6585,7 +6585,7 @@ This list contains 975 plugins. :pypi:`pytest-snowflake-bdd` - *last release*: Dec 19, 2021, + *last release*: Dec 30, 2021, *status*: 4 - Beta, *requires*: pytest (>=6.2.0) @@ -7152,7 +7152,7 @@ This list contains 975 plugins. :pypi:`pytest-tesults` - *last release*: Jul 31, 2021, + *last release*: Dec 31, 2021, *status*: 5 - Production/Stable, *requires*: pytest (>=3.5.0) @@ -7586,7 +7586,7 @@ This list contains 975 plugins. Local continuous test runner with pytest and watchdog. :pypi:`pytest-watcher` - *last release*: Sep 18, 2021, + *last release*: Dec 30, 2021, *status*: 3 - Alpha, *requires*: N/A From b6350b8b974e47ff67727044f8e965101f54f287 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 3 Jan 2022 21:08:03 +0000 Subject: [PATCH 061/176] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/asottile/pyupgrade: v2.29.1 → v2.31.0](https://github.com/asottile/pyupgrade/compare/v2.29.1...v2.31.0) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 57896c39532..70ff318dcbf 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,7 +34,7 @@ repos: - id: reorder-python-imports args: ['--application-directories=.:src', --py37-plus] - repo: https://github.com/asottile/pyupgrade - rev: v2.29.1 + rev: v2.31.0 hooks: - id: pyupgrade args: [--py37-plus] From 4038752bf38be9dcb724e028b5d604ac05f64dd5 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Wed, 8 Dec 2021 11:01:10 -0300 Subject: [PATCH 062/176] Ensure Config.inifile is available during pytest_cmdline_main Fix #9396 --- changelog/9396.bugfix.rst | 1 + src/_pytest/legacypath.py | 69 +++++++++++++++++++------------------- testing/test_config.py | 1 + testing/test_legacypath.py | 17 ++++++++++ 4 files changed, 54 insertions(+), 34 deletions(-) create mode 100644 changelog/9396.bugfix.rst diff --git a/changelog/9396.bugfix.rst b/changelog/9396.bugfix.rst new file mode 100644 index 00000000000..dcb83bbc14f --- /dev/null +++ b/changelog/9396.bugfix.rst @@ -0,0 +1 @@ +Ensure :attr:`pytest.Config.inifile` is available during the :func:`pytest_cmdline_main <_pytest.hookspec.pytest_cmdline_main>` hook (regression during ``7.0.0rc1``). diff --git a/src/_pytest/legacypath.py b/src/_pytest/legacypath.py index 4c2db941257..37e8c24220e 100644 --- a/src/_pytest/legacypath.py +++ b/src/_pytest/legacypath.py @@ -403,37 +403,17 @@ def Node_fspath_set(self: Node, value: LEGACY_PATH) -> None: self.path = Path(value) -@hookimpl -def pytest_configure(config: Config) -> None: - import pytest - - mp = pytest.MonkeyPatch() - config.add_cleanup(mp.undo) - - if config.pluginmanager.has_plugin("tmpdir"): - # Create TmpdirFactory and attach it to the config object. - # - # This is to comply with existing plugins which expect the handler to be - # available at pytest_configure time, but ideally should be moved entirely - # to the tmpdir_factory session fixture. - try: - tmp_path_factory = config._tmp_path_factory # type: ignore[attr-defined] - except AttributeError: - # tmpdir plugin is blocked. - pass - else: - _tmpdirhandler = TempdirFactory(tmp_path_factory, _ispytest=True) - mp.setattr(config, "_tmpdirhandler", _tmpdirhandler, raising=False) - - config.pluginmanager.register(LegacyTmpdirPlugin, "legacypath-tmpdir") +@hookimpl(tryfirst=True) +def pytest_load_initial_conftests(early_config: Config) -> None: + """Monkeypatch legacy path attributes in several classes, as early as possible.""" + mp = MonkeyPatch() + early_config.add_cleanup(mp.undo) # Add Cache.makedir(). - mp.setattr(pytest.Cache, "makedir", Cache_makedir, raising=False) + mp.setattr(Cache, "makedir", Cache_makedir, raising=False) # Add FixtureRequest.fspath property. - mp.setattr( - pytest.FixtureRequest, "fspath", property(FixtureRequest_fspath), raising=False - ) + mp.setattr(FixtureRequest, "fspath", property(FixtureRequest_fspath), raising=False) # Add TerminalReporter.startdir property. mp.setattr( @@ -441,22 +421,43 @@ def pytest_configure(config: Config) -> None: ) # Add Config.{invocation_dir,rootdir,inifile} properties. - mp.setattr( - pytest.Config, "invocation_dir", property(Config_invocation_dir), raising=False - ) - mp.setattr(pytest.Config, "rootdir", property(Config_rootdir), raising=False) - mp.setattr(pytest.Config, "inifile", property(Config_inifile), raising=False) + mp.setattr(Config, "invocation_dir", property(Config_invocation_dir), raising=False) + mp.setattr(Config, "rootdir", property(Config_rootdir), raising=False) + mp.setattr(Config, "inifile", property(Config_inifile), raising=False) # Add Session.startdir property. - mp.setattr(pytest.Session, "startdir", property(Session_stardir), raising=False) + mp.setattr(Session, "startdir", property(Session_stardir), raising=False) # Add pathlist configuration type. - mp.setattr(pytest.Config, "_getini_unknown_type", Config__getini_unknown_type) + mp.setattr(Config, "_getini_unknown_type", Config__getini_unknown_type) # Add Node.fspath property. mp.setattr(Node, "fspath", property(Node_fspath, Node_fspath_set), raising=False) +@hookimpl +def pytest_configure(config: Config) -> None: + """Installs the LegacyTmpdirPlugin if the ``tmpdir`` plugin is also installed.""" + if config.pluginmanager.has_plugin("tmpdir"): + mp = MonkeyPatch() + config.add_cleanup(mp.undo) + # Create TmpdirFactory and attach it to the config object. + # + # This is to comply with existing plugins which expect the handler to be + # available at pytest_configure time, but ideally should be moved entirely + # to the tmpdir_factory session fixture. + try: + tmp_path_factory = config._tmp_path_factory # type: ignore[attr-defined] + except AttributeError: + # tmpdir plugin is blocked. + pass + else: + _tmpdirhandler = TempdirFactory(tmp_path_factory, _ispytest=True) + mp.setattr(config, "_tmpdirhandler", _tmpdirhandler, raising=False) + + config.pluginmanager.register(LegacyTmpdirPlugin, "legacypath-tmpdir") + + @hookimpl def pytest_plugin_registered(plugin: object, manager: PytestPluginManager) -> None: # pytester is not loaded by default and is commonly loaded from a conftest, diff --git a/testing/test_config.py b/testing/test_config.py index 9a57b919dd9..f691d3ed5bb 100644 --- a/testing/test_config.py +++ b/testing/test_config.py @@ -1268,6 +1268,7 @@ def pytest_load_initial_conftests(self): expected = [ "_pytest.config", m.__module__, + "_pytest.legacypath", "_pytest.pythonpath", "_pytest.capture", "_pytest.warnings", diff --git a/testing/test_legacypath.py b/testing/test_legacypath.py index 1d3fdb4bd9c..fbfd88b7384 100644 --- a/testing/test_legacypath.py +++ b/testing/test_legacypath.py @@ -161,3 +161,20 @@ def test_overriden(pytestconfig): ) result = pytester.runpytest("--override-ini", "paths=foo/bar1.py foo/bar2.py", "-s") result.stdout.fnmatch_lines(["user_path:bar1.py", "user_path:bar2.py"]) + + +def test_inifile_from_cmdline_main_hook(pytester: pytest.Pytester) -> None: + """Ensure Config.inifile is available during pytest_cmdline_main (#9396).""" + p = pytester.makeini( + """ + [pytest] + """ + ) + pytester.makeconftest( + """ + def pytest_cmdline_main(config): + print("pytest_cmdline_main inifile =", config.inifile) + """ + ) + result = pytester.runpytest_subprocess("-s") + result.stdout.fnmatch_lines(f"*pytest_cmdline_main inifile = {p}") From 696f955ff8c3345de5090e0aada6e3223f67969f Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Wed, 8 Dec 2021 11:49:04 -0300 Subject: [PATCH 063/176] Split wrappers and non-wrappers in test_load_initial_conftest_last_ordering Seems better to test which one is which explicitly. --- testing/test_config.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/testing/test_config.py b/testing/test_config.py index f691d3ed5bb..c8e21a8478a 100644 --- a/testing/test_config.py +++ b/testing/test_config.py @@ -1264,16 +1264,16 @@ def pytest_load_initial_conftests(self): m = My() pm.register(m) hc = pm.hook.pytest_load_initial_conftests - values = hc._nonwrappers + hc._wrappers - expected = [ + assert [x.function.__module__ for x in hc._nonwrappers] == [ "_pytest.config", m.__module__, "_pytest.legacypath", "_pytest.pythonpath", + ] + assert [x.function.__module__ for x in hc._wrappers] == [ "_pytest.capture", "_pytest.warnings", ] - assert [x.function.__module__ for x in values] == expected def test_get_plugin_specs_as_list() -> None: From 71baf24b6d41da6704433ca9909b5e6d954564b9 Mon Sep 17 00:00:00 2001 From: Dan Alvizu Date: Tue, 4 Jan 2022 06:55:01 -0700 Subject: [PATCH 064/176] Doc update: clarify -W syntax (#9464) Co-authored-by: Hugo van Kemenade Co-authored-by: Bruno Oliveira --- doc/en/how-to/capture-warnings.rst | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/doc/en/how-to/capture-warnings.rst b/doc/en/how-to/capture-warnings.rst index 7e877b4d3da..efdf10e3394 100644 --- a/doc/en/how-to/capture-warnings.rst +++ b/doc/en/how-to/capture-warnings.rst @@ -42,8 +42,18 @@ Running pytest now produces this output: -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ======================= 1 passed, 1 warning in 0.12s ======================= -The ``-W`` flag can be passed to control which warnings will be displayed or even turn -them into errors: +Controlling warnings +-------------------- + +Similar to Python's `warning filter`_ and :option:`-W option ` flag, pytest provides +its own ``-W`` flag to control which warnings are ignored, displayed, or turned into +errors. See the `warning filter`_ documentation for more +advanced use-cases. + +.. _`warning filter`: https://docs.python.org/3/library/warnings.html#warning-filter + +This code sample shows how to treat any ``UserWarning`` category class of warning +as an error: .. code-block:: pytest @@ -96,9 +106,6 @@ all other warnings into errors. When a warning matches more than one option in the list, the action for the last matching option is performed. -Both ``-W`` command-line option and ``filterwarnings`` ini option are based on Python's own -:option:`-W option ` and :func:`warnings.simplefilter`, so please refer to those sections in the Python -documentation for other examples and advanced usage. .. _`filterwarnings`: From b19374bc193fddfe2b0c2da21e4e3a96846f15ea Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Fri, 7 Jan 2022 12:15:34 +0200 Subject: [PATCH 065/176] config: fix incorrect cache hit check in _getconftestmodules This made the cache not work as intended, causing a major slowdown. See #9478 for discussion and context. Authored-by: Anthony Sottile --- src/_pytest/config/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_pytest/config/__init__.py b/src/_pytest/config/__init__.py index dee3d4974fb..174d80a01ca 100644 --- a/src/_pytest/config/__init__.py +++ b/src/_pytest/config/__init__.py @@ -538,7 +538,7 @@ def _getconftestmodules( # Optimization: avoid repeated searches in the same directory. # Assumes always called with same importmode and rootpath. existing_clist = self._dirpath2confmods.get(directory) - if existing_clist: + if existing_clist is not None: return existing_clist # XXX these days we may rather want to use config.rootpath From 5f23157b39143f25560ee0dfa52a2df49a7cb6c3 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Sat, 8 Jan 2022 12:36:43 +0200 Subject: [PATCH 066/176] config: remove always truthy condition --- src/_pytest/config/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_pytest/config/__init__.py b/src/_pytest/config/__init__.py index 174d80a01ca..5ec4099140e 100644 --- a/src/_pytest/config/__init__.py +++ b/src/_pytest/config/__init__.py @@ -602,7 +602,7 @@ def _importconftest( dirpath = conftestpath.parent if dirpath in self._dirpath2confmods: for path, mods in self._dirpath2confmods.items(): - if path and dirpath in path.parents or path == dirpath: + if dirpath in path.parents or path == dirpath: assert mod not in mods mods.append(mod) self.trace(f"loading conftestmodule {mod!r}") From 1c7644cc7a796dda13c8ee56c3d65d99bd35a39b Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Sat, 8 Jan 2022 13:50:52 +0200 Subject: [PATCH 067/176] config: some comments --- src/_pytest/config/__init__.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/_pytest/config/__init__.py b/src/_pytest/config/__init__.py index 5ec4099140e..79b2ad59862 100644 --- a/src/_pytest/config/__init__.py +++ b/src/_pytest/config/__init__.py @@ -345,14 +345,21 @@ def __init__(self) -> None: import _pytest.assertion super().__init__("pytest") - # The objects are module objects, only used generically. - self._conftest_plugins: Set[types.ModuleType] = set() - # State related to local conftest plugins. + # -- State related to local conftest plugins. + # All loaded conftest modules. + self._conftest_plugins: Set[types.ModuleType] = set() + # All conftest modules applicable for a directory. + # This includes the directory's own conftest modules as well + # as those of its parent directories. self._dirpath2confmods: Dict[Path, List[types.ModuleType]] = {} + # The conftest module of a conftest path. self._conftestpath2mod: Dict[Path, types.ModuleType] = {} + # Cutoff directory above which conftests are no longer discovered. self._confcutdir: Optional[Path] = None + # If set, conftest loading is skipped. self._noconftest = False + self._duplicatepaths: Set[Path] = set() # plugins that were explicitly skipped with pytest.skip From 0c98f1923101e5905c54ba07650a043fca374f4b Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Sat, 8 Jan 2022 22:41:14 +0200 Subject: [PATCH 068/176] config: make confcutdir check a bit more clear & correct I think this named function makes the code a bit easier to understand. Also change the check to explicitly check for "is a sub-path of" instead of the previous check which only worked assuming that path is within confcutdir or a direct parent of it. --- src/_pytest/config/__init__.py | 25 ++++++++++++++++++------- src/_pytest/main.py | 3 +-- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/_pytest/config/__init__.py b/src/_pytest/config/__init__.py index 79b2ad59862..a30ee6cee00 100644 --- a/src/_pytest/config/__init__.py +++ b/src/_pytest/config/__init__.py @@ -521,6 +521,19 @@ def _set_initial_conftests( if not foundanchor: self._try_load_conftest(current, namespace.importmode, rootpath) + def _is_in_confcutdir(self, path: Path) -> bool: + """Whether a path is within the confcutdir. + + When false, should not load conftest. + """ + if self._confcutdir is None: + return True + try: + path.relative_to(self._confcutdir) + except ValueError: + return False + return True + def _try_load_conftest( self, anchor: Path, importmode: Union[str, ImportMode], rootpath: Path ) -> None: @@ -552,14 +565,12 @@ def _getconftestmodules( # and allow users to opt into looking into the rootdir parent # directories instead of requiring to specify confcutdir. clist = [] - confcutdir_parents = self._confcutdir.parents if self._confcutdir else [] for parent in reversed((directory, *directory.parents)): - if parent in confcutdir_parents: - continue - conftestpath = parent / "conftest.py" - if conftestpath.is_file(): - mod = self._importconftest(conftestpath, importmode, rootpath) - clist.append(mod) + if self._is_in_confcutdir(parent): + conftestpath = parent / "conftest.py" + if conftestpath.is_file(): + mod = self._importconftest(conftestpath, importmode, rootpath) + clist.append(mod) self._dirpath2confmods[directory] = clist return clist diff --git a/src/_pytest/main.py b/src/_pytest/main.py index 952c703509d..afe613fd0d9 100644 --- a/src/_pytest/main.py +++ b/src/_pytest/main.py @@ -689,9 +689,8 @@ def collect(self) -> Iterator[Union[nodes.Item, nodes.Collector]]: # No point in finding packages when collecting doctests. if not self.config.getoption("doctestmodules", False): pm = self.config.pluginmanager - confcutdir = pm._confcutdir for parent in (argpath, *argpath.parents): - if confcutdir and parent in confcutdir.parents: + if not pm._is_in_confcutdir(argpath): break if parent.is_dir(): From ed83efaf4bd802a0c96d8be0c841d1d508fbffd5 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Sun, 9 Jan 2022 00:12:33 +0200 Subject: [PATCH 069/176] testing/test_monkeypatch: fix some patches leaking into pytest code The tests patch `os.path.abspath` which can break some pytest internal code since the patching is not undone immediately. --- testing/test_monkeypatch.py | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/testing/test_monkeypatch.py b/testing/test_monkeypatch.py index 95521818021..49635f95e79 100644 --- a/testing/test_monkeypatch.py +++ b/testing/test_monkeypatch.py @@ -50,21 +50,24 @@ class A: class TestSetattrWithImportPath: def test_string_expression(self, monkeypatch: MonkeyPatch) -> None: - monkeypatch.setattr("os.path.abspath", lambda x: "hello2") - assert os.path.abspath("123") == "hello2" + with monkeypatch.context() as mp: + mp.setattr("os.path.abspath", lambda x: "hello2") + assert os.path.abspath("123") == "hello2" def test_string_expression_class(self, monkeypatch: MonkeyPatch) -> None: - monkeypatch.setattr("_pytest.config.Config", 42) - import _pytest + with monkeypatch.context() as mp: + mp.setattr("_pytest.config.Config", 42) + import _pytest - assert _pytest.config.Config == 42 # type: ignore + assert _pytest.config.Config == 42 # type: ignore def test_unicode_string(self, monkeypatch: MonkeyPatch) -> None: - monkeypatch.setattr("_pytest.config.Config", 42) - import _pytest + with monkeypatch.context() as mp: + mp.setattr("_pytest.config.Config", 42) + import _pytest - assert _pytest.config.Config == 42 # type: ignore - monkeypatch.delattr("_pytest.config.Config") + assert _pytest.config.Config == 42 # type: ignore + mp.delattr("_pytest.config.Config") def test_wrong_target(self, monkeypatch: MonkeyPatch) -> None: with pytest.raises(TypeError): @@ -80,14 +83,16 @@ def test_unknown_attr(self, monkeypatch: MonkeyPatch) -> None: def test_unknown_attr_non_raising(self, monkeypatch: MonkeyPatch) -> None: # https://github.com/pytest-dev/pytest/issues/746 - monkeypatch.setattr("os.path.qweqwe", 42, raising=False) - assert os.path.qweqwe == 42 # type: ignore + with monkeypatch.context() as mp: + mp.setattr("os.path.qweqwe", 42, raising=False) + assert os.path.qweqwe == 42 # type: ignore def test_delattr(self, monkeypatch: MonkeyPatch) -> None: - monkeypatch.delattr("os.path.abspath") - assert not hasattr(os.path, "abspath") - monkeypatch.undo() - assert os.path.abspath + with monkeypatch.context() as mp: + mp.delattr("os.path.abspath") + assert not hasattr(os.path, "abspath") + mp.undo() + assert os.path.abspath def test_delattr() -> None: From d98b695fecd8761ba600cc5e30fb239be5221253 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Sun, 9 Jan 2022 00:28:44 +0200 Subject: [PATCH 070/176] config: return Sequence instead of List from _getconftestmodules Nothing should mutate the internal data structure here. --- src/_pytest/config/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_pytest/config/__init__.py b/src/_pytest/config/__init__.py index a30ee6cee00..a6a22d2b913 100644 --- a/src/_pytest/config/__init__.py +++ b/src/_pytest/config/__init__.py @@ -546,7 +546,7 @@ def _try_load_conftest( def _getconftestmodules( self, path: Path, importmode: Union[str, ImportMode], rootpath: Path - ) -> List[types.ModuleType]: + ) -> Sequence[types.ModuleType]: if self._noconftest: return [] From f0dab8ba8dd6e3f197e577125d392adfcc8d284b Mon Sep 17 00:00:00 2001 From: pytest bot Date: Sun, 9 Jan 2022 00:12:59 +0000 Subject: [PATCH 071/176] [automated] Update plugin list --- doc/en/reference/plugin_list.rst | 154 +++++++++++++++++++------------ 1 file changed, 97 insertions(+), 57 deletions(-) diff --git a/doc/en/reference/plugin_list.rst b/doc/en/reference/plugin_list.rst index 2419abb2e5a..3927fe8dc1b 100644 --- a/doc/en/reference/plugin_list.rst +++ b/doc/en/reference/plugin_list.rst @@ -11,14 +11,14 @@ automatically. Packages classified as inactive are excluded. creating a PDF, because otherwise the table gets far too wide for the page. -This list contains 975 plugins. +This list contains 980 plugins. .. only:: not latex =============================================== ======================================================================================================================================================================== ============== ===================== ================================================ name summary last release status requires =============================================== ======================================================================================================================================================================== ============== ===================== ================================================ - :pypi:`pytest-accept` A pytest-plugin for updating doctest outputs Dec 22, 2021 N/A pytest (>=6,<7) + :pypi:`pytest-accept` A pytest-plugin for updating doctest outputs Jan 07, 2022 N/A pytest (>=6,<8) :pypi:`pytest-adaptavist` pytest plugin for generating test execution results within Jira Test Management (tm4j) Nov 30, 2021 N/A pytest (>=5.4.0) :pypi:`pytest-addons-test` 用于测试pytest的插件 Aug 02, 2021 N/A pytest (>=6.2.4,<7.0.0) :pypi:`pytest-adf` Pytest plugin for writing Azure Data Factory integration tests May 10, 2021 4 - Beta pytest (>=3.5.0) @@ -68,7 +68,7 @@ This list contains 975 plugins. :pypi:`pytest-astropy-header` pytest plugin to add diagnostic information to the header of the test output Dec 27, 2021 3 - Alpha pytest (>=4.6) :pypi:`pytest-ast-transformer` May 04, 2019 3 - Alpha pytest :pypi:`pytest-asyncio` Pytest support for asyncio. Oct 15, 2021 4 - Beta pytest (>=5.4.0) - :pypi:`pytest-asyncio-cooperative` Run all your asynchronous tests cooperatively. Oct 12, 2021 4 - Beta N/A + :pypi:`pytest-asyncio-cooperative` Run all your asynchronous tests cooperatively. Jan 03, 2022 N/A N/A :pypi:`pytest-asyncio-network-simulator` pytest-asyncio-network-simulator: Plugin for pytest for simulator the network in tests Jul 31, 2018 3 - Alpha pytest (<3.7.0,>=3.3.2) :pypi:`pytest-async-mongodb` pytest plugin for async MongoDB Oct 18, 2017 5 - Production/Stable pytest (>=2.5.2) :pypi:`pytest-async-sqlalchemy` Database testing fixtures using the SQLAlchemy asyncio API Oct 07, 2021 4 - Beta pytest (>=6.0.0) @@ -129,7 +129,7 @@ This list contains 975 plugins. :pypi:`pytest-caprng` A plugin that replays pRNG state on failure. May 02, 2018 4 - Beta N/A :pypi:`pytest-capture-deprecatedwarnings` pytest plugin to capture all deprecatedwarnings and put them in one file Apr 30, 2019 N/A N/A :pypi:`pytest-capturelogs` A sample Python project Sep 11, 2021 3 - Alpha N/A - :pypi:`pytest-cases` Separate test code from test cases in pytest. Nov 08, 2021 5 - Production/Stable N/A + :pypi:`pytest-cases` Separate test code from test cases in pytest. Jan 07, 2022 5 - Production/Stable N/A :pypi:`pytest-cassandra` Cassandra CCM Test Fixtures for pytest Nov 04, 2017 1 - Planning N/A :pypi:`pytest-catchlog` py.test plugin to catch log messages. This is a fork of pytest-capturelog. Jan 24, 2016 4 - Beta pytest (>=2.6) :pypi:`pytest-catch-server` Pytest plugin with server for catching HTTP requests. Dec 12, 2019 5 - Production/Stable N/A @@ -165,7 +165,7 @@ This list contains 975 plugins. :pypi:`pytest-concurrent` Concurrently execute test cases with multithread, multiprocess and gevent Jan 12, 2019 4 - Beta pytest (>=3.1.1) :pypi:`pytest-config` Base configurations and utilities for developing your Python project test suite with pytest. Nov 07, 2014 5 - Production/Stable N/A :pypi:`pytest-confluence-report` Package stands for pytest plugin to upload results into Confluence page. Nov 06, 2020 N/A N/A - :pypi:`pytest-console-scripts` Pytest plugin for testing console scripts Sep 28, 2021 4 - Beta N/A + :pypi:`pytest-console-scripts` Pytest plugin for testing console scripts Jan 06, 2022 4 - Beta N/A :pypi:`pytest-consul` pytest plugin with fixtures for testing consul aware apps Nov 24, 2018 3 - Alpha pytest :pypi:`pytest-container` Pytest fixtures for writing container based tests Nov 19, 2021 3 - Alpha pytest (>=3.10) :pypi:`pytest-contextfixture` Define pytest fixtures as context managers. Mar 12, 2013 4 - Beta N/A @@ -291,13 +291,14 @@ This list contains 975 plugins. :pypi:`pytest-elements` Tool to help automate user interfaces Jan 13, 2021 N/A pytest (>=5.4,<6.0) :pypi:`pytest-elk-reporter` A simple plugin to use with pytest Jan 24, 2021 4 - Beta pytest (>=3.5.0) :pypi:`pytest-email` Send execution result email Jul 08, 2020 N/A pytest - :pypi:`pytest-embedded` pytest embedded plugin Nov 29, 2021 N/A pytest (>=6.2.0) - :pypi:`pytest-embedded-idf` pytest embedded plugin for esp-idf project Nov 29, 2021 N/A N/A - :pypi:`pytest-embedded-jtag` pytest embedded plugin for testing with jtag Nov 29, 2021 N/A N/A - :pypi:`pytest-embedded-qemu` pytest embedded plugin for qemu, not target chip Nov 29, 2021 N/A N/A + :pypi:`pytest-embedded` pytest embedded plugin Jan 06, 2022 N/A pytest (>=6.2.0) + :pypi:`pytest-embedded-arduino` pytest embedded plugin for Arduino projects Jan 06, 2022 N/A N/A + :pypi:`pytest-embedded-idf` pytest embedded plugin for esp-idf project Jan 06, 2022 N/A N/A + :pypi:`pytest-embedded-jtag` pytest embedded plugin for testing with jtag Jan 06, 2022 N/A N/A + :pypi:`pytest-embedded-qemu` pytest embedded plugin for qemu, not target chip Jan 06, 2022 N/A N/A :pypi:`pytest-embedded-qemu-idf` pytest embedded plugin for esp-idf project by qemu, not target chip Jun 29, 2021 N/A N/A - :pypi:`pytest-embedded-serial` pytest embedded plugin for testing serial ports Nov 29, 2021 N/A N/A - :pypi:`pytest-embedded-serial-esp` pytest embedded plugin for testing espressif boards via serial ports Nov 29, 2021 N/A N/A + :pypi:`pytest-embedded-serial` pytest embedded plugin for testing serial ports Jan 06, 2022 N/A N/A + :pypi:`pytest-embedded-serial-esp` pytest embedded plugin for testing espressif boards via serial ports Jan 06, 2022 N/A N/A :pypi:`pytest-emoji` A pytest plugin that adds emojis to your test result report Feb 19, 2019 4 - Beta pytest (>=4.2.1) :pypi:`pytest-emoji-output` Pytest plugin to represent test output with emoji support Oct 10, 2021 4 - Beta pytest (==6.0.1) :pypi:`pytest-enabler` Enable installed pytest plugins Nov 08, 2021 5 - Production/Stable pytest (>=6) ; extra == 'testing' @@ -364,6 +365,7 @@ This list contains 975 plugins. :pypi:`pytest-fixture-typecheck` A pytest plugin to assert type annotations at runtime. Aug 24, 2021 N/A pytest :pypi:`pytest-flake8` pytest plugin to check FLAKE8 requirements Dec 16, 2020 4 - Beta pytest (>=3.5) :pypi:`pytest-flake8-path` A pytest fixture for testing flake8 plugins. Aug 11, 2021 5 - Production/Stable pytest + :pypi:`pytest-flake8-v2` pytest plugin to check FLAKE8 requirements Jan 04, 2022 4 - Beta pytest (>=3.5) :pypi:`pytest-flakefinder` Runs tests multiple times to expose flakiness. Jul 28, 2020 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 @@ -404,7 +406,7 @@ This list contains 975 plugins. :pypi:`pytest-hammertime` Display "🔨 " instead of "." for passed pytest tests. Jul 28, 2018 N/A pytest :pypi:`pytest-harvest` Store data created during your pytest tests execution, and retrieve it at the end of the session, e.g. for applicative benchmarking purposes. Apr 01, 2021 5 - Production/Stable N/A :pypi:`pytest-helm-chart` A plugin to provide different types and configs of Kubernetes clusters that can be used for testing. Jun 15, 2020 4 - Beta pytest (>=5.4.2,<6.0.0) - :pypi:`pytest-helm-charts` A plugin to provide different types and configs of Kubernetes clusters that can be used for testing. Oct 26, 2021 4 - Beta pytest (>=6.1.2,<7.0.0) + :pypi:`pytest-helm-charts` A plugin to provide different types and configs of Kubernetes clusters that can be used for testing. Jan 04, 2022 4 - Beta pytest (>=6.1.2,<7.0.0) :pypi:`pytest-helper` Functions to help in using the pytest testing framework May 31, 2019 5 - Production/Stable N/A :pypi:`pytest-helpers` pytest helpers May 17, 2020 N/A pytest :pypi:`pytest-helpers-namespace` Pytest Helpers Namespace Plugin Dec 29, 2021 5 - Production/Stable pytest (>=6.0.0) @@ -412,7 +414,8 @@ This list contains 975 plugins. :pypi:`pytest-historic` Custom report to display pytest historical execution records Apr 08, 2020 N/A pytest :pypi:`pytest-historic-hook` Custom listener to store execution results into MYSQL DB, which is used for pytest-historic report Apr 08, 2020 N/A pytest :pypi:`pytest-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 30, 2021 3 - Alpha pytest (==6.2.5) + :pypi:`pytest-homeassistant-custom-component` Experimental package to automatically extract test plugins for Home Assistant custom components Jan 06, 2022 3 - Alpha pytest (==6.2.5) + :pypi:`pytest-honey` A simple plugin to use with pytest Jan 07, 2022 4 - Beta pytest (>=3.5.0) :pypi:`pytest-honors` Report on tests that honor constraints, and guard against regressions Mar 06, 2020 4 - Beta N/A :pypi:`pytest-hoverfly` Simplify working with Hoverfly from pytest Jul 12, 2021 N/A pytest (>=5.0) :pypi:`pytest-hoverfly-wrapper` Integrates the Hoverfly HTTP proxy into Pytest Aug 29, 2021 4 - Beta N/A @@ -435,7 +438,7 @@ This list contains 975 plugins. :pypi:`pytest-ibutsu` A plugin to sent pytest results to an Ibutsu server Dec 15, 2021 4 - Beta pytest :pypi:`pytest-icdiff` use icdiff for better error messages in pytest assertions Apr 08, 2020 4 - Beta N/A :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-idempotent` Pytest plugin for testing function idempotence. Dec 24, 2021 N/A N/A + :pypi:`pytest-idempotent` Pytest plugin for testing function idempotence. Jan 08, 2022 N/A N/A :pypi:`pytest-ignore-flaky` ignore failures from flaky tests (pytest plugin) Apr 23, 2021 5 - Production/Stable N/A :pypi:`pytest-image-diff` Jul 28, 2021 3 - Alpha pytest :pypi:`pytest-incremental` an incremental test runner (pytest plugin) Apr 24, 2021 5 - Production/Stable N/A @@ -525,7 +528,7 @@ This list contains 975 plugins. :pypi:`pytest-memprof` Estimates memory consumption of test functions Mar 29, 2019 4 - Beta N/A :pypi:`pytest-menu` A pytest plugin for console based interactive test selection just after the collection phase Oct 04, 2017 3 - Alpha pytest (>=2.4.2) :pypi:`pytest-mercurial` pytest plugin to write integration tests for projects using Mercurial Python internals Nov 21, 2020 1 - Planning N/A - :pypi:`pytest-message` Pytest plugin for sending report message of marked tests execution Nov 04, 2021 N/A pytest (>=6.2.5) + :pypi:`pytest-message` Pytest plugin for sending report message of marked tests execution Jan 05, 2022 N/A pytest (>=6.2.5) :pypi:`pytest-messenger` Pytest to Slack reporting plugin Dec 16, 2020 5 - Production/Stable N/A :pypi:`pytest-metadata` pytest plugin for test session metadata Nov 27, 2020 5 - Production/Stable pytest (>=2.9.0) :pypi:`pytest-metrics` Custom metrics report for pytest Apr 04, 2020 N/A pytest @@ -536,11 +539,11 @@ This list contains 975 plugins. :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 May 06, 2021 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 Dec 30, 2021 5 - Production/Stable N/A + :pypi:`pytest-mock-generator` A pytest fixture wrapper for https://pypi.org/project/mock-generator Jan 05, 2022 5 - Production/Stable N/A :pypi:`pytest-mock-helper` Help you mock HTTP call and generate mock code Jan 24, 2018 N/A pytest :pypi:`pytest-mockito` Base fixtures for mockito Jul 11, 2018 4 - Beta N/A :pypi:`pytest-mockredis` An in-memory mock of a Redis server that runs in a separate thread. This is to be used for unit-tests that require a Redis database. Jan 02, 2018 2 - Pre-Alpha N/A - :pypi:`pytest-mock-resources` A pytest plugin for easily instantiating reproducible mock resources. Dec 22, 2021 N/A pytest (>=1.0) + :pypi:`pytest-mock-resources` A pytest plugin for easily instantiating reproducible mock resources. Jan 07, 2022 N/A pytest (>=1.0) :pypi:`pytest-mock-server` Mock server plugin for pytest Apr 06, 2020 4 - Beta N/A :pypi:`pytest-mockservers` A set of fixtures to test your requests to HTTP/UDP servers Mar 31, 2020 N/A pytest (>=4.3.0) :pypi:`pytest-modifyjunit` Utility for adding additional properties to junit xml for IDM QE Jan 10, 2019 N/A N/A @@ -554,7 +557,7 @@ This list contains 975 plugins. :pypi:`pytest-moto` Fixtures for integration tests of AWS services,uses moto mocking library. Aug 28, 2015 1 - Planning N/A :pypi:`pytest-motor` A pytest plugin for motor, the non-blocking MongoDB driver. Jul 21, 2021 3 - Alpha pytest :pypi:`pytest-mp` A test batcher for multiprocessed Pytest runs May 23, 2018 4 - Beta pytest - :pypi:`pytest-mpi` pytest plugin to collect information from tests Mar 14, 2021 3 - Alpha pytest + :pypi:`pytest-mpi` pytest plugin to collect information from tests Jan 08, 2022 3 - Alpha pytest :pypi:`pytest-mpl` pytest plugin to help with testing figures output from Matplotlib Jul 02, 2021 4 - Beta pytest :pypi:`pytest-mproc` low-startup-overhead, scalable, distributed-testing pytest plugin Mar 07, 2021 4 - Beta pytest :pypi:`pytest-multi-check` Pytest-плагин, реализует возможность мульти проверок и мягких проверок Jun 03, 2021 N/A pytest @@ -569,7 +572,7 @@ This list contains 975 plugins. :pypi:`pytest-mypy-testing` Pytest plugin to check mypy output. Jun 13, 2021 N/A pytest :pypi:`pytest-mysql` MySQL process and client fixtures for pytest Nov 22, 2021 5 - Production/Stable 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. Apr 23, 2019 3 - Alpha pytest (>=3.7.2) + :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-network` A simple plugin to disable network on socket level. May 07, 2020 N/A N/A :pypi:`pytest-never-sleep` pytest plugin helps to avoid adding tests without mock \`time.sleep\` May 05, 2021 3 - Alpha pytest (>=3.5.1) :pypi:`pytest-nginx` nginx fixture for pytest Aug 12, 2017 5 - Production/Stable N/A @@ -625,10 +628,10 @@ This list contains 975 plugins. :pypi:`pytest-pep257` py.test plugin for pep257 Jul 09, 2016 N/A N/A :pypi:`pytest-pep8` pytest plugin to check PEP8 requirements Apr 27, 2014 N/A N/A :pypi:`pytest-percent` Change the exit code of pytest test sessions when a required percent of tests pass. May 21, 2020 N/A pytest (>=5.2.0) - :pypi:`pytest-perf` pytest-perf Jun 27, 2021 5 - Production/Stable pytest (>=4.6) ; extra == 'testing' + :pypi:`pytest-perf` pytest-perf Jan 08, 2022 5 - Production/Stable pytest (>=6) ; extra == 'testing' :pypi:`pytest-performance` A simple plugin to ensure the execution of critical sections of code has not been impacted Sep 11, 2020 5 - Production/Stable pytest (>=3.7.0) :pypi:`pytest-persistence` Pytest tool for persistent objects Dec 07, 2021 N/A N/A - :pypi:`pytest-pg` Helps to run PostgreSQL in docker as pytest fixture Dec 28, 2021 5 - Production/Stable pytest (>=6.0.0) + :pypi:`pytest-pg` Helps to run PostgreSQL in docker as pytest fixture Jan 08, 2022 5 - Production/Stable pytest (>=6.0.0) :pypi:`pytest-pgsql` Pytest plugins and helpers for tests using a Postgres database. May 13, 2020 5 - Production/Stable pytest (>=3.0.0) :pypi:`pytest-phmdoctest` pytest plugin to test Python examples in Markdown using phmdoctest. Nov 10, 2021 4 - Beta pytest (>=6.2) ; extra == 'test' :pypi:`pytest-picked` Run the tests related to the changed files Dec 23, 2020 N/A pytest (>=3.5.0) @@ -711,7 +714,7 @@ This list contains 975 plugins. :pypi:`pytest-random-num` Randomise the order in which pytest tests are run with some control over the randomness Oct 19, 2020 5 - Production/Stable N/A :pypi:`pytest-random-order` Randomise the order in which pytest tests are run with some control over the randomness Nov 30, 2018 5 - Production/Stable pytest (>=3.0.0) :pypi:`pytest-readme` Test your README.md file Dec 28, 2014 5 - Production/Stable N/A - :pypi:`pytest-reana` Pytest fixtures for REANA. Nov 22, 2021 3 - Alpha N/A + :pypi:`pytest-reana` Pytest fixtures for REANA. Jan 05, 2022 3 - Alpha N/A :pypi:`pytest-recording` A pytest plugin that allows you recording of network interactions via VCR.py Jul 08, 2021 4 - Beta pytest (>=3.5.0) :pypi:`pytest-recordings` Provides pytest plugins for reporting request/response traffic, screenshots, and more to ReportPortal Aug 13, 2020 N/A N/A :pypi:`pytest-redis` Redis fixtures and fixture factories for Pytest. Dec 07, 2021 5 - Production/Stable pytest @@ -719,7 +722,7 @@ This list contains 975 plugins. :pypi:`pytest-redmine` Pytest plugin for redmine Mar 19, 2018 1 - Planning N/A :pypi:`pytest-ref` A plugin to store reference files to ease regression testing Nov 23, 2019 4 - Beta pytest (>=3.5.0) :pypi:`pytest-reference-formatter` Conveniently run pytest with a dot-formatted test reference. Oct 01, 2019 4 - Beta N/A - :pypi:`pytest-regressions` Easy to use fixtures to write regression tests. Jan 27, 2021 5 - Production/Stable pytest (>=3.5.0) + :pypi:`pytest-regressions` Easy to use fixtures to write regression tests. Jan 04, 2022 5 - Production/Stable pytest (>=3.5.0) :pypi:`pytest-regtest` pytest plugin for regression tests Jun 03, 2021 N/A N/A :pypi:`pytest-relative-order` a pytest plugin that sorts tests using "before" and "after" markers May 17, 2021 4 - Beta N/A :pypi:`pytest-relaxed` Relaxed test discovery/organization for pytest Jun 14, 2019 5 - Production/Stable pytest (<5,>=3) @@ -775,13 +778,13 @@ This list contains 975 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. Dec 31, 2021 5 - Production/Stable N/A + :pypi:`pytest-sbase` A complete web automation framework for end-to-end testing. Jan 05, 2022 5 - Production/Stable N/A :pypi:`pytest-scenario` pytest plugin for test scenarios Feb 06, 2017 3 - Alpha N/A :pypi:`pytest-schema` 👍 Validate return values against a schema-like object in testing Aug 31, 2020 5 - Production/Stable pytest (>=3.5.0) :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 Sep 19, 2020 5 - Production/Stable pytest (>=5.0.0) - :pypi:`pytest-seleniumbase` A complete web automation framework for end-to-end testing. Dec 31, 2021 5 - Production/Stable N/A + :pypi:`pytest-seleniumbase` A complete web automation framework for end-to-end testing. Jan 05, 2022 5 - Production/Stable N/A :pypi:`pytest-selenium-enhancer` pytest plugin for Selenium Dec 16, 2021 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-send-email` Send pytest execution result email Dec 04, 2019 N/A N/A @@ -816,7 +819,7 @@ This list contains 975 plugins. :pypi:`pytest-snapci` py.test plugin for Snap-CI Nov 12, 2015 N/A N/A :pypi:`pytest-snapshot` A plugin for snapshot testing with pytest. Dec 02, 2021 4 - Beta pytest (>=3.0.0) :pypi:`pytest-snmpserver` May 12, 2021 N/A N/A - :pypi:`pytest-snowflake-bdd` Setup test data and run tests on snowflake in BDD style! Dec 30, 2021 4 - Beta pytest (>=6.2.0) + :pypi:`pytest-snowflake-bdd` Setup test data and run tests on snowflake in BDD style! Jan 05, 2022 4 - Beta pytest (>=6.2.0) :pypi:`pytest-socket` Pytest Plugin to disable socket calls during tests Dec 23, 2021 4 - Beta pytest (>=3.6.3) :pypi:`pytest-soft-assertions` May 05, 2020 3 - Alpha pytest :pypi:`pytest-solr` Solr process and client fixtures for py.test. May 11, 2020 3 - Alpha pytest (>=3.0.0) @@ -863,7 +866,8 @@ This list contains 975 plugins. :pypi:`pytest-super-check` Pytest plugin to check your TestCase classes call super in setUp, tearDown, etc. Aug 12, 2021 5 - Production/Stable pytest :pypi:`pytest-svn` SVN repository fixture for py.test May 28, 2019 5 - Production/Stable pytest :pypi:`pytest-symbols` pytest-symbols is a pytest plugin that adds support for passing test environment symbols into pytest tests. Nov 20, 2017 3 - Alpha N/A - :pypi:`pytest-takeltest` Fixtures for ansible, testinfra and molecule Oct 13, 2021 N/A N/A + :pypi:`pytest-system-statistics` Pytest plugin to track and report system usage statistics Jan 05, 2022 4 - Beta pytest (>=6.0.0) + :pypi:`pytest-takeltest` Fixtures for ansible, testinfra and molecule Jan 04, 2022 N/A N/A :pypi:`pytest-talisker` Nov 28, 2021 N/A N/A :pypi:`pytest-tap` Test Anything Protocol (TAP) reporting plugin for pytest Oct 27, 2021 5 - Production/Stable pytest (>=3.0) :pypi:`pytest-tape` easy assertion with expected results saved to yaml files Mar 17, 2021 4 - Beta N/A @@ -883,6 +887,7 @@ This list contains 975 plugins. :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 Oct 22, 2021 4 - Beta N/A :pypi:`pytest-testobject` Plugin to use TestObject Suites with Pytest Sep 24, 2019 4 - Beta pytest (>=3.1.1) + :pypi:`pytest-testpluggy` set your encoding Jan 07, 2022 N/A pytest :pypi:`pytest-testrail` pytest plugin for creating TestRail runs and adding results Aug 27, 2020 N/A pytest (>=3.6) :pypi:`pytest-testrail2` A small example package Nov 17, 2020 N/A pytest (>=5) :pypi:`pytest-testrail-api` Плагин Pytest, для интеграции с TestRail Dec 17, 2021 N/A pytest (>=5.5) @@ -999,9 +1004,9 @@ This list contains 975 plugins. :pypi:`pytest-accept` - *last release*: Dec 22, 2021, + *last release*: Jan 07, 2022, *status*: N/A, - *requires*: pytest (>=6,<7) + *requires*: pytest (>=6,<8) A pytest-plugin for updating doctest outputs @@ -1349,8 +1354,8 @@ This list contains 975 plugins. Pytest support for asyncio. :pypi:`pytest-asyncio-cooperative` - *last release*: Oct 12, 2021, - *status*: 4 - Beta, + *last release*: Jan 03, 2022, + *status*: N/A, *requires*: N/A Run all your asynchronous tests cooperatively. @@ -1776,7 +1781,7 @@ This list contains 975 plugins. A sample Python project :pypi:`pytest-cases` - *last release*: Nov 08, 2021, + *last release*: Jan 07, 2022, *status*: 5 - Production/Stable, *requires*: N/A @@ -2028,7 +2033,7 @@ This list contains 975 plugins. Package stands for pytest plugin to upload results into Confluence page. :pypi:`pytest-console-scripts` - *last release*: Sep 28, 2021, + *last release*: Jan 06, 2022, *status*: 4 - Beta, *requires*: N/A @@ -2910,28 +2915,35 @@ This list contains 975 plugins. Send execution result email :pypi:`pytest-embedded` - *last release*: Nov 29, 2021, + *last release*: Jan 06, 2022, *status*: N/A, *requires*: pytest (>=6.2.0) pytest embedded plugin + :pypi:`pytest-embedded-arduino` + *last release*: Jan 06, 2022, + *status*: N/A, + *requires*: N/A + + pytest embedded plugin for Arduino projects + :pypi:`pytest-embedded-idf` - *last release*: Nov 29, 2021, + *last release*: Jan 06, 2022, *status*: N/A, *requires*: N/A pytest embedded plugin for esp-idf project :pypi:`pytest-embedded-jtag` - *last release*: Nov 29, 2021, + *last release*: Jan 06, 2022, *status*: N/A, *requires*: N/A pytest embedded plugin for testing with jtag :pypi:`pytest-embedded-qemu` - *last release*: Nov 29, 2021, + *last release*: Jan 06, 2022, *status*: N/A, *requires*: N/A @@ -2945,14 +2957,14 @@ This list contains 975 plugins. pytest embedded plugin for esp-idf project by qemu, not target chip :pypi:`pytest-embedded-serial` - *last release*: Nov 29, 2021, + *last release*: Jan 06, 2022, *status*: N/A, *requires*: N/A pytest embedded plugin for testing serial ports :pypi:`pytest-embedded-serial-esp` - *last release*: Nov 29, 2021, + *last release*: Jan 06, 2022, *status*: N/A, *requires*: N/A @@ -3420,6 +3432,13 @@ This list contains 975 plugins. A pytest fixture for testing flake8 plugins. + :pypi:`pytest-flake8-v2` + *last release*: Jan 04, 2022, + *status*: 4 - Beta, + *requires*: pytest (>=3.5) + + pytest plugin to check FLAKE8 requirements + :pypi:`pytest-flakefinder` *last release*: Jul 28, 2020, *status*: 4 - Beta, @@ -3701,7 +3720,7 @@ This list contains 975 plugins. A plugin to provide different types and configs of Kubernetes clusters that can be used for testing. :pypi:`pytest-helm-charts` - *last release*: Oct 26, 2021, + *last release*: Jan 04, 2022, *status*: 4 - Beta, *requires*: pytest (>=6.1.2,<7.0.0) @@ -3757,12 +3776,19 @@ This list contains 975 plugins. A pytest plugin for use with homeassistant custom components. :pypi:`pytest-homeassistant-custom-component` - *last release*: Dec 30, 2021, + *last release*: Jan 06, 2022, *status*: 3 - Alpha, *requires*: pytest (==6.2.5) Experimental package to automatically extract test plugins for Home Assistant custom components + :pypi:`pytest-honey` + *last release*: Jan 07, 2022, + *status*: 4 - Beta, + *requires*: pytest (>=3.5.0) + + A simple plugin to use with pytest + :pypi:`pytest-honors` *last release*: Mar 06, 2020, *status*: 4 - Beta, @@ -3918,7 +3944,7 @@ This list contains 975 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-idempotent` - *last release*: Dec 24, 2021, + *last release*: Jan 08, 2022, *status*: N/A, *requires*: N/A @@ -4548,7 +4574,7 @@ This list contains 975 plugins. pytest plugin to write integration tests for projects using Mercurial Python internals :pypi:`pytest-message` - *last release*: Nov 04, 2021, + *last release*: Jan 05, 2022, *status*: N/A, *requires*: pytest (>=6.2.5) @@ -4625,7 +4651,7 @@ This list contains 975 plugins. A mock API server with configurable routes and responses available as a fixture. :pypi:`pytest-mock-generator` - *last release*: Dec 30, 2021, + *last release*: Jan 05, 2022, *status*: 5 - Production/Stable, *requires*: N/A @@ -4653,7 +4679,7 @@ This list contains 975 plugins. An in-memory mock of a Redis server that runs in a separate thread. This is to be used for unit-tests that require a Redis database. :pypi:`pytest-mock-resources` - *last release*: Dec 22, 2021, + *last release*: Jan 07, 2022, *status*: N/A, *requires*: pytest (>=1.0) @@ -4751,7 +4777,7 @@ This list contains 975 plugins. A test batcher for multiprocessed Pytest runs :pypi:`pytest-mpi` - *last release*: Mar 14, 2021, + *last release*: Jan 08, 2022, *status*: 3 - Alpha, *requires*: pytest @@ -4856,9 +4882,9 @@ This list contains 975 plugins. pytest plugin for visual testing websites using selenium :pypi:`pytest-neo` - *last release*: Apr 23, 2019, + *last release*: Jan 08, 2022, *status*: 3 - Alpha, - *requires*: pytest (>=3.7.2) + *requires*: pytest (>=6.2.0) pytest-neo is a plugin for pytest that shows tests like screen of Matrix. @@ -5248,9 +5274,9 @@ This list contains 975 plugins. Change the exit code of pytest test sessions when a required percent of tests pass. :pypi:`pytest-perf` - *last release*: Jun 27, 2021, + *last release*: Jan 08, 2022, *status*: 5 - Production/Stable, - *requires*: pytest (>=4.6) ; extra == 'testing' + *requires*: pytest (>=6) ; extra == 'testing' pytest-perf @@ -5269,7 +5295,7 @@ This list contains 975 plugins. Pytest tool for persistent objects :pypi:`pytest-pg` - *last release*: Dec 28, 2021, + *last release*: Jan 08, 2022, *status*: 5 - Production/Stable, *requires*: pytest (>=6.0.0) @@ -5850,7 +5876,7 @@ This list contains 975 plugins. Test your README.md file :pypi:`pytest-reana` - *last release*: Nov 22, 2021, + *last release*: Jan 05, 2022, *status*: 3 - Alpha, *requires*: N/A @@ -5906,7 +5932,7 @@ This list contains 975 plugins. Conveniently run pytest with a dot-formatted test reference. :pypi:`pytest-regressions` - *last release*: Jan 27, 2021, + *last release*: Jan 04, 2022, *status*: 5 - Production/Stable, *requires*: pytest (>=3.5.0) @@ -6298,7 +6324,7 @@ This list contains 975 plugins. :pypi:`pytest-sbase` - *last release*: Dec 31, 2021, + *last release*: Jan 05, 2022, *status*: 5 - Production/Stable, *requires*: N/A @@ -6340,7 +6366,7 @@ This list contains 975 plugins. pytest plugin for Selenium :pypi:`pytest-seleniumbase` - *last release*: Dec 31, 2021, + *last release*: Jan 05, 2022, *status*: 5 - Production/Stable, *requires*: N/A @@ -6585,7 +6611,7 @@ This list contains 975 plugins. :pypi:`pytest-snowflake-bdd` - *last release*: Dec 30, 2021, + *last release*: Jan 05, 2022, *status*: 4 - Beta, *requires*: pytest (>=6.2.0) @@ -6913,8 +6939,15 @@ This list contains 975 plugins. pytest-symbols is a pytest plugin that adds support for passing test environment symbols into pytest tests. + :pypi:`pytest-system-statistics` + *last release*: Jan 05, 2022, + *status*: 4 - Beta, + *requires*: pytest (>=6.0.0) + + Pytest plugin to track and report system usage statistics + :pypi:`pytest-takeltest` - *last release*: Oct 13, 2021, + *last release*: Jan 04, 2022, *status*: N/A, *requires*: N/A @@ -7053,6 +7086,13 @@ This list contains 975 plugins. Plugin to use TestObject Suites with Pytest + :pypi:`pytest-testpluggy` + *last release*: Jan 07, 2022, + *status*: N/A, + *requires*: pytest + + set your encoding + :pypi:`pytest-testrail` *last release*: Aug 27, 2020, *status*: N/A, From f08a77de77fc8e9198d649efb4b71827e39f8b77 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Sun, 9 Jan 2022 12:12:19 +0200 Subject: [PATCH 072/176] python: add back `instance` accessor to all python nodes, not just Function Regressed in 062d91ab4 (pytest 7.0.0rc1 only). Fix #9486. --- src/_pytest/python.py | 19 ++++++++++--------- testing/test_collection.py | 25 ++++++++++++++++--------- 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/src/_pytest/python.py b/src/_pytest/python.py index 90f035e8fb1..513214e08c8 100644 --- a/src/_pytest/python.py +++ b/src/_pytest/python.py @@ -283,6 +283,16 @@ def cls(self): node = self.getparent(Class) return node.obj if node is not None else None + @property + def instance(self): + """Python instance object the function is bound to. + + Returns None if not a test method, e.g. for a standalone test function, + a staticmethod, a class or a module. + """ + node = self.getparent(Function) + return getattr(node.obj, "__self__", None) if node is not None else None + @property def obj(self): """Underlying Python object.""" @@ -1693,15 +1703,6 @@ def function(self): """Underlying python 'function' object.""" return getimfunc(self.obj) - @property - def instance(self): - """Python instance object the function is bound to. - - Returns None if not a test method, e.g. for a standalone test function - or a staticmethod. - """ - return getattr(self.obj, "__self__", None) - def _getobj(self): assert self.parent is not None if isinstance(self.parent, Class): diff --git a/testing/test_collection.py b/testing/test_collection.py index 6fd9a708b4e..6a8a5c1cef1 100644 --- a/testing/test_collection.py +++ b/testing/test_collection.py @@ -64,7 +64,7 @@ def test_fail(): assert 0 assert pytester.collect_by_name(modcol, "doesnotexist") is None - def test_getparent(self, pytester: Pytester) -> None: + def test_getparent_and_accessors(self, pytester: Pytester) -> None: modcol = pytester.getmodulecol( """ class TestClass: @@ -77,14 +77,21 @@ def test_foo(self): fn = pytester.collect_by_name(cls, "test_foo") assert isinstance(fn, pytest.Function) - module_parent = fn.getparent(pytest.Module) - assert module_parent is modcol - - function_parent = fn.getparent(pytest.Function) - assert function_parent is fn - - class_parent = fn.getparent(pytest.Class) - assert class_parent is cls + assert fn.getparent(pytest.Module) is modcol + assert modcol.module is not None + assert modcol.cls is None + assert modcol.instance is None + + assert fn.getparent(pytest.Class) is cls + assert cls.module is not None + assert cls.cls is not None + assert cls.instance is None + + assert fn.getparent(pytest.Function) is fn + assert fn.module is not None + assert fn.cls is not None + assert fn.instance is not None + assert fn.function is not None def test_getcustomfile_roundtrip(self, pytester: Pytester) -> None: hello = pytester.makefile(".xxx", hello="world") From 0ef882364e9249f46d21d1e94867de77096b7c62 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Sun, 9 Jan 2022 01:40:57 +0200 Subject: [PATCH 073/176] config: stop resolving symlinks in conftest paths This became the wrong thing to do since 322190fd84e1b86d7b9a2d71f086445ca80c39b3. --- changelog/9493.bugfix.rst | 10 ++++++++++ src/_pytest/config/__init__.py | 11 ++--------- 2 files changed, 12 insertions(+), 9 deletions(-) create mode 100644 changelog/9493.bugfix.rst diff --git a/changelog/9493.bugfix.rst b/changelog/9493.bugfix.rst new file mode 100644 index 00000000000..d99c80b7d2c --- /dev/null +++ b/changelog/9493.bugfix.rst @@ -0,0 +1,10 @@ +Symbolic link components are no longer resolved in conftest paths. +This means that if a conftest appears twice in collection tree, using symlinks, it will be executed twice. +For example, given + + tests/real/conftest.py + tests/real/test_it.py + tests/link -> tests/real + +running ``pytest tests`` now imports the conftest twice, once as ``tests/real/conftest.py`` and once as ``tests/link/conftest.py``. +This is a fix to match a similar change made to test collection itself in pytest 6.0 (see :pull:`6523` for details). diff --git a/src/_pytest/config/__init__.py b/src/_pytest/config/__init__.py index a6a22d2b913..b75a675b6d8 100644 --- a/src/_pytest/config/__init__.py +++ b/src/_pytest/config/__init__.py @@ -592,15 +592,8 @@ def _rget_with_confmod( def _importconftest( self, conftestpath: Path, importmode: Union[str, ImportMode], rootpath: Path ) -> types.ModuleType: - # Use a resolved Path object as key to avoid loading the same conftest - # twice with build systems that create build directories containing - # symlinks to actual files. - # Using Path().resolve() is better than py.path.realpath because - # it resolves to the correct path/drive in case-insensitive file systems (#5792) - key = conftestpath.resolve() - with contextlib.suppress(KeyError): - return self._conftestpath2mod[key] + return self._conftestpath2mod[conftestpath] pkgpath = resolve_package_path(conftestpath) if pkgpath is None: @@ -616,7 +609,7 @@ def _importconftest( self._check_non_top_pytest_plugins(mod, conftestpath) self._conftest_plugins.add(mod) - self._conftestpath2mod[key] = mod + self._conftestpath2mod[conftestpath] = mod dirpath = conftestpath.parent if dirpath in self._dirpath2confmods: for path, mods in self._dirpath2confmods.items(): From 161bc481178c7dbd59b3ee3de92606a006a269aa Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Sun, 9 Jan 2022 00:38:40 +0200 Subject: [PATCH 074/176] config: get rid of _conftestpath2mod It duplicates what PluginManager already knows, and no longer needed now that symlinks are not resolved (see previous commit). --- src/_pytest/config/__init__.py | 9 +++------ testing/test_conftest.py | 21 ++++++++++----------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/src/_pytest/config/__init__.py b/src/_pytest/config/__init__.py index b75a675b6d8..3896313e033 100644 --- a/src/_pytest/config/__init__.py +++ b/src/_pytest/config/__init__.py @@ -1,7 +1,6 @@ """Command line options, ini-file and conftest.py processing.""" import argparse import collections.abc -import contextlib import copy import enum import inspect @@ -353,8 +352,6 @@ def __init__(self) -> None: # This includes the directory's own conftest modules as well # as those of its parent directories. self._dirpath2confmods: Dict[Path, List[types.ModuleType]] = {} - # The conftest module of a conftest path. - self._conftestpath2mod: Dict[Path, types.ModuleType] = {} # Cutoff directory above which conftests are no longer discovered. self._confcutdir: Optional[Path] = None # If set, conftest loading is skipped. @@ -592,8 +589,9 @@ def _rget_with_confmod( def _importconftest( self, conftestpath: Path, importmode: Union[str, ImportMode], rootpath: Path ) -> types.ModuleType: - with contextlib.suppress(KeyError): - return self._conftestpath2mod[conftestpath] + existing = self.get_plugin(str(conftestpath)) + if existing is not None: + return cast(types.ModuleType, existing) pkgpath = resolve_package_path(conftestpath) if pkgpath is None: @@ -609,7 +607,6 @@ def _importconftest( self._check_non_top_pytest_plugins(mod, conftestpath) self._conftest_plugins.add(mod) - self._conftestpath2mod[conftestpath] = mod dirpath = conftestpath.parent if dirpath in self._dirpath2confmods: for path, mods in self._dirpath2confmods.items(): diff --git a/testing/test_conftest.py b/testing/test_conftest.py index 92a5ffb72cf..4cbc2d14c36 100644 --- a/testing/test_conftest.py +++ b/testing/test_conftest.py @@ -146,10 +146,9 @@ def test_issue151_load_all_conftests(pytester: Pytester) -> None: p = pytester.mkdir(name) p.joinpath("conftest.py").touch() - conftest = PytestPluginManager() - conftest_setinitial(conftest, names) - d = list(conftest._conftestpath2mod.values()) - assert len(d) == len(names) + pm = PytestPluginManager() + conftest_setinitial(pm, names) + assert len(set(pm.get_plugins()) - {pm}) == len(names) def test_conftest_global_import(pytester: Pytester) -> None: @@ -192,7 +191,7 @@ def test_conftestcutdir(pytester: Pytester) -> None: conf.parent, importmode="prepend", rootpath=pytester.path ) assert len(values) == 0 - assert Path(conf) not in conftest._conftestpath2mod + assert not conftest.has_plugin(str(conf)) # but we can still import a conftest directly conftest._importconftest(conf, importmode="prepend", rootpath=pytester.path) values = conftest._getconftestmodules( @@ -226,15 +225,15 @@ def test_setinitial_conftest_subdirs(pytester: Pytester, name: str) -> None: sub = pytester.mkdir(name) subconftest = sub.joinpath("conftest.py") subconftest.touch() - conftest = PytestPluginManager() - conftest_setinitial(conftest, [sub.parent], confcutdir=pytester.path) + pm = PytestPluginManager() + conftest_setinitial(pm, [sub.parent], confcutdir=pytester.path) key = subconftest.resolve() if name not in ("whatever", ".dotdir"): - assert key in conftest._conftestpath2mod - assert len(conftest._conftestpath2mod) == 1 + assert pm.has_plugin(str(key)) + assert len(set(pm.get_plugins()) - {pm}) == 1 else: - assert key not in conftest._conftestpath2mod - assert len(conftest._conftestpath2mod) == 0 + assert not pm.has_plugin(str(key)) + assert len(set(pm.get_plugins()) - {pm}) == 0 def test_conftest_confcutdir(pytester: Pytester) -> None: From 0d5f52b127e79f9a90e811f35dcdcd578a7b6625 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Jan 2022 03:02:30 +0000 Subject: [PATCH 075/176] build(deps): Bump django in /testing/plugins_integration Bumps [django](https://github.com/django/django) from 4.0 to 4.0.1. - [Release notes](https://github.com/django/django/releases) - [Commits](https://github.com/django/django/compare/4.0...4.0.1) --- updated-dependencies: - dependency-name: django dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- testing/plugins_integration/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/plugins_integration/requirements.txt b/testing/plugins_integration/requirements.txt index 4583cf0d3a7..c114a1de87e 100644 --- a/testing/plugins_integration/requirements.txt +++ b/testing/plugins_integration/requirements.txt @@ -1,5 +1,5 @@ anyio[curio,trio]==3.4.0 -django==4.0 +django==4.0.1 pytest-asyncio==0.16.0 pytest-bdd==5.0.0 pytest-cov==3.0.0 From 8891d1f449ccfd50e528aad734910aa79a327215 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 10 Jan 2022 21:28:04 +0000 Subject: [PATCH 076/176] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/mirrors-mypy: v0.930 → v0.931](https://github.com/pre-commit/mirrors-mypy/compare/v0.930...v0.931) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 70ff318dcbf..8def093a2c6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -48,7 +48,7 @@ repos: hooks: - id: python-use-type-annotations - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.930 + rev: v0.931 hooks: - id: mypy files: ^(src/|testing/) From 0fe0b78a9f77391b8df8c94527bef8ecc8fff407 Mon Sep 17 00:00:00 2001 From: Emmanuel Arias Date: Thu, 13 Jan 2022 12:52:18 -0300 Subject: [PATCH 077/176] Improve on configuration file docs section To avoid confusions the part of that "the configuration file can be locate on your tests folder" is removed. --- changelog/9505.trivial.rst | 2 ++ doc/en/reference/customize.rst | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 changelog/9505.trivial.rst diff --git a/changelog/9505.trivial.rst b/changelog/9505.trivial.rst new file mode 100644 index 00000000000..51386c226bf --- /dev/null +++ b/changelog/9505.trivial.rst @@ -0,0 +1,2 @@ +Clarify where the configuration files are located. To avoid confusions documentation mentions +that configuration file is located in the root of the repository. diff --git a/doc/en/reference/customize.rst b/doc/en/reference/customize.rst index 22ce24b31e0..626cbaf1709 100644 --- a/doc/en/reference/customize.rst +++ b/doc/en/reference/customize.rst @@ -20,8 +20,7 @@ Configuration file formats -------------------------- Many :ref:`pytest settings ` can be set in a *configuration file*, which -by convention resides on the root of your repository or in your -tests folder. +by convention resides on the root of your repository. A quick example of the configuration files supported by pytest: From 5c2d752e74dbc0e5c39233c0584129709d411112 Mon Sep 17 00:00:00 2001 From: Emmanuel Arias Date: Thu, 13 Jan 2022 13:29:08 -0300 Subject: [PATCH 078/176] improve docs --- doc/en/reference/customize.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/en/reference/customize.rst b/doc/en/reference/customize.rst index 626cbaf1709..fe10ca066b2 100644 --- a/doc/en/reference/customize.rst +++ b/doc/en/reference/customize.rst @@ -20,7 +20,7 @@ Configuration file formats -------------------------- Many :ref:`pytest settings ` can be set in a *configuration file*, which -by convention resides on the root of your repository. +by convention resides in the root directory of your repository. A quick example of the configuration files supported by pytest: From 2ad1b589af8d3d19af4ed15d5de9779065ea9e62 Mon Sep 17 00:00:00 2001 From: Olga Matoula Date: Thu, 13 Jan 2022 20:32:22 +0200 Subject: [PATCH 079/176] Add docs on pytest.warns(None) deprecation (#9495) * Add docs on pytest.warns(None) deprecation * Add new section for common warnings use cases * Fix references for warnings use cases * Fix reference link --- changelog/9404.doc.rst | 1 + doc/en/deprecations.rst | 6 +++--- doc/en/how-to/capture-warnings.rst | 29 +++++++++++++++++++++++++++++ src/_pytest/deprecated.py | 6 ++++-- testing/deprecated_test.py | 6 ++++-- 5 files changed, 41 insertions(+), 7 deletions(-) create mode 100644 changelog/9404.doc.rst diff --git a/changelog/9404.doc.rst b/changelog/9404.doc.rst new file mode 100644 index 00000000000..70e4c6d5899 --- /dev/null +++ b/changelog/9404.doc.rst @@ -0,0 +1 @@ +Added extra documentation on alternatives to common misuses of `pytest.warns(None)` ahead of its deprecation. diff --git a/doc/en/deprecations.rst b/doc/en/deprecations.rst index 6351d1f6e6a..a667fc4ccdf 100644 --- a/doc/en/deprecations.rst +++ b/doc/en/deprecations.rst @@ -221,11 +221,11 @@ Using ``pytest.warns(None)`` .. deprecated:: 7.0 -:func:`pytest.warns(None) ` is now deprecated because many people used -it to mean "this code does not emit warnings", but it actually had the effect of -checking that the code emits at least one warning of any type - like ``pytest.warns()`` +:func:`pytest.warns(None) ` is now deprecated because it was frequently misused. +Its correct usage was checking that the code emits at least one warning of any type - like ``pytest.warns()`` or ``pytest.warns(Warning)``. +See :ref:`warns use cases` for examples. The ``--strict`` command-line option ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/doc/en/how-to/capture-warnings.rst b/doc/en/how-to/capture-warnings.rst index efdf10e3394..501edce7a14 100644 --- a/doc/en/how-to/capture-warnings.rst +++ b/doc/en/how-to/capture-warnings.rst @@ -351,6 +351,35 @@ warnings, or index into it to get a particular recorded warning. Full API: :class:`~_pytest.recwarn.WarningsRecorder`. +.. _`warns use cases`: + +Additional use cases of warnings in tests +----------------------------------------- + +Here are some use cases involving warnings that often come up in tests, and suggestions on how to deal with them: + +- To ensure that **any** warning is emitted, use: + +.. code-block:: python + + with pytest.warns(): + pass + +- To ensure that **no** warnings are emitted, use: + +.. code-block:: python + + with warnings.catch_warnings(): + warnings.simplefilter("error") + +- To suppress warnings, use: + +.. code-block:: python + + with warnings.catch_warnings(): + warnings.simplefilter("ignore") + + .. _custom_failure_messages: Custom failure messages diff --git a/src/_pytest/deprecated.py b/src/_pytest/deprecated.py index f68aea37e4d..4534fbcab82 100644 --- a/src/_pytest/deprecated.py +++ b/src/_pytest/deprecated.py @@ -88,8 +88,10 @@ ) WARNS_NONE_ARG = PytestRemovedIn8Warning( - "Passing None to catch any warning has been deprecated, pass no arguments instead:\n" - " Replace pytest.warns(None) by simply pytest.warns()." + "Passing None has been deprecated.\n" + "See https://docs.pytest.org/en/latest/how-to/capture-warnings.html" + "#additional-use-cases-of-warnings-in-tests" + " for alternatives in common use cases." ) KEYWORD_MSG_ARG = UnformattedWarning( diff --git a/testing/deprecated_test.py b/testing/deprecated_test.py index 07e69e6840f..4104d19db9a 100644 --- a/testing/deprecated_test.py +++ b/testing/deprecated_test.py @@ -138,8 +138,10 @@ def test_warns_none_is_deprecated(): with pytest.warns( PytestDeprecationWarning, match=re.escape( - "Passing None to catch any warning has been deprecated, pass no arguments instead:\n " - "Replace pytest.warns(None) by simply pytest.warns()." + "Passing None has been deprecated.\n" + "See https://docs.pytest.org/en/latest/how-to/capture-warnings.html" + "#additional-use-cases-of-warnings-in-tests" + " for alternatives in common use cases." ), ): with pytest.warns(None): # type: ignore[call-overload] From 3f4eab3f8f4932cbd31abdaa77cf77bbc3c0d588 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Fri, 14 Jan 2022 17:49:38 +0200 Subject: [PATCH 080/176] testing: avoid private pluggy attributes in test --- testing/test_config.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/testing/test_config.py b/testing/test_config.py index c8e21a8478a..bf4b2741eca 100644 --- a/testing/test_config.py +++ b/testing/test_config.py @@ -1264,15 +1264,20 @@ def pytest_load_initial_conftests(self): m = My() pm.register(m) hc = pm.hook.pytest_load_initial_conftests - assert [x.function.__module__ for x in hc._nonwrappers] == [ - "_pytest.config", - m.__module__, - "_pytest.legacypath", - "_pytest.pythonpath", + hookimpls = [ + ( + hookimpl.function.__module__, + "wrapper" if hookimpl.hookwrapper else "nonwrapper", + ) + for hookimpl in hc.get_hookimpls() ] - assert [x.function.__module__ for x in hc._wrappers] == [ - "_pytest.capture", - "_pytest.warnings", + assert hookimpls == [ + ("_pytest.config", "nonwrapper"), + (m.__module__, "nonwrapper"), + ("_pytest.legacypath", "nonwrapper"), + ("_pytest.pythonpath", "nonwrapper"), + ("_pytest.capture", "wrapper"), + ("_pytest.warnings", "wrapper"), ] From 947b5dbc47fca2c8f21fc460888811181fbac788 Mon Sep 17 00:00:00 2001 From: pytest bot Date: Sun, 16 Jan 2022 00:13:41 +0000 Subject: [PATCH 081/176] [automated] Update plugin list --- doc/en/reference/plugin_list.rst | 136 ++++++++++++++++++------------- 1 file changed, 80 insertions(+), 56 deletions(-) diff --git a/doc/en/reference/plugin_list.rst b/doc/en/reference/plugin_list.rst index 3927fe8dc1b..f8ad9f0bdf7 100644 --- a/doc/en/reference/plugin_list.rst +++ b/doc/en/reference/plugin_list.rst @@ -11,7 +11,7 @@ automatically. Packages classified as inactive are excluded. creating a PDF, because otherwise the table gets far too wide for the page. -This list contains 980 plugins. +This list contains 983 plugins. .. only:: not latex @@ -57,7 +57,7 @@ This list contains 980 plugins. :pypi:`pytest-appium` Pytest plugin for appium Dec 05, 2019 N/A N/A :pypi:`pytest-approvaltests` A plugin to use approvaltests with pytest Feb 07, 2021 4 - Beta pytest (>=3.5.0) :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 Dec 31, 2021 4 - Beta pytest (>=4.6) + :pypi:`pytest-arraydiff` pytest plugin to help with comparing array output from tests Jan 13, 2022 4 - Beta pytest (>=4.6) :pypi:`pytest-asgi-server` Convenient ASGI client/server fixtures for Pytest Dec 12, 2020 N/A pytest (>=5.4.1) :pypi:`pytest-asptest` test Answer Set Programming programs Apr 28, 2018 4 - Beta N/A :pypi:`pytest-assertutil` pytest-assertutil May 10, 2019 N/A N/A @@ -67,7 +67,7 @@ This list contains 980 plugins. :pypi:`pytest-astropy` Meta-package containing dependencies for testing Sep 21, 2021 5 - Production/Stable pytest (>=4.6) :pypi:`pytest-astropy-header` pytest plugin to add diagnostic information to the header of the test output Dec 27, 2021 3 - Alpha pytest (>=4.6) :pypi:`pytest-ast-transformer` May 04, 2019 3 - Alpha pytest - :pypi:`pytest-asyncio` Pytest support for asyncio. Oct 15, 2021 4 - Beta pytest (>=5.4.0) + :pypi:`pytest-asyncio` Pytest support for asyncio Jan 13, 2022 4 - Beta pytest (>=5.4.0) :pypi:`pytest-asyncio-cooperative` Run all your asynchronous tests cooperatively. Jan 03, 2022 N/A N/A :pypi:`pytest-asyncio-network-simulator` pytest-asyncio-network-simulator: Plugin for pytest for simulator the network in tests Jul 31, 2018 3 - Alpha pytest (<3.7.0,>=3.3.2) :pypi:`pytest-async-mongodb` pytest plugin for async MongoDB Oct 18, 2017 5 - Production/Stable pytest (>=2.5.2) @@ -323,7 +323,7 @@ This list contains 980 plugins. :pypi:`pytest-executable` pytest plugin for testing executables Nov 10, 2021 4 - Beta pytest (<6.3,>=4.3) :pypi:`pytest-execution-timer` A timer for the phases of Pytest's execution. Dec 24, 2021 4 - Beta N/A :pypi:`pytest-expect` py.test plugin to store test expectations and mark tests based on them Apr 21, 2016 4 - Beta N/A - :pypi:`pytest-expecter` Better testing with expecter and pytest. Jul 08, 2020 5 - Production/Stable N/A + :pypi:`pytest-expecter` Better testing with expecter and pytest. Jan 10, 2022 5 - Production/Stable N/A :pypi:`pytest-expectr` This plugin is used to expect multiple assert using pytest framework. Oct 05, 2018 N/A pytest (>=2.4.2) :pypi:`pytest-experiments` A pytest plugin to help developers of research-oriented software projects keep track of the results of their numerical experiments. Dec 13, 2021 4 - Beta pytest (>=6.2.5,<7.0.0) :pypi:`pytest-explicit` A Pytest plugin to ignore certain marked tests by default Jun 15, 2021 5 - Production/Stable pytest @@ -353,7 +353,7 @@ This list contains 980 plugins. :pypi:`pytest-filemarker` A pytest plugin that runs marked tests when files change. Dec 01, 2020 N/A pytest :pypi:`pytest-filter-case` run test cases filter by mark Nov 05, 2020 N/A N/A :pypi:`pytest-filter-subpackage` Pytest plugin for filtering based on sub-packages Jan 09, 2020 3 - Alpha pytest (>=3.0) - :pypi:`pytest-find-dependencies` A pytest plugin to find dependencies between tests Dec 26, 2021 4 - Beta pytest (>=3.5.0) + :pypi:`pytest-find-dependencies` A pytest plugin to find dependencies between tests Jan 15, 2022 4 - Beta pytest (>=4.3.0) :pypi:`pytest-finer-verdicts` A pytest plugin to treat non-assertion failures as test errors. Jun 18, 2020 N/A pytest (>=5.4.3) :pypi:`pytest-firefox` pytest plugin to manipulate firefox Aug 08, 2017 3 - Alpha pytest (>=3.0.2) :pypi:`pytest-fixture-config` Fixture configuration utils for py.test May 28, 2019 5 - Production/Stable pytest @@ -364,7 +364,7 @@ This list contains 980 plugins. :pypi:`pytest-fixture-tools` Plugin for pytest which provides tools for fixtures Aug 18, 2020 6 - Mature pytest :pypi:`pytest-fixture-typecheck` A pytest plugin to assert type annotations at runtime. Aug 24, 2021 N/A pytest :pypi:`pytest-flake8` pytest plugin to check FLAKE8 requirements Dec 16, 2020 4 - Beta pytest (>=3.5) - :pypi:`pytest-flake8-path` A pytest fixture for testing flake8 plugins. Aug 11, 2021 5 - Production/Stable pytest + :pypi:`pytest-flake8-path` A pytest fixture for testing flake8 plugins. Jan 10, 2022 5 - Production/Stable pytest :pypi:`pytest-flake8-v2` pytest plugin to check FLAKE8 requirements Jan 04, 2022 4 - Beta pytest (>=3.5) :pypi:`pytest-flakefinder` Runs tests multiple times to expose flakiness. Jul 28, 2020 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) @@ -388,8 +388,9 @@ This list contains 980 plugins. :pypi:`pytest-gcov` Uses gcov to measure test coverage of a C library Feb 01, 2018 3 - Alpha N/A :pypi:`pytest-gevent` Ensure that gevent is properly patched when invoking pytest Feb 25, 2020 N/A pytest :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. Nov 30, 2021 N/A N/A + :pypi:`pytest-girder` A set of pytest fixtures for testing Girder applications. Jan 10, 2022 N/A N/A :pypi:`pytest-git` Git repository fixture for py.test May 28, 2019 5 - Production/Stable pytest :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 @@ -406,7 +407,7 @@ This list contains 980 plugins. :pypi:`pytest-hammertime` Display "🔨 " instead of "." for passed pytest tests. Jul 28, 2018 N/A pytest :pypi:`pytest-harvest` Store data created during your pytest tests execution, and retrieve it at the end of the session, e.g. for applicative benchmarking purposes. Apr 01, 2021 5 - Production/Stable N/A :pypi:`pytest-helm-chart` A plugin to provide different types and configs of Kubernetes clusters that can be used for testing. Jun 15, 2020 4 - Beta pytest (>=5.4.2,<6.0.0) - :pypi:`pytest-helm-charts` A plugin to provide different types and configs of Kubernetes clusters that can be used for testing. Jan 04, 2022 4 - Beta pytest (>=6.1.2,<7.0.0) + :pypi:`pytest-helm-charts` A plugin to provide different types and configs of Kubernetes clusters that can be used for testing. Jan 10, 2022 4 - Beta pytest (>=6.1.2,<7.0.0) :pypi:`pytest-helper` Functions to help in using the pytest testing framework May 31, 2019 5 - Production/Stable N/A :pypi:`pytest-helpers` pytest helpers May 17, 2020 N/A pytest :pypi:`pytest-helpers-namespace` Pytest Helpers Namespace Plugin Dec 29, 2021 5 - Production/Stable pytest (>=6.0.0) @@ -414,7 +415,7 @@ This list contains 980 plugins. :pypi:`pytest-historic` Custom report to display pytest historical execution records Apr 08, 2020 N/A pytest :pypi:`pytest-historic-hook` Custom listener to store execution results into MYSQL DB, which is used for pytest-historic report Apr 08, 2020 N/A pytest :pypi:`pytest-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 Jan 06, 2022 3 - Alpha pytest (==6.2.5) + :pypi:`pytest-homeassistant-custom-component` Experimental package to automatically extract test plugins for Home Assistant custom components Jan 11, 2022 3 - Alpha pytest (==6.2.5) :pypi:`pytest-honey` A simple plugin to use with pytest Jan 07, 2022 4 - Beta pytest (>=3.5.0) :pypi:`pytest-honors` Report on tests that honor constraints, and guard against regressions Mar 06, 2020 4 - Beta N/A :pypi:`pytest-hoverfly` Simplify working with Hoverfly from pytest Jul 12, 2021 N/A pytest (>=5.0) @@ -435,10 +436,10 @@ This list contains 980 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-ibutsu` A plugin to sent pytest results to an Ibutsu server Dec 15, 2021 4 - Beta pytest + :pypi:`pytest-ibutsu` A plugin to sent pytest results to an Ibutsu server Jan 14, 2022 4 - Beta pytest :pypi:`pytest-icdiff` use icdiff for better error messages in pytest assertions Apr 08, 2020 4 - Beta N/A :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-idempotent` Pytest plugin for testing function idempotence. Jan 08, 2022 N/A N/A + :pypi:`pytest-idempotent` Pytest plugin for testing function idempotence. Jan 10, 2022 N/A N/A :pypi:`pytest-ignore-flaky` ignore failures from flaky tests (pytest plugin) Apr 23, 2021 5 - Production/Stable N/A :pypi:`pytest-image-diff` Jul 28, 2021 3 - Alpha pytest :pypi:`pytest-incremental` an incremental test runner (pytest plugin) Apr 24, 2021 5 - Production/Stable N/A @@ -462,7 +463,7 @@ This list contains 980 plugins. :pypi:`pytest-ipdb` A py.test plug-in to enable drop to ipdb debugger on test failure. Sep 02, 2014 2 - Pre-Alpha N/A :pypi:`pytest-ipynb` THIS PROJECT IS ABANDONED Jan 29, 2019 3 - Alpha N/A :pypi:`pytest-isort` py.test plugin to check import ordering using isort Apr 27, 2021 5 - Production/Stable N/A - :pypi:`pytest-is-running` pytest plugin providing a function to check if pytest is running. Dec 06, 2021 5 - Production/Stable pytest + :pypi:`pytest-is-running` pytest plugin providing a function to check if pytest is running. Jan 10, 2022 5 - Production/Stable pytest :pypi:`pytest-it` Pytest plugin to display test reports as a plaintext spec, inspired by Rspec: https://github.com/mattduck/pytest-it. Jan 22, 2020 4 - Beta N/A :pypi:`pytest-iterassert` Nicer list and iterable assertion messages for pytest May 11, 2020 3 - Alpha N/A :pypi:`pytest-jasmine` Run jasmine tests from your pytest test suite Nov 04, 2017 1 - Planning N/A @@ -543,8 +544,8 @@ This list contains 980 plugins. :pypi:`pytest-mock-helper` Help you mock HTTP call and generate mock code Jan 24, 2018 N/A pytest :pypi:`pytest-mockito` Base fixtures for mockito Jul 11, 2018 4 - Beta N/A :pypi:`pytest-mockredis` An in-memory mock of a Redis server that runs in a separate thread. This is to be used for unit-tests that require a Redis database. Jan 02, 2018 2 - Pre-Alpha N/A - :pypi:`pytest-mock-resources` A pytest plugin for easily instantiating reproducible mock resources. Jan 07, 2022 N/A pytest (>=1.0) - :pypi:`pytest-mock-server` Mock server plugin for pytest Apr 06, 2020 4 - Beta N/A + :pypi:`pytest-mock-resources` A pytest plugin for easily instantiating reproducible mock resources. Jan 11, 2022 N/A pytest (>=1.0) + :pypi:`pytest-mock-server` Mock server plugin for pytest Jan 09, 2022 4 - Beta pytest (>=3.5.0) :pypi:`pytest-mockservers` A set of fixtures to test your requests to HTTP/UDP servers Mar 31, 2020 N/A pytest (>=4.3.0) :pypi:`pytest-modifyjunit` Utility for adding additional properties to junit xml for IDM QE Jan 10, 2019 N/A N/A :pypi:`pytest-modifyscope` pytest plugin to modify fixture scope Apr 12, 2020 N/A pytest @@ -567,7 +568,7 @@ This list contains 980 plugins. :pypi:`pytest-mutagen` Add the mutation testing feature to pytest Jul 24, 2020 N/A pytest (>=5.4) :pypi:`pytest-mypy` Mypy static type checker plugin for Pytest Mar 21, 2021 4 - Beta pytest (>=3.5) :pypi:`pytest-mypyd` Mypy static type checker plugin for Pytest Aug 20, 2019 4 - Beta pytest (<4.7,>=2.8) ; python_version < "3.5" - :pypi:`pytest-mypy-plugins` pytest plugin for writing tests for mypy plugins Oct 19, 2021 3 - Alpha pytest (>=6.0.0) + :pypi:`pytest-mypy-plugins` pytest plugin for writing tests for mypy plugins Jan 11, 2022 3 - Alpha pytest (>=6.0.0) :pypi:`pytest-mypy-plugins-shim` Substitute for "pytest-mypy-plugins" for Python implementations which aren't supported by mypy. Apr 12, 2021 N/A N/A :pypi:`pytest-mypy-testing` Pytest plugin to check mypy output. Jun 13, 2021 N/A pytest :pypi:`pytest-mysql` MySQL process and client fixtures for pytest Nov 22, 2021 5 - Production/Stable pytest @@ -605,7 +606,7 @@ This list contains 980 plugins. :pypi:`pytest-optional` include/exclude values of fixtures in pytest Oct 07, 2015 N/A N/A :pypi:`pytest-optional-tests` Easy declaration of optional tests (i.e., that are not run by default) Jul 09, 2019 4 - Beta pytest (>=4.5.0) :pypi:`pytest-orchestration` A pytest plugin for orchestrating tests Jul 18, 2019 N/A N/A - :pypi:`pytest-order` pytest plugin to run your tests in a specific order May 30, 2021 4 - Beta pytest (>=5.0) + :pypi:`pytest-order` pytest plugin to run your tests in a specific order Jan 09, 2022 4 - Beta pytest (>=5.0) ; python_version < "3.10" :pypi:`pytest-ordering` pytest plugin to run your tests in a specific order Nov 14, 2018 4 - Beta pytest :pypi:`pytest-osxnotify` OS X notifications for py.test results. May 15, 2015 N/A N/A :pypi:`pytest-otel` pytest-otel report OpenTelemetry traces about test executed Dec 16, 2021 N/A N/A @@ -631,7 +632,7 @@ This list contains 980 plugins. :pypi:`pytest-perf` pytest-perf Jan 08, 2022 5 - Production/Stable pytest (>=6) ; extra == 'testing' :pypi:`pytest-performance` A simple plugin to ensure the execution of critical sections of code has not been impacted Sep 11, 2020 5 - Production/Stable pytest (>=3.7.0) :pypi:`pytest-persistence` Pytest tool for persistent objects Dec 07, 2021 N/A N/A - :pypi:`pytest-pg` Helps to run PostgreSQL in docker as pytest fixture Jan 08, 2022 5 - Production/Stable pytest (>=6.0.0) + :pypi:`pytest-pg` Helps to run PostgreSQL in docker as pytest fixture Jan 09, 2022 5 - Production/Stable pytest (>=6.0.0) :pypi:`pytest-pgsql` Pytest plugins and helpers for tests using a Postgres database. May 13, 2020 5 - Production/Stable pytest (>=3.0.0) :pypi:`pytest-phmdoctest` pytest plugin to test Python examples in Markdown using phmdoctest. Nov 10, 2021 4 - Beta pytest (>=6.2) ; extra == 'test' :pypi:`pytest-picked` Run the tests related to the changed files Dec 23, 2020 N/A pytest (>=3.5.0) @@ -709,7 +710,7 @@ This list contains 980 plugins. :pypi:`pytest-raisesregexp` Simple pytest plugin to look for regex in Exceptions Dec 18, 2015 N/A N/A :pypi:`pytest-raisin` Plugin enabling the use of exception instances with pytest.raises Jun 25, 2020 N/A pytest :pypi:`pytest-random` py.test plugin to randomize tests Apr 28, 2013 3 - Alpha N/A - :pypi:`pytest-randomly` Pytest plugin to randomly order tests and control random.seed. Nov 30, 2021 5 - Production/Stable pytest + :pypi:`pytest-randomly` Pytest plugin to randomly order tests and control random.seed. Jan 10, 2022 5 - Production/Stable pytest :pypi:`pytest-randomness` Pytest plugin about random seed management May 30, 2019 3 - Alpha N/A :pypi:`pytest-random-num` Randomise the order in which pytest tests are run with some control over the randomness Oct 19, 2020 5 - Production/Stable N/A :pypi:`pytest-random-order` Randomise the order in which pytest tests are run with some control over the randomness Nov 30, 2018 5 - Production/Stable pytest (>=3.0.0) @@ -742,7 +743,7 @@ This list contains 980 plugins. :pypi:`pytest-reportlog` Replacement for the --resultlog option, focused in simplicity and extensibility Dec 11, 2020 3 - Alpha pytest (>=5.2) :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 Jun 18, 2021 N/A pytest (>=3.8.0) + :pypi:`pytest-reportportal` Agent for Reporting results of tests to the Report Portal Jan 11, 2022 N/A pytest (>=3.8.0) :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-requires` A pytest plugin to elegantly skip tests with optional requirements Dec 21, 2021 4 - Beta pytest (>=3.5.0) @@ -754,9 +755,9 @@ This list contains 980 plugins. :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-responsemock` Simplified requests calls mocking for pytest Oct 10, 2020 5 - Production/Stable N/A :pypi:`pytest-responses` py.test integration for responses Apr 26, 2021 N/A pytest (>=2.5) - :pypi:`pytest-restrict` Pytest plugin to restrict the test types allowed Aug 12, 2021 5 - Production/Stable pytest + :pypi:`pytest-restrict` Pytest plugin to restrict the test types allowed Jan 10, 2022 5 - Production/Stable pytest :pypi:`pytest-rethinkdb` A RethinkDB plugin for pytest. Jul 24, 2016 4 - Beta N/A - :pypi:`pytest-reverse` Pytest plugin to reverse test order. Aug 12, 2021 5 - Production/Stable pytest + :pypi:`pytest-reverse` Pytest plugin to reverse test order. Jan 10, 2022 5 - Production/Stable pytest :pypi:`pytest-ringo` pytest plugin to test webapplications using the Ringo webframework Sep 27, 2017 3 - Alpha N/A :pypi:`pytest-rng` Fixtures for seeding tests and making randomness reproducible Aug 08, 2019 5 - Production/Stable pytest :pypi:`pytest-roast` pytest plugin for ROAST configuration override and fixtures Jul 29, 2021 5 - Production/Stable pytest @@ -778,13 +779,13 @@ This list contains 980 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. Jan 05, 2022 5 - Production/Stable N/A + :pypi:`pytest-sbase` A complete web automation framework for end-to-end testing. Jan 12, 2022 5 - Production/Stable N/A :pypi:`pytest-scenario` pytest plugin for test scenarios Feb 06, 2017 3 - Alpha N/A :pypi:`pytest-schema` 👍 Validate return values against a schema-like object in testing Aug 31, 2020 5 - Production/Stable pytest (>=3.5.0) :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 Sep 19, 2020 5 - Production/Stable pytest (>=5.0.0) - :pypi:`pytest-seleniumbase` A complete web automation framework for end-to-end testing. Jan 05, 2022 5 - Production/Stable N/A + :pypi:`pytest-seleniumbase` A complete web automation framework for end-to-end testing. Jan 12, 2022 5 - Production/Stable N/A :pypi:`pytest-selenium-enhancer` pytest plugin for Selenium Dec 16, 2021 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-send-email` Send pytest execution result email Dec 04, 2019 N/A N/A @@ -822,6 +823,7 @@ This list contains 980 plugins. :pypi:`pytest-snowflake-bdd` Setup test data and run tests on snowflake in BDD style! Jan 05, 2022 4 - Beta pytest (>=6.2.0) :pypi:`pytest-socket` Pytest Plugin to disable socket calls during tests Dec 23, 2021 4 - Beta pytest (>=3.6.3) :pypi:`pytest-soft-assertions` May 05, 2020 3 - Alpha pytest + :pypi:`pytest-solidity` A PyTest library plugin for Solidity language. Jan 15, 2022 1 - Planning pytest (<7,>=6.0.1) ; extra == 'tests' :pypi:`pytest-solr` Solr process and client fixtures for py.test. May 11, 2020 3 - Alpha pytest (>=3.0.0) :pypi:`pytest-sorter` A simple plugin to first execute tests that historically failed more Apr 20, 2021 4 - Beta pytest (>=3.1.1) :pypi:`pytest-sosu` Unofficial PyTest plugin for Sauce Labs Dec 20, 2021 2 - Pre-Alpha pytest @@ -833,7 +835,7 @@ This list contains 980 plugins. :pypi:`pytest-spiratest` Exports unit tests as test runs in SpiraTest/Team/Plan Oct 13, 2021 N/A N/A :pypi:`pytest-splinter` Splinter plugin for pytest testing framework Dec 25, 2020 6 - Mature N/A :pypi:`pytest-splinter4` Pytest plugin for the splinter automation library Dec 22, 2021 6 - Mature pytest (>=6.2.4) - :pypi:`pytest-split` Pytest plugin which splits the test suite to equally sized sub suites based on test execution time. Nov 09, 2021 4 - Beta pytest (>=5,<7) + :pypi:`pytest-split` Pytest plugin which splits the test suite to equally sized sub suites based on test execution time. Jan 10, 2022 4 - Beta pytest (>=5,<7) :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 @@ -859,11 +861,11 @@ This list contains 980 plugins. :pypi:`pytest-study` A pytest plugin to organize long run tests (named studies) without interfering the regular tests Sep 26, 2017 3 - Alpha pytest (>=2.0) :pypi:`pytest-subprocess` A plugin to fake subprocess for pytest Nov 07, 2021 5 - Production/Stable pytest (>=4.0.0) :pypi:`pytest-subtesthack` A hack to explicitly set up and tear down fixtures. Mar 02, 2021 N/A N/A - :pypi:`pytest-subtests` unittest subTest() support and subtests fixture May 29, 2021 4 - Beta pytest (>=5.3.0) + :pypi:`pytest-subtests` unittest subTest() support and subtests fixture Jan 15, 2022 4 - Beta pytest (>=6.0) :pypi:`pytest-subunit` pytest-subunit is a plugin for py.test which outputs testsresult in subunit format. Aug 29, 2017 N/A N/A :pypi:`pytest-sugar` pytest-sugar is a plugin for pytest that changes the default look and feel of pytest (e.g. progressbar, show tests that fail instantly). Jul 06, 2020 3 - Alpha N/A :pypi:`pytest-sugar-bugfix159` Workaround for https://github.com/Frozenball/pytest-sugar/issues/159 Nov 07, 2018 5 - Production/Stable pytest (!=3.7.3,>=3.5); extra == 'testing' - :pypi:`pytest-super-check` Pytest plugin to check your TestCase classes call super in setUp, tearDown, etc. Aug 12, 2021 5 - Production/Stable pytest + :pypi:`pytest-super-check` Pytest plugin to check your TestCase classes call super in setUp, tearDown, etc. Jan 10, 2022 5 - Production/Stable pytest :pypi:`pytest-svn` SVN repository fixture for py.test May 28, 2019 5 - Production/Stable pytest :pypi:`pytest-symbols` pytest-symbols is a pytest plugin that adds support for passing test environment symbols into pytest tests. Nov 20, 2017 3 - Alpha N/A :pypi:`pytest-system-statistics` Pytest plugin to track and report system usage statistics Jan 05, 2022 4 - Beta pytest (>=6.0.0) @@ -912,6 +914,7 @@ This list contains 980 plugins. :pypi:`pytest-timeouts` Linux-only Pytest plugin to control durations of various test case execution phases Sep 21, 2019 5 - Production/Stable N/A :pypi:`pytest-timer` A timer plugin for pytest Jun 02, 2021 N/A N/A :pypi:`pytest-timestamper` Pytest plugin to add a timestamp prefix to the pytest output Jun 06, 2021 N/A N/A + :pypi:`pytest-timestamps` A simple plugin to view timestamps for each test Jan 14, 2022 N/A pytest (>=5.2) :pypi:`pytest-tipsi-django` Nov 17, 2021 4 - Beta pytest (>=6.0.0) :pypi:`pytest-tipsi-testing` Better fixtures management. Various helpers Nov 04, 2020 4 - Beta pytest (>=3.3.0) :pypi:`pytest-tldr` A pytest plugin that limits the output to just the things you need. Mar 12, 2021 4 - Beta pytest (>=3.5.0) @@ -1277,7 +1280,7 @@ This list contains 980 plugins. pyest results colection plugin :pypi:`pytest-arraydiff` - *last release*: Dec 31, 2021, + *last release*: Jan 13, 2022, *status*: 4 - Beta, *requires*: pytest (>=4.6) @@ -1347,11 +1350,11 @@ This list contains 980 plugins. :pypi:`pytest-asyncio` - *last release*: Oct 15, 2021, + *last release*: Jan 13, 2022, *status*: 4 - Beta, *requires*: pytest (>=5.4.0) - Pytest support for asyncio. + Pytest support for asyncio :pypi:`pytest-asyncio-cooperative` *last release*: Jan 03, 2022, @@ -3139,7 +3142,7 @@ This list contains 980 plugins. py.test plugin to store test expectations and mark tests based on them :pypi:`pytest-expecter` - *last release*: Jul 08, 2020, + *last release*: Jan 10, 2022, *status*: 5 - Production/Stable, *requires*: N/A @@ -3349,9 +3352,9 @@ This list contains 980 plugins. Pytest plugin for filtering based on sub-packages :pypi:`pytest-find-dependencies` - *last release*: Dec 26, 2021, + *last release*: Jan 15, 2022, *status*: 4 - Beta, - *requires*: pytest (>=3.5.0) + *requires*: pytest (>=4.3.0) A pytest plugin to find dependencies between tests @@ -3426,7 +3429,7 @@ This list contains 980 plugins. pytest plugin to check FLAKE8 requirements :pypi:`pytest-flake8-path` - *last release*: Aug 11, 2021, + *last release*: Jan 10, 2022, *status*: 5 - Production/Stable, *requires*: pytest @@ -3593,6 +3596,13 @@ This list contains 980 plugins. A flexible framework for executing BDD gherkin tests + :pypi:`pytest-gh-log-group` + *last release*: Jan 11, 2022, + *status*: 3 - Alpha, + *requires*: pytest + + pytest plugin for gh actions + :pypi:`pytest-ghostinspector` *last release*: May 17, 2016, *status*: 3 - Alpha, @@ -3601,7 +3611,7 @@ This list contains 980 plugins. For finding/executing Ghost Inspector tests :pypi:`pytest-girder` - *last release*: Nov 30, 2021, + *last release*: Jan 10, 2022, *status*: N/A, *requires*: N/A @@ -3720,7 +3730,7 @@ This list contains 980 plugins. A plugin to provide different types and configs of Kubernetes clusters that can be used for testing. :pypi:`pytest-helm-charts` - *last release*: Jan 04, 2022, + *last release*: Jan 10, 2022, *status*: 4 - Beta, *requires*: pytest (>=6.1.2,<7.0.0) @@ -3776,7 +3786,7 @@ This list contains 980 plugins. A pytest plugin for use with homeassistant custom components. :pypi:`pytest-homeassistant-custom-component` - *last release*: Jan 06, 2022, + *last release*: Jan 11, 2022, *status*: 3 - Alpha, *requires*: pytest (==6.2.5) @@ -3923,7 +3933,7 @@ This list contains 980 plugins. help hypo module for pytest :pypi:`pytest-ibutsu` - *last release*: Dec 15, 2021, + *last release*: Jan 14, 2022, *status*: 4 - Beta, *requires*: pytest @@ -3944,7 +3954,7 @@ This list contains 980 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-idempotent` - *last release*: Jan 08, 2022, + *last release*: Jan 10, 2022, *status*: N/A, *requires*: N/A @@ -4112,7 +4122,7 @@ This list contains 980 plugins. py.test plugin to check import ordering using isort :pypi:`pytest-is-running` - *last release*: Dec 06, 2021, + *last release*: Jan 10, 2022, *status*: 5 - Production/Stable, *requires*: pytest @@ -4679,16 +4689,16 @@ This list contains 980 plugins. An in-memory mock of a Redis server that runs in a separate thread. This is to be used for unit-tests that require a Redis database. :pypi:`pytest-mock-resources` - *last release*: Jan 07, 2022, + *last release*: Jan 11, 2022, *status*: N/A, *requires*: pytest (>=1.0) A pytest plugin for easily instantiating reproducible mock resources. :pypi:`pytest-mock-server` - *last release*: Apr 06, 2020, + *last release*: Jan 09, 2022, *status*: 4 - Beta, - *requires*: N/A + *requires*: pytest (>=3.5.0) Mock server plugin for pytest @@ -4847,7 +4857,7 @@ This list contains 980 plugins. Mypy static type checker plugin for Pytest :pypi:`pytest-mypy-plugins` - *last release*: Oct 19, 2021, + *last release*: Jan 11, 2022, *status*: 3 - Alpha, *requires*: pytest (>=6.0.0) @@ -5113,9 +5123,9 @@ This list contains 980 plugins. A pytest plugin for orchestrating tests :pypi:`pytest-order` - *last release*: May 30, 2021, + *last release*: Jan 09, 2022, *status*: 4 - Beta, - *requires*: pytest (>=5.0) + *requires*: pytest (>=5.0) ; python_version < "3.10" pytest plugin to run your tests in a specific order @@ -5295,7 +5305,7 @@ This list contains 980 plugins. Pytest tool for persistent objects :pypi:`pytest-pg` - *last release*: Jan 08, 2022, + *last release*: Jan 09, 2022, *status*: 5 - Production/Stable, *requires*: pytest (>=6.0.0) @@ -5841,7 +5851,7 @@ This list contains 980 plugins. py.test plugin to randomize tests :pypi:`pytest-randomly` - *last release*: Nov 30, 2021, + *last release*: Jan 10, 2022, *status*: 5 - Production/Stable, *requires*: pytest @@ -6072,7 +6082,7 @@ This list contains 980 plugins. pytest plugin for adding tests' parameters to junit report :pypi:`pytest-reportportal` - *last release*: Jun 18, 2021, + *last release*: Jan 11, 2022, *status*: N/A, *requires*: pytest (>=3.8.0) @@ -6156,7 +6166,7 @@ This list contains 980 plugins. py.test integration for responses :pypi:`pytest-restrict` - *last release*: Aug 12, 2021, + *last release*: Jan 10, 2022, *status*: 5 - Production/Stable, *requires*: pytest @@ -6170,7 +6180,7 @@ This list contains 980 plugins. A RethinkDB plugin for pytest. :pypi:`pytest-reverse` - *last release*: Aug 12, 2021, + *last release*: Jan 10, 2022, *status*: 5 - Production/Stable, *requires*: pytest @@ -6324,7 +6334,7 @@ This list contains 980 plugins. :pypi:`pytest-sbase` - *last release*: Jan 05, 2022, + *last release*: Jan 12, 2022, *status*: 5 - Production/Stable, *requires*: N/A @@ -6366,7 +6376,7 @@ This list contains 980 plugins. pytest plugin for Selenium :pypi:`pytest-seleniumbase` - *last release*: Jan 05, 2022, + *last release*: Jan 12, 2022, *status*: 5 - Production/Stable, *requires*: N/A @@ -6631,6 +6641,13 @@ This list contains 980 plugins. + :pypi:`pytest-solidity` + *last release*: Jan 15, 2022, + *status*: 1 - Planning, + *requires*: pytest (<7,>=6.0.1) ; extra == 'tests' + + A PyTest library plugin for Solidity language. + :pypi:`pytest-solr` *last release*: May 11, 2020, *status*: 3 - Alpha, @@ -6709,7 +6726,7 @@ This list contains 980 plugins. Pytest plugin for the splinter automation library :pypi:`pytest-split` - *last release*: Nov 09, 2021, + *last release*: Jan 10, 2022, *status*: 4 - Beta, *requires*: pytest (>=5,<7) @@ -6891,9 +6908,9 @@ This list contains 980 plugins. A hack to explicitly set up and tear down fixtures. :pypi:`pytest-subtests` - *last release*: May 29, 2021, + *last release*: Jan 15, 2022, *status*: 4 - Beta, - *requires*: pytest (>=5.3.0) + *requires*: pytest (>=6.0) unittest subTest() support and subtests fixture @@ -6919,7 +6936,7 @@ This list contains 980 plugins. Workaround for https://github.com/Frozenball/pytest-sugar/issues/159 :pypi:`pytest-super-check` - *last release*: Aug 12, 2021, + *last release*: Jan 10, 2022, *status*: 5 - Production/Stable, *requires*: pytest @@ -7261,6 +7278,13 @@ This list contains 980 plugins. Pytest plugin to add a timestamp prefix to the pytest output + :pypi:`pytest-timestamps` + *last release*: Jan 14, 2022, + *status*: N/A, + *requires*: pytest (>=5.2) + + A simple plugin to view timestamps for each test + :pypi:`pytest-tipsi-django` *last release*: Nov 17, 2021, *status*: 4 - Beta, From c393f95c9989d5187f07b8e62519bd5467f0f0db Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Jan 2022 03:02:30 +0000 Subject: [PATCH 082/176] build(deps): Bump anyio[curio,trio] in /testing/plugins_integration Bumps [anyio[curio,trio]](https://github.com/agronholm/anyio) from 3.4.0 to 3.5.0. - [Release notes](https://github.com/agronholm/anyio/releases) - [Changelog](https://github.com/agronholm/anyio/blob/master/docs/versionhistory.rst) - [Commits](https://github.com/agronholm/anyio/compare/3.4.0...3.5.0) --- updated-dependencies: - dependency-name: anyio[curio,trio] dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- testing/plugins_integration/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/plugins_integration/requirements.txt b/testing/plugins_integration/requirements.txt index c114a1de87e..8cf38ee53ca 100644 --- a/testing/plugins_integration/requirements.txt +++ b/testing/plugins_integration/requirements.txt @@ -1,4 +1,4 @@ -anyio[curio,trio]==3.4.0 +anyio[curio,trio]==3.5.0 django==4.0.1 pytest-asyncio==0.16.0 pytest-bdd==5.0.0 From 3f44b4078c6a69c73299f318d9a6816caedd258d Mon Sep 17 00:00:00 2001 From: Brett Holman Date: Tue, 18 Jan 2022 09:46:06 -0700 Subject: [PATCH 083/176] Add test coverage to test rewrite --- changelog/9521.improvement.rst | 1 + testing/test_assertrewrite.py | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 changelog/9521.improvement.rst diff --git a/changelog/9521.improvement.rst b/changelog/9521.improvement.rst new file mode 100644 index 00000000000..0c402ad242b --- /dev/null +++ b/changelog/9521.improvement.rst @@ -0,0 +1 @@ +Add test coverage to assertion rewrite path. diff --git a/testing/test_assertrewrite.py b/testing/test_assertrewrite.py index c568143f51c..dd1573935fc 100644 --- a/testing/test_assertrewrite.py +++ b/testing/test_assertrewrite.py @@ -1123,6 +1123,28 @@ def test_read_pyc(self, tmp_path: Path) -> None: assert _read_pyc(source, pyc) is None # no error + def test_read_pyc_success(self, tmp_path: Path, pytester: Pytester) -> None: + """ + Ensure that the _rewrite_test() -> _write_pyc() produces a pyc file + that can be properly read with _read_pyc() + """ + from _pytest.assertion import AssertionState + from _pytest.assertion.rewrite import _read_pyc + from _pytest.assertion.rewrite import _rewrite_test + from _pytest.assertion.rewrite import _write_pyc + + config = pytester.parseconfig() + state = AssertionState(config, "rewrite") + + fn = tmp_path / "source.py" + pyc = Path(str(fn) + "c") + + fn.write_text("def test(): assert True") + + source_stat, co = _rewrite_test(fn, config) + _write_pyc(state, co, source_stat, pyc) + assert _read_pyc(fn, pyc, state.trace) is not None + def test_read_pyc_more_invalid(self, tmp_path: Path) -> None: from _pytest.assertion.rewrite import _read_pyc From 1fd0dcd5108ae4abd960ddadb666f1d6a2d7177f Mon Sep 17 00:00:00 2001 From: Chris NeJame Date: Wed, 19 Jan 2022 09:09:47 -0500 Subject: [PATCH 084/176] fix missing ref to flattened fixture order image --- .../test_fixtures_order_autouse_flat.svg | 56 +++++++++++++++++++ doc/en/reference/fixtures.rst | 3 + 2 files changed, 59 insertions(+) create mode 100644 doc/en/example/fixtures/test_fixtures_order_autouse_flat.svg diff --git a/doc/en/example/fixtures/test_fixtures_order_autouse_flat.svg b/doc/en/example/fixtures/test_fixtures_order_autouse_flat.svg new file mode 100644 index 00000000000..03c4598272a --- /dev/null +++ b/doc/en/example/fixtures/test_fixtures_order_autouse_flat.svg @@ -0,0 +1,56 @@ + + + + + order + + a + + b + + c + + autouse + + d + + e + + f + + g + + test_order + diff --git a/doc/en/reference/fixtures.rst b/doc/en/reference/fixtures.rst index da2c5e009c3..d25979ab95d 100644 --- a/doc/en/reference/fixtures.rst +++ b/doc/en/reference/fixtures.rst @@ -401,6 +401,9 @@ the graph would look like this: Because ``c`` can now be put above ``d`` in the graph, pytest can once again linearize the graph to this: +.. image:: /example/fixtures/test_fixtures_order_autouse_flat.* + :align: center + In this example, ``c`` makes ``b`` and ``a`` effectively autouse fixtures as well. From 6672a103545f28b7d9fc455538769bb127744889 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Wed, 19 Jan 2022 15:42:04 +0200 Subject: [PATCH 085/176] fixtures: use node.ihook instead of open-coding it --- src/_pytest/fixtures.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/_pytest/fixtures.py b/src/_pytest/fixtures.py index e0409fcf2d7..be03fb2a820 100644 --- a/src/_pytest/fixtures.py +++ b/src/_pytest/fixtures.py @@ -992,8 +992,8 @@ def finish(self, request: SubRequest) -> None: if exc: raise exc finally: - hook = self._fixturemanager.session.gethookproxy(request.node.path) - hook.pytest_fixture_post_finalizer(fixturedef=self, request=request) + ihook = request.node.ihook + ihook.pytest_fixture_post_finalizer(fixturedef=self, request=request) # Even if finalization fails, we invalidate the cached fixture # value and remove all finalizers because they may be bound methods # which will keep instances alive. @@ -1027,8 +1027,8 @@ def execute(self, request: SubRequest) -> FixtureValue: self.finish(request) assert self.cached_result is None - hook = self._fixturemanager.session.gethookproxy(request.node.path) - result = hook.pytest_fixture_setup(fixturedef=self, request=request) + ihook = request.node.ihook + result = ihook.pytest_fixture_setup(fixturedef=self, request=request) return result def cache_key(self, request: SubRequest) -> object: From 4e5fb520b620b9d50479b8e4e9ac85863f1558c0 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Wed, 6 Oct 2021 22:39:49 +0300 Subject: [PATCH 086/176] python: remove an unneeded normalize_mark_list call `callspec.mark` is already `List[Mark]` so no need to normalize it. --- src/_pytest/python.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_pytest/python.py b/src/_pytest/python.py index 513214e08c8..98c28b3d2f9 100644 --- a/src/_pytest/python.py +++ b/src/_pytest/python.py @@ -1666,7 +1666,7 @@ def __init__( # feel free to cry, this was broken for years before # and keywords can't fix it per design self.keywords[mark.name] = mark - self.own_markers.extend(normalize_mark_list(callspec.marks)) + self.own_markers.extend(callspec.marks) if keywords: self.keywords.update(keywords) From e9bb1aa233c882de53172cdd5e762a8a49e427a7 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Thu, 7 Oct 2021 00:42:43 +0300 Subject: [PATCH 087/176] python: be consistent with what value marks have in keywords Marks are added to keywords in three places: - `Node.add_marker`: name -> `Mark` - `Function.__init__(callspec)`: name -> `Mark` - `Function.__init__ iter_markers`: name -> True I think it should be consistent, which will also help with some upcoming code cleaning. The `Mark` seems more useful than just a `True`, so switch to that. --- src/_pytest/python.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_pytest/python.py b/src/_pytest/python.py index 98c28b3d2f9..d07c01d7bc9 100644 --- a/src/_pytest/python.py +++ b/src/_pytest/python.py @@ -1675,7 +1675,7 @@ def __init__( self.keywords.update( { - mark.name: True + mark.name: mark for mark in self.iter_markers() if mark.name not in self.keywords } From 8713c3246212b04ae75739a02c72c581ea5570d7 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Thu, 7 Oct 2021 00:37:19 +0300 Subject: [PATCH 088/176] python: unpacked marks need to be added to keywords on all node types (except `Instance`) Currently, `Function` does this manually, but other node types don't get their markers added to their `keywords`, but they should, if only for consistency. --- src/_pytest/python.py | 3 +++ testing/test_collection.py | 30 ++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/src/_pytest/python.py b/src/_pytest/python.py index d07c01d7bc9..71c998c8e54 100644 --- a/src/_pytest/python.py +++ b/src/_pytest/python.py @@ -303,6 +303,9 @@ def obj(self): # used to avoid Function marker duplication if self._ALLOW_MARKERS: self.own_markers.extend(get_unpacked_marks(self.obj)) + # This assumes that `obj` is called before there is a chance + # to add custom keys to `self.keywords`, so no fear of overriding. + self.keywords.update({mark.name: mark for mark in self.own_markers}) return obj @obj.setter diff --git a/testing/test_collection.py b/testing/test_collection.py index 6a8a5c1cef1..e79ae384d7a 100644 --- a/testing/test_collection.py +++ b/testing/test_collection.py @@ -881,6 +881,36 @@ def test_method(self): pass assert item.keywords["kw"] == "method" assert len(item.keywords) == len(set(item.keywords)) + def test_unpacked_marks_added_to_keywords(self, pytester: Pytester) -> None: + item = pytester.getitem( + """ + import pytest + pytestmark = pytest.mark.foo + class TestClass: + pytestmark = pytest.mark.bar + def test_method(self): pass + test_method.pytestmark = pytest.mark.baz + """, + "test_method", + ) + assert isinstance(item, pytest.Function) + cls = item.getparent(pytest.Class) + assert cls is not None + mod = item.getparent(pytest.Module) + assert mod is not None + + assert item.keywords["foo"] == pytest.mark.foo.mark + assert item.keywords["bar"] == pytest.mark.bar.mark + assert item.keywords["baz"] == pytest.mark.baz.mark + + assert cls.keywords["foo"] == pytest.mark.foo.mark + assert cls.keywords["bar"] == pytest.mark.bar.mark + assert "baz" not in cls.keywords + + assert mod.keywords["foo"] == pytest.mark.foo.mark + assert "bar" not in mod.keywords + assert "baz" not in mod.keywords + COLLECTION_ERROR_PY_FILES = dict( test_01_failure=""" From d9bcfa0c2bb0ebf8e0a59c8296625a1eca77da05 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Wed, 6 Oct 2021 22:41:04 +0300 Subject: [PATCH 089/176] python: don't redundantly duplicate parent markers to own keywords This does have a slight semantic change: in a node hierarchy parent -> child, if parent has a marker applied, then child is constructed, then `parent.themarker = "overridden"`, previously `child.keywords['themarker']` would return `True`, now it returns `"overridden"`. But that's actually what I would have expected so I see it as more of a bugfix. --- src/_pytest/python.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/_pytest/python.py b/src/_pytest/python.py index 71c998c8e54..60b2ae20fd3 100644 --- a/src/_pytest/python.py +++ b/src/_pytest/python.py @@ -1676,10 +1676,11 @@ def __init__( # todo: this is a hell of a hack # https://github.com/pytest-dev/pytest/issues/4569 + # Take own_markers only; NodeKeywords handles parent traversal on its own. self.keywords.update( { mark.name: mark - for mark in self.iter_markers() + for mark in self.own_markers if mark.name not in self.keywords } ) From 3c69bc919c1cc5c45f52b90ef1ebdd136952d577 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Wed, 6 Oct 2021 22:59:34 +0300 Subject: [PATCH 090/176] python: remove broken/ineffectual keywords marks initialization By my analysis, this deleted code block has no effect: 1. `self.keywords` is `update`d with `callspec.marks`. 2. `self.own_markers` is `update`d with `callspec.marks`. 3. `self.keywords` is `update`d with `self.own_markers`. So together steps 2+3 completely undo step 1. --- src/_pytest/python.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/_pytest/python.py b/src/_pytest/python.py index 60b2ae20fd3..63701a5355e 100644 --- a/src/_pytest/python.py +++ b/src/_pytest/python.py @@ -1662,13 +1662,6 @@ def __init__( self.own_markers.extend(get_unpacked_marks(self.obj)) if callspec: self.callspec = callspec - # this is total hostile and a mess - # keywords are broken by design by now - # this will be redeemed later - for mark in callspec.marks: - # feel free to cry, this was broken for years before - # and keywords can't fix it per design - self.keywords[mark.name] = mark self.own_markers.extend(callspec.marks) if keywords: self.keywords.update(keywords) From 456a2538acfe72ba080e1beaf907cbea822153c8 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Wed, 6 Oct 2021 22:50:36 +0300 Subject: [PATCH 091/176] python: optimize node keywords initialization If we do the `update`s in the right order, we can avoid the `mark.name not in self.keywords` check, since `self.keywords` starts out clean and `update` will override previously set keywords. --- src/_pytest/python.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/_pytest/python.py b/src/_pytest/python.py index 63701a5355e..b71f1bbfc0f 100644 --- a/src/_pytest/python.py +++ b/src/_pytest/python.py @@ -1658,25 +1658,20 @@ def __init__( # Note: when FunctionDefinition is introduced, we should change ``originalname`` # to a readonly property that returns FunctionDefinition.name. - self.keywords.update(self.obj.__dict__) self.own_markers.extend(get_unpacked_marks(self.obj)) if callspec: self.callspec = callspec self.own_markers.extend(callspec.marks) - if keywords: - self.keywords.update(keywords) # todo: this is a hell of a hack # https://github.com/pytest-dev/pytest/issues/4569 - + # Note: the order of the updates is important here; indicates what + # takes priority (ctor argument over function attributes over markers). # Take own_markers only; NodeKeywords handles parent traversal on its own. - self.keywords.update( - { - mark.name: mark - for mark in self.own_markers - if mark.name not in self.keywords - } - ) + self.keywords.update({mark.name: mark for mark in self.own_markers}) + self.keywords.update(self.obj.__dict__) + if keywords: + self.keywords.update(keywords) if fixtureinfo is None: fixtureinfo = self.session._fixturemanager.getfixtureinfo( From 74571ba55f66cba9ed18945212af4afab6a2cab6 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Wed, 6 Oct 2021 23:29:48 +0300 Subject: [PATCH 092/176] Add missing `keywords` type annotations --- src/_pytest/python.py | 2 +- src/_pytest/reports.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/_pytest/python.py b/src/_pytest/python.py index b71f1bbfc0f..9b1d3119b21 100644 --- a/src/_pytest/python.py +++ b/src/_pytest/python.py @@ -1637,7 +1637,7 @@ def __init__( config: Optional[Config] = None, callspec: Optional[CallSpec2] = None, callobj=NOTSET, - keywords=None, + keywords: Optional[Mapping[str, Any]] = None, session: Optional[Session] = None, fixtureinfo: Optional[FuncFixtureInfo] = None, originalname: Optional[str] = None, diff --git a/src/_pytest/reports.py b/src/_pytest/reports.py index a68e68bc526..725fdf61739 100644 --- a/src/_pytest/reports.py +++ b/src/_pytest/reports.py @@ -7,6 +7,7 @@ from typing import Iterable from typing import Iterator from typing import List +from typing import Mapping from typing import Optional from typing import Tuple from typing import Type @@ -254,7 +255,7 @@ def __init__( self, nodeid: str, location: Tuple[str, Optional[int], str], - keywords, + keywords: Mapping[str, Any], outcome: "Literal['passed', 'failed', 'skipped']", longrepr: Union[ None, ExceptionInfo[BaseException], Tuple[str, int, str], str, TerminalRepr From 6d128cd52ef70e401999acda8d45dd5f6139b071 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Thu, 7 Oct 2021 01:15:22 +0300 Subject: [PATCH 093/176] python: use a more memory-friendly generator --- src/_pytest/python.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/_pytest/python.py b/src/_pytest/python.py index 9b1d3119b21..6fda4d544e7 100644 --- a/src/_pytest/python.py +++ b/src/_pytest/python.py @@ -305,7 +305,7 @@ def obj(self): self.own_markers.extend(get_unpacked_marks(self.obj)) # This assumes that `obj` is called before there is a chance # to add custom keys to `self.keywords`, so no fear of overriding. - self.keywords.update({mark.name: mark for mark in self.own_markers}) + self.keywords.update((mark.name, mark) for mark in self.own_markers) return obj @obj.setter @@ -1668,7 +1668,7 @@ def __init__( # Note: the order of the updates is important here; indicates what # takes priority (ctor argument over function attributes over markers). # Take own_markers only; NodeKeywords handles parent traversal on its own. - self.keywords.update({mark.name: mark for mark in self.own_markers}) + self.keywords.update((mark.name, mark) for mark in self.own_markers) self.keywords.update(self.obj.__dict__) if keywords: self.keywords.update(keywords) From 471634d6bdc2ac6b838d8fd191d274bea2a97c97 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Fri, 21 Jan 2022 16:16:40 +0200 Subject: [PATCH 094/176] python: fix confused docstring of `Metafunc._resolve_arg_ids` The docstring (and function name itself) described things as if IDs are being assigned to the argnames, but actually they're assigned to the parameter sets. --- src/_pytest/python.py | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/src/_pytest/python.py b/src/_pytest/python.py index 513214e08c8..da3bd950ddd 100644 --- a/src/_pytest/python.py +++ b/src/_pytest/python.py @@ -1118,7 +1118,7 @@ def parametrize( It will also override any fixture-function defined scope, allowing to set a dynamic scope using test context or configuration. """ - argnames, parameters = ParameterSet._for_parametrize( + argnames, parametersets = ParameterSet._for_parametrize( argnames, argvalues, self.function, @@ -1150,8 +1150,8 @@ def parametrize( if generated_ids is not None: ids = generated_ids - ids = self._resolve_arg_ids( - argnames, ids, parameters, nodeid=self.definition.nodeid + ids = self._resolve_parameter_set_ids( + argnames, ids, parametersets, nodeid=self.definition.nodeid ) # Store used (possibly generated) ids with parametrize Marks. @@ -1163,7 +1163,9 @@ def parametrize( # of all calls. newcalls = [] for callspec in self._calls or [CallSpec2()]: - for param_index, (param_id, param_set) in enumerate(zip(ids, parameters)): + for param_index, (param_id, param_set) in enumerate( + zip(ids, parametersets) + ): newcallspec = callspec.setmulti( valtypes=arg_values_types, argnames=argnames, @@ -1176,7 +1178,7 @@ def parametrize( newcalls.append(newcallspec) self._calls = newcalls - def _resolve_arg_ids( + def _resolve_parameter_set_ids( self, argnames: Sequence[str], ids: Optional[ @@ -1185,18 +1187,23 @@ def _resolve_arg_ids( Callable[[Any], Optional[object]], ] ], - parameters: Sequence[ParameterSet], + parametersets: Sequence[ParameterSet], nodeid: str, ) -> List[str]: - """Resolve the actual ids for the given argnames, based on the ``ids`` parameter given - to ``parametrize``. + """Resolve the actual ids for the given parameter sets. - :param List[str] argnames: List of argument names passed to ``parametrize()``. - :param ids: The ids parameter of the parametrized call (see docs). - :param List[ParameterSet] parameters: The list of parameter values, same size as ``argnames``. - :param str str: The nodeid of the item that generated this parametrized call. - :rtype: List[str] - :returns: The list of ids for each argname given. + :param argnames: + Argument names passed to ``parametrize()``. + :param ids: + The `ids` parameter of the ``parametrize()`` call (see docs). + :param parametersets: + The parameter sets, each containing a set of values corresponding + to ``argnames``. + :param nodeid str: + The nodeid of the definition item that generated this + parametrization. + :returns: + List with ids for each parameter set given. """ if ids is None: idfn = None @@ -1206,8 +1213,8 @@ def _resolve_arg_ids( ids_ = None else: idfn = None - ids_ = self._validate_ids(ids, parameters, self.function.__name__) - return idmaker(argnames, parameters, idfn, ids_, self.config, nodeid=nodeid) + ids_ = self._validate_ids(ids, parametersets, self.function.__name__) + return idmaker(argnames, parametersets, idfn, ids_, self.config, nodeid=nodeid) def _validate_ids( self, From aee04cd49f9470ea5bf409c9de532b186a084c76 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Sat, 22 Jan 2022 00:27:43 +0200 Subject: [PATCH 095/176] config: avoid stat storm in _getconftestmodules Fix #9478. --- src/_pytest/config/__init__.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/_pytest/config/__init__.py b/src/_pytest/config/__init__.py index 3896313e033..59c88885df5 100644 --- a/src/_pytest/config/__init__.py +++ b/src/_pytest/config/__init__.py @@ -330,6 +330,14 @@ def _prepareconfig( raise +def _get_directory(path: Path) -> Path: + """Get the directory of a path - itself if already a directory.""" + if path.is_file(): + return path.parent + else: + return path + + @final class PytestPluginManager(PluginManager): """A :py:class:`pluggy.PluginManager ` with @@ -357,6 +365,11 @@ def __init__(self) -> None: # If set, conftest loading is skipped. self._noconftest = False + # _getconftestmodules()'s call to _get_directory() causes a stat + # storm when it's called potentially thousands of times in a test + # session (#9478), often with the same path, so cache it. + self._get_directory = lru_cache(256)(_get_directory) + self._duplicatepaths: Set[Path] = set() # plugins that were explicitly skipped with pytest.skip @@ -547,10 +560,7 @@ def _getconftestmodules( if self._noconftest: return [] - if path.is_file(): - directory = path.parent - else: - directory = path + directory = self._get_directory(path) # Optimization: avoid repeated searches in the same directory. # Assumes always called with same importmode and rootpath. From dddadefa68fe519ade65dcd675cf17fd440167e9 Mon Sep 17 00:00:00 2001 From: pytest bot Date: Sun, 23 Jan 2022 00:12:46 +0000 Subject: [PATCH 096/176] [automated] Update plugin list --- doc/en/reference/plugin_list.rst | 168 +++++++++++++++---------------- 1 file changed, 80 insertions(+), 88 deletions(-) diff --git a/doc/en/reference/plugin_list.rst b/doc/en/reference/plugin_list.rst index f8ad9f0bdf7..7c0f3c86bd5 100644 --- a/doc/en/reference/plugin_list.rst +++ b/doc/en/reference/plugin_list.rst @@ -11,7 +11,7 @@ automatically. Packages classified as inactive are excluded. creating a PDF, because otherwise the table gets far too wide for the page. -This list contains 983 plugins. +This list contains 982 plugins. .. only:: not latex @@ -19,7 +19,7 @@ This list contains 983 plugins. name summary last release status requires =============================================== ======================================================================================================================================================================== ============== ===================== ================================================ :pypi:`pytest-accept` A pytest-plugin for updating doctest outputs Jan 07, 2022 N/A pytest (>=6,<8) - :pypi:`pytest-adaptavist` pytest plugin for generating test execution results within Jira Test Management (tm4j) Nov 30, 2021 N/A pytest (>=5.4.0) + :pypi:`pytest-adaptavist` pytest plugin for generating test execution results within Jira Test Management (tm4j) Jan 21, 2022 N/A pytest (>=5.4.0) :pypi:`pytest-addons-test` 用于测试pytest的插件 Aug 02, 2021 N/A pytest (>=6.2.4,<7.0.0) :pypi:`pytest-adf` Pytest plugin for writing Azure Data Factory integration tests May 10, 2021 4 - Beta pytest (>=3.5.0) :pypi:`pytest-adf-azure-identity` Pytest plugin for writing Azure Data Factory integration tests Mar 06, 2021 4 - Beta pytest (>=3.5.0) @@ -27,7 +27,7 @@ This list contains 983 plugins. :pypi:`pytest-aggreport` pytest plugin for pytest-repeat that generate aggregate report of the same test cases with additional statistics details. Mar 07, 2021 4 - Beta pytest (>=6.2.2) :pypi:`pytest-aio` Pytest plugin for testing async python code Oct 20, 2021 4 - Beta pytest :pypi:`pytest-aiofiles` pytest fixtures for writing aiofiles tests with pyfakefs May 14, 2017 5 - Production/Stable N/A - :pypi:`pytest-aiohttp` pytest plugin for aiohttp support Dec 05, 2017 N/A pytest + :pypi:`pytest-aiohttp` Pytest plugin for aiohttp support Jan 21, 2022 4 - Beta pytest (>=6.1.0) :pypi:`pytest-aiohttp-client` Pytest \`client\` fixture for the Aiohttp Nov 01, 2020 N/A pytest (>=6) :pypi:`pytest-aiomoto` pytest-aiomoto Dec 10, 2021 N/A pytest (>=6.2.5,<7.0.0) :pypi:`pytest-aioresponses` py.test integration for aioresponses Jul 29, 2021 4 - Beta pytest (>=3.5.0) @@ -67,7 +67,7 @@ This list contains 983 plugins. :pypi:`pytest-astropy` Meta-package containing dependencies for testing Sep 21, 2021 5 - Production/Stable pytest (>=4.6) :pypi:`pytest-astropy-header` pytest plugin to add diagnostic information to the header of the test output Dec 27, 2021 3 - Alpha pytest (>=4.6) :pypi:`pytest-ast-transformer` May 04, 2019 3 - Alpha pytest - :pypi:`pytest-asyncio` Pytest support for asyncio Jan 13, 2022 4 - Beta pytest (>=5.4.0) + :pypi:`pytest-asyncio` Pytest support for asyncio Jan 17, 2022 4 - Beta pytest (>=6.1.0) :pypi:`pytest-asyncio-cooperative` Run all your asynchronous tests cooperatively. Jan 03, 2022 N/A N/A :pypi:`pytest-asyncio-network-simulator` pytest-asyncio-network-simulator: Plugin for pytest for simulator the network in tests Jul 31, 2018 3 - Alpha pytest (<3.7.0,>=3.3.2) :pypi:`pytest-async-mongodb` pytest plugin for async MongoDB Oct 18, 2017 5 - Production/Stable pytest (>=2.5.2) @@ -115,7 +115,7 @@ This list contains 983 plugins. :pypi:`pytest-browsermob-proxy` BrowserMob proxy plugin for py.test. Jun 11, 2013 4 - Beta N/A :pypi:`pytest-browserstack-local` \`\`py.test\`\` plugin to run \`\`BrowserStackLocal\`\` in background. Feb 09, 2018 N/A N/A :pypi:`pytest-bug` Pytest plugin for marking tests as a bug Jun 02, 2020 5 - Production/Stable pytest (>=3.6.0) - :pypi:`pytest-bugtong-tag` pytest-bugtong-tag is a plugin for pytest Apr 23, 2021 N/A N/A + :pypi:`pytest-bugtong-tag` pytest-bugtong-tag is a plugin for pytest Jan 16, 2022 N/A N/A :pypi:`pytest-bugzilla` py.test bugzilla integration plugin May 05, 2010 4 - Beta N/A :pypi:`pytest-bugzilla-notifier` A plugin that allows you to execute create, update, and read information from BugZilla bugs Jun 15, 2018 4 - Beta pytest (>=2.9.2) :pypi:`pytest-buildkite` Plugin for pytest that automatically publishes coverage and pytest report annotations to Buildkite. Jul 13, 2019 4 - Beta pytest (>=3.5.0) @@ -152,7 +152,6 @@ This list contains 983 plugins. :pypi:`pytest-cloud` Distributed tests planner plugin for pytest testing framework. Oct 05, 2020 6 - Mature N/A :pypi:`pytest-cloudflare-worker` pytest plugin for testing cloudflare workers Mar 30, 2021 4 - Beta pytest (>=6.0.0) :pypi:`pytest-cobra` PyTest plugin for testing Smart Contracts for Ethereum blockchain. Jun 29, 2019 3 - Alpha pytest (<4.0.0,>=3.7.1) - :pypi:`pytest-codeblocks` Test code blocks in your READMEs Dec 21, 2021 4 - Beta pytest (>=6) :pypi:`pytest-codecheckers` pytest plugin to add source code sanity checks (pep8 and friends) Feb 13, 2010 N/A N/A :pypi:`pytest-codecov` Pytest plugin for uploading pytest-cov results to codecov.io Oct 27, 2021 4 - Beta pytest (>=4.6.0) :pypi:`pytest-codegen` Automatically create pytest test signatures Aug 23, 2020 2 - Pre-Alpha N/A @@ -197,7 +196,7 @@ This list contains 983 plugins. :pypi:`pytest-data` Useful functions for managing data for pytest fixtures Nov 01, 2016 5 - Production/Stable N/A :pypi:`pytest-databricks` Pytest plugin for remote Databricks notebooks testing Jul 29, 2020 N/A pytest :pypi:`pytest-datadir` pytest plugin for test data directories and files Oct 22, 2019 5 - Production/Stable pytest (>=2.7.0) - :pypi:`pytest-datadir-mgr` Manager for test data providing downloads, caching of generated files, and a context for temp directories. Aug 16, 2021 5 - Production/Stable pytest + :pypi:`pytest-datadir-mgr` Manager for test data: downloads, artifact caching, and a tmpdir context. Jan 20, 2022 5 - Production/Stable pytest :pypi:`pytest-datadir-ng` Fixtures for pytest allowing test functions/methods to easily retrieve test resources from the local filesystem. Dec 25, 2019 5 - Production/Stable pytest :pypi:`pytest-data-file` Fixture "data" and "case_data" for test from yaml file Dec 04, 2019 N/A N/A :pypi:`pytest-datafiles` py.test plugin to create a 'tmpdir' containing predefined files/directories. Oct 07, 2018 5 - Production/Stable pytest (>=3.6) @@ -239,7 +238,7 @@ This list contains 983 plugins. :pypi:`pytest-django-haystack` Cleanup your Haystack indexes between tests Sep 03, 2017 5 - Production/Stable pytest (>=2.3.4) :pypi:`pytest-django-ifactory` A model instance factory for pytest-django Jan 13, 2021 3 - Alpha N/A :pypi:`pytest-django-lite` The bare minimum to integrate py.test with Django. Jan 30, 2014 N/A N/A - :pypi:`pytest-django-liveserver-ssl` Jul 30, 2021 3 - Alpha N/A + :pypi:`pytest-django-liveserver-ssl` Jan 20, 2022 3 - Alpha N/A :pypi:`pytest-django-model` A Simple Way to Test your Django Models Feb 14, 2019 4 - Beta N/A :pypi:`pytest-django-ordering` A pytest plugin for preserving the order in which Django runs tests. Jul 25, 2019 5 - Production/Stable pytest (>=2.3.0) :pypi:`pytest-django-queries` Generate performance reports from your django database performance tests. Mar 01, 2021 N/A N/A @@ -291,14 +290,14 @@ This list contains 983 plugins. :pypi:`pytest-elements` Tool to help automate user interfaces Jan 13, 2021 N/A pytest (>=5.4,<6.0) :pypi:`pytest-elk-reporter` A simple plugin to use with pytest Jan 24, 2021 4 - Beta pytest (>=3.5.0) :pypi:`pytest-email` Send execution result email Jul 08, 2020 N/A pytest - :pypi:`pytest-embedded` pytest embedded plugin Jan 06, 2022 N/A pytest (>=6.2.0) - :pypi:`pytest-embedded-arduino` pytest embedded plugin for Arduino projects Jan 06, 2022 N/A N/A - :pypi:`pytest-embedded-idf` pytest embedded plugin for esp-idf project Jan 06, 2022 N/A N/A - :pypi:`pytest-embedded-jtag` pytest embedded plugin for testing with jtag Jan 06, 2022 N/A N/A - :pypi:`pytest-embedded-qemu` pytest embedded plugin for qemu, not target chip Jan 06, 2022 N/A N/A + :pypi:`pytest-embedded` pytest embedded plugin Jan 21, 2022 N/A pytest (>=6.2.0) + :pypi:`pytest-embedded-arduino` pytest embedded plugin for Arduino projects Jan 21, 2022 N/A N/A + :pypi:`pytest-embedded-idf` pytest embedded plugin for esp-idf project Jan 21, 2022 N/A N/A + :pypi:`pytest-embedded-jtag` pytest embedded plugin for testing with jtag Jan 21, 2022 N/A N/A + :pypi:`pytest-embedded-qemu` pytest embedded plugin for qemu, not target chip Jan 21, 2022 N/A N/A :pypi:`pytest-embedded-qemu-idf` pytest embedded plugin for esp-idf project by qemu, not target chip Jun 29, 2021 N/A N/A - :pypi:`pytest-embedded-serial` pytest embedded plugin for testing serial ports Jan 06, 2022 N/A N/A - :pypi:`pytest-embedded-serial-esp` pytest embedded plugin for testing espressif boards via serial ports Jan 06, 2022 N/A N/A + :pypi:`pytest-embedded-serial` pytest embedded plugin for testing serial ports Jan 21, 2022 N/A N/A + :pypi:`pytest-embedded-serial-esp` pytest embedded plugin for testing espressif boards via serial ports Jan 21, 2022 N/A N/A :pypi:`pytest-emoji` A pytest plugin that adds emojis to your test result report Feb 19, 2019 4 - Beta pytest (>=4.2.1) :pypi:`pytest-emoji-output` Pytest plugin to represent test output with emoji support Oct 10, 2021 4 - Beta pytest (==6.0.1) :pypi:`pytest-enabler` Enable installed pytest plugins Nov 08, 2021 5 - Production/Stable pytest (>=6) ; extra == 'testing' @@ -353,7 +352,7 @@ This list contains 983 plugins. :pypi:`pytest-filemarker` A pytest plugin that runs marked tests when files change. Dec 01, 2020 N/A pytest :pypi:`pytest-filter-case` run test cases filter by mark Nov 05, 2020 N/A N/A :pypi:`pytest-filter-subpackage` Pytest plugin for filtering based on sub-packages Jan 09, 2020 3 - Alpha pytest (>=3.0) - :pypi:`pytest-find-dependencies` A pytest plugin to find dependencies between tests Jan 15, 2022 4 - Beta pytest (>=4.3.0) + :pypi:`pytest-find-dependencies` A pytest plugin to find dependencies between tests Jan 16, 2022 4 - Beta pytest (>=4.3.0) :pypi:`pytest-finer-verdicts` A pytest plugin to treat non-assertion failures as test errors. Jun 18, 2020 N/A pytest (>=5.4.3) :pypi:`pytest-firefox` pytest plugin to manipulate firefox Aug 08, 2017 3 - Alpha pytest (>=3.0.2) :pypi:`pytest-fixture-config` Fixture configuration utils for py.test May 28, 2019 5 - Production/Stable pytest @@ -365,7 +364,7 @@ This list contains 983 plugins. :pypi:`pytest-fixture-typecheck` A pytest plugin to assert type annotations at runtime. Aug 24, 2021 N/A pytest :pypi:`pytest-flake8` pytest plugin to check FLAKE8 requirements Dec 16, 2020 4 - Beta pytest (>=3.5) :pypi:`pytest-flake8-path` A pytest fixture for testing flake8 plugins. Jan 10, 2022 5 - Production/Stable pytest - :pypi:`pytest-flake8-v2` pytest plugin to check FLAKE8 requirements Jan 04, 2022 4 - Beta pytest (>=3.5) + :pypi:`pytest-flake8-v2` pytest plugin to check FLAKE8 requirements Jan 20, 2022 4 - Beta pytest (>=3.5) :pypi:`pytest-flakefinder` Runs tests multiple times to expose flakiness. Jul 28, 2020 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 @@ -415,10 +414,10 @@ This list contains 983 plugins. :pypi:`pytest-historic` Custom report to display pytest historical execution records Apr 08, 2020 N/A pytest :pypi:`pytest-historic-hook` Custom listener to store execution results into MYSQL DB, which is used for pytest-historic report Apr 08, 2020 N/A pytest :pypi:`pytest-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 Jan 11, 2022 3 - Alpha pytest (==6.2.5) + :pypi:`pytest-homeassistant-custom-component` Experimental package to automatically extract test plugins for Home Assistant custom components Jan 18, 2022 3 - Alpha pytest (==6.2.5) :pypi:`pytest-honey` A simple plugin to use with pytest Jan 07, 2022 4 - Beta pytest (>=3.5.0) :pypi:`pytest-honors` Report on tests that honor constraints, and guard against regressions Mar 06, 2020 4 - Beta N/A - :pypi:`pytest-hoverfly` Simplify working with Hoverfly from pytest Jul 12, 2021 N/A pytest (>=5.0) + :pypi:`pytest-hoverfly` Simplify working with Hoverfly from pytest Jan 20, 2022 N/A pytest (>=5.0) :pypi:`pytest-hoverfly-wrapper` Integrates the Hoverfly HTTP proxy into Pytest Aug 29, 2021 4 - Beta N/A :pypi:`pytest-hpfeeds` Helpers for testing hpfeeds in your python project Aug 27, 2021 4 - Beta pytest (>=6.2.4,<7.0.0) :pypi:`pytest-html` pytest plugin for generating HTML reports Dec 13, 2020 5 - Production/Stable pytest (!=6.0.0,>=5.0) @@ -431,7 +430,7 @@ This list contains 983 plugins. :pypi:`pytest-http-mocker` Pytest plugin for http mocking (via https://github.com/vilus/mocker) Oct 20, 2019 N/A N/A :pypi:`pytest-httpretty` A thin wrapper of HTTPretty for pytest Feb 16, 2014 3 - Alpha N/A :pypi:`pytest-httpserver` pytest-httpserver is a httpserver for pytest Dec 15, 2021 3 - Alpha N/A - :pypi:`pytest-httpx` Send responses to httpx. Dec 27, 2021 5 - Production/Stable pytest (==6.*) + :pypi:`pytest-httpx` Send responses to httpx. Jan 17, 2022 5 - Production/Stable pytest (==6.*) :pypi:`pytest-httpx-blockage` Disable httpx requests during a test run Nov 16, 2021 N/A pytest (>=6.2.5) :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 @@ -441,7 +440,7 @@ This list contains 983 plugins. :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-idempotent` Pytest plugin for testing function idempotence. Jan 10, 2022 N/A N/A :pypi:`pytest-ignore-flaky` ignore failures from flaky tests (pytest plugin) Apr 23, 2021 5 - Production/Stable N/A - :pypi:`pytest-image-diff` Jul 28, 2021 3 - Alpha pytest + :pypi:`pytest-image-diff` Jan 20, 2022 3 - Alpha pytest :pypi:`pytest-incremental` an incremental test runner (pytest plugin) Apr 24, 2021 5 - Production/Stable N/A :pypi:`pytest-influxdb` Plugin for influxdb and pytest integration. Apr 20, 2021 N/A N/A :pypi:`pytest-info-collector` pytest plugin to collect information from tests May 26, 2019 3 - Alpha N/A @@ -578,7 +577,7 @@ This list contains 983 plugins. :pypi:`pytest-never-sleep` pytest plugin helps to avoid adding tests without mock \`time.sleep\` May 05, 2021 3 - Alpha pytest (>=3.5.1) :pypi:`pytest-nginx` nginx fixture for pytest Aug 12, 2017 5 - Production/Stable N/A :pypi:`pytest-nginx-iplweb` nginx fixture for pytest - iplweb temporary fork Mar 01, 2019 5 - Production/Stable N/A - :pypi:`pytest-ngrok` Jan 22, 2020 3 - Alpha N/A + :pypi:`pytest-ngrok` Jan 20, 2022 3 - Alpha pytest :pypi:`pytest-ngsfixtures` pytest ngs fixtures Sep 06, 2019 2 - Pre-Alpha pytest (>=5.0.0) :pypi:`pytest-nice` A pytest plugin that alerts user of failed test cases with screen notifications May 04, 2019 4 - Beta pytest :pypi:`pytest-nice-parametrize` A small snippet for nicer PyTest's Parametrize Apr 17, 2021 5 - Production/Stable N/A @@ -586,7 +585,6 @@ This list contains 983 plugins. :pypi:`pytest-nocustom` Run all tests without custom markers Jul 07, 2021 5 - Production/Stable N/A :pypi:`pytest-nodev` Test-driven source code search for Python. Jul 21, 2016 4 - Beta pytest (>=2.8.1) :pypi:`pytest-nogarbage` Ensure a test produces no garbage Aug 29, 2021 5 - Production/Stable pytest (>=4.6.0) - :pypi:`pytest-notebook` A pytest plugin for testing Jupyter Notebooks Sep 16, 2020 4 - Beta pytest (>=3.5.0) :pypi:`pytest-notice` Send pytest execution result email Nov 05, 2020 N/A N/A :pypi:`pytest-notification` A pytest plugin for sending a desktop notification and playing a sound upon completion of tests Jun 19, 2020 N/A pytest (>=4) :pypi:`pytest-notifier` A pytest plugin to notify test result Jun 12, 2020 3 - Alpha pytest @@ -601,7 +599,7 @@ This list contains 983 plugins. :pypi:`pytest-only` Use @pytest.mark.only to run a single test Jan 19, 2020 N/A 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-opentmi` pytest plugin for publish results to opentmi Nov 04, 2021 5 - Production/Stable pytest (>=5.0) + :pypi:`pytest-opentmi` pytest plugin for publish results to opentmi Jan 19, 2022 5 - Production/Stable pytest (>=5.0) :pypi:`pytest-operator` Fixtures for Operators Dec 06, 2021 N/A N/A :pypi:`pytest-optional` include/exclude values of fixtures in pytest Oct 07, 2015 N/A N/A :pypi:`pytest-optional-tests` Easy declaration of optional tests (i.e., that are not run by default) Jul 09, 2019 4 - Beta pytest (>=4.5.0) @@ -632,7 +630,7 @@ This list contains 983 plugins. :pypi:`pytest-perf` pytest-perf Jan 08, 2022 5 - Production/Stable pytest (>=6) ; extra == 'testing' :pypi:`pytest-performance` A simple plugin to ensure the execution of critical sections of code has not been impacted Sep 11, 2020 5 - Production/Stable pytest (>=3.7.0) :pypi:`pytest-persistence` Pytest tool for persistent objects Dec 07, 2021 N/A N/A - :pypi:`pytest-pg` Helps to run PostgreSQL in docker as pytest fixture Jan 09, 2022 5 - Production/Stable pytest (>=6.0.0) + :pypi:`pytest-pg` Helps to run PostgreSQL in docker as pytest fixture Jan 18, 2022 5 - Production/Stable pytest (>=6.0.0) :pypi:`pytest-pgsql` Pytest plugins and helpers for tests using a Postgres database. May 13, 2020 5 - Production/Stable pytest (>=3.0.0) :pypi:`pytest-phmdoctest` pytest plugin to test Python examples in Markdown using phmdoctest. Nov 10, 2021 4 - Beta pytest (>=6.2) ; extra == 'test' :pypi:`pytest-picked` Run the tests related to the changed files Dec 23, 2020 N/A pytest (>=3.5.0) @@ -695,7 +693,7 @@ This list contains 983 plugins. :pypi:`pytest-pytorch` pytest plugin for a better developer experience when working with the PyTorch test suite May 25, 2021 4 - Beta pytest :pypi:`pytest-qasync` Pytest support for qasync. Jul 12, 2021 4 - Beta pytest (>=5.4.0) :pypi:`pytest-qatouch` Pytest plugin for uploading test results to your QA Touch Testrun. Jun 26, 2021 4 - Beta pytest (>=6.2.0) - :pypi:`pytest-qgis` A pytest plugin for testing QGIS python plugins Dec 16, 2021 5 - Production/Stable pytest (>=6.2.3) + :pypi:`pytest-qgis` A pytest plugin for testing QGIS python plugins Jan 18, 2022 5 - Production/Stable pytest (>=6.2.3) :pypi:`pytest-qml` Run QML Tests with pytest Dec 02, 2020 4 - Beta pytest (>=6.0.0) :pypi:`pytest-qr` pytest plugin to generate test result QR codes Nov 25, 2021 4 - Beta N/A :pypi:`pytest-qt` pytest support for PyQt and PySide applications Jun 13, 2021 5 - Production/Stable pytest (>=3.0.0) @@ -723,7 +721,7 @@ This list contains 983 plugins. :pypi:`pytest-redmine` Pytest plugin for redmine Mar 19, 2018 1 - Planning N/A :pypi:`pytest-ref` A plugin to store reference files to ease regression testing Nov 23, 2019 4 - Beta pytest (>=3.5.0) :pypi:`pytest-reference-formatter` Conveniently run pytest with a dot-formatted test reference. Oct 01, 2019 4 - Beta N/A - :pypi:`pytest-regressions` Easy to use fixtures to write regression tests. Jan 04, 2022 5 - Production/Stable pytest (>=3.5.0) + :pypi:`pytest-regressions` Easy to use fixtures to write regression tests. Jan 19, 2022 5 - Production/Stable pytest (>=3.5.0) :pypi:`pytest-regtest` pytest plugin for regression tests Jun 03, 2021 N/A N/A :pypi:`pytest-relative-order` a pytest plugin that sorts tests using "before" and "after" markers May 17, 2021 4 - Beta N/A :pypi:`pytest-relaxed` Relaxed test discovery/organization for pytest Jun 14, 2019 5 - Production/Stable pytest (<5,>=3) @@ -750,7 +748,7 @@ This list contains 983 plugins. :pypi:`pytest-reraise` Make multi-threaded pytest test cases fail when they should Jun 17, 2021 5 - Production/Stable pytest (>=4.6) :pypi:`pytest-rerun` Re-run only changed files in specified branch Jul 08, 2019 N/A pytest (>=3.6) :pypi:`pytest-rerunfailures` pytest plugin to re-run tests to eliminate flaky failures Sep 17, 2021 5 - Production/Stable pytest (>=5.3) - :pypi:`pytest-resilient-circuits` Resilient Circuits fixtures for PyTest. Nov 15, 2021 N/A N/A + :pypi:`pytest-resilient-circuits` Resilient Circuits fixtures for PyTest. Jan 20, 2022 N/A N/A :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-responsemock` Simplified requests calls mocking for pytest Oct 10, 2020 5 - Production/Stable N/A @@ -779,13 +777,13 @@ This list contains 983 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. Jan 12, 2022 5 - Production/Stable N/A + :pypi:`pytest-sbase` A complete web automation framework for end-to-end testing. Jan 20, 2022 5 - Production/Stable N/A :pypi:`pytest-scenario` pytest plugin for test scenarios Feb 06, 2017 3 - Alpha N/A :pypi:`pytest-schema` 👍 Validate return values against a schema-like object in testing Aug 31, 2020 5 - Production/Stable pytest (>=3.5.0) :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 Sep 19, 2020 5 - Production/Stable pytest (>=5.0.0) - :pypi:`pytest-seleniumbase` A complete web automation framework for end-to-end testing. Jan 12, 2022 5 - Production/Stable N/A + :pypi:`pytest-seleniumbase` A complete web automation framework for end-to-end testing. Jan 20, 2022 5 - Production/Stable N/A :pypi:`pytest-selenium-enhancer` pytest plugin for Selenium Dec 16, 2021 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-send-email` Send pytest execution result email Dec 04, 2019 N/A N/A @@ -799,6 +797,7 @@ This list contains 983 plugins. :pypi:`pytest-sftpserver` py.test plugin to locally test sftp server connections. Sep 16, 2019 4 - Beta N/A :pypi:`pytest-shard` Dec 11, 2020 4 - Beta pytest :pypi:`pytest-shell` A pytest plugin to help with testing shell scripts / black box commands Nov 07, 2021 N/A N/A + :pypi:`pytest-shell-utilities` Pytest plugin to simplify running shell commands against the system Jan 21, 2022 4 - Beta pytest (>=6.0.0) :pypi:`pytest-sheraf` Versatile ZODB abstraction layer - pytest fixtures Feb 11, 2020 N/A pytest :pypi:`pytest-sherlock` pytest plugin help to find coupled tests Nov 18, 2021 5 - Production/Stable pytest (>=3.5.1) :pypi:`pytest-shortcuts` Expand command-line shortcuts listed in pytest configuration Oct 29, 2020 4 - Beta pytest (>=3.5.0) @@ -839,7 +838,7 @@ This list contains 983 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 Dec 17, 2021 N/A pytest (>5.4.0,<6.3) + :pypi:`pytest-splunk-addon` A Dynamic test tool for Splunk Apps and Add-ons Jan 21, 2022 N/A pytest (>5.4.0,<6.3) :pypi:`pytest-splunk-addon-ui-smartx` Library to support testing Splunk Add-on UX Dec 06, 2021 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 @@ -878,7 +877,7 @@ This list contains 983 plugins. :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 :pypi:`pytest-telegram` Pytest to Telegram reporting plugin Dec 10, 2020 5 - Production/Stable N/A :pypi:`pytest-tempdir` Predictable and repeatable tempdir support. Oct 11, 2019 4 - Beta pytest (>=2.8.1) - :pypi:`pytest-terraform` A pytest plugin for using terraform fixtures Nov 10, 2021 N/A pytest (>=6.0) + :pypi:`pytest-terraform` A pytest plugin for using terraform fixtures Jan 17, 2022 N/A pytest (>=6.0) :pypi:`pytest-terraform-fixture` generate terraform resources to use with pytest Nov 14, 2018 4 - Beta N/A :pypi:`pytest-testbook` A plugin to run tests written in Jupyter notebook Dec 11, 2016 3 - Alpha N/A :pypi:`pytest-testconfig` Test configuration plugin for pytest. Jan 11, 2020 4 - Beta pytest (>=3.5.0) @@ -907,14 +906,14 @@ This list contains 983 plugins. :pypi:`pytest-tesults` Tesults plugin for pytest Dec 31, 2021 5 - Production/Stable pytest (>=3.5.0) :pypi:`pytest-tezos` pytest-ligo Jan 16, 2020 4 - Beta N/A :pypi:`pytest-thawgun` Pytest plugin for time travel May 26, 2020 3 - Alpha N/A - :pypi:`pytest-threadleak` Detects thread leaks Sep 08, 2017 4 - Beta N/A + :pypi:`pytest-threadleak` Detects thread leaks Jan 18, 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-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 Dec 13, 2021 5 - Production/Stable pytest (>=5.0.0) + :pypi:`pytest-timeout` pytest plugin to abort hanging tests Jan 18, 2022 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 :pypi:`pytest-timer` A timer plugin for pytest Jun 02, 2021 N/A N/A :pypi:`pytest-timestamper` Pytest plugin to add a timestamp prefix to the pytest output Jun 06, 2021 N/A N/A - :pypi:`pytest-timestamps` A simple plugin to view timestamps for each test Jan 14, 2022 N/A pytest (>=5.2) + :pypi:`pytest-timestamps` A simple plugin to view timestamps for each test Jan 16, 2022 N/A pytest (>=5.2) :pypi:`pytest-tipsi-django` Nov 17, 2021 4 - Beta pytest (>=6.0.0) :pypi:`pytest-tipsi-testing` Better fixtures management. Various helpers Nov 04, 2020 4 - Beta pytest (>=3.3.0) :pypi:`pytest-tldr` A pytest plugin that limits the output to just the things you need. Mar 12, 2021 4 - Beta pytest (>=3.5.0) @@ -1014,7 +1013,7 @@ This list contains 983 plugins. A pytest-plugin for updating doctest outputs :pypi:`pytest-adaptavist` - *last release*: Nov 30, 2021, + *last release*: Jan 21, 2022, *status*: N/A, *requires*: pytest (>=5.4.0) @@ -1070,11 +1069,11 @@ This list contains 983 plugins. pytest fixtures for writing aiofiles tests with pyfakefs :pypi:`pytest-aiohttp` - *last release*: Dec 05, 2017, - *status*: N/A, - *requires*: pytest + *last release*: Jan 21, 2022, + *status*: 4 - Beta, + *requires*: pytest (>=6.1.0) - pytest plugin for aiohttp support + Pytest plugin for aiohttp support :pypi:`pytest-aiohttp-client` *last release*: Nov 01, 2020, @@ -1350,9 +1349,9 @@ This list contains 983 plugins. :pypi:`pytest-asyncio` - *last release*: Jan 13, 2022, + *last release*: Jan 17, 2022, *status*: 4 - Beta, - *requires*: pytest (>=5.4.0) + *requires*: pytest (>=6.1.0) Pytest support for asyncio @@ -1686,7 +1685,7 @@ This list contains 983 plugins. Pytest plugin for marking tests as a bug :pypi:`pytest-bugtong-tag` - *last release*: Apr 23, 2021, + *last release*: Jan 16, 2022, *status*: N/A, *requires*: N/A @@ -1944,13 +1943,6 @@ This list contains 983 plugins. PyTest plugin for testing Smart Contracts for Ethereum blockchain. - :pypi:`pytest-codeblocks` - *last release*: Dec 21, 2021, - *status*: 4 - Beta, - *requires*: pytest (>=6) - - Test code blocks in your READMEs - :pypi:`pytest-codecheckers` *last release*: Feb 13, 2010, *status*: N/A, @@ -2260,11 +2252,11 @@ This list contains 983 plugins. pytest plugin for test data directories and files :pypi:`pytest-datadir-mgr` - *last release*: Aug 16, 2021, + *last release*: Jan 20, 2022, *status*: 5 - Production/Stable, *requires*: pytest - Manager for test data providing downloads, caching of generated files, and a context for temp directories. + Manager for test data: downloads, artifact caching, and a tmpdir context. :pypi:`pytest-datadir-ng` *last release*: Dec 25, 2019, @@ -2554,7 +2546,7 @@ This list contains 983 plugins. The bare minimum to integrate py.test with Django. :pypi:`pytest-django-liveserver-ssl` - *last release*: Jul 30, 2021, + *last release*: Jan 20, 2022, *status*: 3 - Alpha, *requires*: N/A @@ -2918,35 +2910,35 @@ This list contains 983 plugins. Send execution result email :pypi:`pytest-embedded` - *last release*: Jan 06, 2022, + *last release*: Jan 21, 2022, *status*: N/A, *requires*: pytest (>=6.2.0) pytest embedded plugin :pypi:`pytest-embedded-arduino` - *last release*: Jan 06, 2022, + *last release*: Jan 21, 2022, *status*: N/A, *requires*: N/A pytest embedded plugin for Arduino projects :pypi:`pytest-embedded-idf` - *last release*: Jan 06, 2022, + *last release*: Jan 21, 2022, *status*: N/A, *requires*: N/A pytest embedded plugin for esp-idf project :pypi:`pytest-embedded-jtag` - *last release*: Jan 06, 2022, + *last release*: Jan 21, 2022, *status*: N/A, *requires*: N/A pytest embedded plugin for testing with jtag :pypi:`pytest-embedded-qemu` - *last release*: Jan 06, 2022, + *last release*: Jan 21, 2022, *status*: N/A, *requires*: N/A @@ -2960,14 +2952,14 @@ This list contains 983 plugins. pytest embedded plugin for esp-idf project by qemu, not target chip :pypi:`pytest-embedded-serial` - *last release*: Jan 06, 2022, + *last release*: Jan 21, 2022, *status*: N/A, *requires*: N/A pytest embedded plugin for testing serial ports :pypi:`pytest-embedded-serial-esp` - *last release*: Jan 06, 2022, + *last release*: Jan 21, 2022, *status*: N/A, *requires*: N/A @@ -3352,7 +3344,7 @@ This list contains 983 plugins. Pytest plugin for filtering based on sub-packages :pypi:`pytest-find-dependencies` - *last release*: Jan 15, 2022, + *last release*: Jan 16, 2022, *status*: 4 - Beta, *requires*: pytest (>=4.3.0) @@ -3436,7 +3428,7 @@ This list contains 983 plugins. A pytest fixture for testing flake8 plugins. :pypi:`pytest-flake8-v2` - *last release*: Jan 04, 2022, + *last release*: Jan 20, 2022, *status*: 4 - Beta, *requires*: pytest (>=3.5) @@ -3786,7 +3778,7 @@ This list contains 983 plugins. A pytest plugin for use with homeassistant custom components. :pypi:`pytest-homeassistant-custom-component` - *last release*: Jan 11, 2022, + *last release*: Jan 18, 2022, *status*: 3 - Alpha, *requires*: pytest (==6.2.5) @@ -3807,7 +3799,7 @@ This list contains 983 plugins. Report on tests that honor constraints, and guard against regressions :pypi:`pytest-hoverfly` - *last release*: Jul 12, 2021, + *last release*: Jan 20, 2022, *status*: N/A, *requires*: pytest (>=5.0) @@ -3898,7 +3890,7 @@ This list contains 983 plugins. pytest-httpserver is a httpserver for pytest :pypi:`pytest-httpx` - *last release*: Dec 27, 2021, + *last release*: Jan 17, 2022, *status*: 5 - Production/Stable, *requires*: pytest (==6.*) @@ -3968,7 +3960,7 @@ This list contains 983 plugins. ignore failures from flaky tests (pytest plugin) :pypi:`pytest-image-diff` - *last release*: Jul 28, 2021, + *last release*: Jan 20, 2022, *status*: 3 - Alpha, *requires*: pytest @@ -4927,9 +4919,9 @@ This list contains 983 plugins. nginx fixture for pytest - iplweb temporary fork :pypi:`pytest-ngrok` - *last release*: Jan 22, 2020, + *last release*: Jan 20, 2022, *status*: 3 - Alpha, - *requires*: N/A + *requires*: pytest @@ -4982,13 +4974,6 @@ This list contains 983 plugins. Ensure a test produces no garbage - :pypi:`pytest-notebook` - *last release*: Sep 16, 2020, - *status*: 4 - Beta, - *requires*: pytest (>=3.5.0) - - A pytest plugin for testing Jupyter Notebooks - :pypi:`pytest-notice` *last release*: Nov 05, 2020, *status*: N/A, @@ -5088,7 +5073,7 @@ This list contains 983 plugins. Pytest plugin for detecting inadvertent open file handles :pypi:`pytest-opentmi` - *last release*: Nov 04, 2021, + *last release*: Jan 19, 2022, *status*: 5 - Production/Stable, *requires*: pytest (>=5.0) @@ -5305,7 +5290,7 @@ This list contains 983 plugins. Pytest tool for persistent objects :pypi:`pytest-pg` - *last release*: Jan 09, 2022, + *last release*: Jan 18, 2022, *status*: 5 - Production/Stable, *requires*: pytest (>=6.0.0) @@ -5746,7 +5731,7 @@ This list contains 983 plugins. Pytest plugin for uploading test results to your QA Touch Testrun. :pypi:`pytest-qgis` - *last release*: Dec 16, 2021, + *last release*: Jan 18, 2022, *status*: 5 - Production/Stable, *requires*: pytest (>=6.2.3) @@ -5942,7 +5927,7 @@ This list contains 983 plugins. Conveniently run pytest with a dot-formatted test reference. :pypi:`pytest-regressions` - *last release*: Jan 04, 2022, + *last release*: Jan 19, 2022, *status*: 5 - Production/Stable, *requires*: pytest (>=3.5.0) @@ -6131,7 +6116,7 @@ This list contains 983 plugins. pytest plugin to re-run tests to eliminate flaky failures :pypi:`pytest-resilient-circuits` - *last release*: Nov 15, 2021, + *last release*: Jan 20, 2022, *status*: N/A, *requires*: N/A @@ -6334,7 +6319,7 @@ This list contains 983 plugins. :pypi:`pytest-sbase` - *last release*: Jan 12, 2022, + *last release*: Jan 20, 2022, *status*: 5 - Production/Stable, *requires*: N/A @@ -6376,7 +6361,7 @@ This list contains 983 plugins. pytest plugin for Selenium :pypi:`pytest-seleniumbase` - *last release*: Jan 12, 2022, + *last release*: Jan 20, 2022, *status*: 5 - Production/Stable, *requires*: N/A @@ -6473,6 +6458,13 @@ This list contains 983 plugins. A pytest plugin to help with testing shell scripts / black box commands + :pypi:`pytest-shell-utilities` + *last release*: Jan 21, 2022, + *status*: 4 - Beta, + *requires*: pytest (>=6.0.0) + + Pytest plugin to simplify running shell commands against the system + :pypi:`pytest-sheraf` *last release*: Feb 11, 2020, *status*: N/A, @@ -6754,7 +6746,7 @@ This list contains 983 plugins. :pypi:`pytest-splunk-addon` - *last release*: Dec 17, 2021, + *last release*: Jan 21, 2022, *status*: N/A, *requires*: pytest (>5.4.0,<6.3) @@ -7027,7 +7019,7 @@ This list contains 983 plugins. Predictable and repeatable tempdir support. :pypi:`pytest-terraform` - *last release*: Nov 10, 2021, + *last release*: Jan 17, 2022, *status*: N/A, *requires*: pytest (>=6.0) @@ -7230,9 +7222,9 @@ This list contains 983 plugins. Pytest plugin for time travel :pypi:`pytest-threadleak` - *last release*: Sep 08, 2017, + *last release*: Jan 18, 2022, *status*: 4 - Beta, - *requires*: N/A + *requires*: pytest (>=3.1.1) Detects thread leaks @@ -7251,7 +7243,7 @@ This list contains 983 plugins. A pytest plugin to time test function runs :pypi:`pytest-timeout` - *last release*: Dec 13, 2021, + *last release*: Jan 18, 2022, *status*: 5 - Production/Stable, *requires*: pytest (>=5.0.0) @@ -7279,7 +7271,7 @@ This list contains 983 plugins. Pytest plugin to add a timestamp prefix to the pytest output :pypi:`pytest-timestamps` - *last release*: Jan 14, 2022, + *last release*: Jan 16, 2022, *status*: N/A, *requires*: pytest (>=5.2) From 7783fb1b1ebd7026d10eaffb3e2a26f07c0d3602 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 23 Jan 2022 20:37:56 +0000 Subject: [PATCH 097/176] build(deps): Bump pytest-asyncio in /testing/plugins_integration Bumps [pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio) from 0.16.0 to 0.17.2. - [Release notes](https://github.com/pytest-dev/pytest-asyncio/releases) - [Commits](https://github.com/pytest-dev/pytest-asyncio/compare/v0.16.0...v0.17.2) --- updated-dependencies: - dependency-name: pytest-asyncio dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- testing/plugins_integration/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/plugins_integration/requirements.txt b/testing/plugins_integration/requirements.txt index 8cf38ee53ca..ae2fc3d1297 100644 --- a/testing/plugins_integration/requirements.txt +++ b/testing/plugins_integration/requirements.txt @@ -1,6 +1,6 @@ anyio[curio,trio]==3.5.0 django==4.0.1 -pytest-asyncio==0.16.0 +pytest-asyncio==0.17.2 pytest-bdd==5.0.0 pytest-cov==3.0.0 pytest-django==4.5.2 From 9ae64aae56157c832f305353436e1e9432d58131 Mon Sep 17 00:00:00 2001 From: Andrew Svetlov Date: Sun, 23 Jan 2022 23:07:28 +0200 Subject: [PATCH 098/176] Setup strict asyncio mode --- testing/plugins_integration/pytest.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/testing/plugins_integration/pytest.ini b/testing/plugins_integration/pytest.ini index b42b07d145a..3bacdef62ab 100644 --- a/testing/plugins_integration/pytest.ini +++ b/testing/plugins_integration/pytest.ini @@ -1,5 +1,6 @@ [pytest] addopts = --strict-markers +asyncio_mode = strict filterwarnings = error::pytest.PytestWarning ignore:.*.fspath is deprecated and will be replaced by .*.path.*:pytest.PytestDeprecationWarning From 039c3a201d1b05befb4f1cf60517cf12005e8ef2 Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Sun, 23 Jan 2022 21:21:26 -0500 Subject: [PATCH 099/176] upgrade flake8-typing-imports Committed via https://github.com/asottile/all-repos --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8def093a2c6..71357f0108e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -26,7 +26,7 @@ repos: - id: flake8 language_version: python3 additional_dependencies: - - flake8-typing-imports==1.9.0 + - flake8-typing-imports==1.12.0 - flake8-docstrings==1.5.0 - repo: https://github.com/asottile/reorder_python_imports rev: v2.6.0 From a17e7083527d1b8743721a7d505da3d390d2b87e Mon Sep 17 00:00:00 2001 From: Akuli Date: Tue, 25 Jan 2022 15:33:22 +0200 Subject: [PATCH 100/176] With -vv, display the full skip/xfail reason instead of "..." (#9537) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- changelog/9536.improvement.rst | 1 + src/_pytest/terminal.py | 22 ++++++++----- testing/test_terminal.py | 56 +++++++++++++++++++++++++++------- 3 files changed, 60 insertions(+), 19 deletions(-) create mode 100644 changelog/9536.improvement.rst diff --git a/changelog/9536.improvement.rst b/changelog/9536.improvement.rst new file mode 100644 index 00000000000..c7769602f54 --- /dev/null +++ b/changelog/9536.improvement.rst @@ -0,0 +1 @@ +When ``-vv`` is given on command line, show skipping and xfail reasons in full instead of truncating them to fit the terminal width. diff --git a/src/_pytest/terminal.py b/src/_pytest/terminal.py index ccbd84d7d71..4bcc968d100 100644 --- a/src/_pytest/terminal.py +++ b/src/_pytest/terminal.py @@ -542,15 +542,21 @@ def pytest_runtest_logreport(self, report: TestReport) -> None: if not running_xdist: self.write_ensure_prefix(line, word, **markup) if rep.skipped or hasattr(report, "wasxfail"): - available_width = ( - (self._tw.fullwidth - self._tw.width_of_current_line) - - len(" [100%]") - - 1 - ) reason = _get_raw_skip_reason(rep) - reason_ = _format_trimmed(" ({})", reason, available_width) - if reason and reason_ is not None: - self._tw.write(reason_) + if self.config.option.verbose < 2: + available_width = ( + (self._tw.fullwidth - self._tw.width_of_current_line) + - len(" [100%]") + - 1 + ) + formatted_reason = _format_trimmed( + " ({})", reason, available_width + ) + else: + formatted_reason = f" ({reason})" + + if reason and formatted_reason is not None: + self._tw.write(formatted_reason) if self._show_progress_info: self._write_progress_information_filling_space() else: diff --git a/testing/test_terminal.py b/testing/test_terminal.py index b1904816c95..e5f41266280 100644 --- a/testing/test_terminal.py +++ b/testing/test_terminal.py @@ -385,21 +385,55 @@ def test_9(): def test_10(): pytest.xfail("It's 🕙 o'clock") + + @pytest.mark.skip( + reason="cannot do foobar because baz is missing due to I don't know what" + ) + def test_long_skip(): + pass + + @pytest.mark.xfail( + reason="cannot do foobar because baz is missing due to I don't know what" + ) + def test_long_xfail(): + print(1 / 0) """ ) + + common_output = [ + "test_verbose_skip_reason.py::test_1 SKIPPED (123) *", + "test_verbose_skip_reason.py::test_2 XPASS (456) *", + "test_verbose_skip_reason.py::test_3 XFAIL (789) *", + "test_verbose_skip_reason.py::test_4 XFAIL *", + "test_verbose_skip_reason.py::test_5 SKIPPED (unconditional skip) *", + "test_verbose_skip_reason.py::test_6 XPASS *", + "test_verbose_skip_reason.py::test_7 SKIPPED *", + "test_verbose_skip_reason.py::test_8 SKIPPED (888 is great) *", + "test_verbose_skip_reason.py::test_9 XFAIL *", + "test_verbose_skip_reason.py::test_10 XFAIL (It's 🕙 o'clock) *", + ] + result = pytester.runpytest("-v") result.stdout.fnmatch_lines( - [ - "test_verbose_skip_reason.py::test_1 SKIPPED (123) *", - "test_verbose_skip_reason.py::test_2 XPASS (456) *", - "test_verbose_skip_reason.py::test_3 XFAIL (789) *", - "test_verbose_skip_reason.py::test_4 XFAIL *", - "test_verbose_skip_reason.py::test_5 SKIPPED (unconditional skip) *", - "test_verbose_skip_reason.py::test_6 XPASS *", - "test_verbose_skip_reason.py::test_7 SKIPPED *", - "test_verbose_skip_reason.py::test_8 SKIPPED (888 is great) *", - "test_verbose_skip_reason.py::test_9 XFAIL *", - "test_verbose_skip_reason.py::test_10 XFAIL (It's 🕙 o'clock) *", + common_output + + [ + "test_verbose_skip_reason.py::test_long_skip SKIPPED (cannot *...) *", + "test_verbose_skip_reason.py::test_long_xfail XFAIL (cannot *...) *", + ] + ) + + result = pytester.runpytest("-vv") + result.stdout.fnmatch_lines( + common_output + + [ + ( + "test_verbose_skip_reason.py::test_long_skip SKIPPED" + " (cannot do foobar because baz is missing due to I don't know what) *" + ), + ( + "test_verbose_skip_reason.py::test_long_xfail XFAIL" + " (cannot do foobar because baz is missing due to I don't know what) *" + ), ] ) From e6166ccc3c4fa45fccf4dde42986676637e76370 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Tue, 25 Jan 2022 22:39:13 +0200 Subject: [PATCH 101/176] doc/reference: don't document `pytest.__version__` under "Marks" --- doc/en/reference/reference.rst | 64 ++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/doc/en/reference/reference.rst b/doc/en/reference/reference.rst index ce97ad5f710..aec384d6d33 100644 --- a/doc/en/reference/reference.rst +++ b/doc/en/reference/reference.rst @@ -9,6 +9,39 @@ This page contains the full reference to pytest's API. :depth: 3 :local: +Constants +--------- + +pytest.__version__ +~~~~~~~~~~~~~~~~~~ + +The current pytest version, as a string:: + + >>> import pytest + >>> pytest.__version__ + '7.0.0' + + +.. _`version-tuple`: + +pytest.version_tuple +~~~~~~~~~~~~~~~~~~~~ + +.. versionadded:: 7.0 + +The current pytest version, as a tuple:: + + >>> import pytest + >>> pytest.version_tuple + (7, 0, 0) + +For pre-releases, the last component will be a string with the prerelease version:: + + >>> import pytest + >>> pytest.version_tuple + (7, 0, '0rc1') + + Functions --------- @@ -226,37 +259,6 @@ Marks a test function as *expected to fail*. a new release of a library fixes a known bug). -pytest.__version__ -~~~~~~~~~~~~~~~~~~ - -The current pytest version, as a string:: - - >>> import pytest - >>> pytest.__version__ - '7.0.0' - - -.. _`version-tuple`: - -pytest.version_tuple -~~~~~~~~~~~~~~~~~~~~ - -.. versionadded:: 7.0 - -The current pytest version, as a tuple:: - - >>> import pytest - >>> pytest.version_tuple - (7, 0, 0) - -For pre-releases, the last component will be a string with the prerelease version:: - - >>> import pytest - >>> pytest.version_tuple - (7, 0, '0rc1') - - - Custom marks ~~~~~~~~~~~~ From 52fbf3dbaae4139ae5f82d757b62992e1b4f0b19 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Tue, 25 Jan 2022 22:44:04 +0200 Subject: [PATCH 102/176] fixtures: make code flow clearer Make the two cases (direct/indirect fixture) clearer. The try-catch forces the reader to jump around. --- src/_pytest/fixtures.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/_pytest/fixtures.py b/src/_pytest/fixtures.py index be03fb2a820..612fb60fd06 100644 --- a/src/_pytest/fixtures.py +++ b/src/_pytest/fixtures.py @@ -597,8 +597,17 @@ def _compute_fixture_value(self, fixturedef: "FixtureDef[object]") -> None: funcitem = self._pyfuncitem scope = fixturedef._scope try: - param = funcitem.callspec.getparam(argname) - except (AttributeError, ValueError): + callspec = funcitem.callspec + except AttributeError: + callspec = None + if callspec is not None and argname in callspec.params: + param = callspec.params[argname] + param_index = callspec.indices[argname] + # If a parametrize invocation set a scope it will override + # the static scope defined with the fixture function. + with suppress(KeyError): + scope = callspec._arg2scope[argname] + else: param = NOTSET param_index = 0 has_params = fixturedef.params is not None @@ -638,12 +647,6 @@ def _compute_fixture_value(self, fixturedef: "FixtureDef[object]") -> None: ) ) fail(msg, pytrace=False) - else: - param_index = funcitem.callspec.indices[argname] - # If a parametrize invocation set a scope it will override - # the static scope defined with the fixture function. - with suppress(KeyError): - scope = funcitem.callspec._arg2scope[argname] subrequest = SubRequest( self, scope, param, param_index, fixturedef, _ispytest=True From acd203453557328d59466c0827ff89c21d52d381 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Tue, 25 Jan 2022 23:00:58 +0200 Subject: [PATCH 103/176] fixtures: document FixtureDef's attributes --- src/_pytest/fixtures.py | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/src/_pytest/fixtures.py b/src/_pytest/fixtures.py index 612fb60fd06..ed463729f75 100644 --- a/src/_pytest/fixtures.py +++ b/src/_pytest/fixtures.py @@ -930,7 +930,7 @@ def _eval_scope_callable( @final class FixtureDef(Generic[FixtureValue]): - """A container for a factory definition.""" + """A container for a fixture definition.""" def __init__( self, @@ -949,26 +949,52 @@ def __init__( ] = None, ) -> None: self._fixturemanager = fixturemanager + # The "base" node ID for the fixture. + # + # This is a node ID prefix. A fixture is only available to a node (e.g. + # a `Function` item) if the fixture's baseid is a parent of the node's + # nodeid (see the `iterparentnodeids` function for what constitutes a + # "parent" and a "prefix" in this context). + # + # For a fixture found in a Collector's object (e.g. a `Module`s module, + # a `Class`'s class), the baseid is the Collector's nodeid. + # + # For a fixture found in a conftest plugin, the baseid is the conftest's + # directory path relative to the rootdir. + # + # For other plugins, the baseid is the empty string (always matches). self.baseid = baseid or "" + # Whether the fixture was found from a node or a conftest in the + # collection tree. Will be false for fixtures defined in non-conftest + # plugins. self.has_location = baseid is not None + # The fixture factory function. self.func = func + # The name by which the fixture may be requested. self.argname = argname if scope is None: scope = Scope.Function elif callable(scope): scope = _eval_scope_callable(scope, argname, fixturemanager.config) - if isinstance(scope, str): scope = Scope.from_user( scope, descr=f"Fixture '{func.__name__}'", where=baseid ) self._scope = scope + # If the fixture is directly parametrized, the parameter values. self.params: Optional[Sequence[object]] = params - self.argnames: Tuple[str, ...] = getfuncargnames( - func, name=argname, is_method=unittest - ) - self.unittest = unittest + # If the fixture is directly parametrized, a tuple of explicit IDs to + # assign to the parameter values, or a callable to generate an ID given + # a parameter value. self.ids = ids + # The names requested by the fixtures. + self.argnames = getfuncargnames(func, name=argname, is_method=unittest) + # Whether the fixture was collected from a unittest TestCase class. + # Note that it really only makes sense to define autouse fixtures in + # unittest TestCases. + self.unittest = unittest + # If the fixture was executed, the current value of the fixture. + # Can change if the fixture is executed with different parameters. self.cached_result: Optional[_FixtureCachedResult[FixtureValue]] = None self._finalizers: List[Callable[[], object]] = [] From b21b008118fc8cf65b4bcd9b059f1cd704e05c68 Mon Sep 17 00:00:00 2001 From: Tobias Deiminger Date: Thu, 16 Dec 2021 21:02:27 +0100 Subject: [PATCH 104/176] Refactor idmaker functions into class IdMaker This commit only refactors, it does not change or add functionality yet. Public API is retained. Reason or refactoring: User provided parameter IDs (e.g. Metafunc.parametrize(ids=...)) had so far only been used to calculate a unique test ID for each test invocation. That test ID was a joined string where each parameter contributed some partial ID. We're soon going to reuse functionality to generate parameter keys for reorder_items and FixtureDef cache. We will be interested in the partial IDs, and only if they originate from explicit user information. Refactoring makes logic and data accessible for reuse, and increases cohesion in general. --- src/_pytest/python.py | 245 +++++++++++++++++++++---------------- testing/python/metafunc.py | 146 ++++++++++++++-------- 2 files changed, 237 insertions(+), 154 deletions(-) diff --git a/src/_pytest/python.py b/src/_pytest/python.py index dc8b1d9a712..f5b332e6831 100644 --- a/src/_pytest/python.py +++ b/src/_pytest/python.py @@ -929,6 +929,139 @@ def hasnew(obj: object) -> bool: return False +@final +@attr.s(frozen=True, auto_attribs=True, slots=True) +class IdMaker: + """Make IDs for a parametrization.""" + + # The argnames of the parametrization. + argnames: Sequence[str] + # The ParameterSets of the parametrization. + parametersets: Sequence[ParameterSet] + # Optionally, a user-provided callable to make IDs for parameters in a + # ParameterSet. + idfn: Optional[Callable[[Any], Optional[object]]] + # Optionally, explicit IDs for ParameterSets by index. + ids: Optional[Sequence[Union[None, str]]] + # Optionally, the pytest config. + # Used for controlling ASCII escaping, and for calling the + # :hook:`pytest_make_parametrize_id` hook. + config: Optional[Config] + # Optionally, the ID of the node being parametrized. + # Used only for clearer error messages. + nodeid: Optional[str] + + def make_unique_parameterset_ids(self) -> List[str]: + """Make a unique identifier for each ParameterSet, that may be used to + identify the parametrization in a node ID. + + Format is -...-[counter], where prm_x_token is + - user-provided id, if given + - else an id derived from the value, applicable for certain types + - else + The counter suffix is appended only in case a string wouldn't be unique + otherwise. + """ + resolved_ids = list(self._resolve_ids()) + # All IDs must be unique! + if len(resolved_ids) != len(set(resolved_ids)): + # Record the number of occurrences of each ID. + id_counts = Counter(resolved_ids) + # Map the ID to its next suffix. + id_suffixes: Dict[str, int] = defaultdict(int) + # Suffix non-unique IDs to make them unique. + for index, id in enumerate(resolved_ids): + if id_counts[id] > 1: + resolved_ids[index] = f"{id}{id_suffixes[id]}" + id_suffixes[id] += 1 + return resolved_ids + + def _resolve_ids(self) -> Iterable[str]: + """Resolve IDs for all ParameterSets (may contain duplicates).""" + for idx, parameterset in enumerate(self.parametersets): + if parameterset.id is not None: + # ID provided directly - pytest.param(..., id="...") + yield parameterset.id + elif self.ids and idx < len(self.ids) and self.ids[idx] is not None: + # ID provided in the IDs list - parametrize(..., ids=[...]). + id = self.ids[idx] + assert id is not None + yield _ascii_escaped_by_config(id, self.config) + else: + # ID not provided - generate it. + yield "-".join( + self._idval(val, argname, idx) + for val, argname in zip(parameterset.values, self.argnames) + ) + + def _idval(self, val: object, argname: str, idx: int) -> str: + """Make an ID for a parameter in a ParameterSet.""" + idval = self._idval_from_function(val, argname, idx) + if idval is not None: + return idval + idval = self._idval_from_hook(val, argname) + if idval is not None: + return idval + idval = self._idval_from_value(val) + if idval is not None: + return idval + return self._idval_from_argname(argname, idx) + + def _idval_from_function( + self, val: object, argname: str, idx: int + ) -> Optional[str]: + """Try to make an ID for a parameter in a ParameterSet using the + user-provided id callable, if given.""" + if self.idfn is None: + return None + try: + id = self.idfn(val) + except Exception as e: + prefix = f"{self.nodeid}: " if self.nodeid is not None else "" + msg = "error raised while trying to determine id of parameter '{}' at position {}" + msg = prefix + msg.format(argname, idx) + raise ValueError(msg) from e + if id is None: + return None + return self._idval_from_value(id) + + def _idval_from_hook(self, val: object, argname: str) -> Optional[str]: + """Try to make an ID for a parameter in a ParameterSet by calling the + :hook:`pytest_make_parametrize_id` hook.""" + if self.config: + id: Optional[str] = self.config.hook.pytest_make_parametrize_id( + config=self.config, val=val, argname=argname + ) + return id + return None + + def _idval_from_value(self, val: object) -> Optional[str]: + """Try to make an ID for a parameter in a ParameterSet from its value, + if the value type is supported.""" + if isinstance(val, STRING_TYPES): + return _ascii_escaped_by_config(val, self.config) + elif val is None or isinstance(val, (float, int, bool, complex)): + return str(val) + elif isinstance(val, Pattern): + return ascii_escaped(val.pattern) + elif val is NOTSET: + # Fallback to default. Note that NOTSET is an enum.Enum. + pass + elif isinstance(val, enum.Enum): + return str(val) + elif isinstance(getattr(val, "__name__", None), str): + # Name of a class, function, module, etc. + name: str = getattr(val, "__name__") + return name + return None + + @staticmethod + def _idval_from_argname(argname: str, idx: int) -> str: + """Make an ID for a parameter in a ParameterSet from the argument name + and the index of the ParameterSet.""" + return str(argname) + str(idx) + + @final @attr.s(frozen=True, slots=True, auto_attribs=True) class CallSpec2: @@ -1217,12 +1350,15 @@ def _resolve_parameter_set_ids( else: idfn = None ids_ = self._validate_ids(ids, parametersets, self.function.__name__) - return idmaker(argnames, parametersets, idfn, ids_, self.config, nodeid=nodeid) + id_maker = IdMaker( + argnames, parametersets, idfn, ids_, self.config, nodeid=nodeid + ) + return id_maker.make_unique_parameterset_ids() def _validate_ids( self, ids: Iterable[Union[None, str, float, int, bool]], - parameters: Sequence[ParameterSet], + parametersets: Sequence[ParameterSet], func_name: str, ) -> List[Union[None, str]]: try: @@ -1232,12 +1368,12 @@ def _validate_ids( iter(ids) except TypeError as e: raise TypeError("ids must be a callable or an iterable") from e - num_ids = len(parameters) + num_ids = len(parametersets) # num_ids == 0 is a special case: https://github.com/pytest-dev/pytest/issues/1849 - if num_ids != len(parameters) and num_ids != 0: + if num_ids != len(parametersets) and num_ids != 0: msg = "In {}: {} parameter sets specified, with different number of ids: {}" - fail(msg.format(func_name, len(parameters), num_ids), pytrace=False) + fail(msg.format(func_name, len(parametersets), num_ids), pytrace=False) new_ids = [] for idx, id_value in enumerate(itertools.islice(ids, num_ids)): @@ -1374,105 +1510,6 @@ def _ascii_escaped_by_config(val: Union[str, bytes], config: Optional[Config]) - return val if escape_option else ascii_escaped(val) # type: ignore -def _idval( - val: object, - argname: str, - idx: int, - idfn: Optional[Callable[[Any], Optional[object]]], - nodeid: Optional[str], - config: Optional[Config], -) -> str: - if idfn: - try: - generated_id = idfn(val) - if generated_id is not None: - val = generated_id - except Exception as e: - prefix = f"{nodeid}: " if nodeid is not None else "" - msg = "error raised while trying to determine id of parameter '{}' at position {}" - msg = prefix + msg.format(argname, idx) - raise ValueError(msg) from e - elif config: - hook_id: Optional[str] = config.hook.pytest_make_parametrize_id( - config=config, val=val, argname=argname - ) - if hook_id: - return hook_id - - if isinstance(val, STRING_TYPES): - return _ascii_escaped_by_config(val, config) - elif val is None or isinstance(val, (float, int, bool, complex)): - return str(val) - elif isinstance(val, Pattern): - return ascii_escaped(val.pattern) - elif val is NOTSET: - # Fallback to default. Note that NOTSET is an enum.Enum. - pass - elif isinstance(val, enum.Enum): - return str(val) - elif isinstance(getattr(val, "__name__", None), str): - # Name of a class, function, module, etc. - name: str = getattr(val, "__name__") - return name - return str(argname) + str(idx) - - -def _idvalset( - idx: int, - parameterset: ParameterSet, - argnames: Iterable[str], - idfn: Optional[Callable[[Any], Optional[object]]], - ids: Optional[List[Union[None, str]]], - nodeid: Optional[str], - config: Optional[Config], -) -> str: - if parameterset.id is not None: - return parameterset.id - id = None if ids is None or idx >= len(ids) else ids[idx] - if id is None: - this_id = [ - _idval(val, argname, idx, idfn, nodeid=nodeid, config=config) - for val, argname in zip(parameterset.values, argnames) - ] - return "-".join(this_id) - else: - return _ascii_escaped_by_config(id, config) - - -def idmaker( - argnames: Iterable[str], - parametersets: Iterable[ParameterSet], - idfn: Optional[Callable[[Any], Optional[object]]] = None, - ids: Optional[List[Union[None, str]]] = None, - config: Optional[Config] = None, - nodeid: Optional[str] = None, -) -> List[str]: - resolved_ids = [ - _idvalset( - valindex, parameterset, argnames, idfn, ids, config=config, nodeid=nodeid - ) - for valindex, parameterset in enumerate(parametersets) - ] - - # All IDs must be unique! - unique_ids = set(resolved_ids) - if len(unique_ids) != len(resolved_ids): - - # Record the number of occurrences of each test ID. - test_id_counts = Counter(resolved_ids) - - # Map the test ID to its next suffix. - test_id_suffixes: Dict[str, int] = defaultdict(int) - - # Suffix non-unique IDs to make them unique. - for index, test_id in enumerate(resolved_ids): - if test_id_counts[test_id] > 1: - resolved_ids[index] = f"{test_id}{test_id_suffixes[test_id]}" - test_id_suffixes[test_id] += 1 - - return resolved_ids - - def _pretty_fixture_path(func) -> str: cwd = Path.cwd() loc = Path(getlocation(func, str(cwd))) diff --git a/testing/python/metafunc.py b/testing/python/metafunc.py index fc0082eb6b9..b6ad4a80924 100644 --- a/testing/python/metafunc.py +++ b/testing/python/metafunc.py @@ -24,8 +24,7 @@ from _pytest.compat import NOTSET from _pytest.outcomes import fail from _pytest.pytester import Pytester -from _pytest.python import _idval -from _pytest.python import idmaker +from _pytest.python import IdMaker from _pytest.scope import Scope @@ -286,7 +285,7 @@ class A: deadline=400.0 ) # very close to std deadline and CI boxes are not reliable in CPU power def test_idval_hypothesis(self, value) -> None: - escaped = _idval(value, "a", 6, None, nodeid=None, config=None) + escaped = IdMaker([], [], None, None, None, None)._idval(value, "a", 6) assert isinstance(escaped, str) escaped.encode("ascii") @@ -308,7 +307,9 @@ def test_unicode_idval(self) -> None: ), ] for val, expected in values: - assert _idval(val, "a", 6, None, nodeid=None, config=None) == expected + assert ( + IdMaker([], [], None, None, None, None)._idval(val, "a", 6) == expected + ) def test_unicode_idval_with_config(self) -> None: """Unit test for expected behavior to obtain ids with @@ -336,7 +337,7 @@ def getini(self, name): ("ação", MockConfig({option: False}), "a\\xe7\\xe3o"), ] for val, config, expected in values: - actual = _idval(val, "a", 6, None, nodeid=None, config=config) + actual = IdMaker([], [], None, None, config, None)._idval(val, "a", 6) assert actual == expected def test_bytes_idval(self) -> None: @@ -349,7 +350,9 @@ def test_bytes_idval(self) -> None: ("αρά".encode(), r"\xce\xb1\xcf\x81\xce\xac"), ] for val, expected in values: - assert _idval(val, "a", 6, idfn=None, nodeid=None, config=None) == expected + assert ( + IdMaker([], [], None, None, None, None)._idval(val, "a", 6) == expected + ) def test_class_or_function_idval(self) -> None: """Unit test for the expected behavior to obtain ids for parametrized @@ -363,7 +366,9 @@ def test_function(): values = [(TestClass, "TestClass"), (test_function, "test_function")] for val, expected in values: - assert _idval(val, "a", 6, None, nodeid=None, config=None) == expected + assert ( + IdMaker([], [], None, None, None, None)._idval(val, "a", 6) == expected + ) def test_notset_idval(self) -> None: """Test that a NOTSET value (used by an empty parameterset) generates @@ -371,29 +376,43 @@ def test_notset_idval(self) -> None: Regression test for #7686. """ - assert _idval(NOTSET, "a", 0, None, nodeid=None, config=None) == "a0" + assert IdMaker([], [], None, None, None, None)._idval(NOTSET, "a", 0) == "a0" def test_idmaker_autoname(self) -> None: """#250""" - result = idmaker( - ("a", "b"), [pytest.param("string", 1.0), pytest.param("st-ring", 2.0)] - ) + result = IdMaker( + ("a", "b"), + [pytest.param("string", 1.0), pytest.param("st-ring", 2.0)], + None, + None, + None, + None, + ).make_unique_parameterset_ids() assert result == ["string-1.0", "st-ring-2.0"] - result = idmaker( - ("a", "b"), [pytest.param(object(), 1.0), pytest.param(object(), object())] - ) + result = IdMaker( + ("a", "b"), + [pytest.param(object(), 1.0), pytest.param(object(), object())], + None, + None, + None, + None, + ).make_unique_parameterset_ids() assert result == ["a0-1.0", "a1-b1"] # unicode mixing, issue250 - result = idmaker(("a", "b"), [pytest.param({}, b"\xc3\xb4")]) + result = IdMaker( + ("a", "b"), [pytest.param({}, b"\xc3\xb4")], None, None, None, None + ).make_unique_parameterset_ids() assert result == ["a0-\\xc3\\xb4"] def test_idmaker_with_bytes_regex(self) -> None: - result = idmaker(("a"), [pytest.param(re.compile(b"foo"), 1.0)]) + result = IdMaker( + ("a"), [pytest.param(re.compile(b"foo"), 1.0)], None, None, None, None + ).make_unique_parameterset_ids() assert result == ["foo"] def test_idmaker_native_strings(self) -> None: - result = idmaker( + result = IdMaker( ("a", "b"), [ pytest.param(1.0, -1.1), @@ -410,7 +429,11 @@ def test_idmaker_native_strings(self) -> None: pytest.param(b"\xc3\xb4", "other"), pytest.param(1.0j, -2.0j), ], - ) + None, + None, + None, + None, + ).make_unique_parameterset_ids() assert result == [ "1.0--1.1", "2--202", @@ -428,7 +451,7 @@ def test_idmaker_native_strings(self) -> None: ] def test_idmaker_non_printable_characters(self) -> None: - result = idmaker( + result = IdMaker( ("s", "n"), [ pytest.param("\x00", 1), @@ -438,23 +461,33 @@ def test_idmaker_non_printable_characters(self) -> None: pytest.param("\t", 5), pytest.param(b"\t", 6), ], - ) + None, + None, + None, + None, + ).make_unique_parameterset_ids() assert result == ["\\x00-1", "\\x05-2", "\\x00-3", "\\x05-4", "\\t-5", "\\t-6"] def test_idmaker_manual_ids_must_be_printable(self) -> None: - result = idmaker( + result = IdMaker( ("s",), [ pytest.param("x00", id="hello \x00"), pytest.param("x05", id="hello \x05"), ], - ) + None, + None, + None, + None, + ).make_unique_parameterset_ids() assert result == ["hello \\x00", "hello \\x05"] def test_idmaker_enum(self) -> None: enum = pytest.importorskip("enum") e = enum.Enum("Foo", "one, two") - result = idmaker(("a", "b"), [pytest.param(e.one, e.two)]) + result = IdMaker( + ("a", "b"), [pytest.param(e.one, e.two)], None, None, None, None + ).make_unique_parameterset_ids() assert result == ["Foo.one-Foo.two"] def test_idmaker_idfn(self) -> None: @@ -465,15 +498,18 @@ def ids(val: object) -> Optional[str]: return repr(val) return None - result = idmaker( + result = IdMaker( ("a", "b"), [ pytest.param(10.0, IndexError()), pytest.param(20, KeyError()), pytest.param("three", [1, 2, 3]), ], - idfn=ids, - ) + ids, + None, + None, + None, + ).make_unique_parameterset_ids() assert result == ["10.0-IndexError()", "20-KeyError()", "three-b2"] def test_idmaker_idfn_unique_names(self) -> None: @@ -482,15 +518,18 @@ def test_idmaker_idfn_unique_names(self) -> None: def ids(val: object) -> str: return "a" - result = idmaker( + result = IdMaker( ("a", "b"), [ pytest.param(10.0, IndexError()), pytest.param(20, KeyError()), pytest.param("three", [1, 2, 3]), ], - idfn=ids, - ) + ids, + None, + None, + None, + ).make_unique_parameterset_ids() assert result == ["a-a0", "a-a1", "a-a2"] def test_idmaker_with_idfn_and_config(self) -> None: @@ -520,12 +559,9 @@ def getini(self, name): (MockConfig({option: False}), "a\\xe7\\xe3o"), ] for config, expected in values: - result = idmaker( - ("a",), - [pytest.param("string")], - idfn=lambda _: "ação", - config=config, - ) + result = IdMaker( + ("a",), [pytest.param("string")], lambda _: "ação", None, config, None + ).make_unique_parameterset_ids() assert result == [expected] def test_idmaker_with_ids_and_config(self) -> None: @@ -555,12 +591,9 @@ def getini(self, name): (MockConfig({option: False}), "a\\xe7\\xe3o"), ] for config, expected in values: - result = idmaker( - ("a",), - [pytest.param("string")], - ids=["ação"], - config=config, - ) + result = IdMaker( + ("a",), [pytest.param("string")], None, ["ação"], config, None + ).make_unique_parameterset_ids() assert result == [expected] def test_parametrize_ids_exception(self, pytester: Pytester) -> None: @@ -617,23 +650,36 @@ def test_int(arg): ) def test_idmaker_with_ids(self) -> None: - result = idmaker( - ("a", "b"), [pytest.param(1, 2), pytest.param(3, 4)], ids=["a", None] - ) + result = IdMaker( + ("a", "b"), + [pytest.param(1, 2), pytest.param(3, 4)], + None, + ["a", None], + None, + None, + ).make_unique_parameterset_ids() assert result == ["a", "3-4"] def test_idmaker_with_paramset_id(self) -> None: - result = idmaker( + result = IdMaker( ("a", "b"), [pytest.param(1, 2, id="me"), pytest.param(3, 4, id="you")], - ids=["a", None], - ) + None, + ["a", None], + None, + None, + ).make_unique_parameterset_ids() assert result == ["me", "you"] def test_idmaker_with_ids_unique_names(self) -> None: - result = idmaker( - ("a"), map(pytest.param, [1, 2, 3, 4, 5]), ids=["a", "a", "b", "c", "b"] - ) + result = IdMaker( + ("a"), + list(map(pytest.param, [1, 2, 3, 4, 5])), + None, + ["a", "a", "b", "c", "b"], + None, + None, + ).make_unique_parameterset_ids() assert result == ["a0", "a1", "b0", "c", "b1"] def test_parametrize_indirect(self) -> None: From 396a7def751cd7d6c615f9d81d5a49f2b50bfeaa Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 27 Jan 2022 11:49:18 +0100 Subject: [PATCH 105/176] Add additional docs for uncooperative ctor deprecation (#9498) * Add additional docs for uncooperative ctor deprecation Fixes #9488 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Break up long line * Recommend kwonly args Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- doc/en/deprecations.rst | 38 ++++++++++++++++++++++++++++ doc/en/example/nonpython/conftest.py | 4 +-- src/_pytest/nodes.py | 5 +++- 3 files changed, 44 insertions(+), 3 deletions(-) diff --git a/doc/en/deprecations.rst b/doc/en/deprecations.rst index a667fc4ccdf..d9fb4d6b04e 100644 --- a/doc/en/deprecations.rst +++ b/doc/en/deprecations.rst @@ -56,6 +56,10 @@ Plugins which implement custom items and collectors are encouraged to replace ``fspath`` parameters (``py.path.local``) with ``path`` parameters (``pathlib.Path``), and drop any other usage of the ``py`` library if possible. +If possible, plugins with custom items should use :ref:`cooperative +constructors ` to avoid hardcoding +arguments they only pass on to the superclass. + .. note:: The name of the :class:`~_pytest.nodes.Node` arguments and attributes (the new attribute being ``path``) is **the opposite** of the situation for @@ -191,6 +195,40 @@ Instead, a separate collector node should be used, which collects the item. See .. _example pr fixing inheritance: https://github.com/asmeurer/pytest-flakes/pull/40/files +.. _uncooperative-constructors-deprecated: + +Constructors of custom :class:`pytest.Node` subclasses should take ``**kwargs`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. deprecated:: 7.0 + +If custom subclasses of nodes like :class:`pytest.Item` override the +``__init__`` method, they should take ``**kwargs``. Thus, + +.. code-block:: python + + class CustomItem(pytest.Item): + def __init__(self, name, parent, additional_arg): + super().__init__(name, parent) + self.additional_arg = additional_arg + +should be turned into: + +.. code-block:: python + + class CustomItem(pytest.Item): + def __init__(self, *, additional_arg, **kwargs): + super().__init__(**kwargs) + self.additional_arg = additional_arg + +to avoid hard-coding the arguments pytest can pass to the superclass. +See :ref:`non-python tests` for a full example. + +For cases without conflicts, no deprecation warning is emitted. For cases with +conflicts (such as :class:`pytest.File` now taking ``path`` instead of +``fspath``, as :ref:`outlined above `), a +deprecation warning is now raised. + Backward compatibilities in ``Parser.addoption`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/doc/en/example/nonpython/conftest.py b/doc/en/example/nonpython/conftest.py index 7ec4134036c..bc39a1f6b20 100644 --- a/doc/en/example/nonpython/conftest.py +++ b/doc/en/example/nonpython/conftest.py @@ -18,8 +18,8 @@ def collect(self): class YamlItem(pytest.Item): - def __init__(self, name, parent, spec): - super().__init__(name, parent) + def __init__(self, *, spec, **kwargs): + super().__init__(**kwargs) self.spec = spec def runtest(self): diff --git a/src/_pytest/nodes.py b/src/_pytest/nodes.py index 53dea04e795..6e8454ad7c6 100644 --- a/src/_pytest/nodes.py +++ b/src/_pytest/nodes.py @@ -145,7 +145,10 @@ def _create(self, *k, **kw): warnings.warn( PytestDeprecationWarning( - f"{self} is not using a cooperative constructor and only takes {set(known_kw)}" + f"{self} is not using a cooperative constructor and only takes {set(known_kw)}.\n" + "See https://docs.pytest.org/en/stable/deprecations.html" + "#constructors-of-custom-pytest-node-subclasses-should-take-kwargs " + "for more details." ) ) From f064942f2e42a311e67e059a0c981abe697b5bef Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Thu, 27 Jan 2022 08:18:36 -0300 Subject: [PATCH 106/176] Make 'warnings' and 'deselected' in assert_outcomes optional (#9475) Fix #9471 --- src/_pytest/pytester.py | 12 ++++++++---- src/_pytest/pytester_assertions.py | 15 +++++++++------ testing/test_pytester.py | 4 ++++ 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/src/_pytest/pytester.py b/src/_pytest/pytester.py index 5db896c1f76..933d7d35759 100644 --- a/src/_pytest/pytester.py +++ b/src/_pytest/pytester.py @@ -596,11 +596,15 @@ def assert_outcomes( errors: int = 0, xpassed: int = 0, xfailed: int = 0, - warnings: int = 0, - deselected: int = 0, + warnings: Optional[int] = None, + deselected: Optional[int] = None, ) -> None: - """Assert that the specified outcomes appear with the respective - numbers (0 means it didn't occur) in the text output from a test run.""" + """ + Assert that the specified outcomes appear with the respective + numbers (0 means it didn't occur) in the text output from a test run. + + ``warnings`` and ``deselected`` are only checked if not None. + """ __tracebackhide__ = True from _pytest.pytester_assertions import assert_outcomes diff --git a/src/_pytest/pytester_assertions.py b/src/_pytest/pytester_assertions.py index 6a5aabece47..657e4db5fc3 100644 --- a/src/_pytest/pytester_assertions.py +++ b/src/_pytest/pytester_assertions.py @@ -4,6 +4,7 @@ # hence cannot be subject to assertion rewriting, which requires a # module to not be already imported. from typing import Dict +from typing import Optional from typing import Sequence from typing import Tuple from typing import Union @@ -42,8 +43,8 @@ def assert_outcomes( errors: int = 0, xpassed: int = 0, xfailed: int = 0, - warnings: int = 0, - deselected: int = 0, + warnings: Optional[int] = None, + deselected: Optional[int] = None, ) -> None: """Assert that the specified outcomes appear with the respective numbers (0 means it didn't occur) in the text output from a test run.""" @@ -56,8 +57,6 @@ def assert_outcomes( "errors": outcomes.get("errors", 0), "xpassed": outcomes.get("xpassed", 0), "xfailed": outcomes.get("xfailed", 0), - "warnings": outcomes.get("warnings", 0), - "deselected": outcomes.get("deselected", 0), } expected = { "passed": passed, @@ -66,7 +65,11 @@ def assert_outcomes( "errors": errors, "xpassed": xpassed, "xfailed": xfailed, - "warnings": warnings, - "deselected": deselected, } + if warnings is not None: + obtained["warnings"] = outcomes.get("warnings", 0) + expected["warnings"] = warnings + if deselected is not None: + obtained["deselected"] = outcomes.get("deselected", 0) + expected["deselected"] = deselected assert obtained == expected diff --git a/testing/test_pytester.py b/testing/test_pytester.py index bc6e52aba0e..9f7cf42b77c 100644 --- a/testing/test_pytester.py +++ b/testing/test_pytester.py @@ -835,6 +835,8 @@ def test_with_warning(): ) result = pytester.runpytest() result.assert_outcomes(passed=1, warnings=1) + # If warnings is not passed, it is not checked at all. + result.assert_outcomes(passed=1) def test_pytester_outcomes_deselected(pytester: Pytester) -> None: @@ -849,3 +851,5 @@ def test_two(): ) result = pytester.runpytest("-k", "test_one") result.assert_outcomes(passed=1, deselected=1) + # If deselected is not passed, it is not checked at all. + result.assert_outcomes(passed=1) From 843f03e3caa1f9137fe81edcf0b86f11634f146b Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 27 Jan 2022 13:32:37 +0100 Subject: [PATCH 107/176] doc: Add ellipsis to warning usecase list (#9558) I feel like this makes it clearer where the code which was inside 'pytest.warns' is supposed to go. --- doc/en/how-to/capture-warnings.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/en/how-to/capture-warnings.rst b/doc/en/how-to/capture-warnings.rst index 501edce7a14..065c11e610c 100644 --- a/doc/en/how-to/capture-warnings.rst +++ b/doc/en/how-to/capture-warnings.rst @@ -363,7 +363,7 @@ Here are some use cases involving warnings that often come up in tests, and sugg .. code-block:: python with pytest.warns(): - pass + ... - To ensure that **no** warnings are emitted, use: @@ -371,6 +371,7 @@ Here are some use cases involving warnings that often come up in tests, and sugg with warnings.catch_warnings(): warnings.simplefilter("error") + ... - To suppress warnings, use: @@ -378,6 +379,7 @@ Here are some use cases involving warnings that often come up in tests, and sugg with warnings.catch_warnings(): warnings.simplefilter("ignore") + ... .. _custom_failure_messages: From 597bb9376b958ad97d5533af15a72ff992db7c5c Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 27 Jan 2022 13:33:09 +0100 Subject: [PATCH 108/176] Add missing cooperative constructor changelog (#9559) This was supposed to be part of #9488, but I only now noticed it was lying around uncommitted in my git dir --- changelog/9488.deprecation.rst | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 changelog/9488.deprecation.rst diff --git a/changelog/9488.deprecation.rst b/changelog/9488.deprecation.rst new file mode 100644 index 00000000000..5c5807ec34a --- /dev/null +++ b/changelog/9488.deprecation.rst @@ -0,0 +1,7 @@ +If custom subclasses of nodes like :class:`pytest.Item` override the +``__init__`` method, they should take ``**kwargs``. See +:ref:`uncooperative-constructors-deprecated` for details. + +Note that a deprection warning is only emitted when there is a conflict in the +arguments pytest expected to pass. This deprecation was already part of pytest +7.0.0rc1 but wasn't documented. From 6e1445b5212ee1d20e05c0715f34f6c28dedf442 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 27 Jan 2022 13:33:20 +0100 Subject: [PATCH 109/176] ci: Bump up timeout (#9560) macOS apparently can be slow, https://github.com/pytest-dev/pytest/runs/4965510831 for #9556 got cancelled at 91% --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 79ce0e2225b..77cee5a8a06 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -24,7 +24,7 @@ permissions: {} jobs: build: runs-on: ${{ matrix.os }} - timeout-minutes: 30 + timeout-minutes: 45 permissions: contents: read From ee9ddff34eab0368adc1cea42d49661061f2ff9b Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 27 Jan 2022 13:39:32 +0100 Subject: [PATCH 110/176] doc: Recategorize 7.0.0 changelog items (#9561) --- changelog/{9505.trivial.rst => 9505.doc.rst} | 0 changelog/{9521.improvement.rst => 9521.trivial.rst} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename changelog/{9505.trivial.rst => 9505.doc.rst} (100%) rename changelog/{9521.improvement.rst => 9521.trivial.rst} (100%) diff --git a/changelog/9505.trivial.rst b/changelog/9505.doc.rst similarity index 100% rename from changelog/9505.trivial.rst rename to changelog/9505.doc.rst diff --git a/changelog/9521.improvement.rst b/changelog/9521.trivial.rst similarity index 100% rename from changelog/9521.improvement.rst rename to changelog/9521.trivial.rst From 321747628e268e645f3535ecafeac2dddffdaa81 Mon Sep 17 00:00:00 2001 From: pytest bot Date: Sun, 30 Jan 2022 00:12:51 +0000 Subject: [PATCH 111/176] [automated] Update plugin list --- doc/en/reference/plugin_list.rst | 126 ++++++++++++++++++------------- 1 file changed, 75 insertions(+), 51 deletions(-) diff --git a/doc/en/reference/plugin_list.rst b/doc/en/reference/plugin_list.rst index 7c0f3c86bd5..540bdb06952 100644 --- a/doc/en/reference/plugin_list.rst +++ b/doc/en/reference/plugin_list.rst @@ -11,7 +11,7 @@ automatically. Packages classified as inactive are excluded. creating a PDF, because otherwise the table gets far too wide for the page. -This list contains 982 plugins. +This list contains 985 plugins. .. only:: not latex @@ -19,7 +19,7 @@ This list contains 982 plugins. name summary last release status requires =============================================== ======================================================================================================================================================================== ============== ===================== ================================================ :pypi:`pytest-accept` A pytest-plugin for updating doctest outputs Jan 07, 2022 N/A pytest (>=6,<8) - :pypi:`pytest-adaptavist` pytest plugin for generating test execution results within Jira Test Management (tm4j) Jan 21, 2022 N/A pytest (>=5.4.0) + :pypi:`pytest-adaptavist` pytest plugin for generating test execution results within Jira Test Management (tm4j) Jan 27, 2022 N/A pytest (>=5.4.0) :pypi:`pytest-addons-test` 用于测试pytest的插件 Aug 02, 2021 N/A pytest (>=6.2.4,<7.0.0) :pypi:`pytest-adf` Pytest plugin for writing Azure Data Factory integration tests May 10, 2021 4 - Beta pytest (>=3.5.0) :pypi:`pytest-adf-azure-identity` Pytest plugin for writing Azure Data Factory integration tests Mar 06, 2021 4 - Beta pytest (>=3.5.0) @@ -47,7 +47,7 @@ This list contains 982 plugins. :pypi:`pytest-ansible` Plugin for py.test to simplify calling ansible modules from tests or fixtures May 25, 2021 5 - Production/Stable N/A :pypi:`pytest-ansible-playbook` Pytest fixture which runs given ansible playbook file. Mar 08, 2019 4 - Beta N/A :pypi:`pytest-ansible-playbook-runner` Pytest fixture which runs given ansible playbook file. Dec 02, 2020 4 - Beta pytest (>=3.1.0) - :pypi:`pytest-antilru` Bust functools.lru_cache when running pytest to avoid test pollution Apr 11, 2019 5 - Production/Stable pytest + :pypi:`pytest-antilru` Bust functools.lru_cache when running pytest to avoid test pollution Jan 29, 2022 5 - Production/Stable pytest :pypi:`pytest-anyio` The pytest anyio plugin is built into anyio. You don't need this package. Jun 29, 2021 N/A pytest :pypi:`pytest-anything` Pytest fixtures to assert anything and something Feb 18, 2021 N/A N/A :pypi:`pytest-aoc` Downloads puzzle inputs for Advent of Code and synthesizes PyTest fixtures Nov 23, 2021 N/A pytest ; extra == 'test' @@ -68,7 +68,7 @@ This list contains 982 plugins. :pypi:`pytest-astropy-header` pytest plugin to add diagnostic information to the header of the test output Dec 27, 2021 3 - Alpha pytest (>=4.6) :pypi:`pytest-ast-transformer` May 04, 2019 3 - Alpha pytest :pypi:`pytest-asyncio` Pytest support for asyncio Jan 17, 2022 4 - Beta pytest (>=6.1.0) - :pypi:`pytest-asyncio-cooperative` Run all your asynchronous tests cooperatively. Jan 03, 2022 N/A N/A + :pypi:`pytest-asyncio-cooperative` Run all your asynchronous tests cooperatively. Jan 25, 2022 N/A N/A :pypi:`pytest-asyncio-network-simulator` pytest-asyncio-network-simulator: Plugin for pytest for simulator the network in tests Jul 31, 2018 3 - Alpha pytest (<3.7.0,>=3.3.2) :pypi:`pytest-async-mongodb` pytest plugin for async MongoDB Oct 18, 2017 5 - Production/Stable pytest (>=2.5.2) :pypi:`pytest-async-sqlalchemy` Database testing fixtures using the SQLAlchemy asyncio API Oct 07, 2021 4 - Beta pytest (>=6.0.0) @@ -95,8 +95,8 @@ This list contains 982 plugins. :pypi:`pytest-beds` Fixtures for testing Google Appengine (GAE) apps Jun 07, 2016 4 - Beta N/A :pypi:`pytest-bench` Benchmark utility that plugs into pytest. Jul 21, 2014 3 - Alpha N/A :pypi:`pytest-benchmark` A \`\`pytest\`\` fixture for benchmarking code. It will group the tests into rounds that are calibrated to the chosen timer. Apr 17, 2021 5 - Production/Stable pytest (>=3.8) - :pypi:`pytest-bg-process` Pytest plugin to initialize background process Aug 17, 2021 4 - Beta pytest (>=3.5.0) - :pypi:`pytest-bigchaindb` A BigchainDB plugin for pytest. Aug 17, 2021 4 - Beta N/A + :pypi:`pytest-bg-process` Pytest plugin to initialize background process Jan 24, 2022 4 - Beta pytest (>=3.5.0) + :pypi:`pytest-bigchaindb` A BigchainDB plugin for pytest. Jan 24, 2022 4 - Beta N/A :pypi:`pytest-bigquery-mock` Provides a mock fixture for python bigquery client Aug 05, 2021 N/A pytest (>=5.0) :pypi:`pytest-black` A pytest plugin to enable format checking with black Oct 05, 2020 4 - Beta N/A :pypi:`pytest-black-multipy` Allow '--black' on older Pythons Jan 14, 2021 5 - Production/Stable pytest (!=3.7.3,>=3.5) ; extra == 'testing' @@ -106,6 +106,7 @@ This list contains 982 plugins. :pypi:`pytest-blockage` Disable network requests during a test run. Dec 21, 2021 N/A pytest :pypi:`pytest-blocker` pytest plugin to mark a test as blocker and skip all other tests Sep 07, 2015 4 - Beta N/A :pypi:`pytest-board` Local continuous test runner with pytest and watchdog. Jan 20, 2019 N/A N/A + :pypi:`pytest-bootstrap` Jan 28, 2022 N/A N/A :pypi:`pytest-bpdb` A py.test plug-in to enable drop to bpdb debugger on test failure. Jan 19, 2015 2 - Pre-Alpha N/A :pypi:`pytest-bravado` Pytest-bravado automatically generates from OpenAPI specification client fixtures. Jul 19, 2021 N/A N/A :pypi:`pytest-breakword` Use breakword with pytest Aug 04, 2021 N/A pytest (>=6.2.4,<7.0.0) @@ -209,6 +210,7 @@ This list contains 982 plugins. :pypi:`pytest-dbfixtures` Databases fixtures plugin for py.test. Dec 07, 2016 4 - Beta N/A :pypi:`pytest-db-plugin` Nov 27, 2021 N/A pytest (>=5.0) :pypi:`pytest-dbt-adapter` A pytest plugin for testing dbt adapter plugins Nov 24, 2021 N/A pytest (<7,>=6) + :pypi:`pytest-dbt-core` Pytest extension for dbt. Jan 28, 2022 N/A pytest (>=6.2.5) ; extra == 'test' :pypi:`pytest-dbus-notification` D-BUS notifications for pytest results. Mar 05, 2014 5 - Production/Stable N/A :pypi:`pytest-deadfixtures` A simple plugin to list unused fixtures in pytest Jul 23, 2020 5 - Production/Stable N/A :pypi:`pytest-deepcov` deepcov Mar 30, 2021 N/A N/A @@ -364,7 +366,7 @@ This list contains 982 plugins. :pypi:`pytest-fixture-typecheck` A pytest plugin to assert type annotations at runtime. Aug 24, 2021 N/A pytest :pypi:`pytest-flake8` pytest plugin to check FLAKE8 requirements Dec 16, 2020 4 - Beta pytest (>=3.5) :pypi:`pytest-flake8-path` A pytest fixture for testing flake8 plugins. Jan 10, 2022 5 - Production/Stable pytest - :pypi:`pytest-flake8-v2` pytest plugin to check FLAKE8 requirements Jan 20, 2022 4 - Beta pytest (>=3.5) + :pypi:`pytest-flake8-v2` pytest plugin to check FLAKE8 requirements Jan 25, 2022 4 - Beta pytest (>=6.0) :pypi:`pytest-flakefinder` Runs tests multiple times to expose flakiness. Jul 28, 2020 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 @@ -414,7 +416,7 @@ This list contains 982 plugins. :pypi:`pytest-historic` Custom report to display pytest historical execution records Apr 08, 2020 N/A pytest :pypi:`pytest-historic-hook` Custom listener to store execution results into MYSQL DB, which is used for pytest-historic report Apr 08, 2020 N/A pytest :pypi:`pytest-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 Jan 18, 2022 3 - Alpha pytest (==6.2.5) + :pypi:`pytest-homeassistant-custom-component` Experimental package to automatically extract test plugins for Home Assistant custom components Jan 29, 2022 3 - Alpha pytest (==6.2.5) :pypi:`pytest-honey` A simple plugin to use with pytest Jan 07, 2022 4 - Beta pytest (>=3.5.0) :pypi:`pytest-honors` Report on tests that honor constraints, and guard against regressions Mar 06, 2020 4 - Beta N/A :pypi:`pytest-hoverfly` Simplify working with Hoverfly from pytest Jan 20, 2022 N/A pytest (>=5.0) @@ -429,8 +431,8 @@ This list contains 982 plugins. :pypi:`pytest-httpbin` Easily test your HTTP library against a local copy of httpbin Dec 25, 2021 5 - Production/Stable N/A :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 Dec 15, 2021 3 - Alpha N/A - :pypi:`pytest-httpx` Send responses to httpx. Jan 17, 2022 5 - Production/Stable pytest (==6.*) + :pypi:`pytest-httpserver` pytest-httpserver is a httpserver for pytest Jan 27, 2022 3 - Alpha N/A + :pypi:`pytest-httpx` Send responses to httpx. Jan 26, 2022 5 - Production/Stable pytest (==6.*) :pypi:`pytest-httpx-blockage` Disable httpx requests during a test run Nov 16, 2021 N/A pytest (>=6.2.5) :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 @@ -447,7 +449,7 @@ This list contains 982 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 Sep 30, 2021 N/A N/A - :pypi:`pytest-inmanta` A py.test plugin providing fixtures to simplify inmanta modules testing. Aug 17, 2021 5 - Production/Stable N/A + :pypi:`pytest-inmanta` A py.test plugin providing fixtures to simplify inmanta modules testing. Jan 26, 2022 5 - Production/Stable N/A :pypi:`pytest-inmanta-extensions` Inmanta tests package May 27, 2021 5 - Production/Stable N/A :pypi:`pytest-Inomaly` A simple image diff plugin for pytest Feb 13, 2018 4 - Beta N/A :pypi:`pytest-insta` A practical snapshot testing plugin for pytest Apr 07, 2021 N/A pytest (>=6.0.2,<7.0.0) @@ -537,7 +539,7 @@ This list contains 982 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 May 06, 2021 5 - Production/Stable pytest (>=5.0) + :pypi:`pytest-mock` Thin-wrapper around the mock package for easier use with pytest Jan 28, 2022 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 Jan 05, 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 @@ -546,6 +548,7 @@ This list contains 982 plugins. :pypi:`pytest-mock-resources` A pytest plugin for easily instantiating reproducible mock resources. Jan 11, 2022 N/A pytest (>=1.0) :pypi:`pytest-mock-server` Mock server plugin for pytest Jan 09, 2022 4 - Beta pytest (>=3.5.0) :pypi:`pytest-mockservers` A set of fixtures to test your requests to HTTP/UDP servers Mar 31, 2020 N/A pytest (>=4.3.0) + :pypi:`pytest-modified-env` Pytest plugin to fail a test if it leaves modified \`os.environ\` afterwards. Jan 29, 2022 4 - Beta N/A :pypi:`pytest-modifyjunit` Utility for adding additional properties to junit xml for IDM QE Jan 10, 2019 N/A N/A :pypi:`pytest-modifyscope` pytest plugin to modify fixture scope Apr 12, 2020 N/A pytest :pypi:`pytest-molecule` PyTest Molecule Plugin :: discover and run molecule tests Oct 06, 2021 5 - Production/Stable N/A @@ -663,7 +666,7 @@ This list contains 982 plugins. :pypi:`pytest-postgres` Run PostgreSQL in Docker container in Pytest. Mar 22, 2020 N/A pytest :pypi:`pytest-postgresql` Postgresql fixtures and fixture factories for Pytest. Dec 22, 2021 5 - Production/Stable pytest (>=6.2.0) :pypi:`pytest-power` pytest plugin with powerful fixtures Dec 31, 2020 N/A pytest (>=5.4) - :pypi:`pytest-pretty-terminal` pytest plugin for generating prettier terminal output Nov 24, 2021 N/A pytest (>=3.4.1) + :pypi:`pytest-pretty-terminal` pytest plugin for generating prettier terminal output Jan 25, 2022 N/A pytest (>=3.4.1) :pypi:`pytest-pride` Minitest-style test colors Apr 02, 2016 3 - Alpha N/A :pypi:`pytest-print` pytest-print adds the printer fixture you can use to print messages to the user (directly to the pytest runner, not stdout) Dec 28, 2021 5 - Production/Stable pytest (>=6) :pypi:`pytest-profiles` pytest plugin for configuration profiles Dec 09, 2021 4 - Beta pytest (>=3.7.0) @@ -683,7 +686,7 @@ This list contains 982 plugins. :pypi:`pytest-pylint` pytest plugin to check source code with pylint Nov 09, 2020 5 - Production/Stable pytest (>=5.4) :pypi:`pytest-pypi` Easily test your HTTP library against a local copy of pypi Mar 04, 2018 3 - Alpha N/A :pypi:`pytest-pypom-navigation` Core engine for cookiecutter-qa and pytest-play packages Feb 18, 2019 4 - Beta pytest (>=3.0.7) - :pypi:`pytest-pyppeteer` A plugin to run pyppeteer in pytest. Feb 16, 2021 4 - Beta pytest (>=6.0.2) + :pypi:`pytest-pyppeteer` A plugin to run pyppeteer in pytest Jan 27, 2022 N/A pytest (>=6.2.5,<7.0.0) :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 15, 2021 5 - Production/Stable pytest :pypi:`pytest-pyramid-server` Pyramid server fixture for py.test May 28, 2019 5 - Production/Stable pytest @@ -771,19 +774,19 @@ This list contains 982 plugins. :pypi:`pytest-runtime-xfail` Call runtime_xfail() to mark running test as xfail. Aug 26, 2021 N/A N/A :pypi:`pytest-salt` Pytest Salt Plugin Jan 27, 2020 4 - Beta N/A :pypi:`pytest-salt-containers` A Pytest plugin that builds and creates docker containers Nov 09, 2016 4 - Beta N/A - :pypi:`pytest-salt-factories` Pytest Salt Plugin Sep 16, 2021 4 - Beta pytest (>=6.0.0) + :pypi:`pytest-salt-factories` Pytest Salt Plugin Jan 27, 2022 4 - Beta pytest (>=6.0.0) :pypi:`pytest-salt-from-filenames` Simple PyTest Plugin For Salt's Test Suite Specifically Jan 29, 2019 4 - Beta pytest (>=4.1) :pypi:`pytest-salt-runtests-bridge` Simple PyTest Plugin For Salt's Test Suite Specifically Dec 05, 2019 4 - Beta pytest (>=4.1) :pypi:`pytest-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. Jan 20, 2022 5 - Production/Stable N/A + :pypi:`pytest-sbase` A complete web automation framework for end-to-end testing. Jan 27, 2022 5 - Production/Stable N/A :pypi:`pytest-scenario` pytest plugin for test scenarios Feb 06, 2017 3 - Alpha N/A :pypi:`pytest-schema` 👍 Validate return values against a schema-like object in testing Aug 31, 2020 5 - Production/Stable pytest (>=3.5.0) :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 Sep 19, 2020 5 - Production/Stable pytest (>=5.0.0) - :pypi:`pytest-seleniumbase` A complete web automation framework for end-to-end testing. Jan 20, 2022 5 - Production/Stable N/A + :pypi:`pytest-seleniumbase` A complete web automation framework for end-to-end testing. Jan 27, 2022 5 - Production/Stable N/A :pypi:`pytest-selenium-enhancer` pytest plugin for Selenium Dec 16, 2021 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-send-email` Send pytest execution result email Dec 04, 2019 N/A N/A @@ -797,7 +800,7 @@ This list contains 982 plugins. :pypi:`pytest-sftpserver` py.test plugin to locally test sftp server connections. Sep 16, 2019 4 - Beta N/A :pypi:`pytest-shard` Dec 11, 2020 4 - Beta pytest :pypi:`pytest-shell` A pytest plugin to help with testing shell scripts / black box commands Nov 07, 2021 N/A N/A - :pypi:`pytest-shell-utilities` Pytest plugin to simplify running shell commands against the system Jan 21, 2022 4 - Beta pytest (>=6.0.0) + :pypi:`pytest-shell-utilities` Pytest plugin to simplify running shell commands against the system Jan 25, 2022 4 - Beta pytest (>=6.0.0) :pypi:`pytest-sheraf` Versatile ZODB abstraction layer - pytest fixtures Feb 11, 2020 N/A pytest :pypi:`pytest-sherlock` pytest plugin help to find coupled tests Nov 18, 2021 5 - Production/Stable pytest (>=3.5.1) :pypi:`pytest-shortcuts` Expand command-line shortcuts listed in pytest configuration Oct 29, 2020 4 - Beta pytest (>=3.5.0) @@ -806,7 +809,7 @@ This list contains 982 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 Oct 04, 2021 4 - Beta pytest (>=6.0.0) + :pypi:`pytest-skip-markers` Pytest Salt Plugin Jan 26, 2022 5 - Production/Stable pytest (>=6.0.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. Sep 28, 2021 N/A N/A @@ -820,7 +823,7 @@ This list contains 982 plugins. :pypi:`pytest-snapshot` A plugin for snapshot testing with pytest. Dec 02, 2021 4 - Beta pytest (>=3.0.0) :pypi:`pytest-snmpserver` May 12, 2021 N/A N/A :pypi:`pytest-snowflake-bdd` Setup test data and run tests on snowflake in BDD style! Jan 05, 2022 4 - Beta pytest (>=6.2.0) - :pypi:`pytest-socket` Pytest Plugin to disable socket calls during tests Dec 23, 2021 4 - Beta pytest (>=3.6.3) + :pypi:`pytest-socket` Pytest Plugin to disable socket calls during tests Jan 23, 2022 4 - Beta pytest (>=3.6.3) :pypi:`pytest-soft-assertions` May 05, 2020 3 - Alpha pytest :pypi:`pytest-solidity` A PyTest library plugin for Solidity language. Jan 15, 2022 1 - Planning pytest (<7,>=6.0.1) ; extra == 'tests' :pypi:`pytest-solr` Solr process and client fixtures for py.test. May 11, 2020 3 - Alpha pytest (>=3.0.0) @@ -838,7 +841,7 @@ This list contains 982 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 Jan 21, 2022 N/A pytest (>5.4.0,<6.3) + :pypi:`pytest-splunk-addon` A Dynamic test tool for Splunk Apps and Add-ons Jan 25, 2022 N/A pytest (>5.4.0,<6.3) :pypi:`pytest-splunk-addon-ui-smartx` Library to support testing Splunk Add-on UX Dec 06, 2021 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 @@ -858,7 +861,7 @@ This list contains 982 plugins. :pypi:`pytest-stub` Stub packages, modules and attributes. Apr 28, 2020 5 - Production/Stable N/A :pypi:`pytest-stubprocess` Provide stub implementations for subprocesses in Python tests Sep 17, 2018 3 - Alpha pytest (>=3.5.0) :pypi:`pytest-study` A pytest plugin to organize long run tests (named studies) without interfering the regular tests Sep 26, 2017 3 - Alpha pytest (>=2.0) - :pypi:`pytest-subprocess` A plugin to fake subprocess for pytest Nov 07, 2021 5 - Production/Stable pytest (>=4.0.0) + :pypi:`pytest-subprocess` A plugin to fake subprocess for pytest Jan 23, 2022 5 - Production/Stable pytest (>=4.0.0) :pypi:`pytest-subtesthack` A hack to explicitly set up and tear down fixtures. Mar 02, 2021 N/A N/A :pypi:`pytest-subtests` unittest subTest() support and subtests fixture Jan 15, 2022 4 - Beta pytest (>=6.0) :pypi:`pytest-subunit` pytest-subunit is a plugin for py.test which outputs testsresult in subunit format. Aug 29, 2017 N/A N/A @@ -867,7 +870,7 @@ This list contains 982 plugins. :pypi:`pytest-super-check` Pytest plugin to check your TestCase classes call super in setUp, tearDown, etc. Jan 10, 2022 5 - Production/Stable pytest :pypi:`pytest-svn` SVN repository fixture for py.test May 28, 2019 5 - Production/Stable pytest :pypi:`pytest-symbols` pytest-symbols is a pytest plugin that adds support for passing test environment symbols into pytest tests. Nov 20, 2017 3 - Alpha N/A - :pypi:`pytest-system-statistics` Pytest plugin to track and report system usage statistics Jan 05, 2022 4 - Beta pytest (>=6.0.0) + :pypi:`pytest-system-statistics` Pytest plugin to track and report system usage statistics Jan 26, 2022 5 - Production/Stable pytest (>=6.0.0) :pypi:`pytest-takeltest` Fixtures for ansible, testinfra and molecule Jan 04, 2022 N/A N/A :pypi:`pytest-talisker` Nov 28, 2021 N/A N/A :pypi:`pytest-tap` Test Anything Protocol (TAP) reporting plugin for pytest Oct 27, 2021 5 - Production/Stable pytest (>=3.0) @@ -1013,7 +1016,7 @@ This list contains 982 plugins. A pytest-plugin for updating doctest outputs :pypi:`pytest-adaptavist` - *last release*: Jan 21, 2022, + *last release*: Jan 27, 2022, *status*: N/A, *requires*: pytest (>=5.4.0) @@ -1209,7 +1212,7 @@ This list contains 982 plugins. Pytest fixture which runs given ansible playbook file. :pypi:`pytest-antilru` - *last release*: Apr 11, 2019, + *last release*: Jan 29, 2022, *status*: 5 - Production/Stable, *requires*: pytest @@ -1356,7 +1359,7 @@ This list contains 982 plugins. Pytest support for asyncio :pypi:`pytest-asyncio-cooperative` - *last release*: Jan 03, 2022, + *last release*: Jan 25, 2022, *status*: N/A, *requires*: N/A @@ -1545,14 +1548,14 @@ This list contains 982 plugins. A \`\`pytest\`\` fixture for benchmarking code. It will group the tests into rounds that are calibrated to the chosen timer. :pypi:`pytest-bg-process` - *last release*: Aug 17, 2021, + *last release*: Jan 24, 2022, *status*: 4 - Beta, *requires*: pytest (>=3.5.0) Pytest plugin to initialize background process :pypi:`pytest-bigchaindb` - *last release*: Aug 17, 2021, + *last release*: Jan 24, 2022, *status*: 4 - Beta, *requires*: N/A @@ -1621,6 +1624,13 @@ This list contains 982 plugins. Local continuous test runner with pytest and watchdog. + :pypi:`pytest-bootstrap` + *last release*: Jan 28, 2022, + *status*: N/A, + *requires*: N/A + + + :pypi:`pytest-bpdb` *last release*: Jan 19, 2015, *status*: 2 - Pre-Alpha, @@ -2342,6 +2352,13 @@ This list contains 982 plugins. A pytest plugin for testing dbt adapter plugins + :pypi:`pytest-dbt-core` + *last release*: Jan 28, 2022, + *status*: N/A, + *requires*: pytest (>=6.2.5) ; extra == 'test' + + Pytest extension for dbt. + :pypi:`pytest-dbus-notification` *last release*: Mar 05, 2014, *status*: 5 - Production/Stable, @@ -3428,9 +3445,9 @@ This list contains 982 plugins. A pytest fixture for testing flake8 plugins. :pypi:`pytest-flake8-v2` - *last release*: Jan 20, 2022, + *last release*: Jan 25, 2022, *status*: 4 - Beta, - *requires*: pytest (>=3.5) + *requires*: pytest (>=6.0) pytest plugin to check FLAKE8 requirements @@ -3778,7 +3795,7 @@ This list contains 982 plugins. A pytest plugin for use with homeassistant custom components. :pypi:`pytest-homeassistant-custom-component` - *last release*: Jan 18, 2022, + *last release*: Jan 29, 2022, *status*: 3 - Alpha, *requires*: pytest (==6.2.5) @@ -3883,14 +3900,14 @@ This list contains 982 plugins. A thin wrapper of HTTPretty for pytest :pypi:`pytest-httpserver` - *last release*: Dec 15, 2021, + *last release*: Jan 27, 2022, *status*: 3 - Alpha, *requires*: N/A pytest-httpserver is a httpserver for pytest :pypi:`pytest-httpx` - *last release*: Jan 17, 2022, + *last release*: Jan 26, 2022, *status*: 5 - Production/Stable, *requires*: pytest (==6.*) @@ -4009,7 +4026,7 @@ This list contains 982 plugins. Reuse pytest.ini to store env variables :pypi:`pytest-inmanta` - *last release*: Aug 17, 2021, + *last release*: Jan 26, 2022, *status*: 5 - Production/Stable, *requires*: N/A @@ -4639,7 +4656,7 @@ This list contains 982 plugins. pytest plugin to display test execution output like a mochajs :pypi:`pytest-mock` - *last release*: May 06, 2021, + *last release*: Jan 28, 2022, *status*: 5 - Production/Stable, *requires*: pytest (>=5.0) @@ -4701,6 +4718,13 @@ This list contains 982 plugins. A set of fixtures to test your requests to HTTP/UDP servers + :pypi:`pytest-modified-env` + *last release*: Jan 29, 2022, + *status*: 4 - Beta, + *requires*: N/A + + Pytest plugin to fail a test if it leaves modified \`os.environ\` afterwards. + :pypi:`pytest-modifyjunit` *last release*: Jan 10, 2019, *status*: N/A, @@ -5521,7 +5545,7 @@ This list contains 982 plugins. pytest plugin with powerful fixtures :pypi:`pytest-pretty-terminal` - *last release*: Nov 24, 2021, + *last release*: Jan 25, 2022, *status*: N/A, *requires*: pytest (>=3.4.1) @@ -5661,11 +5685,11 @@ This list contains 982 plugins. Core engine for cookiecutter-qa and pytest-play packages :pypi:`pytest-pyppeteer` - *last release*: Feb 16, 2021, - *status*: 4 - Beta, - *requires*: pytest (>=6.0.2) + *last release*: Jan 27, 2022, + *status*: N/A, + *requires*: pytest (>=6.2.5,<7.0.0) - A plugin to run pyppeteer in pytest. + A plugin to run pyppeteer in pytest :pypi:`pytest-pyq` *last release*: Mar 10, 2020, @@ -6277,7 +6301,7 @@ This list contains 982 plugins. A Pytest plugin that builds and creates docker containers :pypi:`pytest-salt-factories` - *last release*: Sep 16, 2021, + *last release*: Jan 27, 2022, *status*: 4 - Beta, *requires*: pytest (>=6.0.0) @@ -6319,7 +6343,7 @@ This list contains 982 plugins. :pypi:`pytest-sbase` - *last release*: Jan 20, 2022, + *last release*: Jan 27, 2022, *status*: 5 - Production/Stable, *requires*: N/A @@ -6361,7 +6385,7 @@ This list contains 982 plugins. pytest plugin for Selenium :pypi:`pytest-seleniumbase` - *last release*: Jan 20, 2022, + *last release*: Jan 27, 2022, *status*: 5 - Production/Stable, *requires*: N/A @@ -6459,7 +6483,7 @@ This list contains 982 plugins. A pytest plugin to help with testing shell scripts / black box commands :pypi:`pytest-shell-utilities` - *last release*: Jan 21, 2022, + *last release*: Jan 25, 2022, *status*: 4 - Beta, *requires*: pytest (>=6.0.0) @@ -6522,8 +6546,8 @@ This list contains 982 plugins. Allow for multiple processes to log to a single file :pypi:`pytest-skip-markers` - *last release*: Oct 04, 2021, - *status*: 4 - Beta, + *last release*: Jan 26, 2022, + *status*: 5 - Production/Stable, *requires*: pytest (>=6.0.0) Pytest Salt Plugin @@ -6620,7 +6644,7 @@ This list contains 982 plugins. Setup test data and run tests on snowflake in BDD style! :pypi:`pytest-socket` - *last release*: Dec 23, 2021, + *last release*: Jan 23, 2022, *status*: 4 - Beta, *requires*: pytest (>=3.6.3) @@ -6746,7 +6770,7 @@ This list contains 982 plugins. :pypi:`pytest-splunk-addon` - *last release*: Jan 21, 2022, + *last release*: Jan 25, 2022, *status*: N/A, *requires*: pytest (>5.4.0,<6.3) @@ -6886,7 +6910,7 @@ This list contains 982 plugins. A pytest plugin to organize long run tests (named studies) without interfering the regular tests :pypi:`pytest-subprocess` - *last release*: Nov 07, 2021, + *last release*: Jan 23, 2022, *status*: 5 - Production/Stable, *requires*: pytest (>=4.0.0) @@ -6949,8 +6973,8 @@ This list contains 982 plugins. pytest-symbols is a pytest plugin that adds support for passing test environment symbols into pytest tests. :pypi:`pytest-system-statistics` - *last release*: Jan 05, 2022, - *status*: 4 - Beta, + *last release*: Jan 26, 2022, + *status*: 5 - Production/Stable, *requires*: pytest (>=6.0.0) Pytest plugin to track and report system usage statistics From b2701a02724514ef5bddaab65af30d85d8d753c3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 31 Jan 2022 03:02:08 +0000 Subject: [PATCH 112/176] build(deps): Bump pytest-mock in /testing/plugins_integration Bumps [pytest-mock](https://github.com/pytest-dev/pytest-mock) from 3.6.1 to 3.7.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.6.1...v3.7.0) --- updated-dependencies: - dependency-name: pytest-mock dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- testing/plugins_integration/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/plugins_integration/requirements.txt b/testing/plugins_integration/requirements.txt index ae2fc3d1297..8c5d69ff19a 100644 --- a/testing/plugins_integration/requirements.txt +++ b/testing/plugins_integration/requirements.txt @@ -6,7 +6,7 @@ pytest-cov==3.0.0 pytest-django==4.5.2 pytest-flakes==4.0.5 pytest-html==3.1.1 -pytest-mock==3.6.1 +pytest-mock==3.7.0 pytest-rerunfailures==10.2 pytest-sugar==0.9.4 pytest-trio==0.7.0 From 3aef0b9de6ed071580a63b441d749162c71037de Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 31 Jan 2022 22:18:51 +0000 Subject: [PATCH 113/176] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black: 21.12b0 → 22.1.0](https://github.com/psf/black/compare/21.12b0...22.1.0) - [github.com/asottile/blacken-docs: v1.12.0 → v1.12.1](https://github.com/asottile/blacken-docs/compare/v1.12.0...v1.12.1) - [github.com/asottile/reorder_python_imports: v2.6.0 → v2.7.1](https://github.com/asottile/reorder_python_imports/compare/v2.6.0...v2.7.1) --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 71357f0108e..125f5561db4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,11 +1,11 @@ repos: - repo: https://github.com/psf/black - rev: 21.12b0 + rev: 22.1.0 hooks: - id: black args: [--safe, --quiet] - repo: https://github.com/asottile/blacken-docs - rev: v1.12.0 + rev: v1.12.1 hooks: - id: blacken-docs additional_dependencies: [black==20.8b1] @@ -29,7 +29,7 @@ repos: - flake8-typing-imports==1.12.0 - flake8-docstrings==1.5.0 - repo: https://github.com/asottile/reorder_python_imports - rev: v2.6.0 + rev: v2.7.1 hooks: - id: reorder-python-imports args: ['--application-directories=.:src', --py37-plus] From 9d2ffe207bfea9a8b57452bafb9961aba67edf7a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 31 Jan 2022 22:20:16 +0000 Subject: [PATCH 114/176] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/_pytest/doctest.py | 2 +- testing/io/test_terminalwriter.py | 2 +- testing/python/approx.py | 2 +- testing/test_assertrewrite.py | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/_pytest/doctest.py b/src/_pytest/doctest.py index 0784f431b8e..7d37be2acc0 100644 --- a/src/_pytest/doctest.py +++ b/src/_pytest/doctest.py @@ -656,7 +656,7 @@ def _remove_unwanted_precision(self, want: str, got: str) -> str: precision = 0 if fraction is None else len(fraction) if exponent is not None: precision -= int(exponent) - if float(w.group()) == approx(float(g.group()), abs=10 ** -precision): + if float(w.group()) == approx(float(g.group()), abs=10**-precision): # They're close enough. Replace the text we actually # got with the text we want, so that it will match when we # check the string literally. diff --git a/testing/io/test_terminalwriter.py b/testing/io/test_terminalwriter.py index 4866c94a558..6fe718b5341 100644 --- a/testing/io/test_terminalwriter.py +++ b/testing/io/test_terminalwriter.py @@ -56,7 +56,7 @@ def test_terminalwriter_not_unicode() -> None: file = io.TextIOWrapper(buffer, encoding="cp1252") tw = terminalwriter.TerminalWriter(file) tw.write("hello 🌀 wôrld אבג", flush=True) - assert buffer.getvalue() == br"hello \U0001f300 w\xf4rld \u05d0\u05d1\u05d2" + assert buffer.getvalue() == rb"hello \U0001f300 w\xf4rld \u05d0\u05d1\u05d2" win32 = int(sys.platform == "win32") diff --git a/testing/python/approx.py b/testing/python/approx.py index f417a5992cc..eb9bcd874c0 100644 --- a/testing/python/approx.py +++ b/testing/python/approx.py @@ -771,7 +771,7 @@ def test_foo(): def test_expected_value_type_error(self, x, name): with pytest.raises( TypeError, - match=fr"pytest.approx\(\) does not support nested {name}:", + match=rf"pytest.approx\(\) does not support nested {name}:", ): approx(x) diff --git a/testing/test_assertrewrite.py b/testing/test_assertrewrite.py index dd1573935fc..ae18b4be34a 100644 --- a/testing/test_assertrewrite.py +++ b/testing/test_assertrewrite.py @@ -1313,7 +1313,7 @@ def test_simple_failure(): @pytest.mark.skipif( - sys.maxsize <= (2 ** 31 - 1), reason="Causes OverflowError on 32bit systems" + sys.maxsize <= (2**31 - 1), reason="Causes OverflowError on 32bit systems" ) @pytest.mark.parametrize("offset", [-1, +1]) def test_source_mtime_long_long(pytester: Pytester, offset) -> None: @@ -1332,7 +1332,7 @@ def test(): pass # use unsigned long timestamp which overflows signed long, # which was the cause of the bug # +1 offset also tests masking of 0xFFFFFFFF - timestamp = 2 ** 32 + offset + timestamp = 2**32 + offset os.utime(str(p), (timestamp, timestamp)) result = pytester.runpytest() assert result.ret == 0 From 12b288d84af798c36842fb4c973c144068e5c6d0 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 3 Feb 2022 11:48:55 +0100 Subject: [PATCH 115/176] releasing: Always set doc_version (#9589) Looks like something (tox?) does not deal with empty arguments being passed to release.py correctly --- scripts/prepare-release-pr.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/scripts/prepare-release-pr.py b/scripts/prepare-release-pr.py index 73088397d55..fcfd85b20cc 100644 --- a/scripts/prepare-release-pr.py +++ b/scripts/prepare-release-pr.py @@ -90,13 +90,10 @@ def prepare_release_pr( if prerelease: template_name = "release.pre.rst" - doc_version = release_branch elif is_feature_release: template_name = "release.minor.rst" - doc_version = "" # unused in template else: template_name = "release.patch.rst" - doc_version = "" # unused in template # important to use tox here because we have changed branches, so dependencies # might have changed as well @@ -107,7 +104,7 @@ def prepare_release_pr( "--", version, template_name, - doc_version, + release_branch, # doc_version "--skip-check-links", ] print("Running", " ".join(cmdline)) From 2982753d807b8a2acc3dd6b23ec560384970da7e Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 3 Feb 2022 16:33:07 +0100 Subject: [PATCH 116/176] releasing: Add template for major releases (#9596) * releasing: Add template for major releases With pytest 6.0.0, we still used a manual releasing workflow (at least if I remember correctly), and apparently we never wrote a release announcement template for major releases. Instead, the minor release template claimed that the release would contain "breaking changes", which doesn't seem reasonable. Thus, this adds a new major template based on the former minor template, and adjusts the latter to only mention fixes and new features instead. * Update scripts/release.minor.rst Co-authored-by: Bruno Oliveira Co-authored-by: Bruno Oliveira --- scripts/prepare-release-pr.py | 4 +++- scripts/release.major.rst | 24 ++++++++++++++++++++++++ scripts/release.minor.rst | 4 ++-- 3 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 scripts/release.major.rst diff --git a/scripts/prepare-release-pr.py b/scripts/prepare-release-pr.py index fcfd85b20cc..7a80de7edaa 100644 --- a/scripts/prepare-release-pr.py +++ b/scripts/prepare-release-pr.py @@ -88,7 +88,9 @@ def prepare_release_pr( print(f"Branch {Fore.CYAN}{release_branch}{Fore.RESET} created.") - if prerelease: + if is_major: + template_name = "release.major.rst" + elif prerelease: template_name = "release.pre.rst" elif is_feature_release: template_name = "release.minor.rst" diff --git a/scripts/release.major.rst b/scripts/release.major.rst new file mode 100644 index 00000000000..76e447f0c6d --- /dev/null +++ b/scripts/release.major.rst @@ -0,0 +1,24 @@ +pytest-{version} +======================================= + +The pytest team is proud to announce the {version} release! + +This release contains new features, improvements, bug fixes, and breaking changes, so users +are encouraged to take a look at the CHANGELOG carefully: + + https://docs.pytest.org/en/stable/changelog.html + +For complete documentation, please visit: + + https://docs.pytest.org/en/stable/ + +As usual, you can upgrade from PyPI via: + + pip install -U pytest + +Thanks to all of the contributors to this release: + +{contributors} + +Happy testing, +The pytest Development Team diff --git a/scripts/release.minor.rst b/scripts/release.minor.rst index 76e447f0c6d..9a06d3d4140 100644 --- a/scripts/release.minor.rst +++ b/scripts/release.minor.rst @@ -3,8 +3,8 @@ pytest-{version} The pytest team is proud to announce the {version} release! -This release contains new features, improvements, bug fixes, and breaking changes, so users -are encouraged to take a look at the CHANGELOG carefully: +This release contains new features, improvements, and bug fixes, +the full list of changes is available in the changelog: https://docs.pytest.org/en/stable/changelog.html From dfa7023862242b497a7f4707d3aaf906effe8f11 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 4 Feb 2022 11:48:24 +0100 Subject: [PATCH 117/176] Prepare release 7.0.0 (#9598) (#9604) * Prepare release version 7.0.0 * Add note to changelog Co-authored-by: pytest bot Co-authored-by: Florian Bruhin (cherry picked from commit e37fbe5685d330cbe7819c5a08d0a524df7299bf) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- changelog/9355.bugfix.rst | 1 - changelog/9396.bugfix.rst | 1 - changelog/9404.doc.rst | 1 - changelog/9488.deprecation.rst | 7 --- changelog/9505.doc.rst | 2 - changelog/9521.trivial.rst | 1 - doc/en/announce/index.rst | 1 + doc/en/announce/release-7.0.0.rst | 74 +++++++++++++++++++++++++++++++ doc/en/builtin.rst | 4 +- doc/en/changelog.rst | 45 +++++++++++++++++++ doc/en/getting-started.rst | 2 +- 11 files changed, 123 insertions(+), 16 deletions(-) delete mode 100644 changelog/9355.bugfix.rst delete mode 100644 changelog/9396.bugfix.rst delete mode 100644 changelog/9404.doc.rst delete mode 100644 changelog/9488.deprecation.rst delete mode 100644 changelog/9505.doc.rst delete mode 100644 changelog/9521.trivial.rst create mode 100644 doc/en/announce/release-7.0.0.rst diff --git a/changelog/9355.bugfix.rst b/changelog/9355.bugfix.rst deleted file mode 100644 index a2739369fe0..00000000000 --- a/changelog/9355.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed error message prints function decorators when using assert in Python 3.8 and above. diff --git a/changelog/9396.bugfix.rst b/changelog/9396.bugfix.rst deleted file mode 100644 index dcb83bbc14f..00000000000 --- a/changelog/9396.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Ensure :attr:`pytest.Config.inifile` is available during the :func:`pytest_cmdline_main <_pytest.hookspec.pytest_cmdline_main>` hook (regression during ``7.0.0rc1``). diff --git a/changelog/9404.doc.rst b/changelog/9404.doc.rst deleted file mode 100644 index 70e4c6d5899..00000000000 --- a/changelog/9404.doc.rst +++ /dev/null @@ -1 +0,0 @@ -Added extra documentation on alternatives to common misuses of `pytest.warns(None)` ahead of its deprecation. diff --git a/changelog/9488.deprecation.rst b/changelog/9488.deprecation.rst deleted file mode 100644 index 5c5807ec34a..00000000000 --- a/changelog/9488.deprecation.rst +++ /dev/null @@ -1,7 +0,0 @@ -If custom subclasses of nodes like :class:`pytest.Item` override the -``__init__`` method, they should take ``**kwargs``. See -:ref:`uncooperative-constructors-deprecated` for details. - -Note that a deprection warning is only emitted when there is a conflict in the -arguments pytest expected to pass. This deprecation was already part of pytest -7.0.0rc1 but wasn't documented. diff --git a/changelog/9505.doc.rst b/changelog/9505.doc.rst deleted file mode 100644 index 51386c226bf..00000000000 --- a/changelog/9505.doc.rst +++ /dev/null @@ -1,2 +0,0 @@ -Clarify where the configuration files are located. To avoid confusions documentation mentions -that configuration file is located in the root of the repository. diff --git a/changelog/9521.trivial.rst b/changelog/9521.trivial.rst deleted file mode 100644 index 0c402ad242b..00000000000 --- a/changelog/9521.trivial.rst +++ /dev/null @@ -1 +0,0 @@ -Add test coverage to assertion rewrite path. diff --git a/doc/en/announce/index.rst b/doc/en/announce/index.rst index ccda9d536e3..75dde1bd6d9 100644 --- a/doc/en/announce/index.rst +++ b/doc/en/announce/index.rst @@ -6,6 +6,7 @@ Release announcements :maxdepth: 2 + release-7.0.0 release-7.0.0rc1 release-6.2.5 release-6.2.4 diff --git a/doc/en/announce/release-7.0.0.rst b/doc/en/announce/release-7.0.0.rst new file mode 100644 index 00000000000..3ce4335564f --- /dev/null +++ b/doc/en/announce/release-7.0.0.rst @@ -0,0 +1,74 @@ +pytest-7.0.0 +======================================= + +The pytest team is proud to announce the 7.0.0 release! + +This release contains new features, improvements, bug fixes, and breaking changes, so users +are encouraged to take a look at the CHANGELOG carefully: + + https://docs.pytest.org/en/stable/changelog.html + +For complete documentation, please visit: + + https://docs.pytest.org/en/stable/ + +As usual, you can upgrade from PyPI via: + + pip install -U pytest + +Thanks to all of the contributors to this release: + +* Adam J. Stewart +* Alexander King +* Amin Alaee +* Andrew Neitsch +* Anthony Sottile +* Ben Davies +* Bernát Gábor +* Brian Okken +* Bruno Oliveira +* Cristian Vera +* Dan Alvizu +* David Szotten +* Eddie +* Emmanuel Arias +* Emmanuel Meric de Bellefon +* Eric Liu +* Florian Bruhin +* GergelyKalmar +* Graeme Smecher +* Harshna +* Hugo van Kemenade +* Jakub Kulík +* James Myatt +* Jeff Rasley +* Kale Kundert +* Kian Meng, Ang +* Miro Hrončok +* Naveen-Pratap +* Oleg Höfling +* Olga Matoula +* Ran Benita +* Ronny Pfannschmidt +* Simon K +* Srip +* Sören Wegener +* Taneli Hukkinen +* Terje Runde +* Thomas Grainger +* Thomas Hisch +* William Jamir Silva +* Yuval Shimon +* Zac Hatfield-Dodds +* andrewdotn +* denivyruck +* ericluoliu +* oleg.hoefling +* symonk +* ziebam +* Éloi Rivard +* Éric + + +Happy testing, +The pytest Development Team diff --git a/doc/en/builtin.rst b/doc/en/builtin.rst index ba173ac196f..c7e7863b218 100644 --- a/doc/en/builtin.rst +++ b/doc/en/builtin.rst @@ -117,10 +117,10 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a `pytest-xdist `__ plugin. See :issue:`7767` for details. - tmpdir_factory [session scope] -- .../_pytest/legacypath.py:292 + tmpdir_factory [session scope] -- .../_pytest/legacypath.py:295 Return a :class:`pytest.TempdirFactory` instance for the test session. - tmpdir -- .../_pytest/legacypath.py:299 + tmpdir -- .../_pytest/legacypath.py:302 Return a temporary directory path object which is unique to each test function invocation, created as a sub directory of the base temporary directory. diff --git a/doc/en/changelog.rst b/doc/en/changelog.rst index 6896072e1ab..9605d6bcf00 100644 --- a/doc/en/changelog.rst +++ b/doc/en/changelog.rst @@ -28,6 +28,51 @@ with advance notice in the **Deprecations** section of releases. .. towncrier release notes start +pytest 7.0.0 (2022-02-03) +========================= + +(**Please see the full set of changes for this release also in the 7.0.0rc1 notes below**) + +Deprecations +------------ + +- `#9488 `_: If custom subclasses of nodes like :class:`pytest.Item` override the + ``__init__`` method, they should take ``**kwargs``. See + :ref:`uncooperative-constructors-deprecated` for details. + + Note that a deprection warning is only emitted when there is a conflict in the + arguments pytest expected to pass. This deprecation was already part of pytest + 7.0.0rc1 but wasn't documented. + + + +Bug Fixes +--------- + +- `#9355 `_: Fixed error message prints function decorators when using assert in Python 3.8 and above. + + +- `#9396 `_: Ensure :attr:`pytest.Config.inifile` is available during the :func:`pytest_cmdline_main <_pytest.hookspec.pytest_cmdline_main>` hook (regression during ``7.0.0rc1``). + + + +Improved Documentation +---------------------- + +- `#9404 `_: Added extra documentation on alternatives to common misuses of `pytest.warns(None)` ahead of its deprecation. + + +- `#9505 `_: Clarify where the configuration files are located. To avoid confusions documentation mentions + that configuration file is located in the root of the repository. + + + +Trivial/Internal Changes +------------------------ + +- `#9521 `_: Add test coverage to assertion rewrite path. + + pytest 7.0.0rc1 (2021-12-06) ============================ diff --git a/doc/en/getting-started.rst b/doc/en/getting-started.rst index 47eed9c9354..4c948843a9d 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.0.0rc1 + pytest 7.0.0 .. _`simpletest`: From dff1a15881bfc25dfb90c9ec81393dae97c44548 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 4 Feb 2022 12:11:30 +0100 Subject: [PATCH 118/176] ci: Add missing macOS CI envs (#9601) alinsa_vix in Discord noticed that we are not testing Python 3.9 and 3.10 on macOS, which seems strange. Maybe this is due how to macOS CI resources were quite scarce for a while, but I believe this has improved since. --- .github/workflows/main.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 77cee5a8a06..c8f216c4104 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -48,6 +48,8 @@ jobs: "macos-py37", "macos-py38", + "macos-py39", + "macos-py310", "docs", "doctesting", @@ -116,6 +118,14 @@ jobs: os: macos-latest tox_env: "py38-xdist" use_coverage: true + - name: "macos-py39" + python: "3.9" + os: macos-latest + tox_env: "py39-xdist" + - name: "macos-py310" + python: "3.10" + os: macos-latest + tox_env: "py310-xdist" - name: "plugins" python: "3.9" From 48f01bdcc29f1ae457616053dbda43cb25a99e5f Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 4 Feb 2022 12:12:58 +0100 Subject: [PATCH 119/176] doc: Hide done training (#9602) Only commenting out as I expect to add trainings at PyConDE and possibly PyConIT soon --- doc/en/index.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/en/index.rst b/doc/en/index.rst index da0d3bd4220..9e9cf0b68a8 100644 --- a/doc/en/index.rst +++ b/doc/en/index.rst @@ -1,10 +1,11 @@ :orphan: -.. sidebar:: Next Open Trainings +.. + .. sidebar:: Next Open Trainings - - `Professional Testing with Python `_, via `Python Academy `_, February 1st to 3rd, 2022, Leipzig (Germany) and remote. + - `Professional Testing with Python `_, via `Python Academy `_, February 1st to 3rd, 2022, Leipzig (Germany) and remote. - Also see `previous talks and blogposts `_. + Also see `previous talks and blogposts `_. .. _features: From b5a168aa0e00c5cd0c2ffd40be0189ec15266d0e Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 4 Feb 2022 12:13:33 +0100 Subject: [PATCH 120/176] doc: Streamline remote handling in releasing docs (#9603) The docs already assume an 'upstream' remote, so we can only fetch from there instead of fetching all remotes. We also don't need to hardcode the remote URL. --- RELEASING.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/RELEASING.rst b/RELEASING.rst index f9e4d5f153c..5e7654210d6 100644 --- a/RELEASING.rst +++ b/RELEASING.rst @@ -37,7 +37,7 @@ breaking changes or new features. For a new minor release, first create a new maintenance branch from ``main``:: - git fetch --all + git fetch upstream git branch 7.1.x upstream/main git push upstream 7.1.x @@ -63,7 +63,7 @@ Major releases 1. Create a new maintenance branch from ``main``:: - git fetch --all + git fetch upstream git branch 8.0.x upstream/main git push upstream 8.0.x @@ -136,9 +136,9 @@ Both automatic and manual processes described above follow the same steps from t #. After all tests pass and the PR has been approved, tag the release commit in the ``release-MAJOR.MINOR.PATCH`` branch and push it. This will publish to PyPI:: - git fetch --all + git fetch upstream git tag MAJOR.MINOR.PATCH upstream/release-MAJOR.MINOR.PATCH - git push git@github.com:pytest-dev/pytest.git MAJOR.MINOR.PATCH + git push upstream MAJOR.MINOR.PATCH Wait for the deploy to complete, then make sure it is `available on PyPI `_. @@ -146,7 +146,7 @@ Both automatic and manual processes described above follow the same steps from t #. Cherry-pick the CHANGELOG / announce files to the ``main`` branch:: - git fetch --all --prune + git fetch upstream git checkout upstream/main -b cherry-pick-release git cherry-pick -x -m1 upstream/MAJOR.MINOR.x @@ -158,7 +158,7 @@ Both automatic and manual processes described above follow the same steps from t git checkout main git pull git tag MAJOR.{MINOR+1}.0.dev0 - git push git@github.com:pytest-dev/pytest.git MAJOR.{MINOR+1}.0.dev0 + git push upstream MAJOR.{MINOR+1}.0.dev0 #. Send an email announcement with the contents from:: From 57f8f5d2b313b9601872a1184a809060468a606e Mon Sep 17 00:00:00 2001 From: Gabor Szabo Date: Fri, 4 Feb 2022 14:38:26 +0200 Subject: [PATCH 121/176] Mention basetemp in docs as a way to only keep last temp dir (#9607) Closes #9599 --- doc/en/how-to/tmp_path.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/en/how-to/tmp_path.rst b/doc/en/how-to/tmp_path.rst index ebd74d42e90..b261a55637e 100644 --- a/doc/en/how-to/tmp_path.rst +++ b/doc/en/how-to/tmp_path.rst @@ -121,6 +121,10 @@ the system temporary directory. The base name will be ``pytest-NUM`` where ``NUM`` will be incremented with each test run. Moreover, entries older than 3 temporary directories will be removed. +The number of entries currently cannot be changed, but using the ``--basetemp`` +option will remove the directory before every run, effectively meaning the temporary directories +of only the most recent run will be kept. + You can override the default temporary directory setting like this: .. code-block:: bash From 77a38a3b754e6a82332a1f7bd11bc684c345af28 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 4 Feb 2022 17:36:31 +0100 Subject: [PATCH 122/176] doc: Add changing RTD version to checklist (#9606) I still think it makes sense to always serve docs from the release branch (rather than the latest tagged release), but that means we need to update it on new releases. --- RELEASING.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/RELEASING.rst b/RELEASING.rst index 5e7654210d6..66775e7cfbb 100644 --- a/RELEASING.rst +++ b/RELEASING.rst @@ -160,6 +160,8 @@ Both automatic and manual processes described above follow the same steps from t git tag MAJOR.{MINOR+1}.0.dev0 git push upstream MAJOR.{MINOR+1}.0.dev0 +#. For major and minor releases, change the default version in the `Read the Docs Settings `_ to the new branch. + #. Send an email announcement with the contents from:: doc/en/announce/release-.rst From d1b394af88175ae80819e8317165cf17a140618e Mon Sep 17 00:00:00 2001 From: "P. L. Lim" <2090236+pllim@users.noreply.github.com> Date: Fri, 4 Feb 2022 17:45:04 -0500 Subject: [PATCH 123/176] DOC: pytest.warns() fails on zero warning --- doc/en/how-to/capture-warnings.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/en/how-to/capture-warnings.rst b/doc/en/how-to/capture-warnings.rst index 065c11e610c..8c911424af7 100644 --- a/doc/en/how-to/capture-warnings.rst +++ b/doc/en/how-to/capture-warnings.rst @@ -358,7 +358,7 @@ Additional use cases of warnings in tests Here are some use cases involving warnings that often come up in tests, and suggestions on how to deal with them: -- To ensure that **any** warning is emitted, use: +- To ensure that **at least one** warning is emitted, use: .. code-block:: python From 20c2c30ff241cf3bb48290edd1b7bfebceccd007 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Sat, 5 Feb 2022 11:52:36 +0200 Subject: [PATCH 124/176] mark/structures: use class-based NamedTuple syntax Should hopefully work now in Python>=3.7. --- src/_pytest/mark/structures.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/_pytest/mark/structures.py b/src/_pytest/mark/structures.py index 0e42cd8de5f..ec41b3f99a6 100644 --- a/src/_pytest/mark/structures.py +++ b/src/_pytest/mark/structures.py @@ -72,16 +72,11 @@ def get_empty_parameterset_mark( return mark -class ParameterSet( - NamedTuple( - "ParameterSet", - [ - ("values", Sequence[Union[object, NotSetType]]), - ("marks", Collection[Union["MarkDecorator", "Mark"]]), - ("id", Optional[str]), - ], - ) -): +class ParameterSet(NamedTuple): + values: Sequence[Union[object, NotSetType]] + marks: Collection[Union["MarkDecorator", "Mark"]] + id: Optional[str] + @classmethod def param( cls, From 2c3be75b09d6e88bafc273dc810e4e01165cd054 Mon Sep 17 00:00:00 2001 From: pytest bot Date: Sun, 6 Feb 2022 00:13:55 +0000 Subject: [PATCH 125/176] [automated] Update plugin list --- doc/en/reference/plugin_list.rst | 198 ++++++++++++++++++++++--------- 1 file changed, 139 insertions(+), 59 deletions(-) diff --git a/doc/en/reference/plugin_list.rst b/doc/en/reference/plugin_list.rst index 540bdb06952..f73ad773cb8 100644 --- a/doc/en/reference/plugin_list.rst +++ b/doc/en/reference/plugin_list.rst @@ -11,7 +11,7 @@ automatically. Packages classified as inactive are excluded. creating a PDF, because otherwise the table gets far too wide for the page. -This list contains 985 plugins. +This list contains 995 plugins. .. only:: not latex @@ -19,7 +19,7 @@ This list contains 985 plugins. name summary last release status requires =============================================== ======================================================================================================================================================================== ============== ===================== ================================================ :pypi:`pytest-accept` A pytest-plugin for updating doctest outputs Jan 07, 2022 N/A pytest (>=6,<8) - :pypi:`pytest-adaptavist` pytest plugin for generating test execution results within Jira Test Management (tm4j) Jan 27, 2022 N/A pytest (>=5.4.0) + :pypi:`pytest-adaptavist` pytest plugin for generating test execution results within Jira Test Management (tm4j) Feb 01, 2022 N/A pytest (>=5.4.0) :pypi:`pytest-addons-test` 用于测试pytest的插件 Aug 02, 2021 N/A pytest (>=6.2.4,<7.0.0) :pypi:`pytest-adf` Pytest plugin for writing Azure Data Factory integration tests May 10, 2021 4 - Beta pytest (>=3.5.0) :pypi:`pytest-adf-azure-identity` Pytest plugin for writing Azure Data Factory integration tests Mar 06, 2021 4 - Beta pytest (>=3.5.0) @@ -77,7 +77,7 @@ This list contains 985 plugins. :pypi:`pytest-austin` Austin plugin for pytest Oct 11, 2020 4 - Beta N/A :pypi:`pytest-autochecklog` automatically check condition and log all the checks Apr 25, 2015 4 - Beta N/A :pypi:`pytest-automation` pytest plugin for building a test suite, using YAML files to extend pytest parameterize functionality. Oct 01, 2021 N/A pytest - :pypi:`pytest-automock` Pytest plugin for automatical mocks creation Apr 22, 2020 N/A pytest ; extra == 'dev' + :pypi:`pytest-automock` Pytest plugin for automatical mocks creation Feb 01, 2022 N/A pytest ; extra == 'dev' :pypi:`pytest-auto-parametrize` pytest plugin: avoid repeating arguments in parametrize Oct 02, 2016 3 - Alpha N/A :pypi:`pytest-autotest` This fixture provides a configured "driver" for Android Automated Testing, using uiautomator2. Aug 25, 2021 N/A pytest :pypi:`pytest-avoidance` Makes pytest skip tests that don not need rerunning May 23, 2019 4 - Beta pytest (>=3.5.0) @@ -125,11 +125,11 @@ This list contains 985 plugins. :pypi:`pytest-cache` pytest plugin with mechanisms for caching across test runs Jun 04, 2013 3 - Alpha N/A :pypi:`pytest-cache-assert` Cache assertion data to simplify regression testing of complex serializable data Nov 03, 2021 4 - Beta pytest (>=5) :pypi:`pytest-cagoule` Pytest plugin to only run tests affected by changes Jan 01, 2020 3 - Alpha N/A + :pypi:`pytest-cairo` Feb 04, 2022 N/A pytest :pypi:`pytest-camel-collect` Enable CamelCase-aware pytest class collection Aug 02, 2020 N/A pytest (>=2.9) :pypi:`pytest-canonical-data` A plugin which allows to compare results with canonical results, based on previous runs May 08, 2020 2 - Pre-Alpha pytest (>=3.5.0) :pypi:`pytest-caprng` A plugin that replays pRNG state on failure. May 02, 2018 4 - Beta N/A :pypi:`pytest-capture-deprecatedwarnings` pytest plugin to capture all deprecatedwarnings and put them in one file Apr 30, 2019 N/A N/A - :pypi:`pytest-capturelogs` A sample Python project Sep 11, 2021 3 - Alpha N/A :pypi:`pytest-cases` Separate test code from test cases in pytest. Jan 07, 2022 5 - Production/Stable N/A :pypi:`pytest-cassandra` Cassandra CCM Test Fixtures for pytest Nov 04, 2017 1 - Planning N/A :pypi:`pytest-catchlog` py.test plugin to catch log messages. This is a fork of pytest-capturelog. Jan 24, 2016 4 - Beta pytest (>=2.6) @@ -167,7 +167,7 @@ This list contains 985 plugins. :pypi:`pytest-confluence-report` Package stands for pytest plugin to upload results into Confluence page. Nov 06, 2020 N/A N/A :pypi:`pytest-console-scripts` Pytest plugin for testing console scripts Jan 06, 2022 4 - Beta N/A :pypi:`pytest-consul` pytest plugin with fixtures for testing consul aware apps Nov 24, 2018 3 - Alpha pytest - :pypi:`pytest-container` Pytest fixtures for writing container based tests Nov 19, 2021 3 - Alpha pytest (>=3.10) + :pypi:`pytest-container` Pytest fixtures for writing container based tests Feb 01, 2022 3 - Alpha pytest (>=3.10) :pypi:`pytest-contextfixture` Define pytest fixtures as context managers. Mar 12, 2013 4 - Beta N/A :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. 🍪 May 24, 2021 5 - Production/Stable pytest (>=3.3.0) @@ -210,6 +210,7 @@ This list contains 985 plugins. :pypi:`pytest-dbfixtures` Databases fixtures plugin for py.test. Dec 07, 2016 4 - Beta N/A :pypi:`pytest-db-plugin` Nov 27, 2021 N/A pytest (>=5.0) :pypi:`pytest-dbt-adapter` A pytest plugin for testing dbt adapter plugins Nov 24, 2021 N/A pytest (<7,>=6) + :pypi:`pytest-dbt-conventions` A pytest plugin for linting a dbt project's conventions Feb 04, 2022 N/A pytest (>=6.2.5,<7.0.0) :pypi:`pytest-dbt-core` Pytest extension for dbt. Jan 28, 2022 N/A pytest (>=6.2.5) ; extra == 'test' :pypi:`pytest-dbus-notification` D-BUS notifications for pytest results. Mar 05, 2014 5 - Production/Stable N/A :pypi:`pytest-deadfixtures` A simple plugin to list unused fixtures in pytest Jul 23, 2020 5 - Production/Stable N/A @@ -247,7 +248,7 @@ This list contains 985 plugins. :pypi:`pytest-djangorestframework` A djangorestframework plugin for pytest Aug 11, 2019 4 - Beta N/A :pypi:`pytest-django-rq` A pytest plugin to help writing unit test for django-rq Apr 13, 2020 4 - Beta N/A :pypi:`pytest-django-sqlcounts` py.test plugin for reporting the number of SQLs executed per django testcase. Jun 16, 2015 4 - Beta N/A - :pypi:`pytest-django-testing-postgresql` Use a temporary PostgreSQL database with pytest-django Dec 05, 2019 3 - Alpha N/A + :pypi:`pytest-django-testing-postgresql` Use a temporary PostgreSQL database with pytest-django Jan 31, 2022 4 - Beta N/A :pypi:`pytest-doc` A documentation plugin for py.test. Jun 28, 2015 5 - Production/Stable N/A :pypi:`pytest-docfiles` pytest plugin to test codeblocks in your documentation. Dec 22, 2021 4 - Beta pytest (>=3.7.0) :pypi:`pytest-docgen` An RST Documentation Generator for pytest-based test suites Apr 17, 2020 N/A N/A @@ -258,10 +259,12 @@ This list contains 985 plugins. :pypi:`pytest-docker-db` A plugin to use docker databases for pytests Mar 20, 2021 5 - Production/Stable pytest (>=3.1.1) :pypi:`pytest-docker-fixtures` pytest docker fixtures Nov 23, 2021 3 - Alpha N/A :pypi:`pytest-docker-git-fixtures` Pytest fixtures for testing with git scm. Mar 11, 2021 4 - Beta pytest + :pypi:`pytest-docker-haproxy-fixtures` Pytest fixtures for testing with haproxy. Feb 01, 2022 4 - Beta pytest :pypi:`pytest-docker-pexpect` pytest plugin for writing functional tests with pexpect and docker Jan 14, 2019 N/A pytest :pypi:`pytest-docker-postgresql` A simple plugin to use with pytest Sep 24, 2019 4 - Beta pytest (>=3.5.0) :pypi:`pytest-docker-py` Easy to use, simple to extend, pytest plugin that minimally leverages docker-py. Nov 27, 2018 N/A pytest (==4.0.0) - :pypi:`pytest-docker-registry-fixtures` Pytest fixtures for testing with docker registries. Mar 04, 2021 4 - Beta pytest + :pypi:`pytest-docker-registry-fixtures` Pytest fixtures for testing with docker registries. Feb 01, 2022 4 - Beta pytest + :pypi:`pytest-docker-squid-fixtures` Pytest fixtures for testing with squid. Feb 04, 2022 4 - Beta pytest :pypi:`pytest-docker-tools` Docker integration tests for pytest Jul 23, 2021 4 - Beta pytest (>=6.0.1,<7.0.0) :pypi:`pytest-docs` Documentation tool for pytest Nov 11, 2018 4 - Beta pytest (>=3.5.0) :pypi:`pytest-docstyle` pytest plugin to run pydocstyle Mar 23, 2020 3 - Alpha N/A @@ -318,7 +321,7 @@ This list contains 985 plugins. :pypi:`pytest-ethereum` pytest-ethereum: Pytest library for ethereum projects. Jun 24, 2019 3 - Alpha pytest (==3.3.2); extra == 'dev' :pypi:`pytest-eucalyptus` Pytest Plugin for BDD Aug 13, 2019 N/A pytest (>=4.2.0) :pypi:`pytest-eventlet` Applies eventlet monkey-patch as a pytest plugin. Oct 04, 2021 N/A pytest ; extra == 'dev' - :pypi:`pytest-excel` pytest plugin for generating excel reports Oct 06, 2020 5 - Production/Stable N/A + :pypi:`pytest-excel` pytest plugin for generating excel reports Jan 31, 2022 5 - Production/Stable N/A :pypi:`pytest-exceptional` Better exceptions Mar 16, 2017 4 - Beta N/A :pypi:`pytest-exception-script` Walk your code through exception script to check it's resiliency to failures. Aug 04, 2020 3 - Alpha pytest :pypi:`pytest-executable` pytest plugin for testing executables Nov 10, 2021 4 - Beta pytest (<6.3,>=4.3) @@ -416,7 +419,7 @@ This list contains 985 plugins. :pypi:`pytest-historic` Custom report to display pytest historical execution records Apr 08, 2020 N/A pytest :pypi:`pytest-historic-hook` Custom listener to store execution results into MYSQL DB, which is used for pytest-historic report Apr 08, 2020 N/A pytest :pypi:`pytest-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 Jan 29, 2022 3 - Alpha pytest (==6.2.5) + :pypi:`pytest-homeassistant-custom-component` Experimental package to automatically extract test plugins for Home Assistant custom components Feb 05, 2022 3 - Alpha pytest (==6.2.5) :pypi:`pytest-honey` A simple plugin to use with pytest Jan 07, 2022 4 - Beta pytest (>=3.5.0) :pypi:`pytest-honors` Report on tests that honor constraints, and guard against regressions Mar 06, 2020 4 - Beta N/A :pypi:`pytest-hoverfly` Simplify working with Hoverfly from pytest Jan 20, 2022 N/A pytest (>=5.0) @@ -424,6 +427,7 @@ This list contains 985 plugins. :pypi:`pytest-hpfeeds` Helpers for testing hpfeeds in your python project Aug 27, 2021 4 - Beta pytest (>=6.2.4,<7.0.0) :pypi:`pytest-html` pytest plugin for generating HTML reports Dec 13, 2020 5 - Production/Stable pytest (!=6.0.0,>=5.0) :pypi:`pytest-html-lee` optimized pytest plugin for generating HTML reports Jun 30, 2020 5 - Production/Stable pytest (>=5.0) + :pypi:`pytest-html-object-storage` Pytest report plugin for send HTML report on object-storage Jan 31, 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 Apr 25, 2021 N/A N/A :pypi:`pytest-html-thread` pytest plugin for generating HTML reports Dec 29, 2020 5 - Production/Stable N/A @@ -432,7 +436,7 @@ This list contains 985 plugins. :pypi:`pytest-http-mocker` Pytest plugin for http mocking (via https://github.com/vilus/mocker) Oct 20, 2019 N/A N/A :pypi:`pytest-httpretty` A thin wrapper of HTTPretty for pytest Feb 16, 2014 3 - Alpha N/A :pypi:`pytest-httpserver` pytest-httpserver is a httpserver for pytest Jan 27, 2022 3 - Alpha N/A - :pypi:`pytest-httpx` Send responses to httpx. Jan 26, 2022 5 - Production/Stable pytest (==6.*) + :pypi:`pytest-httpx` Send responses to httpx. Feb 05, 2022 5 - Production/Stable pytest (<8.*,>=6.*) :pypi:`pytest-httpx-blockage` Disable httpx requests during a test run Nov 16, 2021 N/A pytest (>=6.2.5) :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 @@ -440,7 +444,7 @@ This list contains 985 plugins. :pypi:`pytest-ibutsu` A plugin to sent pytest results to an Ibutsu server Jan 14, 2022 4 - Beta pytest :pypi:`pytest-icdiff` use icdiff for better error messages in pytest assertions Apr 08, 2020 4 - Beta N/A :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-idempotent` Pytest plugin for testing function idempotence. Jan 10, 2022 N/A N/A + :pypi:`pytest-idempotent` Pytest plugin for testing function idempotence. Jan 30, 2022 N/A N/A :pypi:`pytest-ignore-flaky` ignore failures from flaky tests (pytest plugin) Apr 23, 2021 5 - Production/Stable N/A :pypi:`pytest-image-diff` Jan 20, 2022 3 - Alpha pytest :pypi:`pytest-incremental` an incremental test runner (pytest plugin) Apr 24, 2021 5 - Production/Stable N/A @@ -450,7 +454,7 @@ This list contains 985 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 Sep 30, 2021 N/A N/A :pypi:`pytest-inmanta` A py.test plugin providing fixtures to simplify inmanta modules testing. Jan 26, 2022 5 - Production/Stable N/A - :pypi:`pytest-inmanta-extensions` Inmanta tests package May 27, 2021 5 - Production/Stable N/A + :pypi:`pytest-inmanta-extensions` Inmanta tests package Feb 03, 2022 5 - Production/Stable N/A :pypi:`pytest-Inomaly` A simple image diff plugin for pytest Feb 13, 2018 4 - Beta N/A :pypi:`pytest-insta` A practical snapshot testing plugin for pytest Apr 07, 2021 N/A pytest (>=6.0.2,<7.0.0) :pypi:`pytest-instafail` pytest plugin to show failures instantly Jun 14, 2020 4 - Beta pytest (>=2.9) @@ -568,7 +572,7 @@ This list contains 985 plugins. :pypi:`pytest-multilog` Multi-process logs handling and other helpers for pytest Jun 10, 2021 N/A N/A :pypi:`pytest-multithreading` a pytest plugin for th and concurrent testing Aug 12, 2021 N/A pytest (>=3.6) :pypi:`pytest-mutagen` Add the mutation testing feature to pytest Jul 24, 2020 N/A pytest (>=5.4) - :pypi:`pytest-mypy` Mypy static type checker plugin for Pytest Mar 21, 2021 4 - Beta pytest (>=3.5) + :pypi:`pytest-mypy` Mypy static type checker plugin for Pytest Jan 30, 2022 4 - Beta pytest (>=6.2) ; python_version >= "3.10" :pypi:`pytest-mypyd` Mypy static type checker plugin for Pytest Aug 20, 2019 4 - Beta pytest (<4.7,>=2.8) ; python_version < "3.5" :pypi:`pytest-mypy-plugins` pytest plugin for writing tests for mypy plugins Jan 11, 2022 3 - Alpha pytest (>=6.0.0) :pypi:`pytest-mypy-plugins-shim` Substitute for "pytest-mypy-plugins" for Python implementations which aren't supported by mypy. Apr 12, 2021 N/A N/A @@ -603,14 +607,14 @@ This list contains 985 plugins. :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-opentmi` pytest plugin for publish results to opentmi Jan 19, 2022 5 - Production/Stable pytest (>=5.0) - :pypi:`pytest-operator` Fixtures for Operators Dec 06, 2021 N/A N/A + :pypi:`pytest-operator` Fixtures for Operators Jan 31, 2022 N/A N/A :pypi:`pytest-optional` include/exclude values of fixtures in pytest Oct 07, 2015 N/A N/A :pypi:`pytest-optional-tests` Easy declaration of optional tests (i.e., that are not run by default) Jul 09, 2019 4 - Beta pytest (>=4.5.0) :pypi:`pytest-orchestration` A pytest plugin for orchestrating tests Jul 18, 2019 N/A N/A :pypi:`pytest-order` pytest plugin to run your tests in a specific order Jan 09, 2022 4 - Beta pytest (>=5.0) ; python_version < "3.10" :pypi:`pytest-ordering` pytest plugin to run your tests in a specific order Nov 14, 2018 4 - Beta pytest :pypi:`pytest-osxnotify` OS X notifications for py.test results. May 15, 2015 N/A N/A - :pypi:`pytest-otel` pytest-otel report OpenTelemetry traces about test executed Dec 16, 2021 N/A N/A + :pypi:`pytest-otel` pytest-otel report OpenTelemetry traces about test executed Jan 31, 2022 N/A N/A :pypi:`pytest-pact` A simple plugin to use with pytest Jan 07, 2019 4 - Beta N/A :pypi:`pytest-pahrametahrize` Parametrize your tests with a Boston accent. Nov 24, 2021 4 - Beta pytest (>=6.0,<7.0) :pypi:`pytest-parallel` a pytest plugin for parallel and concurrent testing Oct 10, 2021 3 - Alpha pytest (>=3.0.0) @@ -630,7 +634,7 @@ This list contains 985 plugins. :pypi:`pytest-pep257` py.test plugin for pep257 Jul 09, 2016 N/A N/A :pypi:`pytest-pep8` pytest plugin to check PEP8 requirements Apr 27, 2014 N/A N/A :pypi:`pytest-percent` Change the exit code of pytest test sessions when a required percent of tests pass. May 21, 2020 N/A pytest (>=5.2.0) - :pypi:`pytest-perf` pytest-perf Jan 08, 2022 5 - Production/Stable pytest (>=6) ; extra == 'testing' + :pypi:`pytest-perf` pytest-perf Feb 05, 2022 5 - Production/Stable pytest (>=6) ; extra == 'testing' :pypi:`pytest-performance` A simple plugin to ensure the execution of critical sections of code has not been impacted Sep 11, 2020 5 - Production/Stable pytest (>=3.7.0) :pypi:`pytest-persistence` Pytest tool for persistent objects Dec 07, 2021 N/A N/A :pypi:`pytest-pg` Helps to run PostgreSQL in docker as pytest fixture Jan 18, 2022 5 - Production/Stable pytest (>=6.0.0) @@ -666,13 +670,14 @@ This list contains 985 plugins. :pypi:`pytest-postgres` Run PostgreSQL in Docker container in Pytest. Mar 22, 2020 N/A pytest :pypi:`pytest-postgresql` Postgresql fixtures and fixture factories for Pytest. Dec 22, 2021 5 - Production/Stable pytest (>=6.2.0) :pypi:`pytest-power` pytest plugin with powerful fixtures Dec 31, 2020 N/A pytest (>=5.4) - :pypi:`pytest-pretty-terminal` pytest plugin for generating prettier terminal output Jan 25, 2022 N/A pytest (>=3.4.1) + :pypi:`pytest-pretty-terminal` pytest plugin for generating prettier terminal output Jan 31, 2022 N/A pytest (>=3.4.1) :pypi:`pytest-pride` Minitest-style test colors Apr 02, 2016 3 - Alpha N/A :pypi:`pytest-print` pytest-print adds the printer fixture you can use to print messages to the user (directly to the pytest runner, not stdout) Dec 28, 2021 5 - Production/Stable pytest (>=6) :pypi:`pytest-profiles` pytest plugin for configuration profiles Dec 09, 2021 4 - Beta pytest (>=3.7.0) :pypi:`pytest-profiling` Profiling plugin for py.test May 28, 2019 5 - Production/Stable pytest - :pypi:`pytest-progress` pytest plugin for instant test progress status Nov 09, 2021 5 - Production/Stable pytest (>=2.7) + :pypi:`pytest-progress` pytest plugin for instant test progress status Jan 31, 2022 5 - Production/Stable N/A :pypi:`pytest-prometheus` Report test pass / failures to a Prometheus PushGateway Oct 03, 2017 N/A N/A + :pypi:`pytest-prometheus-pushgateway` Pytest report plugin for Zulip Jan 31, 2022 5 - Production/Stable pytest :pypi:`pytest-prosper` Test helpers for Prosper projects Sep 24, 2018 N/A N/A :pypi:`pytest-pspec` A rspec format reporter for Python ptest Jun 02, 2020 4 - Beta pytest (>=3.0.0) :pypi:`pytest-psqlgraph` pytest plugin for testing applications that use psqlgraph Oct 19, 2021 4 - Beta pytest (>=6.0) @@ -706,6 +711,7 @@ This list contains 985 plugins. :pypi:`pytest-rabbitmq` RabbitMQ process and client fixtures for pytest Jun 02, 2021 5 - Production/Stable pytest (>=3.0.0) :pypi:`pytest-race` Race conditions tester for pytest Nov 21, 2016 4 - Beta N/A :pypi:`pytest-rage` pytest plugin to implement PEP712 Oct 21, 2011 3 - Alpha N/A + :pypi:`pytest-rail` pytest plugin for creating TestRail runs and adding results Feb 04, 2022 N/A pytest (>=3.6) :pypi:`pytest-railflow-testrail-reporter` Generate json reports along with specified metadata defined in test markers. Dec 02, 2021 5 - Production/Stable pytest :pypi:`pytest-raises` An implementation of pytest.raises as a pytest.mark fixture Apr 23, 2020 N/A pytest (>=3.2.2) :pypi:`pytest-raisesregexp` Simple pytest plugin to look for regex in Exceptions Dec 18, 2015 N/A N/A @@ -754,7 +760,7 @@ This list contains 985 plugins. :pypi:`pytest-resilient-circuits` Resilient Circuits fixtures for PyTest. Jan 20, 2022 N/A N/A :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-responsemock` Simplified requests calls mocking for pytest Oct 10, 2020 5 - Production/Stable N/A + :pypi:`pytest-responsemock` Simplified requests calls mocking for pytest Feb 04, 2022 5 - Production/Stable N/A :pypi:`pytest-responses` py.test integration for responses Apr 26, 2021 N/A pytest (>=2.5) :pypi:`pytest-restrict` Pytest plugin to restrict the test types allowed Jan 10, 2022 5 - Production/Stable pytest :pypi:`pytest-rethinkdb` A RethinkDB plugin for pytest. Jul 24, 2016 4 - Beta N/A @@ -780,13 +786,13 @@ This list contains 985 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. Jan 27, 2022 5 - Production/Stable N/A + :pypi:`pytest-sbase` A complete web automation framework for end-to-end testing. Feb 04, 2022 5 - Production/Stable N/A :pypi:`pytest-scenario` pytest plugin for test scenarios Feb 06, 2017 3 - Alpha N/A :pypi:`pytest-schema` 👍 Validate return values against a schema-like object in testing Aug 31, 2020 5 - Production/Stable pytest (>=3.5.0) :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 Sep 19, 2020 5 - Production/Stable pytest (>=5.0.0) - :pypi:`pytest-seleniumbase` A complete web automation framework for end-to-end testing. Jan 27, 2022 5 - Production/Stable N/A + :pypi:`pytest-seleniumbase` A complete web automation framework for end-to-end testing. Feb 04, 2022 5 - Production/Stable N/A :pypi:`pytest-selenium-enhancer` pytest plugin for Selenium Dec 16, 2021 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-send-email` Send pytest execution result email Dec 04, 2019 N/A N/A @@ -800,7 +806,7 @@ This list contains 985 plugins. :pypi:`pytest-sftpserver` py.test plugin to locally test sftp server connections. Sep 16, 2019 4 - Beta N/A :pypi:`pytest-shard` Dec 11, 2020 4 - Beta pytest :pypi:`pytest-shell` A pytest plugin to help with testing shell scripts / black box commands Nov 07, 2021 N/A N/A - :pypi:`pytest-shell-utilities` Pytest plugin to simplify running shell commands against the system Jan 25, 2022 4 - Beta pytest (>=6.0.0) + :pypi:`pytest-shell-utilities` Pytest plugin to simplify running shell commands against the system Feb 05, 2022 4 - Beta pytest (>=6.0.0) :pypi:`pytest-sheraf` Versatile ZODB abstraction layer - pytest fixtures Feb 11, 2020 N/A pytest :pypi:`pytest-sherlock` pytest plugin help to find coupled tests Nov 18, 2021 5 - Production/Stable pytest (>=3.5.1) :pypi:`pytest-shortcuts` Expand command-line shortcuts listed in pytest configuration Oct 29, 2020 4 - Beta pytest (>=3.5.0) @@ -809,7 +815,7 @@ This list contains 985 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 Jan 26, 2022 5 - Production/Stable pytest (>=6.0.0) + :pypi:`pytest-skip-markers` Pytest Salt Plugin Feb 05, 2022 5 - Production/Stable pytest (>=6.0.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. Sep 28, 2021 N/A N/A @@ -871,6 +877,7 @@ This list contains 985 plugins. :pypi:`pytest-svn` SVN repository fixture for py.test May 28, 2019 5 - Production/Stable pytest :pypi:`pytest-symbols` pytest-symbols is a pytest plugin that adds support for passing test environment symbols into pytest tests. Nov 20, 2017 3 - Alpha N/A :pypi:`pytest-system-statistics` Pytest plugin to track and report system usage statistics Jan 26, 2022 5 - Production/Stable pytest (>=6.0.0) + :pypi:`pytest-system-test-plugin` Pyst - Pytest System-Test Plugin Feb 03, 2022 N/A N/A :pypi:`pytest-takeltest` Fixtures for ansible, testinfra and molecule Jan 04, 2022 N/A N/A :pypi:`pytest-talisker` Nov 28, 2021 N/A N/A :pypi:`pytest-tap` Test Anything Protocol (TAP) reporting plugin for pytest Oct 27, 2021 5 - Production/Stable pytest (>=3.0) @@ -889,7 +896,7 @@ This list contains 985 plugins. :pypi:`pytest-test-groups` A Pytest plugin for running a subset of your tests by splitting them in to equally sized groups. Oct 25, 2016 5 - Production/Stable N/A :pypi:`pytest-testinfra` Test infrastructures Dec 07, 2021 5 - Production/Stable pytest (!=3.0.2) :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 Oct 22, 2021 4 - Beta N/A + :pypi:`pytest-testmon` selects tests affected by changed files and methods Feb 05, 2022 4 - Beta N/A :pypi:`pytest-testobject` Plugin to use TestObject Suites with Pytest Sep 24, 2019 4 - Beta pytest (>=3.1.1) :pypi:`pytest-testpluggy` set your encoding Jan 07, 2022 N/A pytest :pypi:`pytest-testrail` pytest plugin for creating TestRail runs and adding results Aug 27, 2020 N/A pytest (>=3.6) @@ -937,9 +944,11 @@ This list contains 985 plugins. :pypi:`pytest-trepan` Pytest plugin for trepan debugger. Jul 28, 2018 5 - Production/Stable N/A :pypi:`pytest-trialtemp` py.test plugin for using the same _trial_temp working directory as trial Jun 08, 2015 N/A N/A :pypi:`pytest-trio` Pytest plugin for trio Oct 16, 2020 N/A N/A + :pypi:`pytest-trytond` Pytest plugin for the Tryton server framework Feb 02, 2022 3 - Alpha pytest (>=5) :pypi:`pytest-tspwplib` A simple plugin to use with tspwplib Jan 08, 2021 4 - Beta pytest (>=3.5.0) :pypi:`pytest-tstcls` Test Class Base Mar 23, 2020 5 - Production/Stable N/A :pypi:`pytest-twisted` A twisted plugin for pytest. Aug 30, 2021 5 - Production/Stable pytest (>=2.3) + :pypi:`pytest-typechecker` Run type checkers on specified test files Feb 04, 2022 N/A pytest (>=6.2.5,<7.0.0) :pypi:`pytest-typhoon-xray` Typhoon HIL plugin for pytest Nov 03, 2021 4 - Beta N/A :pypi:`pytest-tytest` Typhoon HIL plugin for pytest May 25, 2020 4 - Beta pytest (>=5.4.2) :pypi:`pytest-ubersmith` Easily mock calls to ubersmith at the \`requests\` level. Apr 13, 2015 N/A N/A @@ -1001,8 +1010,9 @@ This list contains 985 plugins. :pypi:`pytest-yuk` Display tests you are uneasy with, using 🤢/🤮 for pass/fail of tests marked with yuk. Mar 26, 2021 N/A N/A :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 02, 2021 5 - Production/Stable pytest (>=4.5.0) + :pypi:`pytest-zebrunner` Pytest connector for Zebrunner reporting Feb 02, 2022 5 - Production/Stable pytest (>=4.5.0) :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 Jan 31, 2022 5 - Production/Stable pytest =============================================== ======================================================================================================================================================================== ============== ===================== ================================================ .. only:: latex @@ -1016,7 +1026,7 @@ This list contains 985 plugins. A pytest-plugin for updating doctest outputs :pypi:`pytest-adaptavist` - *last release*: Jan 27, 2022, + *last release*: Feb 01, 2022, *status*: N/A, *requires*: pytest (>=5.4.0) @@ -1422,7 +1432,7 @@ This list contains 985 plugins. pytest plugin for building a test suite, using YAML files to extend pytest parameterize functionality. :pypi:`pytest-automock` - *last release*: Apr 22, 2020, + *last release*: Feb 01, 2022, *status*: N/A, *requires*: pytest ; extra == 'dev' @@ -1757,6 +1767,13 @@ This list contains 985 plugins. Pytest plugin to only run tests affected by changes + :pypi:`pytest-cairo` + *last release*: Feb 04, 2022, + *status*: N/A, + *requires*: pytest + + + :pypi:`pytest-camel-collect` *last release*: Aug 02, 2020, *status*: N/A, @@ -1785,13 +1802,6 @@ This list contains 985 plugins. pytest plugin to capture all deprecatedwarnings and put them in one file - :pypi:`pytest-capturelogs` - *last release*: Sep 11, 2021, - *status*: 3 - Alpha, - *requires*: N/A - - A sample Python project - :pypi:`pytest-cases` *last release*: Jan 07, 2022, *status*: 5 - Production/Stable, @@ -2052,7 +2062,7 @@ This list contains 985 plugins. pytest plugin with fixtures for testing consul aware apps :pypi:`pytest-container` - *last release*: Nov 19, 2021, + *last release*: Feb 01, 2022, *status*: 3 - Alpha, *requires*: pytest (>=3.10) @@ -2352,6 +2362,13 @@ This list contains 985 plugins. A pytest plugin for testing dbt adapter plugins + :pypi:`pytest-dbt-conventions` + *last release*: Feb 04, 2022, + *status*: N/A, + *requires*: pytest (>=6.2.5,<7.0.0) + + A pytest plugin for linting a dbt project's conventions + :pypi:`pytest-dbt-core` *last release*: Jan 28, 2022, *status*: N/A, @@ -2612,8 +2629,8 @@ This list contains 985 plugins. py.test plugin for reporting the number of SQLs executed per django testcase. :pypi:`pytest-django-testing-postgresql` - *last release*: Dec 05, 2019, - *status*: 3 - Alpha, + *last release*: Jan 31, 2022, + *status*: 4 - Beta, *requires*: N/A Use a temporary PostgreSQL database with pytest-django @@ -2688,6 +2705,13 @@ This list contains 985 plugins. Pytest fixtures for testing with git scm. + :pypi:`pytest-docker-haproxy-fixtures` + *last release*: Feb 01, 2022, + *status*: 4 - Beta, + *requires*: pytest + + Pytest fixtures for testing with haproxy. + :pypi:`pytest-docker-pexpect` *last release*: Jan 14, 2019, *status*: N/A, @@ -2710,12 +2734,19 @@ This list contains 985 plugins. Easy to use, simple to extend, pytest plugin that minimally leverages docker-py. :pypi:`pytest-docker-registry-fixtures` - *last release*: Mar 04, 2021, + *last release*: Feb 01, 2022, *status*: 4 - Beta, *requires*: pytest Pytest fixtures for testing with docker registries. + :pypi:`pytest-docker-squid-fixtures` + *last release*: Feb 04, 2022, + *status*: 4 - Beta, + *requires*: pytest + + Pytest fixtures for testing with squid. + :pypi:`pytest-docker-tools` *last release*: Jul 23, 2021, *status*: 4 - Beta, @@ -3109,7 +3140,7 @@ This list contains 985 plugins. Applies eventlet monkey-patch as a pytest plugin. :pypi:`pytest-excel` - *last release*: Oct 06, 2020, + *last release*: Jan 31, 2022, *status*: 5 - Production/Stable, *requires*: N/A @@ -3795,7 +3826,7 @@ This list contains 985 plugins. A pytest plugin for use with homeassistant custom components. :pypi:`pytest-homeassistant-custom-component` - *last release*: Jan 29, 2022, + *last release*: Feb 05, 2022, *status*: 3 - Alpha, *requires*: pytest (==6.2.5) @@ -3850,6 +3881,13 @@ This list contains 985 plugins. optimized pytest plugin for generating HTML reports + :pypi:`pytest-html-object-storage` + *last release*: Jan 31, 2022, + *status*: 5 - Production/Stable, + *requires*: N/A + + Pytest report plugin for send HTML report on object-storage + :pypi:`pytest-html-profiling` *last release*: Feb 11, 2020, *status*: 5 - Production/Stable, @@ -3907,9 +3945,9 @@ This list contains 985 plugins. pytest-httpserver is a httpserver for pytest :pypi:`pytest-httpx` - *last release*: Jan 26, 2022, + *last release*: Feb 05, 2022, *status*: 5 - Production/Stable, - *requires*: pytest (==6.*) + *requires*: pytest (<8.*,>=6.*) Send responses to httpx. @@ -3963,7 +4001,7 @@ This list contains 985 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-idempotent` - *last release*: Jan 10, 2022, + *last release*: Jan 30, 2022, *status*: N/A, *requires*: N/A @@ -4033,7 +4071,7 @@ This list contains 985 plugins. A py.test plugin providing fixtures to simplify inmanta modules testing. :pypi:`pytest-inmanta-extensions` - *last release*: May 27, 2021, + *last release*: Feb 03, 2022, *status*: 5 - Production/Stable, *requires*: N/A @@ -4859,9 +4897,9 @@ This list contains 985 plugins. Add the mutation testing feature to pytest :pypi:`pytest-mypy` - *last release*: Mar 21, 2021, + *last release*: Jan 30, 2022, *status*: 4 - Beta, - *requires*: pytest (>=3.5) + *requires*: pytest (>=6.2) ; python_version >= "3.10" Mypy static type checker plugin for Pytest @@ -5104,7 +5142,7 @@ This list contains 985 plugins. pytest plugin for publish results to opentmi :pypi:`pytest-operator` - *last release*: Dec 06, 2021, + *last release*: Jan 31, 2022, *status*: N/A, *requires*: N/A @@ -5153,7 +5191,7 @@ This list contains 985 plugins. OS X notifications for py.test results. :pypi:`pytest-otel` - *last release*: Dec 16, 2021, + *last release*: Jan 31, 2022, *status*: N/A, *requires*: N/A @@ -5293,7 +5331,7 @@ This list contains 985 plugins. Change the exit code of pytest test sessions when a required percent of tests pass. :pypi:`pytest-perf` - *last release*: Jan 08, 2022, + *last release*: Feb 05, 2022, *status*: 5 - Production/Stable, *requires*: pytest (>=6) ; extra == 'testing' @@ -5545,7 +5583,7 @@ This list contains 985 plugins. pytest plugin with powerful fixtures :pypi:`pytest-pretty-terminal` - *last release*: Jan 25, 2022, + *last release*: Jan 31, 2022, *status*: N/A, *requires*: pytest (>=3.4.1) @@ -5580,9 +5618,9 @@ This list contains 985 plugins. Profiling plugin for py.test :pypi:`pytest-progress` - *last release*: Nov 09, 2021, + *last release*: Jan 31, 2022, *status*: 5 - Production/Stable, - *requires*: pytest (>=2.7) + *requires*: N/A pytest plugin for instant test progress status @@ -5593,6 +5631,13 @@ This list contains 985 plugins. Report test pass / failures to a Prometheus PushGateway + :pypi:`pytest-prometheus-pushgateway` + *last release*: Jan 31, 2022, + *status*: 5 - Production/Stable, + *requires*: pytest + + Pytest report plugin for Zulip + :pypi:`pytest-prosper` *last release*: Sep 24, 2018, *status*: N/A, @@ -5824,6 +5869,13 @@ This list contains 985 plugins. pytest plugin to implement PEP712 + :pypi:`pytest-rail` + *last release*: Feb 04, 2022, + *status*: N/A, + *requires*: pytest (>=3.6) + + pytest plugin for creating TestRail runs and adding results + :pypi:`pytest-railflow-testrail-reporter` *last release*: Dec 02, 2021, *status*: 5 - Production/Stable, @@ -6161,7 +6213,7 @@ This list contains 985 plugins. Provides path for uniform access to test resources in isolated directory :pypi:`pytest-responsemock` - *last release*: Oct 10, 2020, + *last release*: Feb 04, 2022, *status*: 5 - Production/Stable, *requires*: N/A @@ -6343,7 +6395,7 @@ This list contains 985 plugins. :pypi:`pytest-sbase` - *last release*: Jan 27, 2022, + *last release*: Feb 04, 2022, *status*: 5 - Production/Stable, *requires*: N/A @@ -6385,7 +6437,7 @@ This list contains 985 plugins. pytest plugin for Selenium :pypi:`pytest-seleniumbase` - *last release*: Jan 27, 2022, + *last release*: Feb 04, 2022, *status*: 5 - Production/Stable, *requires*: N/A @@ -6483,7 +6535,7 @@ This list contains 985 plugins. A pytest plugin to help with testing shell scripts / black box commands :pypi:`pytest-shell-utilities` - *last release*: Jan 25, 2022, + *last release*: Feb 05, 2022, *status*: 4 - Beta, *requires*: pytest (>=6.0.0) @@ -6546,7 +6598,7 @@ This list contains 985 plugins. Allow for multiple processes to log to a single file :pypi:`pytest-skip-markers` - *last release*: Jan 26, 2022, + *last release*: Feb 05, 2022, *status*: 5 - Production/Stable, *requires*: pytest (>=6.0.0) @@ -6979,6 +7031,13 @@ This list contains 985 plugins. Pytest plugin to track and report system usage statistics + :pypi:`pytest-system-test-plugin` + *last release*: Feb 03, 2022, + *status*: N/A, + *requires*: N/A + + Pyst - Pytest System-Test Plugin + :pypi:`pytest-takeltest` *last release*: Jan 04, 2022, *status*: N/A, @@ -7106,7 +7165,7 @@ This list contains 985 plugins. pytest reporting plugin for testlink :pypi:`pytest-testmon` - *last release*: Oct 22, 2021, + *last release*: Feb 05, 2022, *status*: 4 - Beta, *requires*: N/A @@ -7441,6 +7500,13 @@ This list contains 985 plugins. Pytest plugin for trio + :pypi:`pytest-trytond` + *last release*: Feb 02, 2022, + *status*: 3 - Alpha, + *requires*: pytest (>=5) + + Pytest plugin for the Tryton server framework + :pypi:`pytest-tspwplib` *last release*: Jan 08, 2021, *status*: 4 - Beta, @@ -7462,6 +7528,13 @@ This list contains 985 plugins. A twisted plugin for pytest. + :pypi:`pytest-typechecker` + *last release*: Feb 04, 2022, + *status*: N/A, + *requires*: pytest (>=6.2.5,<7.0.0) + + Run type checkers on specified test files + :pypi:`pytest-typhoon-xray` *last release*: Nov 03, 2021, *status*: 4 - Beta, @@ -7890,7 +7963,7 @@ This list contains 985 plugins. OWASP ZAP plugin for py.test. :pypi:`pytest-zebrunner` - *last release*: Dec 02, 2021, + *last release*: Feb 02, 2022, *status*: 5 - Production/Stable, *requires*: pytest (>=4.5.0) @@ -7902,3 +7975,10 @@ This list contains 985 plugins. *requires*: pytest (~=3.6) Extend py.test for RPC OpenStack testing. + + :pypi:`pytest-zulip` + *last release*: Jan 31, 2022, + *status*: 5 - Production/Stable, + *requires*: pytest + + Pytest report plugin for Zulip From b3692fe40463a81f83f75f4a9e1a68b332b94aea Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Mon, 7 Feb 2022 15:10:03 -0500 Subject: [PATCH 126/176] work around test pollution caused by new setuptools mutating global logger level --- testing/test_doctest.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/testing/test_doctest.py b/testing/test_doctest.py index e85f44f93f4..c2c83272079 100644 --- a/testing/test_doctest.py +++ b/testing/test_doctest.py @@ -802,11 +802,12 @@ def test_valid_setup_py(self, pytester: Pytester): p = pytester.makepyfile( setup=""" from setuptools import setup, find_packages - setup(name='sample', - version='0.0', - description='description', - packages=find_packages() - ) + if __name__ == '__main__': + setup(name='sample', + version='0.0', + description='description', + packages=find_packages() + ) """ ) result = pytester.runpytest(p, "--doctest-modules") From 15ddccf700ad1318c083eeb543f1c1a419dd1e96 Mon Sep 17 00:00:00 2001 From: Elijah DeLee Date: Fri, 4 Feb 2022 16:06:32 -0500 Subject: [PATCH 127/176] importlib.readers not valid until python 3.10 This exists https://github.com/python/cpython/blob/3.10/Lib/importlib/readers.py and FileReader is in there This is a 404 https://github.com/python/cpython/blob/3.9/Lib/importlib/readers.py This change needs to get backported to the 7.0.z branch(s) too Fixes https://github.com/pytest-dev/pytest/issues/9608 --- src/_pytest/assertion/rewrite.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_pytest/assertion/rewrite.py b/src/_pytest/assertion/rewrite.py index f0922870a4c..cc11e1d16ac 100644 --- a/src/_pytest/assertion/rewrite.py +++ b/src/_pytest/assertion/rewrite.py @@ -273,7 +273,7 @@ def get_data(self, pathname: Union[str, bytes]) -> bytes: with open(pathname, "rb") as f: return f.read() - if sys.version_info >= (3, 9): + if sys.version_info >= (3, 10): def get_resource_reader(self, name: str) -> importlib.abc.TraversableResources: # type: ignore from types import SimpleNamespace From 5f1a2f33daeab6a8efdc43bda8e5053a87aa47a8 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Fri, 4 Feb 2022 18:50:48 -0300 Subject: [PATCH 128/176] Fix invalid importing of `importlib.reader` in Python 3.9 Fix #9608 --- changelog/9608.bugfix.rst | 1 + src/_pytest/assertion/rewrite.py | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) create mode 100644 changelog/9608.bugfix.rst diff --git a/changelog/9608.bugfix.rst b/changelog/9608.bugfix.rst new file mode 100644 index 00000000000..f6b02ef53f7 --- /dev/null +++ b/changelog/9608.bugfix.rst @@ -0,0 +1 @@ +Fix invalid importing of ``importlib.reader`` in Python 3.9. diff --git a/src/_pytest/assertion/rewrite.py b/src/_pytest/assertion/rewrite.py index cc11e1d16ac..ac461ba39b8 100644 --- a/src/_pytest/assertion/rewrite.py +++ b/src/_pytest/assertion/rewrite.py @@ -44,6 +44,8 @@ if TYPE_CHECKING: from _pytest.assertion import AssertionState +if sys.version_info >= (3, 10): + from importlib.readers import FileReader assertstate_key = StashKey["AssertionState"]() @@ -276,10 +278,7 @@ def get_data(self, pathname: Union[str, bytes]) -> bytes: if sys.version_info >= (3, 10): def get_resource_reader(self, name: str) -> importlib.abc.TraversableResources: # type: ignore - from types import SimpleNamespace - from importlib.readers import FileReader - - return FileReader(SimpleNamespace(path=self._rewritten_names[name])) + return FileReader(types.SimpleNamespace(path=self._rewritten_names[name])) def _write_pyc_fp( From 66dc79efd48e87a420072df44ecb087ff7797358 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Fri, 4 Feb 2022 18:56:44 -0300 Subject: [PATCH 129/176] Update changelog/9608.bugfix.rst Co-authored-by: Elijah DeLee --- changelog/9608.bugfix.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog/9608.bugfix.rst b/changelog/9608.bugfix.rst index f6b02ef53f7..4dda46becd2 100644 --- a/changelog/9608.bugfix.rst +++ b/changelog/9608.bugfix.rst @@ -1 +1 @@ -Fix invalid importing of ``importlib.reader`` in Python 3.9. +Fix invalid importing of ``importlib.readers`` in Python 3.9. From f86a87a315d6130bdc9cbc19e4fefcf69836d813 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Fri, 4 Feb 2022 19:07:52 -0300 Subject: [PATCH 130/176] Update src/_pytest/assertion/rewrite.py Co-authored-by: Ran Benita --- src/_pytest/assertion/rewrite.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/_pytest/assertion/rewrite.py b/src/_pytest/assertion/rewrite.py index ac461ba39b8..f4a08a065b2 100644 --- a/src/_pytest/assertion/rewrite.py +++ b/src/_pytest/assertion/rewrite.py @@ -44,7 +44,9 @@ if TYPE_CHECKING: from _pytest.assertion import AssertionState -if sys.version_info >= (3, 10): +if sys.version_info >= (3, 11): + from importlib.resources.readers import FileReader +elif sys.version_info >= (3, 10): from importlib.readers import FileReader assertstate_key = StashKey["AssertionState"]() From d45a19cfdeb0afc767bb641522a436a00903e1ca Mon Sep 17 00:00:00 2001 From: Elijah DeLee Date: Mon, 7 Feb 2022 11:39:19 -0500 Subject: [PATCH 131/176] move function specific imports to function re: review from @asottile that this should only get imported in the function modify the else/if logic since inside the function we already know the python version is >= 3.10, and just have to know if it is 3.11 or greater --- src/_pytest/assertion/rewrite.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/_pytest/assertion/rewrite.py b/src/_pytest/assertion/rewrite.py index f4a08a065b2..eac7bb79ee8 100644 --- a/src/_pytest/assertion/rewrite.py +++ b/src/_pytest/assertion/rewrite.py @@ -43,11 +43,7 @@ if TYPE_CHECKING: from _pytest.assertion import AssertionState - -if sys.version_info >= (3, 11): - from importlib.resources.readers import FileReader -elif sys.version_info >= (3, 10): - from importlib.readers import FileReader + assertstate_key = StashKey["AssertionState"]() @@ -280,6 +276,11 @@ def get_data(self, pathname: Union[str, bytes]) -> bytes: if sys.version_info >= (3, 10): def get_resource_reader(self, name: str) -> importlib.abc.TraversableResources: # type: ignore + if sys.version_info < (3, 11): + from importlib.readers import FileReader + else: + from importlib.resources.readers import FileReader + return FileReader(types.SimpleNamespace(path=self._rewritten_names[name])) From 2073cce10518c4f04ee5c5d8a7b6697cbbb3688e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 7 Feb 2022 16:40:52 +0000 Subject: [PATCH 132/176] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/_pytest/assertion/rewrite.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/_pytest/assertion/rewrite.py b/src/_pytest/assertion/rewrite.py index eac7bb79ee8..81096764e04 100644 --- a/src/_pytest/assertion/rewrite.py +++ b/src/_pytest/assertion/rewrite.py @@ -43,7 +43,7 @@ if TYPE_CHECKING: from _pytest.assertion import AssertionState - + assertstate_key = StashKey["AssertionState"]() @@ -280,7 +280,7 @@ def get_resource_reader(self, name: str) -> importlib.abc.TraversableResources: from importlib.readers import FileReader else: from importlib.resources.readers import FileReader - + return FileReader(types.SimpleNamespace(path=self._rewritten_names[name])) From d00ca3f8e57c38b77b554d9826181f45de714ba6 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Mon, 7 Feb 2022 00:25:32 +0200 Subject: [PATCH 133/176] unittest: restore `UnitTestFunction.obj` to return unbound rather than bound method This fixes #9610. pytest 7.0.0 (unintentionally) changed `UnitTestFunction.obj`'s' behavior to match `Function.obj`. That is probably a good thing to have, however it evidently causes some regressions as described in the issue, so restore the previous behavior for now. In the future we might want to make this change again, but with proper consideration. --- changelog/9610.bugfix.rst | 3 +++ src/_pytest/unittest.py | 9 +++++++++ testing/test_unittest.py | 26 ++++++++++++++++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 changelog/9610.bugfix.rst diff --git a/changelog/9610.bugfix.rst b/changelog/9610.bugfix.rst new file mode 100644 index 00000000000..c8c89c0c961 --- /dev/null +++ b/changelog/9610.bugfix.rst @@ -0,0 +1,3 @@ +Restore `UnitTestFunction.obj` to return unbound rather than bound method. +Fixes a crash during a failed teardown in unittest TestCases with non-default `__init__`. +Regressed in pytest 7.0.0. diff --git a/src/_pytest/unittest.py b/src/_pytest/unittest.py index a05c3b4bc43..851e4943b23 100644 --- a/src/_pytest/unittest.py +++ b/src/_pytest/unittest.py @@ -185,6 +185,15 @@ class TestCaseFunction(Function): _excinfo: Optional[List[_pytest._code.ExceptionInfo[BaseException]]] = None _testcase: Optional["unittest.TestCase"] = None + def _getobj(self): + assert self.parent is not None + # Unlike a regular Function in a Class, where `item.obj` returns + # a *bound* method (attached to an instance), TestCaseFunction's + # `obj` returns an *unbound* method (not attached to an instance). + # This inconsistency is probably not desirable, but needs some + # consideration before changing. + return getattr(self.parent.obj, self.originalname) # type: ignore[attr-defined] + def setup(self) -> None: # A bound method to be called during teardown() if set (see 'runtest()'). self._explicit_tearDown: Optional[Callable[[], None]] = None diff --git a/testing/test_unittest.py b/testing/test_unittest.py index 12bcb9361a4..1601086d5b2 100644 --- a/testing/test_unittest.py +++ b/testing/test_unittest.py @@ -1472,3 +1472,29 @@ def test_cleanup_called_the_right_number_of_times(): passed, skipped, failed = reprec.countoutcomes() assert failed == 2 assert passed == 1 + + +def test_traceback_pruning(pytester: Pytester) -> None: + """Regression test for #9610 - doesn't crash during traceback pruning.""" + pytester.makepyfile( + """ + import unittest + + class MyTestCase(unittest.TestCase): + def __init__(self, test_method): + unittest.TestCase.__init__(self, test_method) + + class TestIt(MyTestCase): + @classmethod + def tearDownClass(cls) -> None: + assert False + + def test_it(self): + pass + """ + ) + reprec = pytester.inline_run() + passed, skipped, failed = reprec.countoutcomes() + assert passed == 1 + assert failed == 1 + assert reprec.ret == 1 From 1612d3d1af1b96517d47efabf60f171553c5479d Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Mon, 7 Feb 2022 21:32:02 +0200 Subject: [PATCH 134/176] doc: remove django intersphinx mapping Initially I just wanted to fix http -> https, but I think it's not worth having at all just for this one reference. --- doc/en/conf.py | 5 ----- doc/en/how-to/plugins.rst | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/doc/en/conf.py b/doc/en/conf.py index b316163532a..1adc3493ad5 100644 --- a/doc/en/conf.py +++ b/doc/en/conf.py @@ -382,7 +382,6 @@ ] -# Example configuration for intersphinx: refer to the Python standard library. intersphinx_mapping = { "pluggy": ("https://pluggy.readthedocs.io/en/stable", None), "python": ("https://docs.python.org/3", None), @@ -390,10 +389,6 @@ "pip": ("https://pip.pypa.io/en/stable", None), "tox": ("https://tox.wiki/en/stable", None), "virtualenv": ("https://virtualenv.pypa.io/en/stable", None), - "django": ( - "http://docs.djangoproject.com/en/stable", - "http://docs.djangoproject.com/en/stable/_objects", - ), "setuptools": ("https://setuptools.pypa.io/en/stable", None), } diff --git a/doc/en/how-to/plugins.rst b/doc/en/how-to/plugins.rst index de31bc04a86..7a1948410e4 100644 --- a/doc/en/how-to/plugins.rst +++ b/doc/en/how-to/plugins.rst @@ -21,7 +21,7 @@ there is no need to activate it. Here is a little annotated list for some popular plugins: * :pypi:`pytest-django`: write tests - for :std:doc:`django ` apps, using pytest integration. + for `django `_ apps, using pytest integration. * :pypi:`pytest-twisted`: write tests for `twisted `_ apps, starting a reactor and From ef7d67b66550df80b800b30165ed7dee6ae82261 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 7 Feb 2022 22:47:20 +0000 Subject: [PATCH 135/176] build(deps): Bump django in /testing/plugins_integration Bumps [django](https://github.com/django/django) from 4.0.1 to 4.0.2. - [Release notes](https://github.com/django/django/releases) - [Commits](https://github.com/django/django/compare/4.0.1...4.0.2) --- updated-dependencies: - dependency-name: django dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- testing/plugins_integration/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/plugins_integration/requirements.txt b/testing/plugins_integration/requirements.txt index 8c5d69ff19a..f75460f02a8 100644 --- a/testing/plugins_integration/requirements.txt +++ b/testing/plugins_integration/requirements.txt @@ -1,5 +1,5 @@ anyio[curio,trio]==3.5.0 -django==4.0.1 +django==4.0.2 pytest-asyncio==0.17.2 pytest-bdd==5.0.0 pytest-cov==3.0.0 From b80472c5bc41144335a49dc5f4b26949ffd8128f Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Tue, 8 Feb 2022 00:52:42 +0200 Subject: [PATCH 136/176] doc: fix a reference --- doc/en/deprecations.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/en/deprecations.rst b/doc/en/deprecations.rst index d9fb4d6b04e..4eaa80e2f27 100644 --- a/doc/en/deprecations.rst +++ b/doc/en/deprecations.rst @@ -16,7 +16,7 @@ Deprecated Features ------------------- Below is a complete list of all pytest features which are considered deprecated. Using those features will issue -:class:`PytestWarning` or subclasses, which can be filtered using :ref:`standard warning filters `. +:class:`~pytest.PytestWarning` or subclasses, which can be filtered using :ref:`standard warning filters `. .. _instance-collector-deprecation: From 579785b6cd201b6cb4da6bdf9be6988db0d469b2 Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Mon, 7 Feb 2022 19:29:01 -0500 Subject: [PATCH 137/176] fix test pollution in test_assertrewrite originally reproduced with this pollution set: ``` testing/test_assertrewrite.py::TestEarlyRewriteBailout::test_pattern_contains_subdirectories testing/test_assertrewrite.py::TestRewriteOnImport::test_remember_rewritten_modules ``` --- testing/test_assertrewrite.py | 20 +++++++++++--------- testing/test_doctest.py | 11 ++++++----- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/testing/test_assertrewrite.py b/testing/test_assertrewrite.py index ae18b4be34a..8f18e89c94f 100644 --- a/testing/test_assertrewrite.py +++ b/testing/test_assertrewrite.py @@ -13,10 +13,12 @@ from pathlib import Path from typing import cast from typing import Dict +from typing import Generator from typing import List from typing import Mapping from typing import Optional from typing import Set +from unittest import mock import _pytest._code import pytest @@ -1376,7 +1378,7 @@ class TestEarlyRewriteBailout: @pytest.fixture def hook( self, pytestconfig, monkeypatch, pytester: Pytester - ) -> AssertionRewritingHook: + ) -> Generator[AssertionRewritingHook, None, None]: """Returns a patched AssertionRewritingHook instance so we can configure its initial paths and track if PathFinder.find_spec has been called. """ @@ -1397,11 +1399,11 @@ def spy_find_spec(name, path): hook = AssertionRewritingHook(pytestconfig) # use default patterns, otherwise we inherit pytest's testing config - hook.fnpats[:] = ["test_*.py", "*_test.py"] - monkeypatch.setattr(hook, "_find_spec", spy_find_spec) - hook.set_session(StubSession()) # type: ignore[arg-type] - pytester.syspathinsert() - return hook + with mock.patch.object(hook, "fnpats", ["test_*.py", "*_test.py"]): + monkeypatch.setattr(hook, "_find_spec", spy_find_spec) + hook.set_session(StubSession()) # type: ignore[arg-type] + pytester.syspathinsert() + yield hook def test_basic(self, pytester: Pytester, hook: AssertionRewritingHook) -> None: """ @@ -1451,9 +1453,9 @@ def test_simple_failure(): } ) pytester.syspathinsert("tests") - hook.fnpats[:] = ["tests/**.py"] - assert hook.find_spec("file") is not None - assert self.find_spec_calls == ["file"] + with mock.patch.object(hook, "fnpats", ["tests/**.py"]): + assert hook.find_spec("file") is not None + assert self.find_spec_calls == ["file"] @pytest.mark.skipif( sys.platform.startswith("win32"), reason="cannot remove cwd on Windows" diff --git a/testing/test_doctest.py b/testing/test_doctest.py index e85f44f93f4..c2c83272079 100644 --- a/testing/test_doctest.py +++ b/testing/test_doctest.py @@ -802,11 +802,12 @@ def test_valid_setup_py(self, pytester: Pytester): p = pytester.makepyfile( setup=""" from setuptools import setup, find_packages - setup(name='sample', - version='0.0', - description='description', - packages=find_packages() - ) + if __name__ == '__main__': + setup(name='sample', + version='0.0', + description='description', + packages=find_packages() + ) """ ) result = pytester.runpytest(p, "--doctest-modules") From 2442034a1eca53dae4b3141732660f3384b6d159 Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Mon, 7 Feb 2022 20:17:14 -0500 Subject: [PATCH 138/176] allow running testids which contain :: in the parametrized portion --- changelog/9642.bugfix.rst | 1 + src/_pytest/main.py | 5 ++++- testing/test_main.py | 6 ++++++ 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 changelog/9642.bugfix.rst diff --git a/changelog/9642.bugfix.rst b/changelog/9642.bugfix.rst new file mode 100644 index 00000000000..0b3c2050c51 --- /dev/null +++ b/changelog/9642.bugfix.rst @@ -0,0 +1 @@ +Fix running tests by id with ``::`` in the parametrize portion. diff --git a/src/_pytest/main.py b/src/_pytest/main.py index afe613fd0d9..8f590754ae0 100644 --- a/src/_pytest/main.py +++ b/src/_pytest/main.py @@ -870,7 +870,10 @@ def resolve_collection_argument( If the path doesn't exist, raise UsageError. If the path is a directory and selection parts are present, raise UsageError. """ - strpath, *parts = str(arg).split("::") + base, squacket, rest = str(arg).partition("[") + strpath, *parts = base.split("::") + if parts: + parts[-1] = f"{parts[-1]}{squacket}{rest}" if as_pypath: strpath = search_pypath(strpath) fspath = invocation_path / strpath diff --git a/testing/test_main.py b/testing/test_main.py index 6a13633f6a9..926715a8c47 100644 --- a/testing/test_main.py +++ b/testing/test_main.py @@ -171,6 +171,12 @@ def test_pypath(self, invocation_path: Path) -> None: invocation_path, "pkg::foo::bar", as_pypath=True ) + def test_parametrized_name_with_colons(self, invocation_path: Path) -> None: + ret = resolve_collection_argument( + invocation_path, "src/pkg/test.py::test[a::b]" + ) + assert ret == (invocation_path / "src/pkg/test.py", ["test[a::b]"]) + def test_does_not_exist(self, invocation_path: Path) -> None: """Given a file/module that does not exist raises UsageError.""" with pytest.raises( From 01e1de7a1a79eeac67cf970e84532c2a99839476 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Wed, 9 Feb 2022 09:58:38 +0200 Subject: [PATCH 139/176] Rename ``pythonpath`` plugin to ``python_path`` Fix #9636. --- changelog/9636.bugfix.rst | 1 + src/_pytest/config/__init__.py | 2 +- src/_pytest/{pythonpath.py => python_path.py} | 0 testing/test_config.py | 2 +- testing/{test_pythonpath.py => test_python_path.py} | 2 +- 5 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 changelog/9636.bugfix.rst rename src/_pytest/{pythonpath.py => python_path.py} (100%) rename testing/{test_pythonpath.py => test_python_path.py} (98%) diff --git a/changelog/9636.bugfix.rst b/changelog/9636.bugfix.rst new file mode 100644 index 00000000000..2288c37ffc7 --- /dev/null +++ b/changelog/9636.bugfix.rst @@ -0,0 +1 @@ +The ``pythonpath`` plugin was renamed to ``python_path``. This avoids a conflict with the ``pytest-pythonpath`` plugin. diff --git a/src/_pytest/config/__init__.py b/src/_pytest/config/__init__.py index 59c88885df5..f4818c861cf 100644 --- a/src/_pytest/config/__init__.py +++ b/src/_pytest/config/__init__.py @@ -254,7 +254,7 @@ def directory_arg(path: str, optname: str) -> str: "warnings", "logging", "reports", - "pythonpath", + "python_path", *(["unraisableexception", "threadexception"] if sys.version_info >= (3, 8) else []), "faulthandler", ) diff --git a/src/_pytest/pythonpath.py b/src/_pytest/python_path.py similarity index 100% rename from src/_pytest/pythonpath.py rename to src/_pytest/python_path.py diff --git a/testing/test_config.py b/testing/test_config.py index bf4b2741eca..8013966f071 100644 --- a/testing/test_config.py +++ b/testing/test_config.py @@ -1275,7 +1275,7 @@ def pytest_load_initial_conftests(self): ("_pytest.config", "nonwrapper"), (m.__module__, "nonwrapper"), ("_pytest.legacypath", "nonwrapper"), - ("_pytest.pythonpath", "nonwrapper"), + ("_pytest.python_path", "nonwrapper"), ("_pytest.capture", "wrapper"), ("_pytest.warnings", "wrapper"), ] diff --git a/testing/test_pythonpath.py b/testing/test_python_path.py similarity index 98% rename from testing/test_pythonpath.py rename to testing/test_python_path.py index 97c439ce0c3..5ee0f55e36a 100644 --- a/testing/test_pythonpath.py +++ b/testing/test_python_path.py @@ -81,7 +81,7 @@ def test_no_ini(pytester: Pytester, file_structure) -> None: def test_clean_up(pytester: Pytester) -> None: - """Test that the pythonpath plugin cleans up after itself.""" + """Test that the plugin cleans up after itself.""" # This is tough to test behaviorly because the cleanup really runs last. # So the test make several implementation assumptions: # - Cleanup is done in pytest_unconfigure(). From 6aaa017b1e81f6eccc48ee4f6b52d25c49747554 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 10 Feb 2022 08:58:20 +0100 Subject: [PATCH 140/176] doc: Discourage squashing for release (#9657) Fixes #9655 --- RELEASING.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RELEASING.rst b/RELEASING.rst index 66775e7cfbb..b018dc48932 100644 --- a/RELEASING.rst +++ b/RELEASING.rst @@ -142,7 +142,7 @@ Both automatic and manual processes described above follow the same steps from t Wait for the deploy to complete, then make sure it is `available on PyPI `_. -#. Merge the PR. +#. Merge the PR. **Make sure it's not squash-merged**, so that the tagged commit ends up in the main branch. #. Cherry-pick the CHANGELOG / announce files to the ``main`` branch:: From 88c35123b8a9e802aa75f80de2953bce3224802a Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Tue, 8 Feb 2022 10:32:21 -0300 Subject: [PATCH 141/176] Delay warning about collector/item diamond inheritance This allows that warning to be filtered by `filterwarnings`. Fix #9643 --- changelog/9643.bugfix.rst | 2 ++ src/_pytest/nodes.py | 45 +++++++++++++++++++++++++++------------ testing/test_nodes.py | 29 ++++++++++++++----------- 3 files changed, 49 insertions(+), 27 deletions(-) create mode 100644 changelog/9643.bugfix.rst diff --git a/changelog/9643.bugfix.rst b/changelog/9643.bugfix.rst new file mode 100644 index 00000000000..24ca81182ed --- /dev/null +++ b/changelog/9643.bugfix.rst @@ -0,0 +1,2 @@ +Delay issuing a :class:`~pytest.PytestWarning` about diamond inheritance involving :class:`~pytest.Item` and +:class:`~pytest.Collector` so it can be filtered using :ref:`standard warning filters `. diff --git a/src/_pytest/nodes.py b/src/_pytest/nodes.py index 6e8454ad7c6..e49c1b003e0 100644 --- a/src/_pytest/nodes.py +++ b/src/_pytest/nodes.py @@ -656,20 +656,6 @@ class Item(Node): nextitem = None - def __init_subclass__(cls) -> None: - problems = ", ".join( - base.__name__ for base in cls.__bases__ if issubclass(base, Collector) - ) - if problems: - warnings.warn( - f"{cls.__name__} is an Item subclass and should not be a collector, " - f"however its bases {problems} are collectors.\n" - "Please split the Collectors and the Item into separate node types.\n" - "Pytest Doc example: https://docs.pytest.org/en/latest/example/nonpython.html\n" - "example pull request on a plugin: https://github.com/asmeurer/pytest-flakes/pull/40/", - PytestWarning, - ) - def __init__( self, name, @@ -697,6 +683,37 @@ def __init__( #: for this test. self.user_properties: List[Tuple[str, object]] = [] + self._check_item_and_collector_diamond_inheritance() + + def _check_item_and_collector_diamond_inheritance(self) -> None: + """ + Check if the current type inherits from both File and Collector + at the same time, emitting a warning accordingly (#8447). + """ + cls = type(self) + + # We inject an attribute in the type to avoid issuing this warning + # for the same class more than once, which is not helpful. + # It is a hack, but was deemed acceptable in order to avoid + # flooding the user in the common case. + attr_name = "_pytest_diamond_inheritance_warning_shown" + if getattr(cls, attr_name, False): + return + setattr(cls, attr_name, True) + + problems = ", ".join( + base.__name__ for base in cls.__bases__ if issubclass(base, Collector) + ) + if problems: + warnings.warn( + f"{cls.__name__} is an Item subclass and should not be a collector, " + f"however its bases {problems} are collectors.\n" + "Please split the Collectors and the Item into separate node types.\n" + "Pytest Doc example: https://docs.pytest.org/en/latest/example/nonpython.html\n" + "example pull request on a plugin: https://github.com/asmeurer/pytest-flakes/pull/40/", + PytestWarning, + ) + def runtest(self) -> None: """Run the test case for this item. diff --git a/testing/test_nodes.py b/testing/test_nodes.py index c8afe0252be..df1439e1c49 100644 --- a/testing/test_nodes.py +++ b/testing/test_nodes.py @@ -1,3 +1,5 @@ +import re +import warnings from pathlib import Path from typing import cast from typing import List @@ -58,30 +60,31 @@ def test_subclassing_both_item_and_collector_deprecated( request, tmp_path: Path ) -> None: """ - Verifies we warn on diamond inheritance - as well as correctly managing legacy inheritance ctors with missing args - as found in plugins + Verifies we warn on diamond inheritance as well as correctly managing legacy + inheritance constructors with missing args as found in plugins. """ - with pytest.warns( - PytestWarning, - match=( - "(?m)SoWrong is an Item subclass and should not be a collector, however its bases File are collectors.\n" - "Please split the Collectors and the Item into separate node types.\n.*" - ), - ): + # We do not expect any warnings messages to issued during class definition. + with warnings.catch_warnings(): + warnings.simplefilter("error") class SoWrong(nodes.Item, nodes.File): def __init__(self, fspath, parent): """Legacy ctor with legacy call # don't wana see""" super().__init__(fspath, parent) - with pytest.warns( - PytestWarning, match=".*SoWrong.* not using a cooperative constructor.*" - ): + with pytest.warns(PytestWarning) as rec: SoWrong.from_parent( request.session, fspath=legacy_path(tmp_path / "broken.txt") ) + messages = [str(x.message) for x in rec] + assert any( + re.search(".*SoWrong.* not using a cooperative constructor.*", x) + for x in messages + ) + assert any( + re.search("(?m)SoWrong .* should not be a collector", x) for x in messages + ) @pytest.mark.parametrize( From 2b127394122aabb72d207d071388351989cc7a19 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 11 Feb 2022 03:47:43 +0000 Subject: [PATCH 142/176] build(deps): Bump twisted in /testing/plugins_integration Bumps [twisted](https://github.com/twisted/twisted) from 21.7.0 to 22.1.0. - [Release notes](https://github.com/twisted/twisted/releases) - [Changelog](https://github.com/twisted/twisted/blob/trunk/NEWS.rst) - [Commits](https://github.com/twisted/twisted/compare/twisted-21.7.0...twisted-22.1.0) --- updated-dependencies: - dependency-name: twisted dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- testing/plugins_integration/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/plugins_integration/requirements.txt b/testing/plugins_integration/requirements.txt index f75460f02a8..3fb8ccf2947 100644 --- a/testing/plugins_integration/requirements.txt +++ b/testing/plugins_integration/requirements.txt @@ -11,5 +11,5 @@ pytest-rerunfailures==10.2 pytest-sugar==0.9.4 pytest-trio==0.7.0 pytest-twisted==1.13.4 -twisted==21.7.0 +twisted==22.1.0 pytest-xvfb==2.0.0 From be0c41bf8e45970ad3fcce751e8499b7387931ea Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Fri, 11 Feb 2022 13:49:11 +0200 Subject: [PATCH 143/176] CI: Test latest 3.10 available --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c8f216c4104..2c53ab23d17 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -75,7 +75,7 @@ jobs: os: windows-latest tox_env: "py39-xdist" - name: "windows-py310" - python: "3.10.1" + python: "3.10" os: windows-latest tox_env: "py310-xdist" @@ -101,7 +101,7 @@ jobs: os: ubuntu-latest tox_env: "py39-xdist" - name: "ubuntu-py310" - python: "3.10.1" + python: "3.10" os: ubuntu-latest tox_env: "py310-xdist" - name: "ubuntu-pypy3" From eb8a3ef8495f3d51bccd4830f927689c29e888e6 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Fri, 11 Feb 2022 14:03:22 +0200 Subject: [PATCH 144/176] Only update the plugin for upstream --- .github/workflows/update-plugin-list.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/update-plugin-list.yml b/.github/workflows/update-plugin-list.yml index 17c6364f4bd..193469072ff 100644 --- a/.github/workflows/update-plugin-list.yml +++ b/.github/workflows/update-plugin-list.yml @@ -12,6 +12,7 @@ permissions: {} jobs: createPullRequest: + if: github.repository_owner == 'pytest-dev' runs-on: ubuntu-latest permissions: contents: write From b79eff065ebbd3dd1c20cb06eb76cb6707a0c8d3 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Fri, 11 Feb 2022 12:20:42 -0300 Subject: [PATCH 145/176] Enable testing with Python 3.11 (#9511) --- .github/workflows/main.yml | 10 ++++++++++ testing/test_assertion.py | 16 +++++++++++----- testing/test_compat.py | 2 ++ testing/test_doctest.py | 2 ++ testing/test_main.py | 21 +++++++++++++++++++-- testing/test_pytester.py | 4 ++-- tox.ini | 1 + 7 files changed, 47 insertions(+), 9 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2c53ab23d17..a69b905683b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -37,6 +37,7 @@ jobs: "windows-py38", "windows-py39", "windows-py310", + "windows-py311", "ubuntu-py37", "ubuntu-py37-pluggy", @@ -44,6 +45,7 @@ jobs: "ubuntu-py38", "ubuntu-py39", "ubuntu-py310", + "ubuntu-py311", "ubuntu-pypy3", "macos-py37", @@ -78,6 +80,10 @@ jobs: python: "3.10" os: windows-latest tox_env: "py310-xdist" + - name: "windows-py311" + python: "3.11-dev" + os: windows-latest + tox_env: "py311" - name: "ubuntu-py37" python: "3.7" @@ -104,6 +110,10 @@ jobs: python: "3.10" os: ubuntu-latest tox_env: "py310-xdist" + - name: "ubuntu-py311" + python: "3.11-dev" + os: ubuntu-latest + tox_env: "py311" - name: "ubuntu-pypy3" python: "pypy-3.7" os: ubuntu-latest diff --git a/testing/test_assertion.py b/testing/test_assertion.py index 317a2beb388..d57cc26a350 100644 --- a/testing/test_assertion.py +++ b/testing/test_assertion.py @@ -1026,7 +1026,7 @@ def __eq__(self, other): # pragma: no cover assert lines is None def test_attrs_with_custom_eq(self) -> None: - @attr.define + @attr.define(slots=False) class SimpleDataObject: field_a = attr.ib() @@ -1648,7 +1648,7 @@ def test_raise_assertion_error(): ) -def test_raise_assertion_error_raisin_repr(pytester: Pytester) -> None: +def test_raise_assertion_error_raising_repr(pytester: Pytester) -> None: pytester.makepyfile( """ class RaisingRepr(object): @@ -1659,9 +1659,15 @@ def test_raising_repr(): """ ) result = pytester.runpytest() - result.stdout.fnmatch_lines( - ["E AssertionError: "] - ) + if sys.version_info >= (3, 11): + # python 3.11 has native support for un-str-able exceptions + result.stdout.fnmatch_lines( + ["E AssertionError: "] + ) + else: + result.stdout.fnmatch_lines( + ["E AssertionError: "] + ) def test_issue_1944(pytester: Pytester) -> None: diff --git a/testing/test_compat.py b/testing/test_compat.py index 88f0f33efc2..8a80fd625dc 100644 --- a/testing/test_compat.py +++ b/testing/test_compat.py @@ -1,4 +1,5 @@ import enum +import sys from functools import partial from functools import wraps from typing import TYPE_CHECKING @@ -91,6 +92,7 @@ def foo(x): assert get_real_func(partial(foo)) is foo +@pytest.mark.skipif(sys.version_info >= (3, 11), reason="couroutine removed") def test_is_generator_asyncio(pytester: Pytester) -> None: pytester.makepyfile( """ diff --git a/testing/test_doctest.py b/testing/test_doctest.py index c2c83272079..67b8ccdb7ec 100644 --- a/testing/test_doctest.py +++ b/testing/test_doctest.py @@ -1,4 +1,5 @@ import inspect +import sys import textwrap from pathlib import Path from typing import Callable @@ -200,6 +201,7 @@ def test_doctest_unexpected_exception(self, pytester: Pytester): "Traceback (most recent call last):", ' File "*/doctest.py", line *, in __run', " *", + *((" *^^^^*",) if sys.version_info >= (3, 11) else ()), ' File "", line 1, in ', "ZeroDivisionError: division by zero", "*/test_doctest_unexpected_exception.txt:2: UnexpectedException", diff --git a/testing/test_main.py b/testing/test_main.py index 926715a8c47..2df51bb7bb9 100644 --- a/testing/test_main.py +++ b/testing/test_main.py @@ -1,6 +1,7 @@ import argparse import os import re +import sys from pathlib import Path from typing import Optional @@ -44,16 +45,32 @@ def pytest_internalerror(excrepr, excinfo): assert result.ret == ExitCode.INTERNAL_ERROR assert result.stdout.lines[0] == "INTERNALERROR> Traceback (most recent call last):" + end_lines = ( + result.stdout.lines[-4:] + if sys.version_info >= (3, 11) + else result.stdout.lines[-3:] + ) + if exc == SystemExit: - assert result.stdout.lines[-3:] == [ + assert end_lines == [ f'INTERNALERROR> File "{c1}", line 4, in pytest_sessionstart', 'INTERNALERROR> raise SystemExit("boom")', + *( + ("INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^",) + if sys.version_info >= (3, 11) + else () + ), "INTERNALERROR> SystemExit: boom", ] else: - assert result.stdout.lines[-3:] == [ + assert end_lines == [ f'INTERNALERROR> File "{c1}", line 4, in pytest_sessionstart', 'INTERNALERROR> raise ValueError("boom")', + *( + ("INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^",) + if sys.version_info >= (3, 11) + else () + ), "INTERNALERROR> ValueError: boom", ] if returncode is False: diff --git a/testing/test_pytester.py b/testing/test_pytester.py index 9f7cf42b77c..049f8b22d81 100644 --- a/testing/test_pytester.py +++ b/testing/test_pytester.py @@ -743,8 +743,8 @@ def test_run_result_repr() -> None: # known exit code r = pytester_mod.RunResult(1, outlines, errlines, duration=0.5) - assert ( - repr(r) == "" ) diff --git a/tox.ini b/tox.ini index a1f4cab00e0..93c390ffc57 100644 --- a/tox.ini +++ b/tox.ini @@ -8,6 +8,7 @@ envlist = py38 py39 py310 + py311 pypy3 py37-{pexpect,xdist,unittestextras,numpy,pluggymain} doctesting From 8afec9a64d7facc12a7f531f2cb597e6d787e051 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Fri, 11 Feb 2022 14:34:02 -0300 Subject: [PATCH 146/176] Add autoflake to pre-commit configuration (#9666) --- .pre-commit-config.yaml | 8 ++++++++ src/_pytest/python.py | 2 -- src/_pytest/python_api.py | 1 - testing/code/test_source.py | 3 --- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 125f5561db4..5de99c99aaf 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -20,6 +20,14 @@ repos: - id: debug-statements exclude: _pytest/(debugging|hookspec).py language_version: python3 +- repo: https://github.com/myint/autoflake + rev: v1.4 + hooks: + - id: autoflake + name: autoflake + args: ["--in-place", "--remove-unused-variables", "--remove-all-unused-imports"] + language: python + files: \.py$ - repo: https://github.com/PyCQA/flake8 rev: 4.0.1 hooks: diff --git a/src/_pytest/python.py b/src/_pytest/python.py index f5b332e6831..23baa9a61f2 100644 --- a/src/_pytest/python.py +++ b/src/_pytest/python.py @@ -905,8 +905,6 @@ class InstanceDummy: only to ignore it; this dummy class keeps them working. This will be removed in pytest 8.""" - pass - def __getattr__(name: str) -> object: if name == "Instance": diff --git a/src/_pytest/python_api.py b/src/_pytest/python_api.py index cb72fde1e1f..9891946cd1e 100644 --- a/src/_pytest/python_api.py +++ b/src/_pytest/python_api.py @@ -131,7 +131,6 @@ def _check_type(self) -> None: # a numeric type. For this reason, the default is to do nothing. The # classes that deal with sequences should reimplement this method to # raise if there are any non-numeric elements in the sequence. - pass def _recursive_list_map(f, x): diff --git a/testing/code/test_source.py b/testing/code/test_source.py index fd2c9fc9719..52417f2f837 100644 --- a/testing/code/test_source.py +++ b/testing/code/test_source.py @@ -1,16 +1,13 @@ # flake8: noqa # disable flake check on this file because some constructs are strange # or redundant on purpose and can't be disable on a line-by-line basis -import ast import inspect import linecache import sys import textwrap from pathlib import Path -from types import CodeType from typing import Any from typing import Dict -from typing import Optional import pytest from _pytest._code import Code From 68be31916520c668c9caa3ddc25531709830ae89 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Fri, 11 Feb 2022 15:50:54 -0300 Subject: [PATCH 147/176] Merge pull request #9674 from pytest-dev/release-7.0.1 (cherry picked from commit 18d35b817de7a8a0b416eefbb54a323f9ba90d21) --- changelog/9608.bugfix.rst | 1 - changelog/9610.bugfix.rst | 3 --- changelog/9636.bugfix.rst | 1 - changelog/9642.bugfix.rst | 1 - changelog/9643.bugfix.rst | 2 -- doc/en/announce/index.rst | 1 + doc/en/announce/release-7.0.1.rst | 20 ++++++++++++++++++++ doc/en/changelog.rst | 24 ++++++++++++++++++++++++ doc/en/getting-started.rst | 2 +- 9 files changed, 46 insertions(+), 9 deletions(-) delete mode 100644 changelog/9608.bugfix.rst delete mode 100644 changelog/9610.bugfix.rst delete mode 100644 changelog/9636.bugfix.rst delete mode 100644 changelog/9642.bugfix.rst delete mode 100644 changelog/9643.bugfix.rst create mode 100644 doc/en/announce/release-7.0.1.rst diff --git a/changelog/9608.bugfix.rst b/changelog/9608.bugfix.rst deleted file mode 100644 index 4dda46becd2..00000000000 --- a/changelog/9608.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fix invalid importing of ``importlib.readers`` in Python 3.9. diff --git a/changelog/9610.bugfix.rst b/changelog/9610.bugfix.rst deleted file mode 100644 index c8c89c0c961..00000000000 --- a/changelog/9610.bugfix.rst +++ /dev/null @@ -1,3 +0,0 @@ -Restore `UnitTestFunction.obj` to return unbound rather than bound method. -Fixes a crash during a failed teardown in unittest TestCases with non-default `__init__`. -Regressed in pytest 7.0.0. diff --git a/changelog/9636.bugfix.rst b/changelog/9636.bugfix.rst deleted file mode 100644 index 2288c37ffc7..00000000000 --- a/changelog/9636.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -The ``pythonpath`` plugin was renamed to ``python_path``. This avoids a conflict with the ``pytest-pythonpath`` plugin. diff --git a/changelog/9642.bugfix.rst b/changelog/9642.bugfix.rst deleted file mode 100644 index 0b3c2050c51..00000000000 --- a/changelog/9642.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fix running tests by id with ``::`` in the parametrize portion. diff --git a/changelog/9643.bugfix.rst b/changelog/9643.bugfix.rst deleted file mode 100644 index 24ca81182ed..00000000000 --- a/changelog/9643.bugfix.rst +++ /dev/null @@ -1,2 +0,0 @@ -Delay issuing a :class:`~pytest.PytestWarning` about diamond inheritance involving :class:`~pytest.Item` and -:class:`~pytest.Collector` so it can be filtered using :ref:`standard warning filters `. diff --git a/doc/en/announce/index.rst b/doc/en/announce/index.rst index 75dde1bd6d9..9505b0b9e46 100644 --- a/doc/en/announce/index.rst +++ b/doc/en/announce/index.rst @@ -6,6 +6,7 @@ Release announcements :maxdepth: 2 + release-7.0.1 release-7.0.0 release-7.0.0rc1 release-6.2.5 diff --git a/doc/en/announce/release-7.0.1.rst b/doc/en/announce/release-7.0.1.rst new file mode 100644 index 00000000000..5accfbad0d4 --- /dev/null +++ b/doc/en/announce/release-7.0.1.rst @@ -0,0 +1,20 @@ +pytest-7.0.1 +======================================= + +pytest 7.0.1 has just been released to PyPI. + +This is a bug-fix release, being a drop-in replacement. To upgrade:: + + pip install --upgrade pytest + +The full changelog is available at https://docs.pytest.org/en/stable/changelog.html. + +Thanks to all of the contributors to this release: + +* Anthony Sottile +* Bruno Oliveira +* Ran Benita + + +Happy testing, +The pytest Development Team diff --git a/doc/en/changelog.rst b/doc/en/changelog.rst index 9605d6bcf00..1acdad366da 100644 --- a/doc/en/changelog.rst +++ b/doc/en/changelog.rst @@ -28,6 +28,30 @@ with advance notice in the **Deprecations** section of releases. .. towncrier release notes start +pytest 7.0.1 (2022-02-11) +========================= + +Bug Fixes +--------- + +- `#9608 `_: Fix invalid importing of ``importlib.readers`` in Python 3.9. + + +- `#9610 `_: Restore `UnitTestFunction.obj` to return unbound rather than bound method. + Fixes a crash during a failed teardown in unittest TestCases with non-default `__init__`. + Regressed in pytest 7.0.0. + + +- `#9636 `_: The ``pythonpath`` plugin was renamed to ``python_path``. This avoids a conflict with the ``pytest-pythonpath`` plugin. + + +- `#9642 `_: Fix running tests by id with ``::`` in the parametrize portion. + + +- `#9643 `_: Delay issuing a :class:`~pytest.PytestWarning` about diamond inheritance involving :class:`~pytest.Item` and + :class:`~pytest.Collector` so it can be filtered using :ref:`standard warning filters `. + + pytest 7.0.0 (2022-02-03) ========================= diff --git a/doc/en/getting-started.rst b/doc/en/getting-started.rst index 4c948843a9d..79b88ced9e1 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.0.0 + pytest 7.0.1 .. _`simpletest`: From c3aa4647c742107b2b1acf41c24b29e8c4bc8f99 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Sat, 5 Feb 2022 12:25:48 +0200 Subject: [PATCH 148/176] python: unify code to generate ID from value In the following @pytest.mark.parametrize(..., ids=[val]) the ID values are only allowed to be `str`, `float`, `int` or `bool`. In the following @pytest.mark.parametrize(..., [val]) @pytest.mark.parametrize(..., [pytest.param(..., id=val]) a different code path is used, which also allows `bytes`, `complex`, `re.Pattern`, `Enum` and anything with a `__name__`. In the interest of consistency, use the latter code path for all cases. --- changelog/9678.improvement.rst | 3 ++ src/_pytest/fixtures.py | 41 +++++---------------- src/_pytest/python.py | 67 ++++++++++++++++++---------------- testing/python/metafunc.py | 53 +++++++++++++++++++-------- 4 files changed, 85 insertions(+), 79 deletions(-) create mode 100644 changelog/9678.improvement.rst diff --git a/changelog/9678.improvement.rst b/changelog/9678.improvement.rst new file mode 100644 index 00000000000..d7bb1083a4d --- /dev/null +++ b/changelog/9678.improvement.rst @@ -0,0 +1,3 @@ +More types are now accepted in the ``ids`` argument to ``@pytest.mark.parametrize``. +Previously only `str`, `float`, `int` and `bool` were accepted; +now `bytes`, `complex`, `re.Pattern`, `Enum` and anything with a `__name__` are also accepted. diff --git a/src/_pytest/fixtures.py b/src/_pytest/fixtures.py index be03fb2a820..fba9085d0c1 100644 --- a/src/_pytest/fixtures.py +++ b/src/_pytest/fixtures.py @@ -939,10 +939,7 @@ def __init__( params: Optional[Sequence[object]], unittest: bool = False, ids: Optional[ - Union[ - Tuple[Union[None, str, float, int, bool], ...], - Callable[[Any], Optional[object]], - ] + Union[Tuple[Optional[object], ...], Callable[[Any], Optional[object]]] ] = None, ) -> None: self._fixturemanager = fixturemanager @@ -1093,18 +1090,8 @@ def pytest_fixture_setup( def _ensure_immutable_ids( - ids: Optional[ - Union[ - Iterable[Union[None, str, float, int, bool]], - Callable[[Any], Optional[object]], - ] - ], -) -> Optional[ - Union[ - Tuple[Union[None, str, float, int, bool], ...], - Callable[[Any], Optional[object]], - ] -]: + ids: Optional[Union[Sequence[Optional[object]], Callable[[Any], Optional[object]]]] +) -> Optional[Union[Tuple[Optional[object], ...], Callable[[Any], Optional[object]]]]: if ids is None: return None if callable(ids): @@ -1148,9 +1135,8 @@ class FixtureFunctionMarker: scope: "Union[_ScopeName, Callable[[str, Config], _ScopeName]]" params: Optional[Tuple[object, ...]] = attr.ib(converter=_params_converter) autouse: bool = False - ids: Union[ - Tuple[Union[None, str, float, int, bool], ...], - Callable[[Any], Optional[object]], + ids: Optional[ + Union[Tuple[Optional[object], ...], Callable[[Any], Optional[object]]] ] = attr.ib( default=None, converter=_ensure_immutable_ids, @@ -1191,10 +1177,7 @@ def fixture( params: Optional[Iterable[object]] = ..., autouse: bool = ..., ids: Optional[ - Union[ - Iterable[Union[None, str, float, int, bool]], - Callable[[Any], Optional[object]], - ] + Union[Sequence[Optional[object]], Callable[[Any], Optional[object]]] ] = ..., name: Optional[str] = ..., ) -> FixtureFunction: @@ -1209,10 +1192,7 @@ def fixture( params: Optional[Iterable[object]] = ..., autouse: bool = ..., ids: Optional[ - Union[ - Iterable[Union[None, str, float, int, bool]], - Callable[[Any], Optional[object]], - ] + Union[Sequence[Optional[object]], Callable[[Any], Optional[object]]] ] = ..., name: Optional[str] = None, ) -> FixtureFunctionMarker: @@ -1226,10 +1206,7 @@ def fixture( params: Optional[Iterable[object]] = None, autouse: bool = False, ids: Optional[ - Union[ - Iterable[Union[None, str, float, int, bool]], - Callable[[Any], Optional[object]], - ] + Union[Sequence[Optional[object]], Callable[[Any], Optional[object]]] ] = None, name: Optional[str] = None, ) -> Union[FixtureFunctionMarker, FixtureFunction]: @@ -1271,7 +1248,7 @@ def fixture( the fixture. :param ids: - List of string ids each corresponding to the params so that they are + Sequence of ids each corresponding to the params so that they are part of the test id. If no ids are provided they will be generated automatically from the params. diff --git a/src/_pytest/python.py b/src/_pytest/python.py index 23baa9a61f2..cd951939e7a 100644 --- a/src/_pytest/python.py +++ b/src/_pytest/python.py @@ -940,7 +940,7 @@ class IdMaker: # ParameterSet. idfn: Optional[Callable[[Any], Optional[object]]] # Optionally, explicit IDs for ParameterSets by index. - ids: Optional[Sequence[Union[None, str]]] + ids: Optional[Sequence[Optional[object]]] # Optionally, the pytest config. # Used for controlling ASCII escaping, and for calling the # :hook:`pytest_make_parametrize_id` hook. @@ -948,6 +948,9 @@ class IdMaker: # Optionally, the ID of the node being parametrized. # Used only for clearer error messages. nodeid: Optional[str] + # Optionally, the ID of the function being parametrized. + # Used only for clearer error messages. + func_name: Optional[str] def make_unique_parameterset_ids(self) -> List[str]: """Make a unique identifier for each ParameterSet, that may be used to @@ -982,9 +985,7 @@ def _resolve_ids(self) -> Iterable[str]: yield parameterset.id elif self.ids and idx < len(self.ids) and self.ids[idx] is not None: # ID provided in the IDs list - parametrize(..., ids=[...]). - id = self.ids[idx] - assert id is not None - yield _ascii_escaped_by_config(id, self.config) + yield self._idval_from_value_required(self.ids[idx], idx) else: # ID not provided - generate it. yield "-".join( @@ -1053,6 +1054,25 @@ def _idval_from_value(self, val: object) -> Optional[str]: return name return None + def _idval_from_value_required(self, val: object, idx: int) -> str: + """Like _idval_from_value(), but fails if the type is not supported.""" + id = self._idval_from_value(val) + if id is not None: + return id + + # Fail. + if self.func_name is not None: + prefix = f"In {self.func_name}: " + elif self.nodeid is not None: + prefix = f"In {self.nodeid}: " + else: + prefix = "" + msg = ( + f"{prefix}ids contains unsupported value {saferepr(val)} (type: {type(val)!r}) at index {idx}. " + "Supported types are: str, bytes, int, float, complex, bool, enum, regex or anything with a __name__." + ) + fail(msg, pytrace=False) + @staticmethod def _idval_from_argname(argname: str, idx: int) -> str: """Make an ID for a parameter in a ParameterSet from the argument name @@ -1182,10 +1202,7 @@ def parametrize( argvalues: Iterable[Union[ParameterSet, Sequence[object], object]], indirect: Union[bool, Sequence[str]] = False, ids: Optional[ - Union[ - Iterable[Union[None, str, float, int, bool]], - Callable[[Any], Optional[object]], - ] + Union[Iterable[Optional[object]], Callable[[Any], Optional[object]]] ] = None, scope: "Optional[_ScopeName]" = None, *, @@ -1316,10 +1333,7 @@ def _resolve_parameter_set_ids( self, argnames: Sequence[str], ids: Optional[ - Union[ - Iterable[Union[None, str, float, int, bool]], - Callable[[Any], Optional[object]], - ] + Union[Iterable[Optional[object]], Callable[[Any], Optional[object]]] ], parametersets: Sequence[ParameterSet], nodeid: str, @@ -1349,16 +1363,22 @@ def _resolve_parameter_set_ids( idfn = None ids_ = self._validate_ids(ids, parametersets, self.function.__name__) id_maker = IdMaker( - argnames, parametersets, idfn, ids_, self.config, nodeid=nodeid + argnames, + parametersets, + idfn, + ids_, + self.config, + nodeid=nodeid, + func_name=self.function.__name__, ) return id_maker.make_unique_parameterset_ids() def _validate_ids( self, - ids: Iterable[Union[None, str, float, int, bool]], + ids: Iterable[Optional[object]], parametersets: Sequence[ParameterSet], func_name: str, - ) -> List[Union[None, str]]: + ) -> List[Optional[object]]: try: num_ids = len(ids) # type: ignore[arg-type] except TypeError: @@ -1373,22 +1393,7 @@ def _validate_ids( msg = "In {}: {} parameter sets specified, with different number of ids: {}" fail(msg.format(func_name, len(parametersets), num_ids), pytrace=False) - new_ids = [] - for idx, id_value in enumerate(itertools.islice(ids, num_ids)): - if id_value is None or isinstance(id_value, str): - new_ids.append(id_value) - elif isinstance(id_value, (float, int, bool)): - new_ids.append(str(id_value)) - else: - msg = ( # type: ignore[unreachable] - "In {}: ids must be list of string/float/int/bool, " - "found: {} (type: {!r}) at index {}" - ) - fail( - msg.format(func_name, saferepr(id_value), type(id_value), idx), - pytrace=False, - ) - return new_ids + return list(itertools.islice(ids, num_ids)) def _resolve_arg_value_types( self, diff --git a/testing/python/metafunc.py b/testing/python/metafunc.py index b6ad4a80924..2fed22718b0 100644 --- a/testing/python/metafunc.py +++ b/testing/python/metafunc.py @@ -106,8 +106,8 @@ def gen() -> Iterator[Union[int, None, Exc]]: with pytest.raises( fail.Exception, match=( - r"In func: ids must be list of string/float/int/bool, found:" - r" Exc\(from_gen\) \(type: \) at index 2" + r"In func: ids contains unsupported value Exc\(from_gen\) \(type: \) at index 2. " + r"Supported types are: .*" ), ): metafunc.parametrize("x", [1, 2, 3], ids=gen()) # type: ignore[arg-type] @@ -285,7 +285,7 @@ class A: deadline=400.0 ) # very close to std deadline and CI boxes are not reliable in CPU power def test_idval_hypothesis(self, value) -> None: - escaped = IdMaker([], [], None, None, None, None)._idval(value, "a", 6) + escaped = IdMaker([], [], None, None, None, None, None)._idval(value, "a", 6) assert isinstance(escaped, str) escaped.encode("ascii") @@ -308,7 +308,8 @@ def test_unicode_idval(self) -> None: ] for val, expected in values: assert ( - IdMaker([], [], None, None, None, None)._idval(val, "a", 6) == expected + IdMaker([], [], None, None, None, None, None)._idval(val, "a", 6) + == expected ) def test_unicode_idval_with_config(self) -> None: @@ -337,7 +338,7 @@ def getini(self, name): ("ação", MockConfig({option: False}), "a\\xe7\\xe3o"), ] for val, config, expected in values: - actual = IdMaker([], [], None, None, config, None)._idval(val, "a", 6) + actual = IdMaker([], [], None, None, config, None, None)._idval(val, "a", 6) assert actual == expected def test_bytes_idval(self) -> None: @@ -351,7 +352,8 @@ def test_bytes_idval(self) -> None: ] for val, expected in values: assert ( - IdMaker([], [], None, None, None, None)._idval(val, "a", 6) == expected + IdMaker([], [], None, None, None, None, None)._idval(val, "a", 6) + == expected ) def test_class_or_function_idval(self) -> None: @@ -367,7 +369,8 @@ def test_function(): values = [(TestClass, "TestClass"), (test_function, "test_function")] for val, expected in values: assert ( - IdMaker([], [], None, None, None, None)._idval(val, "a", 6) == expected + IdMaker([], [], None, None, None, None, None)._idval(val, "a", 6) + == expected ) def test_notset_idval(self) -> None: @@ -376,7 +379,9 @@ def test_notset_idval(self) -> None: Regression test for #7686. """ - assert IdMaker([], [], None, None, None, None)._idval(NOTSET, "a", 0) == "a0" + assert ( + IdMaker([], [], None, None, None, None, None)._idval(NOTSET, "a", 0) == "a0" + ) def test_idmaker_autoname(self) -> None: """#250""" @@ -387,6 +392,7 @@ def test_idmaker_autoname(self) -> None: None, None, None, + None, ).make_unique_parameterset_ids() assert result == ["string-1.0", "st-ring-2.0"] @@ -397,17 +403,18 @@ def test_idmaker_autoname(self) -> None: None, None, None, + None, ).make_unique_parameterset_ids() assert result == ["a0-1.0", "a1-b1"] # unicode mixing, issue250 result = IdMaker( - ("a", "b"), [pytest.param({}, b"\xc3\xb4")], None, None, None, None + ("a", "b"), [pytest.param({}, b"\xc3\xb4")], None, None, None, None, None ).make_unique_parameterset_ids() assert result == ["a0-\\xc3\\xb4"] def test_idmaker_with_bytes_regex(self) -> None: result = IdMaker( - ("a"), [pytest.param(re.compile(b"foo"), 1.0)], None, None, None, None + ("a"), [pytest.param(re.compile(b"foo"), 1.0)], None, None, None, None, None ).make_unique_parameterset_ids() assert result == ["foo"] @@ -433,6 +440,7 @@ def test_idmaker_native_strings(self) -> None: None, None, None, + None, ).make_unique_parameterset_ids() assert result == [ "1.0--1.1", @@ -465,6 +473,7 @@ def test_idmaker_non_printable_characters(self) -> None: None, None, None, + None, ).make_unique_parameterset_ids() assert result == ["\\x00-1", "\\x05-2", "\\x00-3", "\\x05-4", "\\t-5", "\\t-6"] @@ -479,6 +488,7 @@ def test_idmaker_manual_ids_must_be_printable(self) -> None: None, None, None, + None, ).make_unique_parameterset_ids() assert result == ["hello \\x00", "hello \\x05"] @@ -486,7 +496,7 @@ def test_idmaker_enum(self) -> None: enum = pytest.importorskip("enum") e = enum.Enum("Foo", "one, two") result = IdMaker( - ("a", "b"), [pytest.param(e.one, e.two)], None, None, None, None + ("a", "b"), [pytest.param(e.one, e.two)], None, None, None, None, None ).make_unique_parameterset_ids() assert result == ["Foo.one-Foo.two"] @@ -509,6 +519,7 @@ def ids(val: object) -> Optional[str]: None, None, None, + None, ).make_unique_parameterset_ids() assert result == ["10.0-IndexError()", "20-KeyError()", "three-b2"] @@ -529,6 +540,7 @@ def ids(val: object) -> str: None, None, None, + None, ).make_unique_parameterset_ids() assert result == ["a-a0", "a-a1", "a-a2"] @@ -560,7 +572,13 @@ def getini(self, name): ] for config, expected in values: result = IdMaker( - ("a",), [pytest.param("string")], lambda _: "ação", None, config, None + ("a",), + [pytest.param("string")], + lambda _: "ação", + None, + config, + None, + None, ).make_unique_parameterset_ids() assert result == [expected] @@ -592,7 +610,7 @@ def getini(self, name): ] for config, expected in values: result = IdMaker( - ("a",), [pytest.param("string")], None, ["ação"], config, None + ("a",), [pytest.param("string")], None, ["ação"], config, None, None ).make_unique_parameterset_ids() assert result == [expected] @@ -657,6 +675,7 @@ def test_idmaker_with_ids(self) -> None: ["a", None], None, None, + None, ).make_unique_parameterset_ids() assert result == ["a", "3-4"] @@ -668,6 +687,7 @@ def test_idmaker_with_paramset_id(self) -> None: ["a", None], None, None, + None, ).make_unique_parameterset_ids() assert result == ["me", "you"] @@ -679,6 +699,7 @@ def test_idmaker_with_ids_unique_names(self) -> None: ["a", "a", "b", "c", "b"], None, None, + None, ).make_unique_parameterset_ids() assert result == ["a0", "a1", "b0", "c", "b1"] @@ -1318,7 +1339,7 @@ def test_parametrized_ids_invalid_type(self, pytester: Pytester) -> None: """ import pytest - @pytest.mark.parametrize("x, expected", [(1, 2), (3, 4), (5, 6)], ids=(None, 2, type)) + @pytest.mark.parametrize("x, expected", [(1, 2), (3, 4), (5, 6)], ids=(None, 2, OSError())) def test_ids_numbers(x,expected): assert x * 2 == expected """ @@ -1326,8 +1347,8 @@ def test_ids_numbers(x,expected): result = pytester.runpytest() result.stdout.fnmatch_lines( [ - "In test_ids_numbers: ids must be list of string/float/int/bool," - " found: (type: ) at index 2" + "In test_ids_numbers: ids contains unsupported value OSError() (type: ) at index 2. " + "Supported types are: str, bytes, int, float, complex, bool, enum, regex or anything with a __name__." ] ) From 295e7535c9cc9b01ac4e1f77f7b5d929be13a483 Mon Sep 17 00:00:00 2001 From: pytest bot Date: Sun, 13 Feb 2022 00:15:13 +0000 Subject: [PATCH 149/176] [automated] Update plugin list --- doc/en/reference/plugin_list.rst | 176 +++++++++++++++++-------------- 1 file changed, 96 insertions(+), 80 deletions(-) diff --git a/doc/en/reference/plugin_list.rst b/doc/en/reference/plugin_list.rst index f73ad773cb8..b6d4f882a61 100644 --- a/doc/en/reference/plugin_list.rst +++ b/doc/en/reference/plugin_list.rst @@ -11,7 +11,7 @@ automatically. Packages classified as inactive are excluded. creating a PDF, because otherwise the table gets far too wide for the page. -This list contains 995 plugins. +This list contains 997 plugins. .. only:: not latex @@ -27,14 +27,14 @@ This list contains 995 plugins. :pypi:`pytest-aggreport` pytest plugin for pytest-repeat that generate aggregate report of the same test cases with additional statistics details. Mar 07, 2021 4 - Beta pytest (>=6.2.2) :pypi:`pytest-aio` Pytest plugin for testing async python code Oct 20, 2021 4 - Beta pytest :pypi:`pytest-aiofiles` pytest fixtures for writing aiofiles tests with pyfakefs May 14, 2017 5 - Production/Stable N/A - :pypi:`pytest-aiohttp` Pytest plugin for aiohttp support Jan 21, 2022 4 - Beta pytest (>=6.1.0) + :pypi:`pytest-aiohttp` Pytest plugin for aiohttp support Feb 12, 2022 4 - Beta pytest (>=6.1.0) :pypi:`pytest-aiohttp-client` Pytest \`client\` fixture for the Aiohttp Nov 01, 2020 N/A pytest (>=6) :pypi:`pytest-aiomoto` pytest-aiomoto Dec 10, 2021 N/A pytest (>=6.2.5,<7.0.0) :pypi:`pytest-aioresponses` py.test integration for aioresponses Jul 29, 2021 4 - Beta pytest (>=3.5.0) :pypi:`pytest-aioworkers` A plugin to test aioworkers project with pytest Dec 04, 2019 4 - Beta pytest (>=3.5.0) :pypi:`pytest-airflow` pytest support for airflow. Apr 03, 2019 3 - Alpha pytest (>=4.4.0) :pypi:`pytest-airflow-utils` Nov 15, 2021 N/A N/A - :pypi:`pytest-alembic` A pytest plugin for verifying alembic migrations. Dec 21, 2021 N/A pytest (>=1.0) + :pypi:`pytest-alembic` A pytest plugin for verifying alembic migrations. Feb 08, 2022 N/A pytest (>=1.0) :pypi:`pytest-allclose` Pytest fixture extending Numpy's allclose function Jul 30, 2019 5 - Production/Stable pytest :pypi:`pytest-allure-adaptor` Plugin for py.test to generate allure xml reports Jan 10, 2018 N/A pytest (>=2.7.3) :pypi:`pytest-allure-adaptor2` Plugin for py.test to generate allure xml reports Oct 14, 2020 N/A pytest (>=2.7.3) @@ -67,7 +67,7 @@ This list contains 995 plugins. :pypi:`pytest-astropy` Meta-package containing dependencies for testing Sep 21, 2021 5 - Production/Stable pytest (>=4.6) :pypi:`pytest-astropy-header` pytest plugin to add diagnostic information to the header of the test output Dec 27, 2021 3 - Alpha pytest (>=4.6) :pypi:`pytest-ast-transformer` May 04, 2019 3 - Alpha pytest - :pypi:`pytest-asyncio` Pytest support for asyncio Jan 17, 2022 4 - Beta pytest (>=6.1.0) + :pypi:`pytest-asyncio` Pytest support for asyncio Feb 10, 2022 4 - Beta pytest (>=6.1.0) :pypi:`pytest-asyncio-cooperative` Run all your asynchronous tests cooperatively. Jan 25, 2022 N/A N/A :pypi:`pytest-asyncio-network-simulator` pytest-asyncio-network-simulator: Plugin for pytest for simulator the network in tests Jul 31, 2018 3 - Alpha pytest (<3.7.0,>=3.3.2) :pypi:`pytest-async-mongodb` pytest plugin for async MongoDB Oct 18, 2017 5 - Production/Stable pytest (>=2.5.2) @@ -130,7 +130,7 @@ This list contains 995 plugins. :pypi:`pytest-canonical-data` A plugin which allows to compare results with canonical results, based on previous runs May 08, 2020 2 - Pre-Alpha pytest (>=3.5.0) :pypi:`pytest-caprng` A plugin that replays pRNG state on failure. May 02, 2018 4 - Beta N/A :pypi:`pytest-capture-deprecatedwarnings` pytest plugin to capture all deprecatedwarnings and put them in one file Apr 30, 2019 N/A N/A - :pypi:`pytest-cases` Separate test code from test cases in pytest. Jan 07, 2022 5 - Production/Stable N/A + :pypi:`pytest-cases` Separate test code from test cases in pytest. Feb 08, 2022 5 - Production/Stable N/A :pypi:`pytest-cassandra` Cassandra CCM Test Fixtures for pytest Nov 04, 2017 1 - Planning N/A :pypi:`pytest-catchlog` py.test plugin to catch log messages. This is a fork of pytest-capturelog. Jan 24, 2016 4 - Beta pytest (>=2.6) :pypi:`pytest-catch-server` Pytest plugin with server for catching HTTP requests. Dec 12, 2019 5 - Production/Stable N/A @@ -148,7 +148,7 @@ This list contains 995 plugins. :pypi:`pytest-ckan` Backport of CKAN 2.9 pytest plugin and fixtures to CAKN 2.8 Apr 28, 2020 4 - Beta pytest :pypi:`pytest-clarity` A plugin providing an alternative, colourful diff output for failing assertions. Jun 11, 2021 N/A N/A :pypi:`pytest-cldf` Easy quality control for CLDF datasets using pytest May 06, 2019 N/A N/A - :pypi:`pytest-click` Py.test plugin for Click Aug 29, 2020 5 - Production/Stable pytest (>=5.0) + :pypi:`pytest-click` Pytest plugin for Click Feb 11, 2022 5 - Production/Stable pytest (>=5.0) :pypi:`pytest-clld` Nov 29, 2021 N/A pytest (>=3.6) :pypi:`pytest-cloud` Distributed tests planner plugin for pytest testing framework. Oct 05, 2020 6 - Mature N/A :pypi:`pytest-cloudflare-worker` pytest plugin for testing cloudflare workers Mar 30, 2021 4 - Beta pytest (>=6.0.0) @@ -229,7 +229,7 @@ This list contains 995 plugins. :pypi:`pytest-diff` A simple plugin to use with pytest Mar 30, 2019 4 - Beta pytest (>=3.5.0) :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. Mar 20, 2021 3 - Alpha pytest (!=6.0.0,<7,>=3.3.2) + :pypi:`pytest-discord` A pytest plugin to notify test results to a Discord channel. Feb 12, 2022 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. Aug 04, 2021 4 - Beta N/A @@ -239,7 +239,7 @@ This list contains 995 plugins. :pypi:`pytest-django-factories` Factories for your Django models that can be used as Pytest fixtures. Nov 12, 2020 4 - Beta N/A :pypi:`pytest-django-gcir` A Django plugin for pytest. Mar 06, 2018 5 - Production/Stable N/A :pypi:`pytest-django-haystack` Cleanup your Haystack indexes between tests Sep 03, 2017 5 - Production/Stable pytest (>=2.3.4) - :pypi:`pytest-django-ifactory` A model instance factory for pytest-django Jan 13, 2021 3 - Alpha N/A + :pypi:`pytest-django-ifactory` A model instance factory for pytest-django Feb 09, 2022 3 - Alpha N/A :pypi:`pytest-django-lite` The bare minimum to integrate py.test with Django. Jan 30, 2014 N/A N/A :pypi:`pytest-django-liveserver-ssl` Jan 20, 2022 3 - Alpha N/A :pypi:`pytest-django-model` A Simple Way to Test your Django Models Feb 14, 2019 4 - Beta N/A @@ -258,13 +258,13 @@ This list contains 995 plugins. :pypi:`pytest-docker-compose` Manages Docker containers during your integration tests Jan 26, 2021 5 - Production/Stable pytest (>=3.3) :pypi:`pytest-docker-db` A plugin to use docker databases for pytests Mar 20, 2021 5 - Production/Stable pytest (>=3.1.1) :pypi:`pytest-docker-fixtures` pytest docker fixtures Nov 23, 2021 3 - Alpha N/A - :pypi:`pytest-docker-git-fixtures` Pytest fixtures for testing with git scm. Mar 11, 2021 4 - Beta pytest - :pypi:`pytest-docker-haproxy-fixtures` Pytest fixtures for testing with haproxy. Feb 01, 2022 4 - Beta pytest + :pypi:`pytest-docker-git-fixtures` Pytest fixtures for testing with git scm. Feb 09, 2022 4 - Beta pytest + :pypi:`pytest-docker-haproxy-fixtures` Pytest fixtures for testing with haproxy. Feb 09, 2022 4 - Beta pytest :pypi:`pytest-docker-pexpect` pytest plugin for writing functional tests with pexpect and docker Jan 14, 2019 N/A pytest :pypi:`pytest-docker-postgresql` A simple plugin to use with pytest Sep 24, 2019 4 - Beta pytest (>=3.5.0) :pypi:`pytest-docker-py` Easy to use, simple to extend, pytest plugin that minimally leverages docker-py. Nov 27, 2018 N/A pytest (==4.0.0) - :pypi:`pytest-docker-registry-fixtures` Pytest fixtures for testing with docker registries. Feb 01, 2022 4 - Beta pytest - :pypi:`pytest-docker-squid-fixtures` Pytest fixtures for testing with squid. Feb 04, 2022 4 - Beta pytest + :pypi:`pytest-docker-registry-fixtures` Pytest fixtures for testing with docker registries. Feb 09, 2022 4 - Beta pytest + :pypi:`pytest-docker-squid-fixtures` Pytest fixtures for testing with squid. Feb 09, 2022 4 - Beta pytest :pypi:`pytest-docker-tools` Docker integration tests for pytest Jul 23, 2021 4 - Beta pytest (>=6.0.1,<7.0.0) :pypi:`pytest-docs` Documentation tool for pytest Nov 11, 2018 4 - Beta pytest (>=3.5.0) :pypi:`pytest-docstyle` pytest plugin to run pydocstyle Mar 23, 2020 3 - Alpha N/A @@ -378,6 +378,7 @@ This list contains 995 plugins. :pypi:`pytest-flask-sqlalchemy-transactions` Run tests in transactions using pytest, Flask, and SQLalchemy. Aug 02, 2018 4 - Beta pytest (>=3.2.1) :pypi:`pytest-flyte` Pytest fixtures for simplifying Flyte integration testing May 03, 2021 N/A pytest :pypi:`pytest-focus` A pytest plugin that alerts user of failed test cases with screen notifications May 04, 2019 4 - Beta pytest + :pypi:`pytest-fold` Fold console output and drop user into interactive text user interface Feb 06, 2022 3 - Alpha pytest (>=6.2.5) :pypi:`pytest-forcefail` py.test plugin to make the test failing regardless of pytest.mark.xfail May 15, 2018 4 - Beta N/A :pypi:`pytest-forward-compatability` A name to avoid typosquating pytest-foward-compatibility Sep 06, 2020 N/A N/A :pypi:`pytest-forward-compatibility` A pytest plugin to shim pytest commandline options for fowards compatibility Sep 29, 2020 N/A N/A @@ -419,7 +420,7 @@ This list contains 995 plugins. :pypi:`pytest-historic` Custom report to display pytest historical execution records Apr 08, 2020 N/A pytest :pypi:`pytest-historic-hook` Custom listener to store execution results into MYSQL DB, which is used for pytest-historic report Apr 08, 2020 N/A pytest :pypi:`pytest-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 Feb 05, 2022 3 - Alpha pytest (==6.2.5) + :pypi:`pytest-homeassistant-custom-component` Experimental package to automatically extract test plugins for Home Assistant custom components Feb 12, 2022 3 - Alpha pytest (==6.2.5) :pypi:`pytest-honey` A simple plugin to use with pytest Jan 07, 2022 4 - Beta pytest (>=3.5.0) :pypi:`pytest-honors` Report on tests that honor constraints, and guard against regressions Mar 06, 2020 4 - Beta N/A :pypi:`pytest-hoverfly` Simplify working with Hoverfly from pytest Jan 20, 2022 N/A pytest (>=5.0) @@ -427,9 +428,9 @@ This list contains 995 plugins. :pypi:`pytest-hpfeeds` Helpers for testing hpfeeds in your python project Aug 27, 2021 4 - Beta pytest (>=6.2.4,<7.0.0) :pypi:`pytest-html` pytest plugin for generating HTML reports Dec 13, 2020 5 - Production/Stable pytest (!=6.0.0,>=5.0) :pypi:`pytest-html-lee` optimized pytest plugin for generating HTML reports Jun 30, 2020 5 - Production/Stable pytest (>=5.0) - :pypi:`pytest-html-object-storage` Pytest report plugin for send HTML report on object-storage Jan 31, 2022 5 - Production/Stable N/A + :pypi:`pytest-html-object-storage` Pytest report plugin for send HTML report on object-storage Feb 06, 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 Apr 25, 2021 N/A N/A + :pypi:`pytest-html-reporter` Generates a static html report based on pytest framework Feb 11, 2022 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 Dec 25, 2021 5 - Production/Stable N/A @@ -454,7 +455,7 @@ This list contains 995 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 Sep 30, 2021 N/A N/A :pypi:`pytest-inmanta` A py.test plugin providing fixtures to simplify inmanta modules testing. Jan 26, 2022 5 - Production/Stable N/A - :pypi:`pytest-inmanta-extensions` Inmanta tests package Feb 03, 2022 5 - Production/Stable N/A + :pypi:`pytest-inmanta-extensions` Inmanta tests package Feb 11, 2022 5 - Production/Stable N/A :pypi:`pytest-Inomaly` A simple image diff plugin for pytest Feb 13, 2018 4 - Beta N/A :pypi:`pytest-insta` A practical snapshot testing plugin for pytest Apr 07, 2021 N/A pytest (>=6.0.2,<7.0.0) :pypi:`pytest-instafail` pytest plugin to show failures instantly Jun 14, 2020 4 - Beta pytest (>=2.9) @@ -467,7 +468,7 @@ This list contains 995 plugins. :pypi:`pytest-involve` Run tests covering a specific file or changeset Feb 02, 2020 4 - Beta pytest (>=3.5.0) :pypi:`pytest-ipdb` A py.test plug-in to enable drop to ipdb debugger on test failure. Sep 02, 2014 2 - Pre-Alpha N/A :pypi:`pytest-ipynb` THIS PROJECT IS ABANDONED Jan 29, 2019 3 - Alpha N/A - :pypi:`pytest-isort` py.test plugin to check import ordering using isort Apr 27, 2021 5 - Production/Stable N/A + :pypi:`pytest-isort` py.test plugin to check import ordering using isort Feb 08, 2022 5 - Production/Stable pytest (>=5.0) :pypi:`pytest-is-running` pytest plugin providing a function to check if pytest is running. Jan 10, 2022 5 - Production/Stable pytest :pypi:`pytest-it` Pytest plugin to display test reports as a plaintext spec, inspired by Rspec: https://github.com/mattduck/pytest-it. Jan 22, 2020 4 - Beta N/A :pypi:`pytest-iterassert` Nicer list and iterable assertion messages for pytest May 11, 2020 3 - Alpha N/A @@ -530,12 +531,12 @@ This list contains 995 plugins. :pypi:`pytest-matrix` Provide tools for generating tests from combinations of fixtures. Jun 24, 2020 5 - Production/Stable pytest (>=5.4.3,<6.0.0) :pypi:`pytest-mccabe` pytest plugin to run the mccabe code complexity checker. Jul 22, 2020 3 - Alpha pytest (>=5.4.0) :pypi:`pytest-md` Plugin for generating Markdown reports for pytest results Jul 11, 2019 3 - Alpha pytest (>=4.2.1) - :pypi:`pytest-md-report` A pytest plugin to make a test results report with Markdown table format. May 04, 2021 4 - Beta pytest (!=6.0.0,<7,>=3.3.2) + :pypi:`pytest-md-report` A pytest plugin to make a test results report with Markdown table format. Feb 06, 2022 4 - Beta pytest (!=6.0.0,<8,>=3.3.2) :pypi:`pytest-memprof` Estimates memory consumption of test functions Mar 29, 2019 4 - Beta N/A :pypi:`pytest-menu` A pytest plugin for console based interactive test selection just after the collection phase Oct 04, 2017 3 - Alpha pytest (>=2.4.2) :pypi:`pytest-mercurial` pytest plugin to write integration tests for projects using Mercurial Python internals Nov 21, 2020 1 - Planning N/A :pypi:`pytest-message` Pytest plugin for sending report message of marked tests execution Jan 05, 2022 N/A pytest (>=6.2.5) - :pypi:`pytest-messenger` Pytest to Slack reporting plugin Dec 16, 2020 5 - Production/Stable N/A + :pypi:`pytest-messenger` Pytest to Slack reporting plugin Feb 07, 2022 5 - Production/Stable N/A :pypi:`pytest-metadata` pytest plugin for test session metadata Nov 27, 2020 5 - Production/Stable pytest (>=2.9.0) :pypi:`pytest-metrics` Custom metrics report for pytest Apr 04, 2020 N/A pytest :pypi:`pytest-mimesis` Mimesis integration with the pytest test runner Mar 21, 2020 5 - Production/Stable pytest (>=4.2) @@ -549,7 +550,7 @@ This list contains 995 plugins. :pypi:`pytest-mock-helper` Help you mock HTTP call and generate mock code Jan 24, 2018 N/A pytest :pypi:`pytest-mockito` Base fixtures for mockito Jul 11, 2018 4 - Beta N/A :pypi:`pytest-mockredis` An in-memory mock of a Redis server that runs in a separate thread. This is to be used for unit-tests that require a Redis database. Jan 02, 2018 2 - Pre-Alpha N/A - :pypi:`pytest-mock-resources` A pytest plugin for easily instantiating reproducible mock resources. Jan 11, 2022 N/A pytest (>=1.0) + :pypi:`pytest-mock-resources` A pytest plugin for easily instantiating reproducible mock resources. Feb 08, 2022 N/A pytest (>=1.0) :pypi:`pytest-mock-server` Mock server plugin for pytest Jan 09, 2022 4 - Beta pytest (>=3.5.0) :pypi:`pytest-mockservers` A set of fixtures to test your requests to HTTP/UDP servers Mar 31, 2020 N/A pytest (>=4.3.0) :pypi:`pytest-modified-env` Pytest plugin to fail a test if it leaves modified \`os.environ\` afterwards. Jan 29, 2022 4 - Beta N/A @@ -565,19 +566,19 @@ This list contains 995 plugins. :pypi:`pytest-motor` A pytest plugin for motor, the non-blocking MongoDB driver. Jul 21, 2021 3 - Alpha pytest :pypi:`pytest-mp` A test batcher for multiprocessed Pytest runs May 23, 2018 4 - Beta pytest :pypi:`pytest-mpi` pytest plugin to collect information from tests Jan 08, 2022 3 - Alpha pytest - :pypi:`pytest-mpl` pytest plugin to help with testing figures output from Matplotlib Jul 02, 2021 4 - Beta pytest + :pypi:`pytest-mpl` pytest plugin to help with testing figures output from Matplotlib Feb 09, 2022 4 - Beta pytest :pypi:`pytest-mproc` low-startup-overhead, scalable, distributed-testing pytest plugin Mar 07, 2021 4 - Beta pytest :pypi:`pytest-multi-check` Pytest-плагин, реализует возможность мульти проверок и мягких проверок Jun 03, 2021 N/A pytest :pypi:`pytest-multihost` Utility for writing multi-host tests for pytest Apr 07, 2020 4 - Beta N/A :pypi:`pytest-multilog` Multi-process logs handling and other helpers for pytest Jun 10, 2021 N/A N/A :pypi:`pytest-multithreading` a pytest plugin for th and concurrent testing Aug 12, 2021 N/A pytest (>=3.6) :pypi:`pytest-mutagen` Add the mutation testing feature to pytest Jul 24, 2020 N/A pytest (>=5.4) - :pypi:`pytest-mypy` Mypy static type checker plugin for Pytest Jan 30, 2022 4 - Beta pytest (>=6.2) ; python_version >= "3.10" + :pypi:`pytest-mypy` Mypy static type checker plugin for Pytest Feb 07, 2022 4 - Beta pytest (>=6.2) ; python_version >= "3.10" :pypi:`pytest-mypyd` Mypy static type checker plugin for Pytest Aug 20, 2019 4 - Beta pytest (<4.7,>=2.8) ; python_version < "3.5" :pypi:`pytest-mypy-plugins` pytest plugin for writing tests for mypy plugins Jan 11, 2022 3 - Alpha pytest (>=6.0.0) :pypi:`pytest-mypy-plugins-shim` Substitute for "pytest-mypy-plugins" for Python implementations which aren't supported by mypy. Apr 12, 2021 N/A N/A :pypi:`pytest-mypy-testing` Pytest plugin to check mypy output. Jun 13, 2021 N/A pytest - :pypi:`pytest-mysql` MySQL process and client fixtures for pytest Nov 22, 2021 5 - Production/Stable pytest + :pypi:`pytest-mysql` MySQL process and client fixtures for pytest Feb 11, 2022 5 - Production/Stable pytest (>=6.2) :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-network` A simple plugin to disable network on socket level. May 07, 2020 N/A N/A @@ -599,7 +600,7 @@ This list contains 995 plugins. :pypi:`pytest-notion` A PyTest Reporter to send test runs to Notion.so Aug 07, 2019 N/A N/A :pypi:`pytest-nunit` A pytest plugin for generating NUnit3 test result XML output Aug 04, 2020 4 - Beta pytest (>=3.5.0) :pypi:`pytest-ochrus` pytest results data-base and HTML reporter Feb 21, 2018 4 - Beta N/A - :pypi:`pytest-odoo` py.test plugin to run Odoo tests Nov 04, 2021 4 - Beta pytest (>=2.9) + :pypi:`pytest-odoo` py.test plugin to run Odoo tests Feb 08, 2022 4 - Beta N/A :pypi:`pytest-odoo-fixtures` Project description Jun 25, 2019 N/A N/A :pypi:`pytest-oerp` pytest plugin to test OpenERP modules Feb 28, 2012 3 - Alpha N/A :pypi:`pytest-ok` The ultimate pytest output plugin Apr 01, 2019 4 - Beta N/A @@ -651,7 +652,7 @@ This list contains 995 plugins. :pypi:`pytest-platform-markers` Markers for pytest to skip tests on specific platforms Sep 09, 2019 4 - Beta pytest (>=3.6.0) :pypi:`pytest-play` pytest plugin that let you automate actions and assertions with test metrics reporting executing plain YAML files Jun 12, 2019 5 - Production/Stable N/A :pypi:`pytest-playbook` Pytest plugin for reading playbooks. Jan 21, 2021 3 - Alpha pytest (>=6.1.2,<7.0.0) - :pypi:`pytest-playwright` A pytest wrapper with fixtures for Playwright to automate web browsers Oct 28, 2021 N/A pytest + :pypi:`pytest-playwright` A pytest wrapper with fixtures for Playwright to automate web browsers Feb 10, 2022 N/A pytest :pypi:`pytest-playwrights` A pytest wrapper with fixtures for Playwright to automate web browsers Dec 02, 2021 N/A N/A :pypi:`pytest-playwright-snapshot` A pytest wrapper for snapshot testing with playwright Aug 19, 2021 N/A N/A :pypi:`pytest-plt` Fixtures for quickly making Matplotlib plots in tests Aug 17, 2020 5 - Production/Stable pytest @@ -697,7 +698,7 @@ This list contains 995 plugins. :pypi:`pytest-pyramid-server` Pyramid server fixture for py.test May 28, 2019 5 - Production/Stable pytest :pypi:`pytest-pyright` Pytest plugin for type checking code with Pyright Aug 16, 2021 4 - Beta pytest (>=3.5.0) :pypi:`pytest-pytestrail` Pytest plugin for interaction with TestRail Aug 27, 2020 4 - Beta pytest (>=3.8.0) - :pypi:`pytest-pythonpath` pytest plugin for adding to the PYTHONPATH from command line or configs. Aug 22, 2018 5 - Production/Stable N/A + :pypi:`pytest-pythonpath` pytest plugin for adding to the PYTHONPATH from command line or configs. Feb 10, 2022 5 - Production/Stable pytest (<7,>=2.5.2) :pypi:`pytest-pytorch` pytest plugin for a better developer experience when working with the PyTorch test suite May 25, 2021 4 - Beta pytest :pypi:`pytest-qasync` Pytest support for qasync. Jul 12, 2021 4 - Beta pytest (>=5.4.0) :pypi:`pytest-qatouch` Pytest plugin for uploading test results to your QA Touch Testrun. Jun 26, 2021 4 - Beta pytest (>=6.2.0) @@ -708,14 +709,14 @@ This list contains 995 plugins. :pypi:`pytest-qt-app` QT app fixture for py.test Dec 23, 2015 5 - Production/Stable N/A :pypi:`pytest-quarantine` A plugin for pytest to manage expected test failures Nov 24, 2019 5 - Production/Stable pytest (>=4.6) :pypi:`pytest-quickcheck` pytest plugin to generate random data inspired by QuickCheck Nov 15, 2020 4 - Beta pytest (<6.0.0,>=4.0) - :pypi:`pytest-rabbitmq` RabbitMQ process and client fixtures for pytest Jun 02, 2021 5 - Production/Stable pytest (>=3.0.0) + :pypi:`pytest-rabbitmq` RabbitMQ process and client fixtures for pytest Feb 11, 2022 5 - Production/Stable pytest (>=3.0.0) :pypi:`pytest-race` Race conditions tester for pytest Nov 21, 2016 4 - Beta N/A :pypi:`pytest-rage` pytest plugin to implement PEP712 Oct 21, 2011 3 - Alpha N/A :pypi:`pytest-rail` pytest plugin for creating TestRail runs and adding results Feb 04, 2022 N/A pytest (>=3.6) :pypi:`pytest-railflow-testrail-reporter` Generate json reports along with specified metadata defined in test markers. Dec 02, 2021 5 - Production/Stable pytest :pypi:`pytest-raises` An implementation of pytest.raises as a pytest.mark fixture Apr 23, 2020 N/A pytest (>=3.2.2) :pypi:`pytest-raisesregexp` Simple pytest plugin to look for regex in Exceptions Dec 18, 2015 N/A N/A - :pypi:`pytest-raisin` Plugin enabling the use of exception instances with pytest.raises Jun 25, 2020 N/A pytest + :pypi:`pytest-raisin` Plugin enabling the use of exception instances with pytest.raises Feb 06, 2022 N/A pytest :pypi:`pytest-random` py.test plugin to randomize tests Apr 28, 2013 3 - Alpha N/A :pypi:`pytest-randomly` Pytest plugin to randomly order tests and control random.seed. Jan 10, 2022 5 - Production/Stable pytest :pypi:`pytest-randomness` Pytest plugin about random seed management May 30, 2019 3 - Alpha N/A @@ -725,7 +726,7 @@ This list contains 995 plugins. :pypi:`pytest-reana` Pytest fixtures for REANA. Jan 05, 2022 3 - Alpha N/A :pypi:`pytest-recording` A pytest plugin that allows you recording of network interactions via VCR.py Jul 08, 2021 4 - Beta pytest (>=3.5.0) :pypi:`pytest-recordings` Provides pytest plugins for reporting request/response traffic, screenshots, and more to ReportPortal Aug 13, 2020 N/A N/A - :pypi:`pytest-redis` Redis fixtures and fixture factories for Pytest. Dec 07, 2021 5 - Production/Stable pytest + :pypi:`pytest-redis` Redis fixtures and fixture factories for Pytest. Feb 10, 2022 5 - Production/Stable pytest (>=6.2.0) :pypi:`pytest-redislite` Pytest plugin for testing code using Redis Sep 19, 2021 4 - Beta pytest :pypi:`pytest-redmine` Pytest plugin for redmine Mar 19, 2018 1 - Planning N/A :pypi:`pytest-ref` A plugin to store reference files to ease regression testing Nov 23, 2019 4 - Beta pytest (>=3.5.0) @@ -786,13 +787,13 @@ This list contains 995 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. Feb 04, 2022 5 - Production/Stable N/A + :pypi:`pytest-sbase` A complete web automation framework for end-to-end testing. Feb 11, 2022 5 - Production/Stable N/A :pypi:`pytest-scenario` pytest plugin for test scenarios Feb 06, 2017 3 - Alpha N/A :pypi:`pytest-schema` 👍 Validate return values against a schema-like object in testing Aug 31, 2020 5 - Production/Stable pytest (>=3.5.0) :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 Sep 19, 2020 5 - Production/Stable pytest (>=5.0.0) - :pypi:`pytest-seleniumbase` A complete web automation framework for end-to-end testing. Feb 04, 2022 5 - Production/Stable N/A + :pypi:`pytest-seleniumbase` A complete web automation framework for end-to-end testing. Feb 11, 2022 5 - Production/Stable N/A :pypi:`pytest-selenium-enhancer` pytest plugin for Selenium Dec 16, 2021 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-send-email` Send pytest execution result email Dec 04, 2019 N/A N/A @@ -826,7 +827,7 @@ This list contains 995 plugins. :pypi:`pytest-smtp` Send email with pytest execution result Feb 20, 2021 N/A pytest :pypi:`pytest-snail` Plugin for adding a marker to slow running tests. 🐌 Nov 04, 2019 3 - Alpha pytest (>=5.0.1) :pypi:`pytest-snapci` py.test plugin for Snap-CI Nov 12, 2015 N/A N/A - :pypi:`pytest-snapshot` A plugin for snapshot testing with pytest. Dec 02, 2021 4 - Beta pytest (>=3.0.0) + :pypi:`pytest-snapshot` A plugin for snapshot testing with pytest. Feb 11, 2022 4 - Beta pytest (>=3.0.0) :pypi:`pytest-snmpserver` May 12, 2021 N/A N/A :pypi:`pytest-snowflake-bdd` Setup test data and run tests on snowflake in BDD style! Jan 05, 2022 4 - Beta pytest (>=6.2.0) :pypi:`pytest-socket` Pytest Plugin to disable socket calls during tests Jan 23, 2022 4 - Beta pytest (>=3.6.3) @@ -840,7 +841,7 @@ This list contains 995 plugins. :pypi:`pytest-spawner` py.test plugin to spawn process and communicate with them. Jul 31, 2015 4 - Beta N/A :pypi:`pytest-spec` Library pytest-spec is a pytest plugin to display test execution output like a SPECIFICATION. May 04, 2021 N/A N/A :pypi:`pytest-sphinx` Doctest plugin for pytest with support for Sphinx-specific doctest-directives Aug 05, 2020 4 - Beta N/A - :pypi:`pytest-spiratest` Exports unit tests as test runs in SpiraTest/Team/Plan Oct 13, 2021 N/A N/A + :pypi:`pytest-spiratest` Exports unit tests as test runs in SpiraTest/Team/Plan Feb 08, 2022 N/A N/A :pypi:`pytest-splinter` Splinter plugin for pytest testing framework Dec 25, 2020 6 - Mature N/A :pypi:`pytest-splinter4` Pytest plugin for the splinter automation library Dec 22, 2021 6 - Mature pytest (>=6.2.4) :pypi:`pytest-split` Pytest plugin which splits the test suite to equally sized sub suites based on test execution time. Jan 10, 2022 4 - Beta pytest (>=5,<7) @@ -848,11 +849,12 @@ This list contains 995 plugins. :pypi:`pytest-split-tests` A Pytest plugin for running a subset of your tests by splitting them in to equally sized groups. Forked from Mark Adams' original project pytest-test-groups. Jul 30, 2021 5 - Production/Stable pytest (>=2.5) :pypi:`pytest-split-tests-tresorit` Feb 22, 2021 1 - Planning N/A :pypi:`pytest-splunk-addon` A Dynamic test tool for Splunk Apps and Add-ons Jan 25, 2022 N/A pytest (>5.4.0,<6.3) - :pypi:`pytest-splunk-addon-ui-smartx` Library to support testing Splunk Add-on UX Dec 06, 2021 N/A N/A + :pypi:`pytest-splunk-addon-ui-smartx` Library to support testing Splunk Add-on UX Feb 07, 2022 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 :pypi:`pytest-sql-bigquery` Yet another SQL-testing framework for BigQuery provided by pytest plugin Dec 19, 2019 N/A pytest + :pypi:`pytest-squadcast` Pytest report plugin for Squadcast Feb 11, 2022 5 - Production/Stable pytest :pypi:`pytest-srcpaths` Add paths to sys.path Oct 15, 2021 N/A N/A :pypi:`pytest-ssh` pytest plugin for ssh command run May 27, 2019 N/A pytest :pypi:`pytest-start-from` Start pytest run from a given point Apr 11, 2016 N/A N/A @@ -867,7 +869,7 @@ This list contains 995 plugins. :pypi:`pytest-stub` Stub packages, modules and attributes. Apr 28, 2020 5 - Production/Stable N/A :pypi:`pytest-stubprocess` Provide stub implementations for subprocesses in Python tests Sep 17, 2018 3 - Alpha pytest (>=3.5.0) :pypi:`pytest-study` A pytest plugin to organize long run tests (named studies) without interfering the regular tests Sep 26, 2017 3 - Alpha pytest (>=2.0) - :pypi:`pytest-subprocess` A plugin to fake subprocess for pytest Jan 23, 2022 5 - Production/Stable pytest (>=4.0.0) + :pypi:`pytest-subprocess` A plugin to fake subprocess for pytest Feb 09, 2022 5 - Production/Stable pytest (>=4.0.0) :pypi:`pytest-subtesthack` A hack to explicitly set up and tear down fixtures. Mar 02, 2021 N/A N/A :pypi:`pytest-subtests` unittest subTest() support and subtests fixture Jan 15, 2022 4 - Beta pytest (>=6.0) :pypi:`pytest-subunit` pytest-subunit is a plugin for py.test which outputs testsresult in subunit format. Aug 29, 2017 N/A N/A @@ -894,7 +896,7 @@ This list contains 995 plugins. :pypi:`pytest-testdirectory` A py.test plugin providing temporary directories in unit tests. Nov 06, 2018 5 - Production/Stable pytest :pypi:`pytest-testdox` A testdox format reporter for pytest Dec 05, 2021 5 - Production/Stable pytest (>=4.6.0) :pypi:`pytest-test-groups` A Pytest plugin for running a subset of your tests by splitting them in to equally sized groups. Oct 25, 2016 5 - Production/Stable N/A - :pypi:`pytest-testinfra` Test infrastructures Dec 07, 2021 5 - Production/Stable pytest (!=3.0.2) + :pypi:`pytest-testinfra` Test infrastructures Feb 10, 2022 5 - Production/Stable pytest (!=3.0.2) :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 Feb 05, 2022 4 - Beta N/A :pypi:`pytest-testobject` Plugin to use TestObject Suites with Pytest Sep 24, 2019 4 - Beta pytest (>=3.1.1) @@ -1082,7 +1084,7 @@ This list contains 995 plugins. pytest fixtures for writing aiofiles tests with pyfakefs :pypi:`pytest-aiohttp` - *last release*: Jan 21, 2022, + *last release*: Feb 12, 2022, *status*: 4 - Beta, *requires*: pytest (>=6.1.0) @@ -1131,7 +1133,7 @@ This list contains 995 plugins. :pypi:`pytest-alembic` - *last release*: Dec 21, 2021, + *last release*: Feb 08, 2022, *status*: N/A, *requires*: pytest (>=1.0) @@ -1362,7 +1364,7 @@ This list contains 995 plugins. :pypi:`pytest-asyncio` - *last release*: Jan 17, 2022, + *last release*: Feb 10, 2022, *status*: 4 - Beta, *requires*: pytest (>=6.1.0) @@ -1803,7 +1805,7 @@ This list contains 995 plugins. pytest plugin to capture all deprecatedwarnings and put them in one file :pypi:`pytest-cases` - *last release*: Jan 07, 2022, + *last release*: Feb 08, 2022, *status*: 5 - Production/Stable, *requires*: N/A @@ -1929,11 +1931,11 @@ This list contains 995 plugins. Easy quality control for CLDF datasets using pytest :pypi:`pytest-click` - *last release*: Aug 29, 2020, + *last release*: Feb 11, 2022, *status*: 5 - Production/Stable, *requires*: pytest (>=5.0) - Py.test plugin for Click + Pytest plugin for Click :pypi:`pytest-clld` *last release*: Nov 29, 2021, @@ -2496,9 +2498,9 @@ This list contains 995 plugins. Disable plugins per test :pypi:`pytest-discord` - *last release*: Mar 20, 2021, - *status*: 3 - Alpha, - *requires*: pytest (!=6.0.0,<7,>=3.3.2) + *last release*: Feb 12, 2022, + *status*: 4 - Beta, + *requires*: pytest (!=6.0.0,<8,>=3.3.2) A pytest plugin to notify test results to a Discord channel. @@ -2566,7 +2568,7 @@ This list contains 995 plugins. Cleanup your Haystack indexes between tests :pypi:`pytest-django-ifactory` - *last release*: Jan 13, 2021, + *last release*: Feb 09, 2022, *status*: 3 - Alpha, *requires*: N/A @@ -2699,14 +2701,14 @@ This list contains 995 plugins. pytest docker fixtures :pypi:`pytest-docker-git-fixtures` - *last release*: Mar 11, 2021, + *last release*: Feb 09, 2022, *status*: 4 - Beta, *requires*: pytest Pytest fixtures for testing with git scm. :pypi:`pytest-docker-haproxy-fixtures` - *last release*: Feb 01, 2022, + *last release*: Feb 09, 2022, *status*: 4 - Beta, *requires*: pytest @@ -2734,14 +2736,14 @@ This list contains 995 plugins. Easy to use, simple to extend, pytest plugin that minimally leverages docker-py. :pypi:`pytest-docker-registry-fixtures` - *last release*: Feb 01, 2022, + *last release*: Feb 09, 2022, *status*: 4 - Beta, *requires*: pytest Pytest fixtures for testing with docker registries. :pypi:`pytest-docker-squid-fixtures` - *last release*: Feb 04, 2022, + *last release*: Feb 09, 2022, *status*: 4 - Beta, *requires*: pytest @@ -3538,6 +3540,13 @@ This list contains 995 plugins. A pytest plugin that alerts user of failed test cases with screen notifications + :pypi:`pytest-fold` + *last release*: Feb 06, 2022, + *status*: 3 - Alpha, + *requires*: pytest (>=6.2.5) + + Fold console output and drop user into interactive text user interface + :pypi:`pytest-forcefail` *last release*: May 15, 2018, *status*: 4 - Beta, @@ -3826,7 +3835,7 @@ This list contains 995 plugins. A pytest plugin for use with homeassistant custom components. :pypi:`pytest-homeassistant-custom-component` - *last release*: Feb 05, 2022, + *last release*: Feb 12, 2022, *status*: 3 - Alpha, *requires*: pytest (==6.2.5) @@ -3882,7 +3891,7 @@ This list contains 995 plugins. optimized pytest plugin for generating HTML reports :pypi:`pytest-html-object-storage` - *last release*: Jan 31, 2022, + *last release*: Feb 06, 2022, *status*: 5 - Production/Stable, *requires*: N/A @@ -3896,7 +3905,7 @@ This list contains 995 plugins. Pytest plugin for generating HTML reports with per-test profiling and optionally call graph visualizations. Based on pytest-html by Dave Hunt. :pypi:`pytest-html-reporter` - *last release*: Apr 25, 2021, + *last release*: Feb 11, 2022, *status*: N/A, *requires*: N/A @@ -4071,7 +4080,7 @@ This list contains 995 plugins. A py.test plugin providing fixtures to simplify inmanta modules testing. :pypi:`pytest-inmanta-extensions` - *last release*: Feb 03, 2022, + *last release*: Feb 11, 2022, *status*: 5 - Production/Stable, *requires*: N/A @@ -4162,9 +4171,9 @@ This list contains 995 plugins. THIS PROJECT IS ABANDONED :pypi:`pytest-isort` - *last release*: Apr 27, 2021, + *last release*: Feb 08, 2022, *status*: 5 - Production/Stable, - *requires*: N/A + *requires*: pytest (>=5.0) py.test plugin to check import ordering using isort @@ -4603,9 +4612,9 @@ This list contains 995 plugins. Plugin for generating Markdown reports for pytest results :pypi:`pytest-md-report` - *last release*: May 04, 2021, + *last release*: Feb 06, 2022, *status*: 4 - Beta, - *requires*: pytest (!=6.0.0,<7,>=3.3.2) + *requires*: pytest (!=6.0.0,<8,>=3.3.2) A pytest plugin to make a test results report with Markdown table format. @@ -4638,7 +4647,7 @@ This list contains 995 plugins. Pytest plugin for sending report message of marked tests execution :pypi:`pytest-messenger` - *last release*: Dec 16, 2020, + *last release*: Feb 07, 2022, *status*: 5 - Production/Stable, *requires*: N/A @@ -4736,7 +4745,7 @@ This list contains 995 plugins. An in-memory mock of a Redis server that runs in a separate thread. This is to be used for unit-tests that require a Redis database. :pypi:`pytest-mock-resources` - *last release*: Jan 11, 2022, + *last release*: Feb 08, 2022, *status*: N/A, *requires*: pytest (>=1.0) @@ -4848,7 +4857,7 @@ This list contains 995 plugins. pytest plugin to collect information from tests :pypi:`pytest-mpl` - *last release*: Jul 02, 2021, + *last release*: Feb 09, 2022, *status*: 4 - Beta, *requires*: pytest @@ -4897,7 +4906,7 @@ This list contains 995 plugins. Add the mutation testing feature to pytest :pypi:`pytest-mypy` - *last release*: Jan 30, 2022, + *last release*: Feb 07, 2022, *status*: 4 - Beta, *requires*: pytest (>=6.2) ; python_version >= "3.10" @@ -4932,9 +4941,9 @@ This list contains 995 plugins. Pytest plugin to check mypy output. :pypi:`pytest-mysql` - *last release*: Nov 22, 2021, + *last release*: Feb 11, 2022, *status*: 5 - Production/Stable, - *requires*: pytest + *requires*: pytest (>=6.2) MySQL process and client fixtures for pytest @@ -5086,9 +5095,9 @@ This list contains 995 plugins. pytest results data-base and HTML reporter :pypi:`pytest-odoo` - *last release*: Nov 04, 2021, + *last release*: Feb 08, 2022, *status*: 4 - Beta, - *requires*: pytest (>=2.9) + *requires*: N/A py.test plugin to run Odoo tests @@ -5450,7 +5459,7 @@ This list contains 995 plugins. Pytest plugin for reading playbooks. :pypi:`pytest-playwright` - *last release*: Oct 28, 2021, + *last release*: Feb 10, 2022, *status*: N/A, *requires*: pytest @@ -5772,9 +5781,9 @@ This list contains 995 plugins. Pytest plugin for interaction with TestRail :pypi:`pytest-pythonpath` - *last release*: Aug 22, 2018, + *last release*: Feb 10, 2022, *status*: 5 - Production/Stable, - *requires*: N/A + *requires*: pytest (<7,>=2.5.2) pytest plugin for adding to the PYTHONPATH from command line or configs. @@ -5849,7 +5858,7 @@ This list contains 995 plugins. pytest plugin to generate random data inspired by QuickCheck :pypi:`pytest-rabbitmq` - *last release*: Jun 02, 2021, + *last release*: Feb 11, 2022, *status*: 5 - Production/Stable, *requires*: pytest (>=3.0.0) @@ -5898,7 +5907,7 @@ This list contains 995 plugins. Simple pytest plugin to look for regex in Exceptions :pypi:`pytest-raisin` - *last release*: Jun 25, 2020, + *last release*: Feb 06, 2022, *status*: N/A, *requires*: pytest @@ -5968,9 +5977,9 @@ This list contains 995 plugins. Provides pytest plugins for reporting request/response traffic, screenshots, and more to ReportPortal :pypi:`pytest-redis` - *last release*: Dec 07, 2021, + *last release*: Feb 10, 2022, *status*: 5 - Production/Stable, - *requires*: pytest + *requires*: pytest (>=6.2.0) Redis fixtures and fixture factories for Pytest. @@ -6395,7 +6404,7 @@ This list contains 995 plugins. :pypi:`pytest-sbase` - *last release*: Feb 04, 2022, + *last release*: Feb 11, 2022, *status*: 5 - Production/Stable, *requires*: N/A @@ -6437,7 +6446,7 @@ This list contains 995 plugins. pytest plugin for Selenium :pypi:`pytest-seleniumbase` - *last release*: Feb 04, 2022, + *last release*: Feb 11, 2022, *status*: 5 - Production/Stable, *requires*: N/A @@ -6675,7 +6684,7 @@ This list contains 995 plugins. py.test plugin for Snap-CI :pypi:`pytest-snapshot` - *last release*: Dec 02, 2021, + *last release*: Feb 11, 2022, *status*: 4 - Beta, *requires*: pytest (>=3.0.0) @@ -6773,7 +6782,7 @@ This list contains 995 plugins. Doctest plugin for pytest with support for Sphinx-specific doctest-directives :pypi:`pytest-spiratest` - *last release*: Oct 13, 2021, + *last release*: Feb 08, 2022, *status*: N/A, *requires*: N/A @@ -6829,7 +6838,7 @@ This list contains 995 plugins. A Dynamic test tool for Splunk Apps and Add-ons :pypi:`pytest-splunk-addon-ui-smartx` - *last release*: Dec 06, 2021, + *last release*: Feb 07, 2022, *status*: N/A, *requires*: N/A @@ -6863,6 +6872,13 @@ This list contains 995 plugins. Yet another SQL-testing framework for BigQuery provided by pytest plugin + :pypi:`pytest-squadcast` + *last release*: Feb 11, 2022, + *status*: 5 - Production/Stable, + *requires*: pytest + + Pytest report plugin for Squadcast + :pypi:`pytest-srcpaths` *last release*: Oct 15, 2021, *status*: N/A, @@ -6962,7 +6978,7 @@ This list contains 995 plugins. A pytest plugin to organize long run tests (named studies) without interfering the regular tests :pypi:`pytest-subprocess` - *last release*: Jan 23, 2022, + *last release*: Feb 09, 2022, *status*: 5 - Production/Stable, *requires*: pytest (>=4.0.0) @@ -7151,7 +7167,7 @@ This list contains 995 plugins. A Pytest plugin for running a subset of your tests by splitting them in to equally sized groups. :pypi:`pytest-testinfra` - *last release*: Dec 07, 2021, + *last release*: Feb 10, 2022, *status*: 5 - Production/Stable, *requires*: pytest (!=3.0.2) From 3e533075868db3700bf0a65abcb7054c640ad39d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 14 Feb 2022 03:02:17 +0000 Subject: [PATCH 150/176] build(deps): Bump pytest-asyncio in /testing/plugins_integration Bumps [pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio) from 0.17.2 to 0.18.1. - [Release notes](https://github.com/pytest-dev/pytest-asyncio/releases) - [Commits](https://github.com/pytest-dev/pytest-asyncio/compare/v0.17.2...v0.18.1) --- updated-dependencies: - dependency-name: pytest-asyncio dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- testing/plugins_integration/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/plugins_integration/requirements.txt b/testing/plugins_integration/requirements.txt index 3fb8ccf2947..7d63d38f9f1 100644 --- a/testing/plugins_integration/requirements.txt +++ b/testing/plugins_integration/requirements.txt @@ -1,6 +1,6 @@ anyio[curio,trio]==3.5.0 django==4.0.2 -pytest-asyncio==0.17.2 +pytest-asyncio==0.18.1 pytest-bdd==5.0.0 pytest-cov==3.0.0 pytest-django==4.5.2 From 747b8372eabc8909aae411937c6b80536bb214c4 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Sun, 13 Feb 2022 09:39:57 -0300 Subject: [PATCH 151/176] Try to import module before creating dummy modules with 'importmode=importlib' The dummy modules we introduce in `insert_missing_modules` (due to #7856 and #7859) would cause problems if the dummy modules actually end up replacing modules which could be imported normally because they are available in `PYTHONPATH`. Now we attempt to first import the module via normal mechanisms, and only introduce the dummy modules if the intermediary modules don't actually exist. Close #9645 --- changelog/9645.bugfix.rst | 1 + src/_pytest/pathlib.py | 19 ++++++++++++++----- testing/test_collection.py | 29 +++++++++++++++++++++++++++++ testing/test_pathlib.py | 19 ++++++++++++------- 4 files changed, 56 insertions(+), 12 deletions(-) create mode 100644 changelog/9645.bugfix.rst diff --git a/changelog/9645.bugfix.rst b/changelog/9645.bugfix.rst new file mode 100644 index 00000000000..089a783dee6 --- /dev/null +++ b/changelog/9645.bugfix.rst @@ -0,0 +1 @@ +Fixed regression where ``--import-mode=importlib`` used together with :envvar:`PYTHONPATH` or :confval:`pythonpath` would cause import errors in test suites. diff --git a/src/_pytest/pathlib.py b/src/_pytest/pathlib.py index def5fa94b2b..c5a411b5963 100644 --- a/src/_pytest/pathlib.py +++ b/src/_pytest/pathlib.py @@ -603,11 +603,20 @@ def insert_missing_modules(modules: Dict[str, ModuleType], module_name: str) -> module_parts = module_name.split(".") while module_name: if module_name not in modules: - module = ModuleType( - module_name, - doc="Empty module created by pytest's importmode=importlib.", - ) - modules[module_name] = module + try: + # If sys.meta_path is empty, calling import_module will issue + # a warning and raise ModuleNotFoundError. To avoid the + # warning, we check sys.meta_path explicitly and raise the error + # ourselves to fall back to creating a dummy module. + if not sys.meta_path: + raise ModuleNotFoundError + importlib.import_module(module_name) + except ModuleNotFoundError: + module = ModuleType( + module_name, + doc="Empty module created by pytest's importmode=importlib.", + ) + modules[module_name] = module module_parts.pop(-1) module_name = ".".join(module_parts) diff --git a/testing/test_collection.py b/testing/test_collection.py index e79ae384d7a..a943a44d227 100644 --- a/testing/test_collection.py +++ b/testing/test_collection.py @@ -1507,6 +1507,35 @@ def test_modules_not_importable_as_side_effect(self, pytester: Pytester) -> None ] ) + def test_using_python_path(self, pytester: Pytester) -> None: + """ + Dummy modules created by insert_missing_modules should not get in + the way of modules that could be imported via python path (#9645). + """ + pytester.makeini( + """ + [pytest] + pythonpath = . + addopts = --import-mode importlib + """ + ) + pytester.makepyfile( + **{ + "tests/__init__.py": "", + "tests/conftest.py": "", + "tests/subpath/__init__.py": "", + "tests/subpath/helper.py": "", + "tests/subpath/test_something.py": """ + import tests.subpath.helper + + def test_something(): + assert True + """, + } + ) + result = pytester.runpytest() + result.stdout.fnmatch_lines("*1 passed in*") + def test_does_not_crash_on_error_from_decorated_function(pytester: Pytester) -> None: """Regression test for an issue around bad exception formatting due to diff --git a/testing/test_pathlib.py b/testing/test_pathlib.py index fe5e08f212f..c901dc6f435 100644 --- a/testing/test_pathlib.py +++ b/testing/test_pathlib.py @@ -562,15 +562,20 @@ def test_module_name_from_path(self, tmp_path: Path) -> None: result = module_name_from_path(Path("/home/foo/test_foo.py"), Path("/bar")) assert result == "home.foo.test_foo" - def test_insert_missing_modules(self) -> None: - modules = {"src.tests.foo": ModuleType("src.tests.foo")} - insert_missing_modules(modules, "src.tests.foo") - assert sorted(modules) == ["src", "src.tests", "src.tests.foo"] + def test_insert_missing_modules( + self, monkeypatch: MonkeyPatch, tmp_path: Path + ) -> None: + monkeypatch.chdir(tmp_path) + # Use 'xxx' and 'xxy' as parent names as they are unlikely to exist and + # don't end up being imported. + modules = {"xxx.tests.foo": ModuleType("xxx.tests.foo")} + insert_missing_modules(modules, "xxx.tests.foo") + assert sorted(modules) == ["xxx", "xxx.tests", "xxx.tests.foo"] mod = ModuleType("mod", doc="My Module") - modules = {"src": mod} - insert_missing_modules(modules, "src") - assert modules == {"src": mod} + modules = {"xxy": mod} + insert_missing_modules(modules, "xxy") + assert modules == {"xxy": mod} modules = {} insert_missing_modules(modules, "") From c9cf2d44245c553258e7e0ed0e446072b3434d1b Mon Sep 17 00:00:00 2001 From: eduardo naufel schettino Date: Tue, 15 Feb 2022 19:17:34 +0800 Subject: [PATCH 152/176] Fix count of selected tests on terminal collection summary (#9628) --- changelog/9626.bugfix.rst | 3 +++ src/_pytest/terminal.py | 4 ++-- testing/test_cacheprovider.py | 2 +- testing/test_terminal.py | 27 +++++++++++++++++++++++++++ 4 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 changelog/9626.bugfix.rst diff --git a/changelog/9626.bugfix.rst b/changelog/9626.bugfix.rst new file mode 100644 index 00000000000..44d3734a1d2 --- /dev/null +++ b/changelog/9626.bugfix.rst @@ -0,0 +1,3 @@ +Fixed count of selected tests on terminal collection summary when there were errors or skipped modules. + +If there were errors or skipped modules on collection, pytest would mistakenly subtract those from the selected count. diff --git a/src/_pytest/terminal.py b/src/_pytest/terminal.py index 4bcc968d100..b4848c48aba 100644 --- a/src/_pytest/terminal.py +++ b/src/_pytest/terminal.py @@ -663,7 +663,7 @@ def report_collect(self, final: bool = False) -> None: errors = len(self.stats.get("error", [])) skipped = len(self.stats.get("skipped", [])) deselected = len(self.stats.get("deselected", [])) - selected = self._numcollected - errors - skipped - deselected + selected = self._numcollected - deselected line = "collected " if final else "collecting " line += ( str(self._numcollected) + " item" + ("" if self._numcollected == 1 else "s") @@ -674,7 +674,7 @@ def report_collect(self, final: bool = False) -> None: line += " / %d deselected" % deselected if skipped: line += " / %d skipped" % skipped - if self._numcollected > selected > 0: + if self._numcollected > selected: line += " / %d selected" % selected if self.isatty: self.rewrite(line, bold=True, erase=True) diff --git a/testing/test_cacheprovider.py b/testing/test_cacheprovider.py index cc6d547dfb1..2baa3c8f189 100644 --- a/testing/test_cacheprovider.py +++ b/testing/test_cacheprovider.py @@ -773,7 +773,7 @@ def pytest_sessionfinish(): result = pytester.runpytest("--lf", "--lfnf", "none") result.stdout.fnmatch_lines( [ - "collected 2 items / 2 deselected", + "collected 2 items / 2 deselected / 0 selected", "run-last-failure: no previously failed tests, deselecting all items.", "deselected=2", "* 2 deselected in *", diff --git a/testing/test_terminal.py b/testing/test_terminal.py index e5f41266280..f0e58e5b4c4 100644 --- a/testing/test_terminal.py +++ b/testing/test_terminal.py @@ -783,6 +783,33 @@ def test_pass(): result.stdout.no_fnmatch_line("*= 1 deselected =*") assert result.ret == 0 + def test_selected_count_with_error(self, pytester: Pytester) -> None: + pytester.makepyfile( + test_selected_count_3=""" + def test_one(): + pass + def test_two(): + pass + def test_three(): + pass + """, + test_selected_count_error=""" + 5/0 + def test_foo(): + pass + def test_bar(): + pass + """, + ) + result = pytester.runpytest("-k", "test_t") + result.stdout.fnmatch_lines( + [ + "collected 3 items / 1 error / 1 deselected / 2 selected", + "* ERROR collecting test_selected_count_error.py *", + ] + ) + assert result.ret == ExitCode.INTERRUPTED + def test_no_skip_summary_if_failure(self, pytester: Pytester) -> None: pytester.makepyfile( """ From fac8f284cd6ffd44c7d401093c67799766473be1 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Tue, 15 Feb 2022 09:43:20 -0300 Subject: [PATCH 153/176] Fix diff output for data types where `-v` would show less information (#9661) Close #5192 --- changelog/5192.improvement.rst | 3 +++ src/_pytest/assertion/util.py | 18 ++----------- testing/acceptance_test.py | 2 -- testing/test_assertion.py | 48 ++++++++++------------------------ testing/test_error_diffs.py | 2 -- 5 files changed, 19 insertions(+), 54 deletions(-) create mode 100644 changelog/5192.improvement.rst diff --git a/changelog/5192.improvement.rst b/changelog/5192.improvement.rst new file mode 100644 index 00000000000..c51077ae5f1 --- /dev/null +++ b/changelog/5192.improvement.rst @@ -0,0 +1,3 @@ +Fixed test output for some data types where ``-v`` would show less information. + +Also, when showing diffs for sequences, ``-q`` would produce full diffs instead of the expected diff. diff --git a/src/_pytest/assertion/util.py b/src/_pytest/assertion/util.py index 14512a7c5ca..03167ddd471 100644 --- a/src/_pytest/assertion/util.py +++ b/src/_pytest/assertion/util.py @@ -223,8 +223,6 @@ def _compare_eq_any(left: Any, right: Any, verbose: int = 0) -> List[str]: explanation = _compare_eq_set(left, right, verbose) elif isdict(left) and isdict(right): explanation = _compare_eq_dict(left, right, verbose) - elif verbose > 0: - explanation = _compare_eq_verbose(left, right) if isiterable(left) and isiterable(right): expl = _compare_eq_iterable(left, right, verbose) @@ -281,18 +279,6 @@ def _diff_text(left: str, right: str, verbose: int = 0) -> List[str]: return explanation -def _compare_eq_verbose(left: Any, right: Any) -> List[str]: - keepends = True - left_lines = repr(left).splitlines(keepends) - right_lines = repr(right).splitlines(keepends) - - explanation: List[str] = [] - explanation += ["+" + line for line in left_lines] - explanation += ["-" + line for line in right_lines] - - return explanation - - def _surrounding_parens_on_own_lines(lines: List[str]) -> None: """Move opening/closing parenthesis/bracket to own lines.""" opening = lines[0][:1] @@ -308,8 +294,8 @@ def _surrounding_parens_on_own_lines(lines: List[str]) -> None: def _compare_eq_iterable( left: Iterable[Any], right: Iterable[Any], verbose: int = 0 ) -> List[str]: - if not verbose and not running_on_ci(): - return ["Use -v to get the full diff"] + if verbose <= 0 and not running_on_ci(): + return ["Use -v to get more diff"] # dynamic import to speedup pytest import difflib diff --git a/testing/acceptance_test.py b/testing/acceptance_test.py index 8b8d4a4a6ed..71d3cc23a2e 100644 --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -1238,8 +1238,6 @@ def test(): " def check():", "> assert 1 == 2", "E assert 1 == 2", - "E +1", - "E -2", "", "pdb.py:2: AssertionError", "*= 1 failed in *", diff --git a/testing/test_assertion.py b/testing/test_assertion.py index d57cc26a350..d37ee72a2ec 100644 --- a/testing/test_assertion.py +++ b/testing/test_assertion.py @@ -83,7 +83,7 @@ def test_dummy_failure(pytester): # how meta! "E assert {'failed': 1,... 'skipped': 0} == {'failed': 0,... 'skipped': 0}", "E Omitting 1 identical items, use -vv to show", "E Differing items:", - "E Use -v to get the full diff", + "E Use -v to get more diff", ] ) # XXX: unstable output. @@ -376,7 +376,7 @@ def test_bytes_diff_normal(self) -> None: assert diff == [ "b'spam' == b'eggs'", "At index 0 diff: b's' != b'e'", - "Use -v to get the full diff", + "Use -v to get more diff", ] def test_bytes_diff_verbose(self) -> None: @@ -444,11 +444,19 @@ def test_iterable_full_diff(self, left, right, expected) -> None: """ expl = callequal(left, right, verbose=0) assert expl is not None - assert expl[-1] == "Use -v to get the full diff" + assert expl[-1] == "Use -v to get more diff" verbose_expl = callequal(left, right, verbose=1) assert verbose_expl is not None assert "\n".join(verbose_expl).endswith(textwrap.dedent(expected).strip()) + def test_iterable_quiet(self) -> None: + expl = callequal([1, 2], [10, 2], verbose=-1) + assert expl == [ + "[1, 2] == [10, 2]", + "At index 0 diff: 1 != 10", + "Use -v to get more diff", + ] + def test_iterable_full_diff_ci( self, monkeypatch: MonkeyPatch, pytester: Pytester ) -> None: @@ -466,7 +474,7 @@ def test_full_diff(): monkeypatch.delenv("CI", raising=False) result = pytester.runpytest() - result.stdout.fnmatch_lines(["E Use -v to get the full diff"]) + result.stdout.fnmatch_lines(["E Use -v to get more diff"]) def test_list_different_lengths(self) -> None: expl = callequal([0, 1], [0, 1, 2]) @@ -699,32 +707,6 @@ def test_list_tuples(self) -> None: assert expl is not None assert len(expl) > 1 - def test_repr_verbose(self) -> None: - class Nums: - def __init__(self, nums): - self.nums = nums - - def __repr__(self): - return str(self.nums) - - list_x = list(range(5000)) - list_y = list(range(5000)) - list_y[len(list_y) // 2] = 3 - nums_x = Nums(list_x) - nums_y = Nums(list_y) - - assert callequal(nums_x, nums_y) is None - - expl = callequal(nums_x, nums_y, verbose=1) - assert expl is not None - assert "+" + repr(nums_x) in expl - assert "-" + repr(nums_y) in expl - - expl = callequal(nums_x, nums_y, verbose=2) - assert expl is not None - assert "+" + repr(nums_x) in expl - assert "-" + repr(nums_y) in expl - def test_list_bad_repr(self) -> None: class A: def __repr__(self): @@ -851,8 +833,6 @@ def test_recursive_dataclasses_verbose(self, pytester: Pytester) -> None: "E ", "E Drill down into differing attribute a:", "E a: 10 != 20", - "E +10", - "E -20", "E ", "E Drill down into differing attribute b:", "E b: 'ten' != 'xxx'", @@ -1059,7 +1039,7 @@ def test_namedtuple(self) -> None: " b: 'b' != 'c'", " - c", " + b", - "Use -v to get the full diff", + "Use -v to get more diff", ] def test_comparing_two_different_namedtuple(self) -> None: @@ -1074,7 +1054,7 @@ def test_comparing_two_different_namedtuple(self) -> None: assert lines == [ "NT1(a=1, b='b') == NT2(a=2, b='b')", "At index 0 diff: 1 != 2", - "Use -v to get the full diff", + "Use -v to get more diff", ] diff --git a/testing/test_error_diffs.py b/testing/test_error_diffs.py index d880be0dabe..eb781210872 100644 --- a/testing/test_error_diffs.py +++ b/testing/test_error_diffs.py @@ -231,8 +231,6 @@ def test_this(): E ['a'] E Drill down into differing attribute a: E a: 1 != 2 - E +1 - E -2 """, id="Compare data classes", ), From 9af3e236955a22ce43f369da4540d9fca2363515 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Tue, 15 Feb 2022 10:00:50 -0300 Subject: [PATCH 154/176] Expand warnings output for ResourceWarning (#9682) Fix #9644 --- changelog/9644.improvement.rst | 4 +++ doc/en/how-to/capture-warnings.rst | 15 ++++++++ src/_pytest/warnings.py | 17 +++++++++ testing/test_warnings.py | 55 ++++++++++++++++++++++++++++++ 4 files changed, 91 insertions(+) create mode 100644 changelog/9644.improvement.rst diff --git a/changelog/9644.improvement.rst b/changelog/9644.improvement.rst new file mode 100644 index 00000000000..6e29fd57a79 --- /dev/null +++ b/changelog/9644.improvement.rst @@ -0,0 +1,4 @@ +More information about the location of resources that led Python to raise :class:`ResourceWarning` can now +be obtained by enabling :mod:`tracemalloc`. + +See :ref:`resource-warnings` for more information. diff --git a/doc/en/how-to/capture-warnings.rst b/doc/en/how-to/capture-warnings.rst index 8c911424af7..4a27767e528 100644 --- a/doc/en/how-to/capture-warnings.rst +++ b/doc/en/how-to/capture-warnings.rst @@ -441,3 +441,18 @@ Please read our :ref:`backwards-compatibility` to learn how we proceed about dep features. The full list of warnings is listed in :ref:`the reference documentation `. + + +.. _`resource-warnings`: + +Resource Warnings +----------------- + +Additional information of the source of a :class:`ResourceWarning` can be obtained when captured by pytest if +:mod:`tracemalloc` module is enabled. + +One convenient way to enable :mod:`tracemalloc` when running tests is to set the :envvar:`PYTHONTRACEMALLOC` to a large +enough number of frames (say ``20``, but that number is application dependent). + +For more information, consult the `Python Development Mode `__ +section in the Python documentation. diff --git a/src/_pytest/warnings.py b/src/_pytest/warnings.py index 154283632cf..4aaa9445293 100644 --- a/src/_pytest/warnings.py +++ b/src/_pytest/warnings.py @@ -81,6 +81,23 @@ def warning_record_to_str(warning_message: warnings.WarningMessage) -> str: warning_message.lineno, warning_message.line, ) + if warning_message.source is not None: + try: + import tracemalloc + except ImportError: + pass + else: + tb = tracemalloc.get_object_traceback(warning_message.source) + if tb is not None: + formatted_tb = "\n".join(tb.format()) + # Use a leading new line to better separate the (large) output + # from the traceback to the previous warning text. + msg += f"\nObject allocated at:\n{formatted_tb}" + else: + # No need for a leading new line. + url = "https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings" + msg += "Enable tracemalloc to get traceback where the object was allocated.\n" + msg += f"See {url} for more info." return msg diff --git a/testing/test_warnings.py b/testing/test_warnings.py index 734e1ebb5cd..7b716bb4546 100644 --- a/testing/test_warnings.py +++ b/testing/test_warnings.py @@ -1,4 +1,5 @@ import os +import sys import warnings from typing import List from typing import Optional @@ -774,3 +775,57 @@ def test_it(): "*Unknown pytest.mark.unknown*", ] ) + + +def test_resource_warning(pytester: Pytester, monkeypatch: pytest.MonkeyPatch) -> None: + # Some platforms (notably PyPy) don't have tracemalloc. + # We choose to explicitly not skip this in case tracemalloc is not + # available, using `importorskip("tracemalloc")` for example, + # because we want to ensure the same code path does not break in those platforms. + try: + import tracemalloc # noqa + + has_tracemalloc = True + except ImportError: + has_tracemalloc = False + + # Explicitly disable PYTHONTRACEMALLOC in case pytest's test suite is running + # with it enabled. + monkeypatch.delenv("PYTHONTRACEMALLOC", raising=False) + + pytester.makepyfile( + """ + def open_file(p): + f = p.open("r") + assert p.read_text() == "hello" + + def test_resource_warning(tmp_path): + p = tmp_path.joinpath("foo.txt") + p.write_text("hello") + open_file(p) + """ + ) + result = pytester.run(sys.executable, "-Xdev", "-m", "pytest") + expected_extra = ( + [ + "*ResourceWarning* unclosed file*", + "*Enable tracemalloc to get traceback where the object was allocated*", + "*See https* for more info.", + ] + if has_tracemalloc + else [] + ) + result.stdout.fnmatch_lines([*expected_extra, "*1 passed*"]) + + monkeypatch.setenv("PYTHONTRACEMALLOC", "20") + + result = pytester.run(sys.executable, "-Xdev", "-m", "pytest") + expected_extra = ( + [ + "*ResourceWarning* unclosed file*", + "*Object allocated at*", + ] + if has_tracemalloc + else [] + ) + result.stdout.fnmatch_lines([*expected_extra, "*1 passed*"]) From 7f50c521b66922529ed2cab8434b865afc8a79dd Mon Sep 17 00:00:00 2001 From: Masaru Tsuchiyama Date: Sun, 20 Feb 2022 17:24:23 +0900 Subject: [PATCH 155/176] fix link of argcomplete page. --- doc/en/how-to/bash-completion.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/en/how-to/bash-completion.rst b/doc/en/how-to/bash-completion.rst index 245dfd6d9a8..117ff7ec13b 100644 --- a/doc/en/how-to/bash-completion.rst +++ b/doc/en/how-to/bash-completion.rst @@ -5,7 +5,7 @@ How to set up bash completion ============================= When using bash as your shell, ``pytest`` can use argcomplete -(https://argcomplete.readthedocs.io/) for auto-completion. +(https://kislyuk.github.io/argcomplete/) for auto-completion. For this ``argcomplete`` needs to be installed **and** enabled. Install argcomplete using: From 0c80a1c836616b0206a4af2fe72001ff797a5f8f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 23 Feb 2022 08:26:18 -0300 Subject: [PATCH 156/176] [automated] Update plugin list (#9701) Co-authored-by: pytest bot --- doc/en/reference/plugin_list.rst | 146 ++++++++++++++++++------------- 1 file changed, 85 insertions(+), 61 deletions(-) diff --git a/doc/en/reference/plugin_list.rst b/doc/en/reference/plugin_list.rst index b6d4f882a61..938246fabc0 100644 --- a/doc/en/reference/plugin_list.rst +++ b/doc/en/reference/plugin_list.rst @@ -11,7 +11,7 @@ automatically. Packages classified as inactive are excluded. creating a PDF, because otherwise the table gets far too wide for the page. -This list contains 997 plugins. +This list contains 1000 plugins. .. only:: not latex @@ -19,7 +19,7 @@ This list contains 997 plugins. name summary last release status requires =============================================== ======================================================================================================================================================================== ============== ===================== ================================================ :pypi:`pytest-accept` A pytest-plugin for updating doctest outputs Jan 07, 2022 N/A pytest (>=6,<8) - :pypi:`pytest-adaptavist` pytest plugin for generating test execution results within Jira Test Management (tm4j) Feb 01, 2022 N/A pytest (>=5.4.0) + :pypi:`pytest-adaptavist` pytest plugin for generating test execution results within Jira Test Management (tm4j) Feb 14, 2022 N/A pytest (>=5.4.0) :pypi:`pytest-addons-test` 用于测试pytest的插件 Aug 02, 2021 N/A pytest (>=6.2.4,<7.0.0) :pypi:`pytest-adf` Pytest plugin for writing Azure Data Factory integration tests May 10, 2021 4 - Beta pytest (>=3.5.0) :pypi:`pytest-adf-azure-identity` Pytest plugin for writing Azure Data Factory integration tests Mar 06, 2021 4 - Beta pytest (>=3.5.0) @@ -106,9 +106,9 @@ This list contains 997 plugins. :pypi:`pytest-blockage` Disable network requests during a test run. Dec 21, 2021 N/A pytest :pypi:`pytest-blocker` pytest plugin to mark a test as blocker and skip all other tests Sep 07, 2015 4 - Beta N/A :pypi:`pytest-board` Local continuous test runner with pytest and watchdog. Jan 20, 2019 N/A N/A - :pypi:`pytest-bootstrap` Jan 28, 2022 N/A N/A + :pypi:`pytest-bootstrap` Feb 19, 2022 N/A N/A :pypi:`pytest-bpdb` A py.test plug-in to enable drop to bpdb debugger on test failure. Jan 19, 2015 2 - Pre-Alpha N/A - :pypi:`pytest-bravado` Pytest-bravado automatically generates from OpenAPI specification client fixtures. Jul 19, 2021 N/A N/A + :pypi:`pytest-bravado` Pytest-bravado automatically generates from OpenAPI specification client fixtures. Feb 15, 2022 N/A N/A :pypi:`pytest-breakword` Use breakword with pytest Aug 04, 2021 N/A pytest (>=6.2.4,<7.0.0) :pypi:`pytest-breed-adapter` A simple plugin to connect with breed-server Nov 07, 2018 4 - Beta pytest (>=3.5.0) :pypi:`pytest-briefcase` A pytest plugin for running tests on a Briefcase project. Jun 14, 2020 4 - Beta pytest (>=3.5.0) @@ -123,9 +123,9 @@ This list contains 997 plugins. :pypi:`pytest-builtin-types` Nov 17, 2021 N/A pytest :pypi:`pytest-bwrap` Run your tests in Bubblewrap sandboxes Oct 26, 2018 3 - Alpha N/A :pypi:`pytest-cache` pytest plugin with mechanisms for caching across test runs Jun 04, 2013 3 - Alpha N/A - :pypi:`pytest-cache-assert` Cache assertion data to simplify regression testing of complex serializable data Nov 03, 2021 4 - Beta pytest (>=5) + :pypi:`pytest-cache-assert` Cache assertion data to simplify regression testing of complex serializable data Feb 18, 2022 4 - Beta pytest (>=5) :pypi:`pytest-cagoule` Pytest plugin to only run tests affected by changes Jan 01, 2020 3 - Alpha N/A - :pypi:`pytest-cairo` Feb 04, 2022 N/A pytest + :pypi:`pytest-cairo` Pytest support for cairo-lang and starknet Feb 19, 2022 N/A pytest :pypi:`pytest-camel-collect` Enable CamelCase-aware pytest class collection Aug 02, 2020 N/A pytest (>=2.9) :pypi:`pytest-canonical-data` A plugin which allows to compare results with canonical results, based on previous runs May 08, 2020 2 - Pre-Alpha pytest (>=3.5.0) :pypi:`pytest-caprng` A plugin that replays pRNG state on failure. May 02, 2018 4 - Beta N/A @@ -253,6 +253,7 @@ This list contains 997 plugins. :pypi:`pytest-docfiles` pytest plugin to test codeblocks in your documentation. Dec 22, 2021 4 - Beta pytest (>=3.7.0) :pypi:`pytest-docgen` An RST Documentation Generator for pytest-based test suites Apr 17, 2020 N/A N/A :pypi:`pytest-docker` Simple pytest fixtures for Docker and docker-compose based tests Jun 14, 2021 N/A pytest (<7.0,>=4.0) + :pypi:`pytest-docker-apache-fixtures` Pytest fixtures for testing with apache2 (httpd). Feb 16, 2022 4 - Beta pytest :pypi:`pytest-docker-butla` Jun 16, 2019 3 - Alpha N/A :pypi:`pytest-dockerc` Run, manage and stop Docker Compose project from Docker API Oct 09, 2020 5 - Production/Stable pytest (>=3.0) :pypi:`pytest-docker-compose` Manages Docker containers during your integration tests Jan 26, 2021 5 - Production/Stable pytest (>=3.3) @@ -265,7 +266,7 @@ This list contains 997 plugins. :pypi:`pytest-docker-py` Easy to use, simple to extend, pytest plugin that minimally leverages docker-py. Nov 27, 2018 N/A pytest (==4.0.0) :pypi:`pytest-docker-registry-fixtures` Pytest fixtures for testing with docker registries. Feb 09, 2022 4 - Beta pytest :pypi:`pytest-docker-squid-fixtures` Pytest fixtures for testing with squid. Feb 09, 2022 4 - Beta pytest - :pypi:`pytest-docker-tools` Docker integration tests for pytest Jul 23, 2021 4 - Beta pytest (>=6.0.1,<7.0.0) + :pypi:`pytest-docker-tools` Docker integration tests for pytest Feb 17, 2022 4 - Beta pytest (>=6.0.1) :pypi:`pytest-docs` Documentation tool for pytest Nov 11, 2018 4 - Beta pytest (>=3.5.0) :pypi:`pytest-docstyle` pytest plugin to run pydocstyle Mar 23, 2020 3 - Alpha N/A :pypi:`pytest-doctest-custom` A py.test plugin for customizing string representations of doctest results. Jul 25, 2016 4 - Beta N/A @@ -282,6 +283,7 @@ This list contains 997 plugins. :pypi:`pytest-dummynet` A py.test plugin providing access to a dummynet. Dec 15, 2021 5 - Production/Stable pytest :pypi:`pytest-dump2json` A pytest plugin for dumping test results to json. Jun 29, 2015 N/A N/A :pypi:`pytest-duration-insights` Jun 25, 2021 N/A N/A + :pypi:`pytest-durations` Pytest plugin reporting fixtures and test functions execution time. Feb 14, 2022 5 - Production/Stable pytest (>=4.6) :pypi:`pytest-dynamicrerun` A pytest plugin to rerun tests dynamically based off of test outcome and output. Aug 15, 2020 4 - Beta N/A :pypi:`pytest-dynamodb` DynamoDB fixtures for pytest Jun 03, 2021 5 - Production/Stable pytest :pypi:`pytest-easy-addoption` pytest-easy-addoption: Easy way to work with pytest addoption Jan 22, 2020 N/A N/A @@ -369,7 +371,7 @@ This list contains 997 plugins. :pypi:`pytest-fixture-typecheck` A pytest plugin to assert type annotations at runtime. Aug 24, 2021 N/A pytest :pypi:`pytest-flake8` pytest plugin to check FLAKE8 requirements Dec 16, 2020 4 - Beta pytest (>=3.5) :pypi:`pytest-flake8-path` A pytest fixture for testing flake8 plugins. Jan 10, 2022 5 - Production/Stable pytest - :pypi:`pytest-flake8-v2` pytest plugin to check FLAKE8 requirements Jan 25, 2022 4 - Beta pytest (>=6.0) + :pypi:`pytest-flake8-v2` pytest plugin to check FLAKE8 requirements Feb 16, 2022 4 - Beta pytest (>=7.0) :pypi:`pytest-flakefinder` Runs tests multiple times to expose flakiness. Jul 28, 2020 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 @@ -378,13 +380,13 @@ This list contains 997 plugins. :pypi:`pytest-flask-sqlalchemy-transactions` Run tests in transactions using pytest, Flask, and SQLalchemy. Aug 02, 2018 4 - Beta pytest (>=3.2.1) :pypi:`pytest-flyte` Pytest fixtures for simplifying Flyte integration testing May 03, 2021 N/A pytest :pypi:`pytest-focus` A pytest plugin that alerts user of failed test cases with screen notifications May 04, 2019 4 - Beta pytest - :pypi:`pytest-fold` Fold console output and drop user into interactive text user interface Feb 06, 2022 3 - Alpha pytest (>=6.2.5) + :pypi:`pytest-fold` Fold console output and drop user into interactive text user interface Feb 19, 2022 3 - Alpha pytest (>=6.2.5) :pypi:`pytest-forcefail` py.test plugin to make the test failing regardless of pytest.mark.xfail May 15, 2018 4 - Beta N/A :pypi:`pytest-forward-compatability` A name to avoid typosquating pytest-foward-compatibility Sep 06, 2020 N/A N/A :pypi:`pytest-forward-compatibility` A pytest plugin to shim pytest commandline options for fowards compatibility Sep 29, 2020 N/A N/A :pypi:`pytest-freezegun` Wrap tests with fixtures in freeze_time Jul 19, 2020 4 - Beta pytest (>=3.0.0) :pypi:`pytest-freeze-reqs` Check if requirement files are frozen Apr 29, 2021 N/A N/A - :pypi:`pytest-frozen-uuids` Deterministically frozen UUID's for your tests Dec 08, 2021 N/A pytest (>=3.0) + :pypi:`pytest-frozen-uuids` Deterministically frozen UUID's for your tests Feb 14, 2022 N/A pytest (>=3.0) :pypi:`pytest-func-cov` Pytest plugin for measuring function coverage Apr 15, 2021 3 - Alpha pytest (>=5) :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 @@ -420,7 +422,7 @@ This list contains 997 plugins. :pypi:`pytest-historic` Custom report to display pytest historical execution records Apr 08, 2020 N/A pytest :pypi:`pytest-historic-hook` Custom listener to store execution results into MYSQL DB, which is used for pytest-historic report Apr 08, 2020 N/A pytest :pypi:`pytest-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 Feb 12, 2022 3 - Alpha pytest (==6.2.5) + :pypi:`pytest-homeassistant-custom-component` Experimental package to automatically extract test plugins for Home Assistant custom components Feb 19, 2022 3 - Alpha pytest (==6.2.5) :pypi:`pytest-honey` A simple plugin to use with pytest Jan 07, 2022 4 - Beta pytest (>=3.5.0) :pypi:`pytest-honors` Report on tests that honor constraints, and guard against regressions Mar 06, 2020 4 - Beta N/A :pypi:`pytest-hoverfly` Simplify working with Hoverfly from pytest Jan 20, 2022 N/A pytest (>=5.0) @@ -430,7 +432,7 @@ This list contains 997 plugins. :pypi:`pytest-html-lee` optimized pytest plugin for generating HTML reports Jun 30, 2020 5 - Production/Stable pytest (>=5.0) :pypi:`pytest-html-object-storage` Pytest report plugin for send HTML report on object-storage Feb 06, 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 11, 2022 N/A N/A + :pypi:`pytest-html-reporter` Generates a static html report based on pytest framework Feb 13, 2022 N/A N/A :pypi:`pytest-html-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 Dec 25, 2021 5 - Production/Stable N/A @@ -464,7 +466,7 @@ This list contains 997 plugins. :pypi:`pytest-integration-mark` Automatic integration test marking and excluding plugin for pytest Jul 19, 2021 N/A pytest (>=5.2,<7.0) :pypi:`pytest-interactive` A pytest plugin for console based interactive test selection just after the collection phase Nov 30, 2017 3 - Alpha N/A :pypi:`pytest-intercept-remote` Pytest plugin for intercepting outgoing connection requests during pytest run. May 24, 2021 4 - Beta pytest (>=4.6) - :pypi:`pytest-invenio` Pytest fixtures for Invenio. May 11, 2021 5 - Production/Stable pytest (<7,>=6) + :pypi:`pytest-invenio` Pytest fixtures for Invenio. Feb 17, 2022 5 - Production/Stable pytest (<7,>=6) :pypi:`pytest-involve` Run tests covering a specific file or changeset Feb 02, 2020 4 - Beta pytest (>=3.5.0) :pypi:`pytest-ipdb` A py.test plug-in to enable drop to ipdb debugger on test failure. Sep 02, 2014 2 - Pre-Alpha N/A :pypi:`pytest-ipynb` THIS PROJECT IS ABANDONED Jan 29, 2019 3 - Alpha N/A @@ -475,7 +477,7 @@ This list contains 997 plugins. :pypi:`pytest-jasmine` Run jasmine tests from your pytest test suite Nov 04, 2017 1 - Planning N/A :pypi:`pytest-jest` A custom jest-pytest oriented Pytest reporter May 22, 2018 4 - Beta pytest (>=3.3.2) :pypi:`pytest-jira` py.test JIRA integration plugin, using markers Dec 02, 2021 3 - Alpha N/A - :pypi:`pytest-jira-xray` pytest plugin to integrate tests with JIRA XRAY Dec 10, 2021 3 - Alpha pytest + :pypi:`pytest-jira-xray` pytest plugin to integrate tests with JIRA XRAY Feb 17, 2022 3 - Alpha pytest :pypi:`pytest-jobserver` Limit parallel tests with posix jobserver. May 15, 2019 5 - Production/Stable pytest :pypi:`pytest-joke` Test failures are better served with humor. Oct 08, 2019 4 - Beta pytest (>=4.2.1) :pypi:`pytest-json` Generate JSON test reports Jan 18, 2016 4 - Beta N/A @@ -550,7 +552,7 @@ This list contains 997 plugins. :pypi:`pytest-mock-helper` Help you mock HTTP call and generate mock code Jan 24, 2018 N/A pytest :pypi:`pytest-mockito` Base fixtures for mockito Jul 11, 2018 4 - Beta N/A :pypi:`pytest-mockredis` An in-memory mock of a Redis server that runs in a separate thread. This is to be used for unit-tests that require a Redis database. Jan 02, 2018 2 - Pre-Alpha N/A - :pypi:`pytest-mock-resources` A pytest plugin for easily instantiating reproducible mock resources. Feb 08, 2022 N/A pytest (>=1.0) + :pypi:`pytest-mock-resources` A pytest plugin for easily instantiating reproducible mock resources. Feb 17, 2022 N/A pytest (>=1.0) :pypi:`pytest-mock-server` Mock server plugin for pytest Jan 09, 2022 4 - Beta pytest (>=3.5.0) :pypi:`pytest-mockservers` A set of fixtures to test your requests to HTTP/UDP servers Mar 31, 2020 N/A pytest (>=4.3.0) :pypi:`pytest-modified-env` Pytest plugin to fail a test if it leaves modified \`os.environ\` afterwards. Jan 29, 2022 4 - Beta N/A @@ -578,7 +580,7 @@ This list contains 997 plugins. :pypi:`pytest-mypy-plugins` pytest plugin for writing tests for mypy plugins Jan 11, 2022 3 - Alpha pytest (>=6.0.0) :pypi:`pytest-mypy-plugins-shim` Substitute for "pytest-mypy-plugins" for Python implementations which aren't supported by mypy. Apr 12, 2021 N/A N/A :pypi:`pytest-mypy-testing` Pytest plugin to check mypy output. Jun 13, 2021 N/A pytest - :pypi:`pytest-mysql` MySQL process and client fixtures for pytest Feb 11, 2022 5 - Production/Stable pytest (>=6.2) + :pypi:`pytest-mysql` MySQL process and client fixtures for pytest Feb 15, 2022 5 - Production/Stable pytest (>=6.2) :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-network` A simple plugin to disable network on socket level. May 07, 2020 N/A N/A @@ -608,7 +610,7 @@ This list contains 997 plugins. :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-opentmi` pytest plugin for publish results to opentmi Jan 19, 2022 5 - Production/Stable pytest (>=5.0) - :pypi:`pytest-operator` Fixtures for Operators Jan 31, 2022 N/A N/A + :pypi:`pytest-operator` Fixtures for Operators Feb 14, 2022 N/A N/A :pypi:`pytest-optional` include/exclude values of fixtures in pytest Oct 07, 2015 N/A N/A :pypi:`pytest-optional-tests` Easy declaration of optional tests (i.e., that are not run by default) Jul 09, 2019 4 - Beta pytest (>=4.5.0) :pypi:`pytest-orchestration` A pytest plugin for orchestrating tests Jul 18, 2019 N/A N/A @@ -766,6 +768,7 @@ This list contains 997 plugins. :pypi:`pytest-restrict` Pytest plugin to restrict the test types allowed Jan 10, 2022 5 - Production/Stable pytest :pypi:`pytest-rethinkdb` A RethinkDB plugin for pytest. Jul 24, 2016 4 - Beta N/A :pypi:`pytest-reverse` Pytest plugin to reverse test order. Jan 10, 2022 5 - Production/Stable 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-ringo` pytest plugin to test webapplications using the Ringo webframework Sep 27, 2017 3 - Alpha N/A :pypi:`pytest-rng` Fixtures for seeding tests and making randomness reproducible Aug 08, 2019 5 - Production/Stable pytest :pypi:`pytest-roast` pytest plugin for ROAST configuration override and fixtures Jul 29, 2021 5 - Production/Stable pytest @@ -781,19 +784,19 @@ This list contains 997 plugins. :pypi:`pytest-runtime-xfail` Call runtime_xfail() to mark running test as xfail. Aug 26, 2021 N/A N/A :pypi:`pytest-salt` Pytest Salt Plugin Jan 27, 2020 4 - Beta N/A :pypi:`pytest-salt-containers` A Pytest plugin that builds and creates docker containers Nov 09, 2016 4 - Beta N/A - :pypi:`pytest-salt-factories` Pytest Salt Plugin Jan 27, 2022 4 - Beta pytest (>=6.0.0) + :pypi:`pytest-salt-factories` Pytest Salt Plugin Feb 19, 2022 4 - Beta pytest (>=6.0.0) :pypi:`pytest-salt-from-filenames` Simple PyTest Plugin For Salt's Test Suite Specifically Jan 29, 2019 4 - Beta pytest (>=4.1) :pypi:`pytest-salt-runtests-bridge` Simple PyTest Plugin For Salt's Test Suite Specifically Dec 05, 2019 4 - Beta pytest (>=4.1) :pypi:`pytest-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. Feb 11, 2022 5 - Production/Stable N/A + :pypi:`pytest-sbase` A complete web automation framework for end-to-end testing. Feb 15, 2022 5 - Production/Stable N/A :pypi:`pytest-scenario` pytest plugin for test scenarios Feb 06, 2017 3 - Alpha N/A :pypi:`pytest-schema` 👍 Validate return values against a schema-like object in testing Aug 31, 2020 5 - Production/Stable pytest (>=3.5.0) :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 Sep 19, 2020 5 - Production/Stable pytest (>=5.0.0) - :pypi:`pytest-seleniumbase` A complete web automation framework for end-to-end testing. Feb 11, 2022 5 - Production/Stable N/A + :pypi:`pytest-seleniumbase` A complete web automation framework for end-to-end testing. Feb 15, 2022 5 - Production/Stable N/A :pypi:`pytest-selenium-enhancer` pytest plugin for Selenium Dec 16, 2021 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-send-email` Send pytest execution result email Dec 04, 2019 N/A N/A @@ -807,7 +810,7 @@ This list contains 997 plugins. :pypi:`pytest-sftpserver` py.test plugin to locally test sftp server connections. Sep 16, 2019 4 - Beta N/A :pypi:`pytest-shard` Dec 11, 2020 4 - Beta pytest :pypi:`pytest-shell` A pytest plugin to help with testing shell scripts / black box commands Nov 07, 2021 N/A N/A - :pypi:`pytest-shell-utilities` Pytest plugin to simplify running shell commands against the system Feb 05, 2022 4 - Beta pytest (>=6.0.0) + :pypi:`pytest-shell-utilities` Pytest plugin to simplify running shell commands against the system Feb 17, 2022 4 - Beta pytest (>=6.0.0) :pypi:`pytest-sheraf` Versatile ZODB abstraction layer - pytest fixtures Feb 11, 2020 N/A pytest :pypi:`pytest-sherlock` pytest plugin help to find coupled tests Nov 18, 2021 5 - Production/Stable pytest (>=3.5.1) :pypi:`pytest-shortcuts` Expand command-line shortcuts listed in pytest configuration Oct 29, 2020 4 - Beta pytest (>=3.5.0) @@ -816,7 +819,7 @@ This list contains 997 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 Feb 05, 2022 5 - Production/Stable pytest (>=6.0.0) + :pypi:`pytest-skip-markers` Pytest Salt Plugin Feb 16, 2022 5 - Production/Stable pytest (>=6.0.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. Sep 28, 2021 N/A N/A @@ -835,7 +838,7 @@ This list contains 997 plugins. :pypi:`pytest-solidity` A PyTest library plugin for Solidity language. Jan 15, 2022 1 - Planning pytest (<7,>=6.0.1) ; extra == 'tests' :pypi:`pytest-solr` Solr process and client fixtures for py.test. May 11, 2020 3 - Alpha pytest (>=3.0.0) :pypi:`pytest-sorter` A simple plugin to first execute tests that historically failed more Apr 20, 2021 4 - Beta pytest (>=3.1.1) - :pypi:`pytest-sosu` Unofficial PyTest plugin for Sauce Labs Dec 20, 2021 2 - Pre-Alpha pytest + :pypi:`pytest-sosu` Unofficial PyTest plugin for Sauce Labs Feb 17, 2022 2 - Pre-Alpha pytest :pypi:`pytest-sourceorder` Test-ordering plugin for pytest Sep 01, 2021 4 - Beta pytest :pypi:`pytest-spark` pytest plugin to run the tests with support of pyspark. Feb 23, 2020 4 - Beta pytest :pypi:`pytest-spawner` py.test plugin to spawn process and communicate with them. Jul 31, 2015 4 - Beta N/A @@ -848,13 +851,13 @@ This list contains 997 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 Jan 25, 2022 N/A pytest (>5.4.0,<6.3) + :pypi:`pytest-splunk-addon` A Dynamic test tool for Splunk Apps and Add-ons Feb 18, 2022 N/A pytest (>5.4.0,<6.3) :pypi:`pytest-splunk-addon-ui-smartx` Library to support testing Splunk Add-on UX Feb 07, 2022 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 :pypi:`pytest-sql-bigquery` Yet another SQL-testing framework for BigQuery provided by pytest plugin Dec 19, 2019 N/A pytest - :pypi:`pytest-squadcast` Pytest report plugin for Squadcast Feb 11, 2022 5 - Production/Stable pytest + :pypi:`pytest-squadcast` Pytest report plugin for Squadcast Feb 18, 2022 5 - Production/Stable pytest :pypi:`pytest-srcpaths` Add paths to sys.path Oct 15, 2021 N/A N/A :pypi:`pytest-ssh` pytest plugin for ssh command run May 27, 2019 N/A pytest :pypi:`pytest-start-from` Start pytest run from a given point Apr 11, 2016 N/A N/A @@ -871,14 +874,14 @@ This list contains 997 plugins. :pypi:`pytest-study` A pytest plugin to organize long run tests (named studies) without interfering the regular tests Sep 26, 2017 3 - Alpha pytest (>=2.0) :pypi:`pytest-subprocess` A plugin to fake subprocess for pytest Feb 09, 2022 5 - Production/Stable pytest (>=4.0.0) :pypi:`pytest-subtesthack` A hack to explicitly set up and tear down fixtures. Mar 02, 2021 N/A N/A - :pypi:`pytest-subtests` unittest subTest() support and subtests fixture Jan 15, 2022 4 - Beta pytest (>=6.0) + :pypi:`pytest-subtests` unittest subTest() support and subtests fixture Feb 13, 2022 4 - Beta pytest (>=7.0) :pypi:`pytest-subunit` pytest-subunit is a plugin for py.test which outputs testsresult in subunit format. Aug 29, 2017 N/A N/A :pypi:`pytest-sugar` pytest-sugar is a plugin for pytest that changes the default look and feel of pytest (e.g. progressbar, show tests that fail instantly). Jul 06, 2020 3 - Alpha N/A :pypi:`pytest-sugar-bugfix159` Workaround for https://github.com/Frozenball/pytest-sugar/issues/159 Nov 07, 2018 5 - Production/Stable pytest (!=3.7.3,>=3.5); extra == 'testing' :pypi:`pytest-super-check` Pytest plugin to check your TestCase classes call super in setUp, tearDown, etc. Jan 10, 2022 5 - Production/Stable pytest :pypi:`pytest-svn` SVN repository fixture for py.test May 28, 2019 5 - Production/Stable pytest :pypi:`pytest-symbols` pytest-symbols is a pytest plugin that adds support for passing test environment symbols into pytest tests. Nov 20, 2017 3 - Alpha N/A - :pypi:`pytest-system-statistics` Pytest plugin to track and report system usage statistics Jan 26, 2022 5 - Production/Stable pytest (>=6.0.0) + :pypi:`pytest-system-statistics` Pytest plugin to track and report system usage statistics Feb 16, 2022 5 - Production/Stable pytest (>=6.0.0) :pypi:`pytest-system-test-plugin` Pyst - Pytest System-Test Plugin Feb 03, 2022 N/A N/A :pypi:`pytest-takeltest` Fixtures for ansible, testinfra and molecule Jan 04, 2022 N/A N/A :pypi:`pytest-talisker` Nov 28, 2021 N/A N/A @@ -898,7 +901,7 @@ This list contains 997 plugins. :pypi:`pytest-test-groups` A Pytest plugin for running a subset of your tests by splitting them in to equally sized groups. Oct 25, 2016 5 - Production/Stable N/A :pypi:`pytest-testinfra` Test infrastructures Feb 10, 2022 5 - Production/Stable pytest (!=3.0.2) :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 Feb 05, 2022 4 - Beta N/A + :pypi:`pytest-testmon` selects tests affected by changed files and methods Feb 18, 2022 4 - Beta N/A :pypi:`pytest-testobject` Plugin to use TestObject Suites with Pytest Sep 24, 2019 4 - Beta pytest (>=3.1.1) :pypi:`pytest-testpluggy` set your encoding Jan 07, 2022 N/A pytest :pypi:`pytest-testrail` pytest plugin for creating TestRail runs and adding results Aug 27, 2020 N/A pytest (>=3.6) @@ -951,7 +954,7 @@ This list contains 997 plugins. :pypi:`pytest-tstcls` Test Class Base Mar 23, 2020 5 - Production/Stable N/A :pypi:`pytest-twisted` A twisted plugin for pytest. Aug 30, 2021 5 - Production/Stable pytest (>=2.3) :pypi:`pytest-typechecker` Run type checkers on specified test files Feb 04, 2022 N/A pytest (>=6.2.5,<7.0.0) - :pypi:`pytest-typhoon-xray` Typhoon HIL plugin for pytest Nov 03, 2021 4 - Beta N/A + :pypi:`pytest-typhoon-xray` Typhoon HIL plugin for pytest Feb 14, 2022 4 - Beta N/A :pypi:`pytest-tytest` Typhoon HIL plugin for pytest May 25, 2020 4 - Beta pytest (>=5.4.2) :pypi:`pytest-ubersmith` Easily mock calls to ubersmith at the \`requests\` level. Apr 13, 2015 N/A N/A :pypi:`pytest-ui` Text User Interface for running python tests Jul 05, 2021 4 - Beta pytest @@ -1028,7 +1031,7 @@ This list contains 997 plugins. A pytest-plugin for updating doctest outputs :pypi:`pytest-adaptavist` - *last release*: Feb 01, 2022, + *last release*: Feb 14, 2022, *status*: N/A, *requires*: pytest (>=5.4.0) @@ -1637,7 +1640,7 @@ This list contains 997 plugins. Local continuous test runner with pytest and watchdog. :pypi:`pytest-bootstrap` - *last release*: Jan 28, 2022, + *last release*: Feb 19, 2022, *status*: N/A, *requires*: N/A @@ -1651,7 +1654,7 @@ This list contains 997 plugins. A py.test plug-in to enable drop to bpdb debugger on test failure. :pypi:`pytest-bravado` - *last release*: Jul 19, 2021, + *last release*: Feb 15, 2022, *status*: N/A, *requires*: N/A @@ -1756,7 +1759,7 @@ This list contains 997 plugins. pytest plugin with mechanisms for caching across test runs :pypi:`pytest-cache-assert` - *last release*: Nov 03, 2021, + *last release*: Feb 18, 2022, *status*: 4 - Beta, *requires*: pytest (>=5) @@ -1770,11 +1773,11 @@ This list contains 997 plugins. Pytest plugin to only run tests affected by changes :pypi:`pytest-cairo` - *last release*: Feb 04, 2022, + *last release*: Feb 19, 2022, *status*: N/A, *requires*: pytest - + Pytest support for cairo-lang and starknet :pypi:`pytest-camel-collect` *last release*: Aug 02, 2020, @@ -2665,6 +2668,13 @@ This list contains 997 plugins. Simple pytest fixtures for Docker and docker-compose based tests + :pypi:`pytest-docker-apache-fixtures` + *last release*: Feb 16, 2022, + *status*: 4 - Beta, + *requires*: pytest + + Pytest fixtures for testing with apache2 (httpd). + :pypi:`pytest-docker-butla` *last release*: Jun 16, 2019, *status*: 3 - Alpha, @@ -2750,9 +2760,9 @@ This list contains 997 plugins. Pytest fixtures for testing with squid. :pypi:`pytest-docker-tools` - *last release*: Jul 23, 2021, + *last release*: Feb 17, 2022, *status*: 4 - Beta, - *requires*: pytest (>=6.0.1,<7.0.0) + *requires*: pytest (>=6.0.1) Docker integration tests for pytest @@ -2868,6 +2878,13 @@ This list contains 997 plugins. + :pypi:`pytest-durations` + *last release*: Feb 14, 2022, + *status*: 5 - Production/Stable, + *requires*: pytest (>=4.6) + + Pytest plugin reporting fixtures and test functions execution time. + :pypi:`pytest-dynamicrerun` *last release*: Aug 15, 2020, *status*: 4 - Beta, @@ -3478,9 +3495,9 @@ This list contains 997 plugins. A pytest fixture for testing flake8 plugins. :pypi:`pytest-flake8-v2` - *last release*: Jan 25, 2022, + *last release*: Feb 16, 2022, *status*: 4 - Beta, - *requires*: pytest (>=6.0) + *requires*: pytest (>=7.0) pytest plugin to check FLAKE8 requirements @@ -3541,7 +3558,7 @@ This list contains 997 plugins. A pytest plugin that alerts user of failed test cases with screen notifications :pypi:`pytest-fold` - *last release*: Feb 06, 2022, + *last release*: Feb 19, 2022, *status*: 3 - Alpha, *requires*: pytest (>=6.2.5) @@ -3583,7 +3600,7 @@ This list contains 997 plugins. Check if requirement files are frozen :pypi:`pytest-frozen-uuids` - *last release*: Dec 08, 2021, + *last release*: Feb 14, 2022, *status*: N/A, *requires*: pytest (>=3.0) @@ -3835,7 +3852,7 @@ This list contains 997 plugins. A pytest plugin for use with homeassistant custom components. :pypi:`pytest-homeassistant-custom-component` - *last release*: Feb 12, 2022, + *last release*: Feb 19, 2022, *status*: 3 - Alpha, *requires*: pytest (==6.2.5) @@ -3905,7 +3922,7 @@ This list contains 997 plugins. Pytest plugin for generating HTML reports with per-test profiling and optionally call graph visualizations. Based on pytest-html by Dave Hunt. :pypi:`pytest-html-reporter` - *last release*: Feb 11, 2022, + *last release*: Feb 13, 2022, *status*: N/A, *requires*: N/A @@ -4143,7 +4160,7 @@ This list contains 997 plugins. Pytest plugin for intercepting outgoing connection requests during pytest run. :pypi:`pytest-invenio` - *last release*: May 11, 2021, + *last release*: Feb 17, 2022, *status*: 5 - Production/Stable, *requires*: pytest (<7,>=6) @@ -4220,7 +4237,7 @@ This list contains 997 plugins. py.test JIRA integration plugin, using markers :pypi:`pytest-jira-xray` - *last release*: Dec 10, 2021, + *last release*: Feb 17, 2022, *status*: 3 - Alpha, *requires*: pytest @@ -4745,7 +4762,7 @@ This list contains 997 plugins. An in-memory mock of a Redis server that runs in a separate thread. This is to be used for unit-tests that require a Redis database. :pypi:`pytest-mock-resources` - *last release*: Feb 08, 2022, + *last release*: Feb 17, 2022, *status*: N/A, *requires*: pytest (>=1.0) @@ -4941,7 +4958,7 @@ This list contains 997 plugins. Pytest plugin to check mypy output. :pypi:`pytest-mysql` - *last release*: Feb 11, 2022, + *last release*: Feb 15, 2022, *status*: 5 - Production/Stable, *requires*: pytest (>=6.2) @@ -5151,7 +5168,7 @@ This list contains 997 plugins. pytest plugin for publish results to opentmi :pypi:`pytest-operator` - *last release*: Jan 31, 2022, + *last release*: Feb 14, 2022, *status*: N/A, *requires*: N/A @@ -6256,6 +6273,13 @@ This list contains 997 plugins. Pytest plugin to reverse test order. + :pypi:`pytest-rich-reporter` + *last release*: Feb 17, 2022, + *status*: 1 - Planning, + *requires*: pytest (>=5.0.0) + + A pytest plugin using Rich for beautiful test result formatting. + :pypi:`pytest-ringo` *last release*: Sep 27, 2017, *status*: 3 - Alpha, @@ -6362,7 +6386,7 @@ This list contains 997 plugins. A Pytest plugin that builds and creates docker containers :pypi:`pytest-salt-factories` - *last release*: Jan 27, 2022, + *last release*: Feb 19, 2022, *status*: 4 - Beta, *requires*: pytest (>=6.0.0) @@ -6404,7 +6428,7 @@ This list contains 997 plugins. :pypi:`pytest-sbase` - *last release*: Feb 11, 2022, + *last release*: Feb 15, 2022, *status*: 5 - Production/Stable, *requires*: N/A @@ -6446,7 +6470,7 @@ This list contains 997 plugins. pytest plugin for Selenium :pypi:`pytest-seleniumbase` - *last release*: Feb 11, 2022, + *last release*: Feb 15, 2022, *status*: 5 - Production/Stable, *requires*: N/A @@ -6544,7 +6568,7 @@ This list contains 997 plugins. A pytest plugin to help with testing shell scripts / black box commands :pypi:`pytest-shell-utilities` - *last release*: Feb 05, 2022, + *last release*: Feb 17, 2022, *status*: 4 - Beta, *requires*: pytest (>=6.0.0) @@ -6607,7 +6631,7 @@ This list contains 997 plugins. Allow for multiple processes to log to a single file :pypi:`pytest-skip-markers` - *last release*: Feb 05, 2022, + *last release*: Feb 16, 2022, *status*: 5 - Production/Stable, *requires*: pytest (>=6.0.0) @@ -6740,7 +6764,7 @@ This list contains 997 plugins. A simple plugin to first execute tests that historically failed more :pypi:`pytest-sosu` - *last release*: Dec 20, 2021, + *last release*: Feb 17, 2022, *status*: 2 - Pre-Alpha, *requires*: pytest @@ -6831,7 +6855,7 @@ This list contains 997 plugins. :pypi:`pytest-splunk-addon` - *last release*: Jan 25, 2022, + *last release*: Feb 18, 2022, *status*: N/A, *requires*: pytest (>5.4.0,<6.3) @@ -6873,7 +6897,7 @@ This list contains 997 plugins. Yet another SQL-testing framework for BigQuery provided by pytest plugin :pypi:`pytest-squadcast` - *last release*: Feb 11, 2022, + *last release*: Feb 18, 2022, *status*: 5 - Production/Stable, *requires*: pytest @@ -6992,9 +7016,9 @@ This list contains 997 plugins. A hack to explicitly set up and tear down fixtures. :pypi:`pytest-subtests` - *last release*: Jan 15, 2022, + *last release*: Feb 13, 2022, *status*: 4 - Beta, - *requires*: pytest (>=6.0) + *requires*: pytest (>=7.0) unittest subTest() support and subtests fixture @@ -7041,7 +7065,7 @@ This list contains 997 plugins. pytest-symbols is a pytest plugin that adds support for passing test environment symbols into pytest tests. :pypi:`pytest-system-statistics` - *last release*: Jan 26, 2022, + *last release*: Feb 16, 2022, *status*: 5 - Production/Stable, *requires*: pytest (>=6.0.0) @@ -7181,7 +7205,7 @@ This list contains 997 plugins. pytest reporting plugin for testlink :pypi:`pytest-testmon` - *last release*: Feb 05, 2022, + *last release*: Feb 18, 2022, *status*: 4 - Beta, *requires*: N/A @@ -7552,7 +7576,7 @@ This list contains 997 plugins. Run type checkers on specified test files :pypi:`pytest-typhoon-xray` - *last release*: Nov 03, 2021, + *last release*: Feb 14, 2022, *status*: 4 - Beta, *requires*: N/A From 7b6e477e2f55f143a490c7d206eac5a7e005b392 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Wed, 23 Feb 2022 15:59:54 +0200 Subject: [PATCH 157/176] Revert "Deprecate raising unittest.SkipTest to skip tests during collection" (#9710) This reverts commit 25e657bfc15aecd8fa8787a028ffc10fc9ac96d5. Turns out that this *is* a working unittest feature, which pytest should support, so undo the deprecation. --- changelog/8242.bugfix.rst | 3 +++ doc/en/changelog.rst | 2 ++ doc/en/deprecations.rst | 13 ------------- src/_pytest/deprecated.py | 5 ----- src/_pytest/runner.py | 7 ------- testing/deprecated_test.py | 17 ----------------- testing/test_nose.py | 2 +- testing/test_unittest.py | 27 +++++++++++++++++++++++++++ 8 files changed, 33 insertions(+), 43 deletions(-) create mode 100644 changelog/8242.bugfix.rst diff --git a/changelog/8242.bugfix.rst b/changelog/8242.bugfix.rst new file mode 100644 index 00000000000..eaa46142eea --- /dev/null +++ b/changelog/8242.bugfix.rst @@ -0,0 +1,3 @@ +The deprecation of raising :class:`unittest.SkipTest` to skip collection of +tests during the pytest collection phase is reverted - this is now a supported +feature again. diff --git a/doc/en/changelog.rst b/doc/en/changelog.rst index 1acdad366da..41a79ce5b2f 100644 --- a/doc/en/changelog.rst +++ b/doc/en/changelog.rst @@ -211,6 +211,8 @@ Deprecations :class:`unittest.SkipTest` / :meth:`unittest.TestCase.skipTest` / :func:`unittest.skip` in unittest test cases is fully supported. + .. note:: This deprecation has been reverted in pytest 7.1.0. + - `#8315 `_: Several behaviors of :meth:`Parser.addoption ` are now scheduled for removal in pytest 8 (deprecated since pytest 2.4.0): diff --git a/doc/en/deprecations.rst b/doc/en/deprecations.rst index 4eaa80e2f27..1210947159b 100644 --- a/doc/en/deprecations.rst +++ b/doc/en/deprecations.rst @@ -241,19 +241,6 @@ scheduled for removal in pytest 8 (deprecated since pytest 2.4.0): - ``parser.addoption(..., type="int/string/float/complex")`` - use ``type=int`` etc. instead. -Raising ``unittest.SkipTest`` during collection -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -.. deprecated:: 7.0 - -Raising :class:`unittest.SkipTest` to skip collection of tests during the -pytest collection phase is deprecated. Use :func:`pytest.skip` instead. - -Note: This deprecation only relates to using `unittest.SkipTest` during test -collection. You are probably not doing that. Ordinary usage of -:class:`unittest.SkipTest` / :meth:`unittest.TestCase.skipTest` / -:func:`unittest.skip` in unittest test cases is fully supported. - Using ``pytest.warns(None)`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/src/_pytest/deprecated.py b/src/_pytest/deprecated.py index 4534fbcab82..f2d79760ae7 100644 --- a/src/_pytest/deprecated.py +++ b/src/_pytest/deprecated.py @@ -47,11 +47,6 @@ # This deprecation is never really meant to be removed. PRIVATE = PytestDeprecationWarning("A private pytest class or function was used.") -UNITTEST_SKIP_DURING_COLLECTION = PytestRemovedIn8Warning( - "Raising unittest.SkipTest to skip tests during collection is deprecated. " - "Use pytest.skip() instead." -) - ARGUMENT_PERCENT_DEFAULT = PytestRemovedIn8Warning( 'pytest now uses argparse. "%default" should be changed to "%(default)s"', ) diff --git a/src/_pytest/runner.py b/src/_pytest/runner.py index e43dd2dc818..df6eecdb129 100644 --- a/src/_pytest/runner.py +++ b/src/_pytest/runner.py @@ -2,7 +2,6 @@ import bdb import os import sys -import warnings from typing import Callable from typing import cast from typing import Dict @@ -28,7 +27,6 @@ from _pytest.compat import final from _pytest.config.argparsing import Parser from _pytest.deprecated import check_ispytest -from _pytest.deprecated import UNITTEST_SKIP_DURING_COLLECTION from _pytest.nodes import Collector from _pytest.nodes import Item from _pytest.nodes import Node @@ -379,11 +377,6 @@ def pytest_make_collect_report(collector: Collector) -> CollectReport: # Type ignored because unittest is loaded dynamically. skip_exceptions.append(unittest.SkipTest) # type: ignore if isinstance(call.excinfo.value, tuple(skip_exceptions)): - if unittest is not None and isinstance( - call.excinfo.value, unittest.SkipTest # type: ignore[attr-defined] - ): - warnings.warn(UNITTEST_SKIP_DURING_COLLECTION, stacklevel=2) - outcome = "skipped" r_ = collector._repr_failure_py(call.excinfo, "line") assert isinstance(r_, ExceptionChainRepr), repr(r_) diff --git a/testing/deprecated_test.py b/testing/deprecated_test.py index 4104d19db9a..db649841abe 100644 --- a/testing/deprecated_test.py +++ b/testing/deprecated_test.py @@ -86,23 +86,6 @@ def __init__(self, foo: int, *, _ispytest: bool = False) -> None: PrivateInit(10, _ispytest=True) -def test_raising_unittest_skiptest_during_collection_is_deprecated( - pytester: Pytester, -) -> None: - pytester.makepyfile( - """ - import unittest - raise unittest.SkipTest() - """ - ) - result = pytester.runpytest() - result.stdout.fnmatch_lines( - [ - "*PytestRemovedIn8Warning: Raising unittest.SkipTest*", - ] - ) - - @pytest.mark.parametrize("hooktype", ["hook", "ihook"]) def test_hookproxy_warnings_for_pathlib(tmp_path, hooktype, request): path = legacy_path(tmp_path) diff --git a/testing/test_nose.py b/testing/test_nose.py index 1ded8854bb7..cab5a81a2b9 100644 --- a/testing/test_nose.py +++ b/testing/test_nose.py @@ -345,7 +345,7 @@ def test_failing(): """ ) result = pytester.runpytest(p) - result.assert_outcomes(skipped=1, warnings=1) + result.assert_outcomes(skipped=1, warnings=0) def test_SkipTest_in_test(pytester: Pytester) -> None: diff --git a/testing/test_unittest.py b/testing/test_unittest.py index 1601086d5b2..fb312814542 100644 --- a/testing/test_unittest.py +++ b/testing/test_unittest.py @@ -1498,3 +1498,30 @@ def test_it(self): assert passed == 1 assert failed == 1 assert reprec.ret == 1 + + +def test_raising_unittest_skiptest_during_collection( + pytester: Pytester, +) -> None: + pytester.makepyfile( + """ + import unittest + + class TestIt(unittest.TestCase): + def test_it(self): pass + def test_it2(self): pass + + raise unittest.SkipTest() + + class TestIt2(unittest.TestCase): + def test_it(self): pass + def test_it2(self): pass + """ + ) + reprec = pytester.inline_run() + passed, skipped, failed = reprec.countoutcomes() + assert passed == 0 + # Unittest reports one fake test for a skipped module. + assert skipped == 1 + assert failed == 0 + assert reprec.ret == ExitCode.NO_TESTS_COLLECTED From bcc826d0fbc60ac5b4e5ecc691db42abf5a616df Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Wed, 23 Feb 2022 19:03:13 -0300 Subject: [PATCH 158/176] Fix numbering and improve changelog entry for #9362 (#9713) --- changelog/9326.bugfix.rst | 1 - changelog/9362.improvement.rst | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 changelog/9326.bugfix.rst create mode 100644 changelog/9362.improvement.rst diff --git a/changelog/9326.bugfix.rst b/changelog/9326.bugfix.rst deleted file mode 100644 index 1aaa424d371..00000000000 --- a/changelog/9326.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Pytest will now avoid specialized assert formatting when it is detected that the default __eq__ is overridden diff --git a/changelog/9362.improvement.rst b/changelog/9362.improvement.rst new file mode 100644 index 00000000000..ad7f8042ca9 --- /dev/null +++ b/changelog/9362.improvement.rst @@ -0,0 +1 @@ +pytest now avoids specialized assert formatting when it is detected that the default ``__eq__`` is overridden in ``attrs`` or ``dataclasses``. From 5f3d94c47eb0f4487ef52ac520b3c48170220fc6 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Thu, 24 Feb 2022 10:16:35 -0300 Subject: [PATCH 159/176] Disallow unordered sequences in pytest.approx (#9709) Fix #9692 --- changelog/9692.improvement.rst | 3 +++ src/_pytest/python_api.py | 40 ++++++++++++++++++++++++---------- testing/python/approx.py | 20 ++++++++++++----- 3 files changed, 45 insertions(+), 18 deletions(-) create mode 100644 changelog/9692.improvement.rst diff --git a/changelog/9692.improvement.rst b/changelog/9692.improvement.rst new file mode 100644 index 00000000000..ecc57a68c22 --- /dev/null +++ b/changelog/9692.improvement.rst @@ -0,0 +1,3 @@ +:func:`pytest.approx` now raises a :class:`TypeError` when given an unordered sequence (such as :class:`set`). + +Note that this implies that custom classes which only implement ``__iter__`` and ``__len__`` are no longer supported as they don't guarantee order. diff --git a/src/_pytest/python_api.py b/src/_pytest/python_api.py index 9891946cd1e..ea646811ddf 100644 --- a/src/_pytest/python_api.py +++ b/src/_pytest/python_api.py @@ -1,5 +1,6 @@ import math import pprint +from collections.abc import Collection from collections.abc import Sized from decimal import Decimal from numbers import Complex @@ -8,7 +9,6 @@ from typing import Callable from typing import cast from typing import Generic -from typing import Iterable from typing import List from typing import Mapping from typing import Optional @@ -306,12 +306,12 @@ def _check_type(self) -> None: raise TypeError(msg.format(key, value, pprint.pformat(self.expected))) -class ApproxSequencelike(ApproxBase): +class ApproxSequenceLike(ApproxBase): """Perform approximate comparisons where the expected value is a sequence of numbers.""" def __repr__(self) -> str: seq_type = type(self.expected) - if seq_type not in (tuple, list, set): + if seq_type not in (tuple, list): seq_type = list return "approx({!r})".format( seq_type(self._approx_scalar(x) for x in self.expected) @@ -515,7 +515,7 @@ class ApproxDecimal(ApproxScalar): def approx(expected, rel=None, abs=None, nan_ok: bool = False) -> ApproxBase: - """Assert that two numbers (or two sets of numbers) are equal to each other + """Assert that two numbers (or two ordered sequences of numbers) are equal to each other within some tolerance. Due to the :std:doc:`tutorial/floatingpoint`, numbers that we @@ -547,16 +547,11 @@ def approx(expected, rel=None, abs=None, nan_ok: bool = False) -> ApproxBase: >>> 0.1 + 0.2 == approx(0.3) True - The same syntax also works for sequences of numbers:: + The same syntax also works for ordered sequences of numbers:: >>> (0.1 + 0.2, 0.2 + 0.4) == approx((0.3, 0.6)) True - Dictionary *values*:: - - >>> {'a': 0.1 + 0.2, 'b': 0.2 + 0.4} == approx({'a': 0.3, 'b': 0.6}) - True - ``numpy`` arrays:: >>> import numpy as np # doctest: +SKIP @@ -569,6 +564,20 @@ def approx(expected, rel=None, abs=None, nan_ok: bool = False) -> ApproxBase: >>> np.array([0.1, 0.2]) + np.array([0.2, 0.1]) == approx(0.3) # doctest: +SKIP True + Only ordered sequences are supported, because ``approx`` needs + to infer the relative position of the sequences without ambiguity. This means + ``sets`` and other unordered sequences are not supported. + + Finally, dictionary *values* can also be compared:: + + >>> {'a': 0.1 + 0.2, 'b': 0.2 + 0.4} == approx({'a': 0.3, 'b': 0.6}) + True + + The comparision will be true if both mappings have the same keys and their + respective values match the expected tolerances. + + **Tolerances** + By default, ``approx`` considers numbers within a relative tolerance of ``1e-6`` (i.e. one part in a million) of its expected value to be equal. This treatment would lead to surprising results if the expected value was @@ -708,12 +717,19 @@ def approx(expected, rel=None, abs=None, nan_ok: bool = False) -> ApproxBase: expected = _as_numpy_array(expected) cls = ApproxNumpy elif ( - isinstance(expected, Iterable) + hasattr(expected, "__getitem__") and isinstance(expected, Sized) # Type ignored because the error is wrong -- not unreachable. and not isinstance(expected, STRING_TYPES) # type: ignore[unreachable] ): - cls = ApproxSequencelike + cls = ApproxSequenceLike + elif ( + isinstance(expected, Collection) + # Type ignored because the error is wrong -- not unreachable. + and not isinstance(expected, STRING_TYPES) # type: ignore[unreachable] + ): + msg = f"pytest.approx() only supports ordered sequences, but got: {repr(expected)}" + raise TypeError(msg) else: cls = ApproxScalar diff --git a/testing/python/approx.py b/testing/python/approx.py index eb9bcd874c0..2eec4e9f7d0 100644 --- a/testing/python/approx.py +++ b/testing/python/approx.py @@ -858,13 +858,21 @@ def test_numpy_scalar_with_array(self): assert approx(expected, rel=5e-7, abs=0) == actual assert approx(expected, rel=5e-8, abs=0) != actual - def test_generic_sized_iterable_object(self): - class MySizedIterable: - def __iter__(self): - return iter([1, 2, 3, 4]) + def test_generic_ordered_sequence(self): + class MySequence: + def __getitem__(self, i): + return [1, 2, 3, 4][i] def __len__(self): return 4 - expected = MySizedIterable() - assert [1, 2, 3, 4] == approx(expected) + expected = MySequence() + assert [1, 2, 3, 4] == approx(expected, abs=1e-4) + + expected_repr = "approx([1 ± 1.0e-06, 2 ± 2.0e-06, 3 ± 3.0e-06, 4 ± 4.0e-06])" + assert repr(approx(expected)) == expected_repr + + def test_allow_ordered_sequences_only(self) -> None: + """pytest.approx() should raise an error on unordered sequences (#9692).""" + with pytest.raises(TypeError, match="only supports ordered sequences"): + assert {1, 2, 3} == approx({1, 2, 3}) From e466a87bb082ea5f7377f84038322e9bc8fba789 Mon Sep 17 00:00:00 2001 From: Kojo Idrissa Date: Fri, 25 Feb 2022 16:13:23 -0600 Subject: [PATCH 160/176] Add the latest book edition of 'Python Testing with pytest' --- AUTHORS | 1 + doc/en/talks.rst | 3 +++ 2 files changed, 4 insertions(+) diff --git a/AUTHORS b/AUTHORS index 9413f9c2e74..2b6ca66de7a 100644 --- a/AUTHORS +++ b/AUTHORS @@ -187,6 +187,7 @@ Kevin Cox Kevin J. Foley Kian-Meng Ang Kodi B. Arfer +Kojo Idrissa Kostis Anagnostopoulos Kristoffer Nordström Kyle Altendorf diff --git a/doc/en/talks.rst b/doc/en/talks.rst index 6843c82bab5..0b195960ab2 100644 --- a/doc/en/talks.rst +++ b/doc/en/talks.rst @@ -11,6 +11,9 @@ Books - `Python Testing with pytest, by Brian Okken (2017) `_. +- `Python Testing with pytest, Second Edition, by Brian Okken (2022) + `_. + Talks and blog postings --------------------------------------------- From 269611e0b43d374643a4b110c55aaee57d71d91a Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Mon, 28 Feb 2022 19:35:36 -0500 Subject: [PATCH 161/176] prevent import-time side-effects from setuptools bundled importlib-metadata --- testing/test_doctest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/test_doctest.py b/testing/test_doctest.py index 67b8ccdb7ec..1b4809240c0 100644 --- a/testing/test_doctest.py +++ b/testing/test_doctest.py @@ -803,8 +803,8 @@ def test_valid_setup_py(self, pytester: Pytester): """ p = pytester.makepyfile( setup=""" - from setuptools import setup, find_packages if __name__ == '__main__': + from setuptools import setup, find_packages setup(name='sample', version='0.0', description='description', From f943d1944a9ece4fc5b1b3a83046380fd2ff3fc4 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Fri, 25 Feb 2022 08:15:11 -0300 Subject: [PATCH 162/176] pytester now requests monkeypatch instead of creating its own instance It is tempting to use `monkeypatch` to replace the other mechanisms in pytester which change global state: `CwdSnapshot`, `SysModulesSnapshot`, `SysPathsSnapshot`, however those are more delicate than they look at first glance so leaving those alone for now. Close #9708 --- changelog/9708.bugfix.rst | 1 + src/_pytest/pytester.py | 10 ++++++---- testing/test_pytester.py | 7 +------ 3 files changed, 8 insertions(+), 10 deletions(-) create mode 100644 changelog/9708.bugfix.rst diff --git a/changelog/9708.bugfix.rst b/changelog/9708.bugfix.rst new file mode 100644 index 00000000000..9defbbd578f --- /dev/null +++ b/changelog/9708.bugfix.rst @@ -0,0 +1 @@ +:fixture:`pytester` now requests a :fixture:`monkeypatch` fixture instead of creating one internally. This solves some issues with tests that involve pytest environment variables. diff --git a/src/_pytest/pytester.py b/src/_pytest/pytester.py index 933d7d35759..8368f944122 100644 --- a/src/_pytest/pytester.py +++ b/src/_pytest/pytester.py @@ -477,7 +477,9 @@ def LineMatcher_fixture(request: FixtureRequest) -> Type["LineMatcher"]: @fixture -def pytester(request: FixtureRequest, tmp_path_factory: TempPathFactory) -> "Pytester": +def pytester( + request: FixtureRequest, tmp_path_factory: TempPathFactory, monkeypatch: MonkeyPatch +) -> "Pytester": """ Facilities to write tests/configuration files, execute pytest in isolation, and match against expected output, perfect for black-box testing of pytest plugins. @@ -488,7 +490,7 @@ def pytester(request: FixtureRequest, tmp_path_factory: TempPathFactory) -> "Pyt It is particularly useful for testing plugins. It is similar to the :fixture:`tmp_path` fixture but provides methods which aid in testing pytest itself. """ - return Pytester(request, tmp_path_factory, _ispytest=True) + return Pytester(request, tmp_path_factory, monkeypatch, _ispytest=True) @fixture @@ -683,6 +685,7 @@ def __init__( self, request: FixtureRequest, tmp_path_factory: TempPathFactory, + monkeypatch: MonkeyPatch, *, _ispytest: bool = False, ) -> None: @@ -706,7 +709,7 @@ def __init__( self._method = self._request.config.getoption("--runpytest") self._test_tmproot = tmp_path_factory.mktemp(f"tmp-{name}", numbered=True) - self._monkeypatch = mp = MonkeyPatch() + self._monkeypatch = mp = monkeypatch mp.setenv("PYTEST_DEBUG_TEMPROOT", str(self._test_tmproot)) # Ensure no unexpected caching via tox. mp.delenv("TOX_ENV_DIR", raising=False) @@ -738,7 +741,6 @@ def _finalize(self) -> None: self._sys_modules_snapshot.restore() self._sys_path_snapshot.restore() self._cwd_snapshot.restore() - self._monkeypatch.undo() def __take_sys_modules_snapshot(self) -> SysModulesSnapshot: # Some zope modules used by twisted-related tests keep internal state diff --git a/testing/test_pytester.py b/testing/test_pytester.py index 049f8b22d81..62dad98589d 100644 --- a/testing/test_pytester.py +++ b/testing/test_pytester.py @@ -618,14 +618,9 @@ def test_linematcher_string_api() -> None: def test_pytest_addopts_before_pytester(request, monkeypatch: MonkeyPatch) -> None: - orig = os.environ.get("PYTEST_ADDOPTS", None) monkeypatch.setenv("PYTEST_ADDOPTS", "--orig-unused") - pytester: Pytester = request.getfixturevalue("pytester") + _: Pytester = request.getfixturevalue("pytester") assert "PYTEST_ADDOPTS" not in os.environ - pytester._finalize() - assert os.environ.get("PYTEST_ADDOPTS") == "--orig-unused" - monkeypatch.undo() - assert os.environ.get("PYTEST_ADDOPTS") == orig def test_run_stdin(pytester: Pytester) -> None: From cf0a4f79b070190dd07d690418a5a2a930701dfa Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 4 Mar 2022 12:56:11 -0300 Subject: [PATCH 163/176] [automated] Update plugin list (#9717) Co-authored-by: pytest bot --- doc/en/reference/plugin_list.rst | 202 +++++++++++++++++-------------- 1 file changed, 113 insertions(+), 89 deletions(-) diff --git a/doc/en/reference/plugin_list.rst b/doc/en/reference/plugin_list.rst index 938246fabc0..e36f21c6750 100644 --- a/doc/en/reference/plugin_list.rst +++ b/doc/en/reference/plugin_list.rst @@ -11,7 +11,7 @@ automatically. Packages classified as inactive are excluded. creating a PDF, because otherwise the table gets far too wide for the page. -This list contains 1000 plugins. +This list contains 1003 plugins. .. only:: not latex @@ -19,7 +19,7 @@ This list contains 1000 plugins. name summary last release status requires =============================================== ======================================================================================================================================================================== ============== ===================== ================================================ :pypi:`pytest-accept` A pytest-plugin for updating doctest outputs Jan 07, 2022 N/A pytest (>=6,<8) - :pypi:`pytest-adaptavist` pytest plugin for generating test execution results within Jira Test Management (tm4j) Feb 14, 2022 N/A pytest (>=5.4.0) + :pypi:`pytest-adaptavist` pytest plugin for generating test execution results within Jira Test Management (tm4j) Feb 22, 2022 N/A pytest (>=5.4.0) :pypi:`pytest-addons-test` 用于测试pytest的插件 Aug 02, 2021 N/A pytest (>=6.2.4,<7.0.0) :pypi:`pytest-adf` Pytest plugin for writing Azure Data Factory integration tests May 10, 2021 4 - Beta pytest (>=3.5.0) :pypi:`pytest-adf-azure-identity` Pytest plugin for writing Azure Data Factory integration tests Mar 06, 2021 4 - Beta pytest (>=3.5.0) @@ -29,7 +29,7 @@ This list contains 1000 plugins. :pypi:`pytest-aiofiles` pytest fixtures for writing aiofiles tests with pyfakefs May 14, 2017 5 - Production/Stable N/A :pypi:`pytest-aiohttp` Pytest plugin for aiohttp support Feb 12, 2022 4 - Beta pytest (>=6.1.0) :pypi:`pytest-aiohttp-client` Pytest \`client\` fixture for the Aiohttp Nov 01, 2020 N/A pytest (>=6) - :pypi:`pytest-aiomoto` pytest-aiomoto Dec 10, 2021 N/A pytest (>=6.2.5,<7.0.0) + :pypi:`pytest-aiomoto` pytest-aiomoto Feb 24, 2022 N/A pytest (>=6.2.5,<7.0.0) :pypi:`pytest-aioresponses` py.test integration for aioresponses Jul 29, 2021 4 - Beta pytest (>=3.5.0) :pypi:`pytest-aioworkers` A plugin to test aioworkers project with pytest Dec 04, 2019 4 - Beta pytest (>=3.5.0) :pypi:`pytest-airflow` pytest support for airflow. Apr 03, 2019 3 - Alpha pytest (>=4.4.0) @@ -38,6 +38,7 @@ This list contains 1000 plugins. :pypi:`pytest-allclose` Pytest fixture extending Numpy's allclose function Jul 30, 2019 5 - Production/Stable pytest :pypi:`pytest-allure-adaptor` Plugin for py.test to generate allure xml reports Jan 10, 2018 N/A pytest (>=2.7.3) :pypi:`pytest-allure-adaptor2` Plugin for py.test to generate allure xml reports Oct 14, 2020 N/A pytest (>=2.7.3) + :pypi:`pytest-allure-collection` pytest plugin to collect allure markers without running any tests Feb 21, 2022 N/A pytest :pypi:`pytest-allure-dsl` pytest plugin to test case doc string dls instructions Oct 25, 2020 4 - Beta pytest :pypi:`pytest-allure-spec-coverage` The pytest plugin aimed to display test coverage of the specs(requirements) in Allure Oct 26, 2021 N/A pytest :pypi:`pytest-alphamoon` Static code checks used at Alphamoon Dec 30, 2021 5 - Production/Stable pytest (>=3.5.0) @@ -106,7 +107,7 @@ This list contains 1000 plugins. :pypi:`pytest-blockage` Disable network requests during a test run. Dec 21, 2021 N/A pytest :pypi:`pytest-blocker` pytest plugin to mark a test as blocker and skip all other tests Sep 07, 2015 4 - Beta N/A :pypi:`pytest-board` Local continuous test runner with pytest and watchdog. Jan 20, 2019 N/A N/A - :pypi:`pytest-bootstrap` Feb 19, 2022 N/A N/A + :pypi:`pytest-bootstrap` Feb 23, 2022 N/A N/A :pypi:`pytest-bpdb` A py.test plug-in to enable drop to bpdb debugger on test failure. Jan 19, 2015 2 - Pre-Alpha N/A :pypi:`pytest-bravado` Pytest-bravado automatically generates from OpenAPI specification client fixtures. Feb 15, 2022 N/A N/A :pypi:`pytest-breakword` Use breakword with pytest Aug 04, 2021 N/A pytest (>=6.2.4,<7.0.0) @@ -165,7 +166,7 @@ This list contains 1000 plugins. :pypi:`pytest-concurrent` Concurrently execute test cases with multithread, multiprocess and gevent Jan 12, 2019 4 - Beta pytest (>=3.1.1) :pypi:`pytest-config` Base configurations and utilities for developing your Python project test suite with pytest. Nov 07, 2014 5 - Production/Stable N/A :pypi:`pytest-confluence-report` Package stands for pytest plugin to upload results into Confluence page. Nov 06, 2020 N/A N/A - :pypi:`pytest-console-scripts` Pytest plugin for testing console scripts Jan 06, 2022 4 - Beta N/A + :pypi:`pytest-console-scripts` Pytest plugin for testing console scripts Feb 23, 2022 4 - Beta N/A :pypi:`pytest-consul` pytest plugin with fixtures for testing consul aware apps Nov 24, 2018 3 - Alpha pytest :pypi:`pytest-container` Pytest fixtures for writing container based tests Feb 01, 2022 3 - Alpha pytest (>=3.10) :pypi:`pytest-contextfixture` Define pytest fixtures as context managers. Mar 12, 2013 4 - Beta N/A @@ -227,6 +228,7 @@ This list contains 1000 plugins. :pypi:`pytest-dicom` pytest plugin to provide DICOM fixtures Dec 19, 2018 3 - Alpha pytest :pypi:`pytest-dictsdiff` Jul 26, 2019 N/A N/A :pypi:`pytest-diff` A simple plugin to use with pytest Mar 30, 2019 4 - Beta pytest (>=3.5.0) + :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-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. Feb 12, 2022 4 - Beta pytest (!=6.0.0,<8,>=3.3.2) @@ -272,8 +274,7 @@ This list contains 1000 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. Dec 09, 2021 3 - Alpha pytest (>=4.6) - :pypi:`pytest-doctest-ufunc` A plugin to run doctests in docstrings of Numpy ufuncs Aug 02, 2020 4 - Beta pytest (>=3.5.0) + :pypi:`pytest-doctestplus` Pytest plugin with advanced doctest features. Feb 25, 2022 3 - Alpha pytest (>=4.6) :pypi:`pytest-dolphin` Some extra stuff that we use ininternally Nov 30, 2016 4 - Beta pytest (==3.0.4) :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) @@ -297,14 +298,14 @@ This list contains 1000 plugins. :pypi:`pytest-elements` Tool to help automate user interfaces Jan 13, 2021 N/A pytest (>=5.4,<6.0) :pypi:`pytest-elk-reporter` A simple plugin to use with pytest Jan 24, 2021 4 - Beta pytest (>=3.5.0) :pypi:`pytest-email` Send execution result email Jul 08, 2020 N/A pytest - :pypi:`pytest-embedded` pytest embedded plugin Jan 21, 2022 N/A pytest (>=6.2.0) - :pypi:`pytest-embedded-arduino` pytest embedded plugin for Arduino projects Jan 21, 2022 N/A N/A - :pypi:`pytest-embedded-idf` pytest embedded plugin for esp-idf project Jan 21, 2022 N/A N/A - :pypi:`pytest-embedded-jtag` pytest embedded plugin for testing with jtag Jan 21, 2022 N/A N/A - :pypi:`pytest-embedded-qemu` pytest embedded plugin for qemu, not target chip Jan 21, 2022 N/A N/A + :pypi:`pytest-embedded` pytest embedded plugin Feb 22, 2022 N/A pytest (>=6.2.0) + :pypi:`pytest-embedded-arduino` pytest embedded plugin for Arduino projects Feb 22, 2022 N/A N/A + :pypi:`pytest-embedded-idf` pytest embedded plugin for esp-idf project Feb 22, 2022 N/A N/A + :pypi:`pytest-embedded-jtag` pytest embedded plugin for testing with jtag Feb 22, 2022 N/A N/A + :pypi:`pytest-embedded-qemu` pytest embedded plugin for qemu, not target chip Feb 22, 2022 N/A N/A :pypi:`pytest-embedded-qemu-idf` pytest embedded plugin for esp-idf project by qemu, not target chip Jun 29, 2021 N/A N/A - :pypi:`pytest-embedded-serial` pytest embedded plugin for testing serial ports Jan 21, 2022 N/A N/A - :pypi:`pytest-embedded-serial-esp` pytest embedded plugin for testing espressif boards via serial ports Jan 21, 2022 N/A N/A + :pypi:`pytest-embedded-serial` pytest embedded plugin for testing serial ports Feb 22, 2022 N/A N/A + :pypi:`pytest-embedded-serial-esp` pytest embedded plugin for testing espressif boards via serial ports Feb 22, 2022 N/A N/A :pypi:`pytest-emoji` A pytest plugin that adds emojis to your test result report Feb 19, 2019 4 - Beta pytest (>=4.2.1) :pypi:`pytest-emoji-output` Pytest plugin to represent test output with emoji support Oct 10, 2021 4 - Beta pytest (==6.0.1) :pypi:`pytest-enabler` Enable installed pytest plugins Nov 08, 2021 5 - Production/Stable pytest (>=6) ; extra == 'testing' @@ -333,7 +334,7 @@ This list contains 1000 plugins. :pypi:`pytest-expectr` This plugin is used to expect multiple assert using pytest framework. Oct 05, 2018 N/A pytest (>=2.4.2) :pypi:`pytest-experiments` A pytest plugin to help developers of research-oriented software projects keep track of the results of their numerical experiments. Dec 13, 2021 4 - Beta pytest (>=6.2.5,<7.0.0) :pypi:`pytest-explicit` A Pytest plugin to ignore certain marked tests by default Jun 15, 2021 5 - Production/Stable pytest - :pypi:`pytest-exploratory` Interactive console for pytest. Aug 03, 2021 N/A pytest (>=5.3) + :pypi:`pytest-exploratory` Interactive console for pytest. Feb 21, 2022 N/A pytest (>=6.2) :pypi:`pytest-external-blockers` a special outcome for tests that are blocked for external reasons Oct 05, 2021 N/A pytest :pypi:`pytest-extra-durations` A pytest plugin to get durations on a per-function basis and per module basis. Apr 21, 2020 4 - Beta pytest (>=3.5.0) :pypi:`pytest-fabric` Provides test utilities to run fabric task tests by using docker containers Sep 12, 2018 5 - Production/Stable N/A @@ -366,12 +367,13 @@ This list contains 1000 plugins. :pypi:`pytest-fixture-maker` Pytest plugin to load fixtures from YAML files Sep 21, 2021 N/A N/A :pypi:`pytest-fixture-marker` A pytest plugin to add markers based on fixtures used. Oct 11, 2020 5 - Production/Stable N/A :pypi:`pytest-fixture-order` pytest plugin to control fixture evaluation order Aug 25, 2020 N/A pytest (>=3.0) + :pypi:`pytest-fixture-rtttg` Warn or fail on fixture name clash Feb 23, 2022 N/A pytest (>=7.0.1,<8.0.0) :pypi:`pytest-fixtures` Common fixtures for pytest May 01, 2019 5 - Production/Stable N/A :pypi:`pytest-fixture-tools` Plugin for pytest which provides tools for fixtures Aug 18, 2020 6 - Mature pytest :pypi:`pytest-fixture-typecheck` A pytest plugin to assert type annotations at runtime. Aug 24, 2021 N/A pytest :pypi:`pytest-flake8` pytest plugin to check FLAKE8 requirements Dec 16, 2020 4 - Beta pytest (>=3.5) :pypi:`pytest-flake8-path` A pytest fixture for testing flake8 plugins. Jan 10, 2022 5 - Production/Stable pytest - :pypi:`pytest-flake8-v2` pytest plugin to check FLAKE8 requirements Feb 16, 2022 4 - Beta pytest (>=7.0) + :pypi:`pytest-flake8-v2` pytest plugin to check FLAKE8 requirements Feb 24, 2022 4 - Beta pytest (>=7.0) :pypi:`pytest-flakefinder` Runs tests multiple times to expose flakiness. Jul 28, 2020 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 @@ -380,7 +382,7 @@ This list contains 1000 plugins. :pypi:`pytest-flask-sqlalchemy-transactions` Run tests in transactions using pytest, Flask, and SQLalchemy. Aug 02, 2018 4 - Beta pytest (>=3.2.1) :pypi:`pytest-flyte` Pytest fixtures for simplifying Flyte integration testing May 03, 2021 N/A pytest :pypi:`pytest-focus` A pytest plugin that alerts user of failed test cases with screen notifications May 04, 2019 4 - Beta pytest - :pypi:`pytest-fold` Fold console output and drop user into interactive text user interface Feb 19, 2022 3 - Alpha pytest (>=6.2.5) + :pypi:`pytest-fold` Fold console output and drop user into interactive text user interface Feb 20, 2022 4 - Beta pytest (>=6.2.5) :pypi:`pytest-forcefail` py.test plugin to make the test failing regardless of pytest.mark.xfail May 15, 2018 4 - Beta N/A :pypi:`pytest-forward-compatability` A name to avoid typosquating pytest-foward-compatibility Sep 06, 2020 N/A N/A :pypi:`pytest-forward-compatibility` A pytest plugin to shim pytest commandline options for fowards compatibility Sep 29, 2020 N/A N/A @@ -397,7 +399,7 @@ This list contains 1000 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. Jan 10, 2022 N/A N/A + :pypi:`pytest-girder` A set of pytest fixtures for testing Girder applications. Feb 26, 2022 N/A N/A :pypi:`pytest-git` Git repository fixture for py.test May 28, 2019 5 - Production/Stable pytest :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 @@ -422,20 +424,21 @@ This list contains 1000 plugins. :pypi:`pytest-historic` Custom report to display pytest historical execution records Apr 08, 2020 N/A pytest :pypi:`pytest-historic-hook` Custom listener to store execution results into MYSQL DB, which is used for pytest-historic report Apr 08, 2020 N/A pytest :pypi:`pytest-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 Feb 19, 2022 3 - Alpha pytest (==6.2.5) + :pypi:`pytest-homeassistant-custom-component` Experimental package to automatically extract test plugins for Home Assistant custom components Feb 26, 2022 3 - Alpha pytest (==7.0.1) :pypi:`pytest-honey` A simple plugin to use with pytest Jan 07, 2022 4 - Beta pytest (>=3.5.0) :pypi:`pytest-honors` Report on tests that honor constraints, and guard against regressions Mar 06, 2020 4 - Beta N/A :pypi:`pytest-hoverfly` Simplify working with Hoverfly from pytest Jan 20, 2022 N/A pytest (>=5.0) - :pypi:`pytest-hoverfly-wrapper` Integrates the Hoverfly HTTP proxy into Pytest Aug 29, 2021 4 - Beta N/A + :pypi:`pytest-hoverfly-wrapper` Integrates the Hoverfly HTTP proxy into Pytest Feb 22, 2022 5 - Production/Stable N/A :pypi:`pytest-hpfeeds` Helpers for testing hpfeeds in your python project Aug 27, 2021 4 - Beta pytest (>=6.2.4,<7.0.0) :pypi:`pytest-html` pytest plugin for generating HTML reports Dec 13, 2020 5 - Production/Stable pytest (!=6.0.0,>=5.0) :pypi:`pytest-html-lee` optimized pytest plugin for generating HTML reports Jun 30, 2020 5 - Production/Stable pytest (>=5.0) - :pypi:`pytest-html-object-storage` Pytest report plugin for send HTML report on object-storage Feb 06, 2022 5 - Production/Stable N/A + :pypi:`pytest-html-merger` Pytest HTML reports merging utility Feb 22, 2022 N/A N/A + :pypi:`pytest-html-object-storage` Pytest report plugin for send HTML report on object-storage Feb 23, 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-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 Dec 25, 2021 5 - Production/Stable N/A + :pypi:`pytest-httpbin` Easily test your HTTP library against a local copy of httpbin Feb 25, 2022 5 - Production/Stable pytest ; extra == 'test' :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 Jan 27, 2022 3 - Alpha N/A @@ -477,7 +480,7 @@ This list contains 1000 plugins. :pypi:`pytest-jasmine` Run jasmine tests from your pytest test suite Nov 04, 2017 1 - Planning N/A :pypi:`pytest-jest` A custom jest-pytest oriented Pytest reporter May 22, 2018 4 - Beta pytest (>=3.3.2) :pypi:`pytest-jira` py.test JIRA integration plugin, using markers Dec 02, 2021 3 - Alpha N/A - :pypi:`pytest-jira-xray` pytest plugin to integrate tests with JIRA XRAY Feb 17, 2022 3 - Alpha pytest + :pypi:`pytest-jira-xray` pytest plugin to integrate tests with JIRA XRAY Feb 26, 2022 3 - Alpha pytest :pypi:`pytest-jobserver` Limit parallel tests with posix jobserver. May 15, 2019 5 - Production/Stable pytest :pypi:`pytest-joke` Test failures are better served with humor. Oct 08, 2019 4 - Beta pytest (>=4.2.1) :pypi:`pytest-json` Generate JSON test reports Jan 18, 2016 4 - Beta N/A @@ -499,7 +502,7 @@ This list contains 1000 plugins. :pypi:`pytest-leaks` A pytest plugin to trace resource leaks. Nov 27, 2019 1 - Planning N/A :pypi:`pytest-level` Select tests of a given level or lower Oct 21, 2019 N/A pytest :pypi:`pytest-libfaketime` A python-libfaketime plugin for pytest. Dec 22, 2018 4 - Beta pytest (>=3.0.0) - :pypi:`pytest-libiio` A pytest plugin to manage interfacing with libiio contexts Dec 15, 2021 4 - Beta N/A + :pypi:`pytest-libiio` A pytest plugin to manage interfacing with libiio contexts Feb 23, 2022 4 - Beta N/A :pypi:`pytest-libnotify` Pytest plugin that shows notifications about the test run Apr 02, 2021 3 - Alpha pytest :pypi:`pytest-ligo` Jan 16, 2020 4 - Beta N/A :pypi:`pytest-lineno` A pytest plugin to show the line numbers of test functions Dec 04, 2020 N/A pytest @@ -552,7 +555,7 @@ This list contains 1000 plugins. :pypi:`pytest-mock-helper` Help you mock HTTP call and generate mock code Jan 24, 2018 N/A pytest :pypi:`pytest-mockito` Base fixtures for mockito Jul 11, 2018 4 - Beta N/A :pypi:`pytest-mockredis` An in-memory mock of a Redis server that runs in a separate thread. This is to be used for unit-tests that require a Redis database. Jan 02, 2018 2 - Pre-Alpha N/A - :pypi:`pytest-mock-resources` A pytest plugin for easily instantiating reproducible mock resources. Feb 17, 2022 N/A pytest (>=1.0) + :pypi:`pytest-mock-resources` A pytest plugin for easily instantiating reproducible mock resources. Feb 26, 2022 N/A pytest (>=1.0) :pypi:`pytest-mock-server` Mock server plugin for pytest Jan 09, 2022 4 - Beta pytest (>=3.5.0) :pypi:`pytest-mockservers` A set of fixtures to test your requests to HTTP/UDP servers Mar 31, 2020 N/A pytest (>=4.3.0) :pypi:`pytest-modified-env` Pytest plugin to fail a test if it leaves modified \`os.environ\` afterwards. Jan 29, 2022 4 - Beta N/A @@ -609,7 +612,7 @@ This list contains 1000 plugins. :pypi:`pytest-only` Use @pytest.mark.only to run a single test Jan 19, 2020 N/A 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-opentmi` pytest plugin for publish results to opentmi Jan 19, 2022 5 - Production/Stable pytest (>=5.0) + :pypi:`pytest-opentmi` pytest plugin for publish results to opentmi Feb 25, 2022 5 - Production/Stable pytest (>=5.0) :pypi:`pytest-operator` Fixtures for Operators Feb 14, 2022 N/A N/A :pypi:`pytest-optional` include/exclude values of fixtures in pytest Oct 07, 2015 N/A N/A :pypi:`pytest-optional-tests` Easy declaration of optional tests (i.e., that are not run by default) Jul 09, 2019 4 - Beta pytest (>=4.5.0) @@ -680,7 +683,7 @@ This list contains 1000 plugins. :pypi:`pytest-profiling` Profiling plugin for py.test May 28, 2019 5 - Production/Stable pytest :pypi:`pytest-progress` pytest plugin for instant test progress status Jan 31, 2022 5 - Production/Stable N/A :pypi:`pytest-prometheus` Report test pass / failures to a Prometheus PushGateway Oct 03, 2017 N/A N/A - :pypi:`pytest-prometheus-pushgateway` Pytest report plugin for Zulip Jan 31, 2022 5 - Production/Stable pytest + :pypi:`pytest-prometheus-pushgateway` Pytest report plugin for Zulip Feb 23, 2022 5 - Production/Stable pytest :pypi:`pytest-prosper` Test helpers for Prosper projects Sep 24, 2018 N/A N/A :pypi:`pytest-pspec` A rspec format reporter for Python ptest Jun 02, 2020 4 - Beta pytest (>=3.0.0) :pypi:`pytest-psqlgraph` pytest plugin for testing applications that use psqlgraph Oct 19, 2021 4 - Beta pytest (>=6.0) @@ -715,7 +718,7 @@ This list contains 1000 plugins. :pypi:`pytest-race` Race conditions tester for pytest Nov 21, 2016 4 - Beta N/A :pypi:`pytest-rage` pytest plugin to implement PEP712 Oct 21, 2011 3 - Alpha N/A :pypi:`pytest-rail` pytest plugin for creating TestRail runs and adding results Feb 04, 2022 N/A pytest (>=3.6) - :pypi:`pytest-railflow-testrail-reporter` Generate json reports along with specified metadata defined in test markers. Dec 02, 2021 5 - Production/Stable pytest + :pypi:`pytest-railflow-testrail-reporter` Generate json reports along with specified metadata defined in test markers. Feb 25, 2022 5 - Production/Stable pytest :pypi:`pytest-raises` An implementation of pytest.raises as a pytest.mark fixture Apr 23, 2020 N/A pytest (>=3.2.2) :pypi:`pytest-raisesregexp` Simple pytest plugin to look for regex in Exceptions Dec 18, 2015 N/A N/A :pypi:`pytest-raisin` Plugin enabling the use of exception instances with pytest.raises Feb 06, 2022 N/A pytest @@ -725,7 +728,7 @@ This list contains 1000 plugins. :pypi:`pytest-random-num` Randomise the order in which pytest tests are run with some control over the randomness Oct 19, 2020 5 - Production/Stable N/A :pypi:`pytest-random-order` Randomise the order in which pytest tests are run with some control over the randomness Nov 30, 2018 5 - Production/Stable pytest (>=3.0.0) :pypi:`pytest-readme` Test your README.md file Dec 28, 2014 5 - Production/Stable N/A - :pypi:`pytest-reana` Pytest fixtures for REANA. Jan 05, 2022 3 - Alpha N/A + :pypi:`pytest-reana` Pytest fixtures for REANA. Feb 26, 2022 3 - Alpha N/A :pypi:`pytest-recording` A pytest plugin that allows you recording of network interactions via VCR.py Jul 08, 2021 4 - Beta pytest (>=3.5.0) :pypi:`pytest-recordings` Provides pytest plugins for reporting request/response traffic, screenshots, and more to ReportPortal Aug 13, 2020 N/A N/A :pypi:`pytest-redis` Redis fixtures and fixture factories for Pytest. Feb 10, 2022 5 - Production/Stable pytest (>=6.2.0) @@ -753,7 +756,7 @@ This list contains 1000 plugins. :pypi:`pytest-reportlog` Replacement for the --resultlog option, focused in simplicity and extensibility Dec 11, 2020 3 - Alpha pytest (>=5.2) :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 Jan 11, 2022 N/A pytest (>=3.8.0) + :pypi:`pytest-reportportal` Agent for Reporting results of tests to the Report Portal Feb 22, 2022 N/A pytest (>=3.8.0) :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-requires` A pytest plugin to elegantly skip tests with optional requirements Dec 21, 2021 4 - Beta pytest (>=3.5.0) @@ -780,7 +783,7 @@ This list contains 1000 plugins. :pypi:`pytest-rts` Coverage-based regression test selection (RTS) plugin for pytest May 17, 2021 N/A pytest :pypi:`pytest-run-changed` Pytest plugin that runs changed tests only Apr 02, 2021 3 - Alpha pytest :pypi:`pytest-runfailed` implement a --failed option for pytest Mar 24, 2016 N/A N/A - :pypi:`pytest-runner` Invoke py.test as distutils command with dependency resolution May 19, 2021 5 - Production/Stable pytest (>=4.6) ; extra == 'testing' + :pypi:`pytest-runner` Invoke py.test as distutils command with dependency resolution Feb 25, 2022 5 - Production/Stable pytest (>=6) ; extra == 'testing' :pypi:`pytest-runtime-xfail` Call runtime_xfail() to mark running test as xfail. Aug 26, 2021 N/A N/A :pypi:`pytest-salt` Pytest Salt Plugin Jan 27, 2020 4 - Beta N/A :pypi:`pytest-salt-containers` A Pytest plugin that builds and creates docker containers Nov 09, 2016 4 - Beta N/A @@ -790,13 +793,13 @@ This list contains 1000 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. Feb 15, 2022 5 - Production/Stable N/A + :pypi:`pytest-sbase` A complete web automation framework for end-to-end testing. Feb 25, 2022 5 - Production/Stable N/A :pypi:`pytest-scenario` pytest plugin for test scenarios Feb 06, 2017 3 - Alpha N/A :pypi:`pytest-schema` 👍 Validate return values against a schema-like object in testing Aug 31, 2020 5 - Production/Stable pytest (>=3.5.0) :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 Sep 19, 2020 5 - Production/Stable pytest (>=5.0.0) - :pypi:`pytest-seleniumbase` A complete web automation framework for end-to-end testing. Feb 15, 2022 5 - Production/Stable N/A + :pypi:`pytest-seleniumbase` A complete web automation framework for end-to-end testing. Feb 25, 2022 5 - Production/Stable N/A :pypi:`pytest-selenium-enhancer` pytest plugin for Selenium Dec 16, 2021 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-send-email` Send pytest execution result email Dec 04, 2019 N/A N/A @@ -810,7 +813,7 @@ This list contains 1000 plugins. :pypi:`pytest-sftpserver` py.test plugin to locally test sftp server connections. Sep 16, 2019 4 - Beta N/A :pypi:`pytest-shard` Dec 11, 2020 4 - Beta pytest :pypi:`pytest-shell` A pytest plugin to help with testing shell scripts / black box commands Nov 07, 2021 N/A N/A - :pypi:`pytest-shell-utilities` Pytest plugin to simplify running shell commands against the system Feb 17, 2022 4 - Beta pytest (>=6.0.0) + :pypi:`pytest-shell-utilities` Pytest plugin to simplify running shell commands against the system Feb 21, 2022 4 - Beta pytest (>=6.0.0) :pypi:`pytest-sheraf` Versatile ZODB abstraction layer - pytest fixtures Feb 11, 2020 N/A pytest :pypi:`pytest-sherlock` pytest plugin help to find coupled tests Nov 18, 2021 5 - Production/Stable pytest (>=3.5.1) :pypi:`pytest-shortcuts` Expand command-line shortcuts listed in pytest configuration Oct 29, 2020 4 - Beta pytest (>=3.5.0) @@ -819,7 +822,7 @@ This list contains 1000 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 Feb 16, 2022 5 - Production/Stable pytest (>=6.0.0) + :pypi:`pytest-skip-markers` Pytest Salt Plugin Feb 22, 2022 5 - Production/Stable pytest (>=6.0.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. Sep 28, 2021 N/A N/A @@ -838,7 +841,7 @@ This list contains 1000 plugins. :pypi:`pytest-solidity` A PyTest library plugin for Solidity language. Jan 15, 2022 1 - Planning pytest (<7,>=6.0.1) ; extra == 'tests' :pypi:`pytest-solr` Solr process and client fixtures for py.test. May 11, 2020 3 - Alpha pytest (>=3.0.0) :pypi:`pytest-sorter` A simple plugin to first execute tests that historically failed more Apr 20, 2021 4 - Beta pytest (>=3.1.1) - :pypi:`pytest-sosu` Unofficial PyTest plugin for Sauce Labs Feb 17, 2022 2 - Pre-Alpha pytest + :pypi:`pytest-sosu` Unofficial PyTest plugin for Sauce Labs Feb 21, 2022 2 - Pre-Alpha pytest :pypi:`pytest-sourceorder` Test-ordering plugin for pytest Sep 01, 2021 4 - Beta pytest :pypi:`pytest-spark` pytest plugin to run the tests with support of pyspark. Feb 23, 2020 4 - Beta pytest :pypi:`pytest-spawner` py.test plugin to spawn process and communicate with them. Jul 31, 2015 4 - Beta N/A @@ -857,7 +860,7 @@ This list contains 1000 plugins. :pypi:`pytest-sqitch` sqitch for pytest Apr 06, 2020 4 - Beta N/A :pypi:`pytest-sqlalchemy` pytest plugin with sqlalchemy related fixtures Mar 13, 2018 3 - Alpha N/A :pypi:`pytest-sql-bigquery` Yet another SQL-testing framework for BigQuery provided by pytest plugin Dec 19, 2019 N/A pytest - :pypi:`pytest-squadcast` Pytest report plugin for Squadcast Feb 18, 2022 5 - Production/Stable pytest + :pypi:`pytest-squadcast` Pytest report plugin for Squadcast Feb 22, 2022 5 - Production/Stable pytest :pypi:`pytest-srcpaths` Add paths to sys.path Oct 15, 2021 N/A N/A :pypi:`pytest-ssh` pytest plugin for ssh command run May 27, 2019 N/A pytest :pypi:`pytest-start-from` Start pytest run from a given point Apr 11, 2016 N/A N/A @@ -896,7 +899,7 @@ This list contains 1000 plugins. :pypi:`pytest-terraform-fixture` generate terraform resources to use with pytest Nov 14, 2018 4 - Beta N/A :pypi:`pytest-testbook` A plugin to run tests written in Jupyter notebook Dec 11, 2016 3 - Alpha N/A :pypi:`pytest-testconfig` Test configuration plugin for pytest. Jan 11, 2020 4 - Beta pytest (>=3.5.0) - :pypi:`pytest-testdirectory` A py.test plugin providing temporary directories in unit tests. Nov 06, 2018 5 - Production/Stable pytest + :pypi:`pytest-testdirectory` A py.test plugin providing temporary directories in unit tests. Feb 21, 2022 5 - Production/Stable pytest :pypi:`pytest-testdox` A testdox format reporter for pytest Dec 05, 2021 5 - Production/Stable pytest (>=4.6.0) :pypi:`pytest-test-groups` A Pytest plugin for running a subset of your tests by splitting them in to equally sized groups. Oct 25, 2016 5 - Production/Stable N/A :pypi:`pytest-testinfra` Test infrastructures Feb 10, 2022 5 - Production/Stable pytest (!=3.0.2) @@ -1017,7 +1020,7 @@ This list contains 1000 plugins. :pypi:`pytest-zap` OWASP ZAP plugin for py.test. May 12, 2014 4 - Beta N/A :pypi:`pytest-zebrunner` Pytest connector for Zebrunner reporting Feb 02, 2022 5 - Production/Stable pytest (>=4.5.0) :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 Jan 31, 2022 5 - Production/Stable pytest + :pypi:`pytest-zulip` Pytest report plugin for Zulip Feb 23, 2022 5 - Production/Stable pytest =============================================== ======================================================================================================================================================================== ============== ===================== ================================================ .. only:: latex @@ -1031,7 +1034,7 @@ This list contains 1000 plugins. A pytest-plugin for updating doctest outputs :pypi:`pytest-adaptavist` - *last release*: Feb 14, 2022, + *last release*: Feb 22, 2022, *status*: N/A, *requires*: pytest (>=5.4.0) @@ -1101,7 +1104,7 @@ This list contains 1000 plugins. Pytest \`client\` fixture for the Aiohttp :pypi:`pytest-aiomoto` - *last release*: Dec 10, 2021, + *last release*: Feb 24, 2022, *status*: N/A, *requires*: pytest (>=6.2.5,<7.0.0) @@ -1163,6 +1166,13 @@ This list contains 1000 plugins. Plugin for py.test to generate allure xml reports + :pypi:`pytest-allure-collection` + *last release*: Feb 21, 2022, + *status*: N/A, + *requires*: pytest + + pytest plugin to collect allure markers without running any tests + :pypi:`pytest-allure-dsl` *last release*: Oct 25, 2020, *status*: 4 - Beta, @@ -1640,7 +1650,7 @@ This list contains 1000 plugins. Local continuous test runner with pytest and watchdog. :pypi:`pytest-bootstrap` - *last release*: Feb 19, 2022, + *last release*: Feb 23, 2022, *status*: N/A, *requires*: N/A @@ -2053,7 +2063,7 @@ This list contains 1000 plugins. Package stands for pytest plugin to upload results into Confluence page. :pypi:`pytest-console-scripts` - *last release*: Jan 06, 2022, + *last release*: Feb 23, 2022, *status*: 4 - Beta, *requires*: N/A @@ -2486,6 +2496,13 @@ This list contains 1000 plugins. A simple plugin to use with pytest + :pypi:`pytest-diff-selector` + *last release*: Feb 24, 2022, + *status*: 4 - Beta, + *requires*: pytest (>=6.2.2) ; extra == 'all' + + Get tests affected by code changes (using git) + :pypi:`pytest-disable` *last release*: Sep 10, 2015, *status*: 4 - Beta, @@ -2802,19 +2819,12 @@ This list contains 1000 plugins. A simple pytest plugin to import names and add them to the doctest namespace. :pypi:`pytest-doctestplus` - *last release*: Dec 09, 2021, + *last release*: Feb 25, 2022, *status*: 3 - Alpha, *requires*: pytest (>=4.6) Pytest plugin with advanced doctest features. - :pypi:`pytest-doctest-ufunc` - *last release*: Aug 02, 2020, - *status*: 4 - Beta, - *requires*: pytest (>=3.5.0) - - A plugin to run doctests in docstrings of Numpy ufuncs - :pypi:`pytest-dolphin` *last release*: Nov 30, 2016, *status*: 4 - Beta, @@ -2977,35 +2987,35 @@ This list contains 1000 plugins. Send execution result email :pypi:`pytest-embedded` - *last release*: Jan 21, 2022, + *last release*: Feb 22, 2022, *status*: N/A, *requires*: pytest (>=6.2.0) pytest embedded plugin :pypi:`pytest-embedded-arduino` - *last release*: Jan 21, 2022, + *last release*: Feb 22, 2022, *status*: N/A, *requires*: N/A pytest embedded plugin for Arduino projects :pypi:`pytest-embedded-idf` - *last release*: Jan 21, 2022, + *last release*: Feb 22, 2022, *status*: N/A, *requires*: N/A pytest embedded plugin for esp-idf project :pypi:`pytest-embedded-jtag` - *last release*: Jan 21, 2022, + *last release*: Feb 22, 2022, *status*: N/A, *requires*: N/A pytest embedded plugin for testing with jtag :pypi:`pytest-embedded-qemu` - *last release*: Jan 21, 2022, + *last release*: Feb 22, 2022, *status*: N/A, *requires*: N/A @@ -3019,14 +3029,14 @@ This list contains 1000 plugins. pytest embedded plugin for esp-idf project by qemu, not target chip :pypi:`pytest-embedded-serial` - *last release*: Jan 21, 2022, + *last release*: Feb 22, 2022, *status*: N/A, *requires*: N/A pytest embedded plugin for testing serial ports :pypi:`pytest-embedded-serial-esp` - *last release*: Jan 21, 2022, + *last release*: Feb 22, 2022, *status*: N/A, *requires*: N/A @@ -3229,9 +3239,9 @@ This list contains 1000 plugins. A Pytest plugin to ignore certain marked tests by default :pypi:`pytest-exploratory` - *last release*: Aug 03, 2021, + *last release*: Feb 21, 2022, *status*: N/A, - *requires*: pytest (>=5.3) + *requires*: pytest (>=6.2) Interactive console for pytest. @@ -3459,6 +3469,13 @@ This list contains 1000 plugins. pytest plugin to control fixture evaluation order + :pypi:`pytest-fixture-rtttg` + *last release*: Feb 23, 2022, + *status*: N/A, + *requires*: pytest (>=7.0.1,<8.0.0) + + Warn or fail on fixture name clash + :pypi:`pytest-fixtures` *last release*: May 01, 2019, *status*: 5 - Production/Stable, @@ -3495,7 +3512,7 @@ This list contains 1000 plugins. A pytest fixture for testing flake8 plugins. :pypi:`pytest-flake8-v2` - *last release*: Feb 16, 2022, + *last release*: Feb 24, 2022, *status*: 4 - Beta, *requires*: pytest (>=7.0) @@ -3558,8 +3575,8 @@ This list contains 1000 plugins. A pytest plugin that alerts user of failed test cases with screen notifications :pypi:`pytest-fold` - *last release*: Feb 19, 2022, - *status*: 3 - Alpha, + *last release*: Feb 20, 2022, + *status*: 4 - Beta, *requires*: pytest (>=6.2.5) Fold console output and drop user into interactive text user interface @@ -3677,7 +3694,7 @@ This list contains 1000 plugins. For finding/executing Ghost Inspector tests :pypi:`pytest-girder` - *last release*: Jan 10, 2022, + *last release*: Feb 26, 2022, *status*: N/A, *requires*: N/A @@ -3852,9 +3869,9 @@ This list contains 1000 plugins. A pytest plugin for use with homeassistant custom components. :pypi:`pytest-homeassistant-custom-component` - *last release*: Feb 19, 2022, + *last release*: Feb 26, 2022, *status*: 3 - Alpha, - *requires*: pytest (==6.2.5) + *requires*: pytest (==7.0.1) Experimental package to automatically extract test plugins for Home Assistant custom components @@ -3880,8 +3897,8 @@ This list contains 1000 plugins. Simplify working with Hoverfly from pytest :pypi:`pytest-hoverfly-wrapper` - *last release*: Aug 29, 2021, - *status*: 4 - Beta, + *last release*: Feb 22, 2022, + *status*: 5 - Production/Stable, *requires*: N/A Integrates the Hoverfly HTTP proxy into Pytest @@ -3907,8 +3924,15 @@ This list contains 1000 plugins. optimized pytest plugin for generating HTML reports + :pypi:`pytest-html-merger` + *last release*: Feb 22, 2022, + *status*: N/A, + *requires*: N/A + + Pytest HTML reports merging utility + :pypi:`pytest-html-object-storage` - *last release*: Feb 06, 2022, + *last release*: Feb 23, 2022, *status*: 5 - Production/Stable, *requires*: N/A @@ -3943,9 +3967,9 @@ This list contains 1000 plugins. Fixture "http" for http requests :pypi:`pytest-httpbin` - *last release*: Dec 25, 2021, + *last release*: Feb 25, 2022, *status*: 5 - Production/Stable, - *requires*: N/A + *requires*: pytest ; extra == 'test' Easily test your HTTP library against a local copy of httpbin @@ -4237,7 +4261,7 @@ This list contains 1000 plugins. py.test JIRA integration plugin, using markers :pypi:`pytest-jira-xray` - *last release*: Feb 17, 2022, + *last release*: Feb 26, 2022, *status*: 3 - Alpha, *requires*: pytest @@ -4391,7 +4415,7 @@ This list contains 1000 plugins. A python-libfaketime plugin for pytest. :pypi:`pytest-libiio` - *last release*: Dec 15, 2021, + *last release*: Feb 23, 2022, *status*: 4 - Beta, *requires*: N/A @@ -4762,7 +4786,7 @@ This list contains 1000 plugins. An in-memory mock of a Redis server that runs in a separate thread. This is to be used for unit-tests that require a Redis database. :pypi:`pytest-mock-resources` - *last release*: Feb 17, 2022, + *last release*: Feb 26, 2022, *status*: N/A, *requires*: pytest (>=1.0) @@ -5161,7 +5185,7 @@ This list contains 1000 plugins. Pytest plugin for detecting inadvertent open file handles :pypi:`pytest-opentmi` - *last release*: Jan 19, 2022, + *last release*: Feb 25, 2022, *status*: 5 - Production/Stable, *requires*: pytest (>=5.0) @@ -5658,7 +5682,7 @@ This list contains 1000 plugins. Report test pass / failures to a Prometheus PushGateway :pypi:`pytest-prometheus-pushgateway` - *last release*: Jan 31, 2022, + *last release*: Feb 23, 2022, *status*: 5 - Production/Stable, *requires*: pytest @@ -5903,7 +5927,7 @@ This list contains 1000 plugins. pytest plugin for creating TestRail runs and adding results :pypi:`pytest-railflow-testrail-reporter` - *last release*: Dec 02, 2021, + *last release*: Feb 25, 2022, *status*: 5 - Production/Stable, *requires*: pytest @@ -5973,7 +5997,7 @@ This list contains 1000 plugins. Test your README.md file :pypi:`pytest-reana` - *last release*: Jan 05, 2022, + *last release*: Feb 26, 2022, *status*: 3 - Alpha, *requires*: N/A @@ -6169,7 +6193,7 @@ This list contains 1000 plugins. pytest plugin for adding tests' parameters to junit report :pypi:`pytest-reportportal` - *last release*: Jan 11, 2022, + *last release*: Feb 22, 2022, *status*: N/A, *requires*: pytest (>=3.8.0) @@ -6358,9 +6382,9 @@ This list contains 1000 plugins. implement a --failed option for pytest :pypi:`pytest-runner` - *last release*: May 19, 2021, + *last release*: Feb 25, 2022, *status*: 5 - Production/Stable, - *requires*: pytest (>=4.6) ; extra == 'testing' + *requires*: pytest (>=6) ; extra == 'testing' Invoke py.test as distutils command with dependency resolution @@ -6428,7 +6452,7 @@ This list contains 1000 plugins. :pypi:`pytest-sbase` - *last release*: Feb 15, 2022, + *last release*: Feb 25, 2022, *status*: 5 - Production/Stable, *requires*: N/A @@ -6470,7 +6494,7 @@ This list contains 1000 plugins. pytest plugin for Selenium :pypi:`pytest-seleniumbase` - *last release*: Feb 15, 2022, + *last release*: Feb 25, 2022, *status*: 5 - Production/Stable, *requires*: N/A @@ -6568,7 +6592,7 @@ This list contains 1000 plugins. A pytest plugin to help with testing shell scripts / black box commands :pypi:`pytest-shell-utilities` - *last release*: Feb 17, 2022, + *last release*: Feb 21, 2022, *status*: 4 - Beta, *requires*: pytest (>=6.0.0) @@ -6631,7 +6655,7 @@ This list contains 1000 plugins. Allow for multiple processes to log to a single file :pypi:`pytest-skip-markers` - *last release*: Feb 16, 2022, + *last release*: Feb 22, 2022, *status*: 5 - Production/Stable, *requires*: pytest (>=6.0.0) @@ -6764,7 +6788,7 @@ This list contains 1000 plugins. A simple plugin to first execute tests that historically failed more :pypi:`pytest-sosu` - *last release*: Feb 17, 2022, + *last release*: Feb 21, 2022, *status*: 2 - Pre-Alpha, *requires*: pytest @@ -6897,7 +6921,7 @@ This list contains 1000 plugins. Yet another SQL-testing framework for BigQuery provided by pytest plugin :pypi:`pytest-squadcast` - *last release*: Feb 18, 2022, + *last release*: Feb 22, 2022, *status*: 5 - Production/Stable, *requires*: pytest @@ -7170,7 +7194,7 @@ This list contains 1000 plugins. Test configuration plugin for pytest. :pypi:`pytest-testdirectory` - *last release*: Nov 06, 2018, + *last release*: Feb 21, 2022, *status*: 5 - Production/Stable, *requires*: pytest @@ -8017,7 +8041,7 @@ This list contains 1000 plugins. Extend py.test for RPC OpenStack testing. :pypi:`pytest-zulip` - *last release*: Jan 31, 2022, + *last release*: Feb 23, 2022, *status*: 5 - Production/Stable, *requires*: pytest From e38d1cac489e42f4bdbecbb50f9f25dc9c36c19f Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Sat, 5 Mar 2022 08:57:00 -0300 Subject: [PATCH 164/176] Improve error message for malformed pyproject.toml files Including the file name is enough to let the user know what the problem is. The same is not needed for `.ini` files because the error message includes the path to the file by default. Fix #9730 --- changelog/9730.bugfix.rst | 1 + src/_pytest/config/findpaths.py | 2 +- testing/test_config.py | 12 +++++++++++- 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 changelog/9730.bugfix.rst diff --git a/changelog/9730.bugfix.rst b/changelog/9730.bugfix.rst new file mode 100644 index 00000000000..df30ab7e360 --- /dev/null +++ b/changelog/9730.bugfix.rst @@ -0,0 +1 @@ +Malformed ``pyproject.toml`` files now produce a clearer error message. diff --git a/src/_pytest/config/findpaths.py b/src/_pytest/config/findpaths.py index 89ade5f23b9..c082e652d92 100644 --- a/src/_pytest/config/findpaths.py +++ b/src/_pytest/config/findpaths.py @@ -70,7 +70,7 @@ def load_config_dict_from_file( try: config = tomli.loads(toml_text) except tomli.TOMLDecodeError as exc: - raise UsageError(str(exc)) from exc + raise UsageError(f"{filepath}: {exc}") from exc result = config.get("tool", {}).get("pytest", {}).get("ini_options", None) if result is not None: diff --git a/testing/test_config.py b/testing/test_config.py index 8013966f071..6784809e097 100644 --- a/testing/test_config.py +++ b/testing/test_config.py @@ -163,7 +163,17 @@ def test_ini_parse_error(self, pytester: Pytester) -> None: pytester.path.joinpath("pytest.ini").write_text("addopts = -x") result = pytester.runpytest() assert result.ret != 0 - result.stderr.fnmatch_lines(["ERROR: *pytest.ini:1: no section header defined"]) + result.stderr.fnmatch_lines("ERROR: *pytest.ini:1: no section header defined") + + def test_toml_parse_error(self, pytester: Pytester) -> None: + pytester.makepyprojecttoml( + """ + \\" + """ + ) + result = pytester.runpytest() + assert result.ret != 0 + result.stderr.fnmatch_lines("ERROR: *pyproject.toml: Invalid statement*") @pytest.mark.xfail(reason="probably not needed") def test_confcutdir(self, pytester: Pytester) -> None: From bc43d66b47b917d43a22e0c703ecfe4eea342263 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 6 Mar 2022 00:01:38 -0300 Subject: [PATCH 165/176] [automated] Update plugin list (#9733) Co-authored-by: pytest bot --- doc/en/reference/plugin_list.rst | 166 ++++++++++++++++++------------- 1 file changed, 99 insertions(+), 67 deletions(-) diff --git a/doc/en/reference/plugin_list.rst b/doc/en/reference/plugin_list.rst index e36f21c6750..be6a5318d7f 100644 --- a/doc/en/reference/plugin_list.rst +++ b/doc/en/reference/plugin_list.rst @@ -11,7 +11,7 @@ automatically. Packages classified as inactive are excluded. creating a PDF, because otherwise the table gets far too wide for the page. -This list contains 1003 plugins. +This list contains 1007 plugins. .. only:: not latex @@ -68,7 +68,7 @@ This list contains 1003 plugins. :pypi:`pytest-astropy` Meta-package containing dependencies for testing Sep 21, 2021 5 - Production/Stable pytest (>=4.6) :pypi:`pytest-astropy-header` pytest plugin to add diagnostic information to the header of the test output Dec 27, 2021 3 - Alpha pytest (>=4.6) :pypi:`pytest-ast-transformer` May 04, 2019 3 - Alpha pytest - :pypi:`pytest-asyncio` Pytest support for asyncio Feb 10, 2022 4 - Beta pytest (>=6.1.0) + :pypi:`pytest-asyncio` Pytest support for asyncio Mar 03, 2022 4 - Beta pytest (>=6.1.0) :pypi:`pytest-asyncio-cooperative` Run all your asynchronous tests cooperatively. Jan 25, 2022 N/A N/A :pypi:`pytest-asyncio-network-simulator` pytest-asyncio-network-simulator: Plugin for pytest for simulator the network in tests Jul 31, 2018 3 - Alpha pytest (<3.7.0,>=3.3.2) :pypi:`pytest-async-mongodb` pytest plugin for async MongoDB Oct 18, 2017 5 - Production/Stable pytest (>=2.5.2) @@ -107,7 +107,7 @@ This list contains 1003 plugins. :pypi:`pytest-blockage` Disable network requests during a test run. Dec 21, 2021 N/A pytest :pypi:`pytest-blocker` pytest plugin to mark a test as blocker and skip all other tests Sep 07, 2015 4 - Beta N/A :pypi:`pytest-board` Local continuous test runner with pytest and watchdog. Jan 20, 2019 N/A N/A - :pypi:`pytest-bootstrap` Feb 23, 2022 N/A N/A + :pypi:`pytest-bootstrap` Mar 04, 2022 N/A N/A :pypi:`pytest-bpdb` A py.test plug-in to enable drop to bpdb debugger on test failure. Jan 19, 2015 2 - Pre-Alpha N/A :pypi:`pytest-bravado` Pytest-bravado automatically generates from OpenAPI specification client fixtures. Feb 15, 2022 N/A N/A :pypi:`pytest-breakword` Use breakword with pytest Aug 04, 2021 N/A pytest (>=6.2.4,<7.0.0) @@ -124,7 +124,7 @@ This list contains 1003 plugins. :pypi:`pytest-builtin-types` Nov 17, 2021 N/A pytest :pypi:`pytest-bwrap` Run your tests in Bubblewrap sandboxes Oct 26, 2018 3 - Alpha N/A :pypi:`pytest-cache` pytest plugin with mechanisms for caching across test runs Jun 04, 2013 3 - Alpha N/A - :pypi:`pytest-cache-assert` Cache assertion data to simplify regression testing of complex serializable data Feb 18, 2022 4 - Beta pytest (>=5) + :pypi:`pytest-cache-assert` Cache assertion data to simplify regression testing of complex serializable data Mar 03, 2022 4 - Beta pytest (>=5.0.0) :pypi:`pytest-cagoule` Pytest plugin to only run tests affected by changes Jan 01, 2020 3 - Alpha N/A :pypi:`pytest-cairo` Pytest support for cairo-lang and starknet Feb 19, 2022 N/A pytest :pypi:`pytest-camel-collect` Enable CamelCase-aware pytest class collection Aug 02, 2020 N/A pytest (>=2.9) @@ -138,6 +138,7 @@ This list contains 1003 plugins. :pypi:`pytest-celery` pytest-celery a shim pytest plugin to enable celery.contrib.pytest May 06, 2021 N/A N/A :pypi:`pytest-chainmaker` pytest plugin for chainmaker Oct 15, 2021 N/A N/A :pypi:`pytest-chalice` A set of py.test fixtures for AWS Chalice Jul 01, 2020 4 - Beta N/A + :pypi:`pytest-change-demo` turn . into √,turn F into x Mar 02, 2022 N/A pytest :pypi:`pytest-change-report` turn . into √,turn F into x Sep 14, 2020 N/A pytest :pypi:`pytest-chdir` A pytest fixture for changing current working directory Jan 28, 2020 N/A pytest (>=5.0.0,<6.0.0) :pypi:`pytest-checkdocs` check the README when running tests Jul 31, 2021 5 - Production/Stable pytest (>=4.6) ; extra == 'testing' @@ -211,7 +212,7 @@ This list contains 1003 plugins. :pypi:`pytest-dbfixtures` Databases fixtures plugin for py.test. Dec 07, 2016 4 - Beta N/A :pypi:`pytest-db-plugin` Nov 27, 2021 N/A pytest (>=5.0) :pypi:`pytest-dbt-adapter` A pytest plugin for testing dbt adapter plugins Nov 24, 2021 N/A pytest (<7,>=6) - :pypi:`pytest-dbt-conventions` A pytest plugin for linting a dbt project's conventions Feb 04, 2022 N/A pytest (>=6.2.5,<7.0.0) + :pypi:`pytest-dbt-conventions` A pytest plugin for linting a dbt project's conventions Mar 02, 2022 N/A pytest (>=6.2.5,<7.0.0) :pypi:`pytest-dbt-core` Pytest extension for dbt. Jan 28, 2022 N/A pytest (>=6.2.5) ; extra == 'test' :pypi:`pytest-dbus-notification` D-BUS notifications for pytest results. Mar 05, 2014 5 - Production/Stable N/A :pypi:`pytest-deadfixtures` A simple plugin to list unused fixtures in pytest Jul 23, 2020 5 - Production/Stable N/A @@ -294,18 +295,18 @@ This list contains 1003 plugins. :pypi:`pytest-easy-server` Pytest plugin for easy testing against servers May 01, 2021 4 - Beta pytest (<5.0.0,>=4.3.1) ; python_version < "3.5" :pypi:`pytest-ec2` Pytest execution on EC2 instance Oct 22, 2019 3 - Alpha N/A :pypi:`pytest-echo` pytest plugin with mechanisms for echoing environment variables, package version and generic attributes Jan 08, 2020 5 - Production/Stable N/A - :pypi:`pytest-elasticsearch` Elasticsearch fixtures and fixture factories for Pytest. May 12, 2021 5 - Production/Stable pytest (>=3.0.0) + :pypi:`pytest-elasticsearch` Elasticsearch fixtures and fixture factories for Pytest. Mar 01, 2022 5 - Production/Stable pytest (>=6.2.0) :pypi:`pytest-elements` Tool to help automate user interfaces Jan 13, 2021 N/A pytest (>=5.4,<6.0) :pypi:`pytest-elk-reporter` A simple plugin to use with pytest Jan 24, 2021 4 - Beta pytest (>=3.5.0) :pypi:`pytest-email` Send execution result email Jul 08, 2020 N/A pytest - :pypi:`pytest-embedded` pytest embedded plugin Feb 22, 2022 N/A pytest (>=6.2.0) - :pypi:`pytest-embedded-arduino` pytest embedded plugin for Arduino projects Feb 22, 2022 N/A N/A - :pypi:`pytest-embedded-idf` pytest embedded plugin for esp-idf project Feb 22, 2022 N/A N/A - :pypi:`pytest-embedded-jtag` pytest embedded plugin for testing with jtag Feb 22, 2022 N/A N/A - :pypi:`pytest-embedded-qemu` pytest embedded plugin for qemu, not target chip Feb 22, 2022 N/A N/A + :pypi:`pytest-embedded` pytest embedded plugin Mar 04, 2022 N/A pytest (>=6.2.0) + :pypi:`pytest-embedded-arduino` pytest embedded plugin for Arduino projects Mar 04, 2022 N/A N/A + :pypi:`pytest-embedded-idf` pytest embedded plugin for esp-idf project Mar 04, 2022 N/A N/A + :pypi:`pytest-embedded-jtag` pytest embedded plugin for testing with jtag Mar 04, 2022 N/A N/A + :pypi:`pytest-embedded-qemu` pytest embedded plugin for qemu, not target chip Mar 04, 2022 N/A N/A :pypi:`pytest-embedded-qemu-idf` pytest embedded plugin for esp-idf project by qemu, not target chip Jun 29, 2021 N/A N/A - :pypi:`pytest-embedded-serial` pytest embedded plugin for testing serial ports Feb 22, 2022 N/A N/A - :pypi:`pytest-embedded-serial-esp` pytest embedded plugin for testing espressif boards via serial ports Feb 22, 2022 N/A N/A + :pypi:`pytest-embedded-serial` pytest embedded plugin for testing serial ports Mar 04, 2022 N/A N/A + :pypi:`pytest-embedded-serial-esp` pytest embedded plugin for testing espressif boards via serial ports Mar 04, 2022 N/A N/A :pypi:`pytest-emoji` A pytest plugin that adds emojis to your test result report Feb 19, 2019 4 - Beta pytest (>=4.2.1) :pypi:`pytest-emoji-output` Pytest plugin to represent test output with emoji support Oct 10, 2021 4 - Beta pytest (==6.0.1) :pypi:`pytest-enabler` Enable installed pytest plugins Nov 08, 2021 5 - Production/Stable pytest (>=6) ; extra == 'testing' @@ -371,9 +372,9 @@ This list contains 1003 plugins. :pypi:`pytest-fixtures` Common fixtures for pytest May 01, 2019 5 - Production/Stable N/A :pypi:`pytest-fixture-tools` Plugin for pytest which provides tools for fixtures Aug 18, 2020 6 - Mature pytest :pypi:`pytest-fixture-typecheck` A pytest plugin to assert type annotations at runtime. Aug 24, 2021 N/A pytest - :pypi:`pytest-flake8` pytest plugin to check FLAKE8 requirements Dec 16, 2020 4 - Beta pytest (>=3.5) + :pypi:`pytest-flake8` pytest plugin to check FLAKE8 requirements Mar 05, 2022 4 - Beta pytest (>=3.5) :pypi:`pytest-flake8-path` A pytest fixture for testing flake8 plugins. Jan 10, 2022 5 - Production/Stable pytest - :pypi:`pytest-flake8-v2` pytest plugin to check FLAKE8 requirements Feb 24, 2022 4 - Beta pytest (>=7.0) + :pypi:`pytest-flake8-v2` pytest plugin to check FLAKE8 requirements Mar 01, 2022 5 - Production/Stable pytest (>=7.0) :pypi:`pytest-flakefinder` Runs tests multiple times to expose flakiness. Jul 28, 2020 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 @@ -399,7 +400,7 @@ This list contains 1003 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. Feb 26, 2022 N/A N/A + :pypi:`pytest-girder` A set of pytest fixtures for testing Girder applications. Mar 01, 2022 N/A N/A :pypi:`pytest-git` Git repository fixture for py.test May 28, 2019 5 - Production/Stable pytest :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 @@ -424,7 +425,7 @@ This list contains 1003 plugins. :pypi:`pytest-historic` Custom report to display pytest historical execution records Apr 08, 2020 N/A pytest :pypi:`pytest-historic-hook` Custom listener to store execution results into MYSQL DB, which is used for pytest-historic report Apr 08, 2020 N/A pytest :pypi:`pytest-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 Feb 26, 2022 3 - Alpha pytest (==7.0.1) + :pypi:`pytest-homeassistant-custom-component` Experimental package to automatically extract test plugins for Home Assistant custom components Mar 05, 2022 3 - Alpha pytest (==7.0.1) :pypi:`pytest-honey` A simple plugin to use with pytest Jan 07, 2022 4 - Beta pytest (>=3.5.0) :pypi:`pytest-honors` Report on tests that honor constraints, and guard against regressions Mar 06, 2020 4 - Beta N/A :pypi:`pytest-hoverfly` Simplify working with Hoverfly from pytest Jan 20, 2022 N/A pytest (>=5.0) @@ -432,8 +433,8 @@ This list contains 1003 plugins. :pypi:`pytest-hpfeeds` Helpers for testing hpfeeds in your python project Aug 27, 2021 4 - Beta pytest (>=6.2.4,<7.0.0) :pypi:`pytest-html` pytest plugin for generating HTML reports Dec 13, 2020 5 - Production/Stable pytest (!=6.0.0,>=5.0) :pypi:`pytest-html-lee` optimized pytest plugin for generating HTML reports Jun 30, 2020 5 - Production/Stable pytest (>=5.0) - :pypi:`pytest-html-merger` Pytest HTML reports merging utility Feb 22, 2022 N/A N/A - :pypi:`pytest-html-object-storage` Pytest report plugin for send HTML report on object-storage Feb 23, 2022 5 - Production/Stable N/A + :pypi:`pytest-html-merger` Pytest HTML reports merging utility Mar 02, 2022 N/A N/A + :pypi:`pytest-html-object-storage` Pytest report plugin for send HTML report on object-storage Mar 04, 2022 5 - Production/Stable N/A :pypi:`pytest-html-profiling` Pytest plugin for generating HTML reports with per-test profiling and optionally call graph visualizations. Based on pytest-html by Dave Hunt. Feb 11, 2020 5 - Production/Stable pytest (>=3.0) :pypi:`pytest-html-reporter` Generates a static html report based on pytest framework Feb 13, 2022 N/A N/A :pypi:`pytest-html-thread` pytest plugin for generating HTML reports Dec 29, 2020 5 - Production/Stable N/A @@ -462,7 +463,7 @@ This list contains 1003 plugins. :pypi:`pytest-inmanta` A py.test plugin providing fixtures to simplify inmanta modules testing. Jan 26, 2022 5 - Production/Stable N/A :pypi:`pytest-inmanta-extensions` Inmanta tests package Feb 11, 2022 5 - Production/Stable N/A :pypi:`pytest-Inomaly` A simple image diff plugin for pytest Feb 13, 2018 4 - Beta N/A - :pypi:`pytest-insta` A practical snapshot testing plugin for pytest Apr 07, 2021 N/A pytest (>=6.0.2,<7.0.0) + :pypi:`pytest-insta` A practical snapshot testing plugin for pytest Feb 28, 2022 N/A pytest (>=6.0.2) :pypi:`pytest-instafail` pytest plugin to show failures instantly Jun 14, 2020 4 - Beta pytest (>=2.9) :pypi:`pytest-instrument` pytest plugin to instrument tests Apr 05, 2020 5 - Production/Stable pytest (>=5.1.0) :pypi:`pytest-integration` Organizing pytests by integration or not Apr 16, 2020 N/A N/A @@ -514,7 +515,7 @@ This list contains 1003 plugins. :pypi:`pytest-localftpserver` A PyTest plugin which provides an FTP fixture for your tests Aug 25, 2021 5 - Production/Stable pytest :pypi:`pytest-localserver` py.test plugin to test server connections locally. Dec 13, 2021 4 - Beta N/A :pypi:`pytest-localstack` Pytest plugin for AWS integration tests Aug 22, 2019 4 - Beta pytest (>=3.3.0) - :pypi:`pytest-lockable` lockable resource plugin for pytest Nov 09, 2021 5 - Production/Stable pytest + :pypi:`pytest-lockable` lockable resource plugin for pytest Feb 28, 2022 5 - Production/Stable pytest :pypi:`pytest-locker` Used to lock object during testing. Essentially changing assertions from being hard coded to asserting that nothing changed Oct 29, 2021 N/A pytest (>=5.4) :pypi:`pytest-log` print log Aug 15, 2021 N/A pytest (>=3.8) :pypi:`pytest-logbook` py.test plugin to capture logbook log messages Nov 23, 2015 5 - Production/Stable pytest (>=2.8) @@ -523,6 +524,7 @@ This list contains 1003 plugins. :pypi:`pytest-logger` Plugin configuring handlers for loggers from Python logging module. Jul 25, 2019 4 - Beta pytest (>=3.2) :pypi:`pytest-logging` Configures logging and allows tweaking the log level with a py.test flag Nov 04, 2015 4 - Beta N/A :pypi:`pytest-log-report` Package for creating a pytest test run reprot Dec 26, 2019 N/A N/A + :pypi:`pytest-loguru` Pytest Loguru Feb 27, 2022 5 - Production/Stable N/A :pypi:`pytest-manual-marker` pytest marker for marking manual tests Oct 11, 2021 3 - Alpha pytest (>=6) :pypi:`pytest-markdown` Test your markdown docs with pytest Jan 15, 2021 4 - Beta pytest (>=6.0.1,<7.0.0) :pypi:`pytest-marker-bugzilla` py.test bugzilla integration plugin, using markers Jan 09, 2020 N/A N/A @@ -572,7 +574,7 @@ This list contains 1003 plugins. :pypi:`pytest-mp` A test batcher for multiprocessed Pytest runs May 23, 2018 4 - Beta pytest :pypi:`pytest-mpi` pytest plugin to collect information from tests Jan 08, 2022 3 - Alpha pytest :pypi:`pytest-mpl` pytest plugin to help with testing figures output from Matplotlib Feb 09, 2022 4 - Beta pytest - :pypi:`pytest-mproc` low-startup-overhead, scalable, distributed-testing pytest plugin Mar 07, 2021 4 - Beta pytest + :pypi:`pytest-mproc` low-startup-overhead, scalable, distributed-testing pytest plugin Feb 28, 2022 4 - Beta pytest :pypi:`pytest-multi-check` Pytest-плагин, реализует возможность мульти проверок и мягких проверок Jun 03, 2021 N/A pytest :pypi:`pytest-multihost` Utility for writing multi-host tests for pytest Apr 07, 2020 4 - Beta N/A :pypi:`pytest-multilog` Multi-process logs handling and other helpers for pytest Jun 10, 2021 N/A N/A @@ -582,7 +584,7 @@ This list contains 1003 plugins. :pypi:`pytest-mypyd` Mypy static type checker plugin for Pytest Aug 20, 2019 4 - Beta pytest (<4.7,>=2.8) ; python_version < "3.5" :pypi:`pytest-mypy-plugins` pytest plugin for writing tests for mypy plugins Jan 11, 2022 3 - Alpha pytest (>=6.0.0) :pypi:`pytest-mypy-plugins-shim` Substitute for "pytest-mypy-plugins" for Python implementations which aren't supported by mypy. Apr 12, 2021 N/A N/A - :pypi:`pytest-mypy-testing` Pytest plugin to check mypy output. Jun 13, 2021 N/A pytest + :pypi:`pytest-mypy-testing` Pytest plugin to check mypy output. Mar 02, 2022 N/A N/A :pypi:`pytest-mysql` MySQL process and client fixtures for pytest Feb 15, 2022 5 - Production/Stable pytest (>=6.2) :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) @@ -612,8 +614,8 @@ This list contains 1003 plugins. :pypi:`pytest-only` Use @pytest.mark.only to run a single test Jan 19, 2020 N/A 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-opentmi` pytest plugin for publish results to opentmi Feb 25, 2022 5 - Production/Stable pytest (>=5.0) - :pypi:`pytest-operator` Fixtures for Operators Feb 14, 2022 N/A N/A + :pypi:`pytest-opentmi` pytest plugin for publish results to opentmi Feb 28, 2022 5 - Production/Stable pytest (>=5.0) + :pypi:`pytest-operator` Fixtures for Operators Mar 02, 2022 N/A pytest :pypi:`pytest-optional` include/exclude values of fixtures in pytest Oct 07, 2015 N/A N/A :pypi:`pytest-optional-tests` Easy declaration of optional tests (i.e., that are not run by default) Jul 09, 2019 4 - Beta pytest (>=4.5.0) :pypi:`pytest-orchestration` A pytest plugin for orchestrating tests Jul 18, 2019 N/A N/A @@ -687,7 +689,7 @@ This list contains 1003 plugins. :pypi:`pytest-prosper` Test helpers for Prosper projects Sep 24, 2018 N/A N/A :pypi:`pytest-pspec` A rspec format reporter for Python ptest Jun 02, 2020 4 - Beta pytest (>=3.0.0) :pypi:`pytest-psqlgraph` pytest plugin for testing applications that use psqlgraph Oct 19, 2021 4 - Beta pytest (>=6.0) - :pypi:`pytest-ptera` Use ptera probes in tests Oct 20, 2021 N/A pytest (>=6.2.4,<7.0.0) + :pypi:`pytest-ptera` Use ptera probes in tests Mar 01, 2022 N/A pytest (>=6.2.4,<7.0.0) :pypi:`pytest-pudb` Pytest PuDB debugger integration Oct 25, 2018 3 - Alpha pytest (>=2.0) :pypi:`pytest-purkinje` py.test plugin for purkinje test runner Oct 28, 2017 2 - Pre-Alpha N/A :pypi:`pytest-pycharm` Plugin for py.test to enter PyCharm debugger on uncaught exceptions Aug 13, 2020 5 - Production/Stable pytest (>=2.3) @@ -771,6 +773,7 @@ This list contains 1003 plugins. :pypi:`pytest-restrict` Pytest plugin to restrict the test types allowed Jan 10, 2022 5 - Production/Stable pytest :pypi:`pytest-rethinkdb` A RethinkDB plugin for pytest. Jul 24, 2016 4 - Beta N/A :pypi:`pytest-reverse` Pytest plugin to reverse test order. Jan 10, 2022 5 - Production/Stable pytest + :pypi:`pytest-rich` Leverage rich for richer test session output Mar 03, 2022 4 - Beta pytest (>=7.0) :pypi:`pytest-rich-reporter` A pytest plugin using Rich for beautiful test result formatting. Feb 17, 2022 1 - Planning pytest (>=5.0.0) :pypi:`pytest-ringo` pytest plugin to test webapplications using the Ringo webframework Sep 27, 2017 3 - Alpha N/A :pypi:`pytest-rng` Fixtures for seeding tests and making randomness reproducible Aug 08, 2019 5 - Production/Stable pytest @@ -793,13 +796,13 @@ This list contains 1003 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. Feb 25, 2022 5 - Production/Stable N/A + :pypi:`pytest-sbase` A complete web automation framework for end-to-end testing. Mar 02, 2022 5 - Production/Stable N/A :pypi:`pytest-scenario` pytest plugin for test scenarios Feb 06, 2017 3 - Alpha N/A :pypi:`pytest-schema` 👍 Validate return values against a schema-like object in testing Aug 31, 2020 5 - Production/Stable pytest (>=3.5.0) :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 Sep 19, 2020 5 - Production/Stable pytest (>=5.0.0) - :pypi:`pytest-seleniumbase` A complete web automation framework for end-to-end testing. Feb 25, 2022 5 - Production/Stable N/A + :pypi:`pytest-seleniumbase` A complete web automation framework for end-to-end testing. Mar 02, 2022 5 - Production/Stable N/A :pypi:`pytest-selenium-enhancer` pytest plugin for Selenium Dec 16, 2021 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-send-email` Send pytest execution result email Dec 04, 2019 N/A N/A @@ -855,7 +858,7 @@ This list contains 1003 plugins. :pypi:`pytest-split-tests` A Pytest plugin for running a subset of your tests by splitting them in to equally sized groups. Forked from Mark Adams' original project pytest-test-groups. Jul 30, 2021 5 - Production/Stable pytest (>=2.5) :pypi:`pytest-split-tests-tresorit` Feb 22, 2021 1 - Planning N/A :pypi:`pytest-splunk-addon` A Dynamic test tool for Splunk Apps and Add-ons Feb 18, 2022 N/A pytest (>5.4.0,<6.3) - :pypi:`pytest-splunk-addon-ui-smartx` Library to support testing Splunk Add-on UX Feb 07, 2022 N/A N/A + :pypi:`pytest-splunk-addon-ui-smartx` Library to support testing Splunk Add-on UX Mar 01, 2022 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 @@ -904,7 +907,7 @@ This list contains 1003 plugins. :pypi:`pytest-test-groups` A Pytest plugin for running a subset of your tests by splitting them in to equally sized groups. Oct 25, 2016 5 - Production/Stable N/A :pypi:`pytest-testinfra` Test infrastructures Feb 10, 2022 5 - Production/Stable pytest (!=3.0.2) :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 Feb 18, 2022 4 - Beta N/A + :pypi:`pytest-testmon` selects tests affected by changed files and methods Mar 01, 2022 4 - Beta N/A :pypi:`pytest-testobject` Plugin to use TestObject Suites with Pytest Sep 24, 2019 4 - Beta pytest (>=3.1.1) :pypi:`pytest-testpluggy` set your encoding Jan 07, 2022 N/A pytest :pypi:`pytest-testrail` pytest plugin for creating TestRail runs and adding results Aug 27, 2020 N/A pytest (>=3.6) @@ -936,6 +939,7 @@ This list contains 1003 plugins. :pypi:`pytest-tipsi-testing` Better fixtures management. Various helpers Nov 04, 2020 4 - Beta pytest (>=3.3.0) :pypi:`pytest-tldr` A pytest plugin that limits the output to just the things you need. Mar 12, 2021 4 - Beta pytest (>=3.5.0) :pypi:`pytest-tm4j-reporter` Cloud Jira Test Management (TM4J) PyTest reporter plugin Sep 01, 2020 N/A pytest + :pypi:`pytest-tmnet` A small example package Mar 01, 2022 N/A N/A :pypi:`pytest-tmreport` this is a vue-element ui report for pytest Nov 17, 2021 N/A N/A :pypi:`pytest-todo` A small plugin for the pytest testing framework, marking TODO comments as failure May 23, 2019 4 - Beta pytest :pypi:`pytest-tomato` Mar 01, 2019 5 - Production/Stable N/A @@ -1020,7 +1024,7 @@ This list contains 1003 plugins. :pypi:`pytest-zap` OWASP ZAP plugin for py.test. May 12, 2014 4 - Beta N/A :pypi:`pytest-zebrunner` Pytest connector for Zebrunner reporting Feb 02, 2022 5 - Production/Stable pytest (>=4.5.0) :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 Feb 23, 2022 5 - Production/Stable pytest + :pypi:`pytest-zulip` Pytest report plugin for Zulip Mar 04, 2022 5 - Production/Stable pytest =============================================== ======================================================================================================================================================================== ============== ===================== ================================================ .. only:: latex @@ -1377,7 +1381,7 @@ This list contains 1003 plugins. :pypi:`pytest-asyncio` - *last release*: Feb 10, 2022, + *last release*: Mar 03, 2022, *status*: 4 - Beta, *requires*: pytest (>=6.1.0) @@ -1650,7 +1654,7 @@ This list contains 1003 plugins. Local continuous test runner with pytest and watchdog. :pypi:`pytest-bootstrap` - *last release*: Feb 23, 2022, + *last release*: Mar 04, 2022, *status*: N/A, *requires*: N/A @@ -1769,9 +1773,9 @@ This list contains 1003 plugins. pytest plugin with mechanisms for caching across test runs :pypi:`pytest-cache-assert` - *last release*: Feb 18, 2022, + *last release*: Mar 03, 2022, *status*: 4 - Beta, - *requires*: pytest (>=5) + *requires*: pytest (>=5.0.0) Cache assertion data to simplify regression testing of complex serializable data @@ -1866,6 +1870,13 @@ This list contains 1003 plugins. A set of py.test fixtures for AWS Chalice + :pypi:`pytest-change-demo` + *last release*: Mar 02, 2022, + *status*: N/A, + *requires*: pytest + + turn . into √,turn F into x + :pypi:`pytest-change-report` *last release*: Sep 14, 2020, *status*: N/A, @@ -2378,7 +2389,7 @@ This list contains 1003 plugins. A pytest plugin for testing dbt adapter plugins :pypi:`pytest-dbt-conventions` - *last release*: Feb 04, 2022, + *last release*: Mar 02, 2022, *status*: N/A, *requires*: pytest (>=6.2.5,<7.0.0) @@ -2959,9 +2970,9 @@ This list contains 1003 plugins. pytest plugin with mechanisms for echoing environment variables, package version and generic attributes :pypi:`pytest-elasticsearch` - *last release*: May 12, 2021, + *last release*: Mar 01, 2022, *status*: 5 - Production/Stable, - *requires*: pytest (>=3.0.0) + *requires*: pytest (>=6.2.0) Elasticsearch fixtures and fixture factories for Pytest. @@ -2987,35 +2998,35 @@ This list contains 1003 plugins. Send execution result email :pypi:`pytest-embedded` - *last release*: Feb 22, 2022, + *last release*: Mar 04, 2022, *status*: N/A, *requires*: pytest (>=6.2.0) pytest embedded plugin :pypi:`pytest-embedded-arduino` - *last release*: Feb 22, 2022, + *last release*: Mar 04, 2022, *status*: N/A, *requires*: N/A pytest embedded plugin for Arduino projects :pypi:`pytest-embedded-idf` - *last release*: Feb 22, 2022, + *last release*: Mar 04, 2022, *status*: N/A, *requires*: N/A pytest embedded plugin for esp-idf project :pypi:`pytest-embedded-jtag` - *last release*: Feb 22, 2022, + *last release*: Mar 04, 2022, *status*: N/A, *requires*: N/A pytest embedded plugin for testing with jtag :pypi:`pytest-embedded-qemu` - *last release*: Feb 22, 2022, + *last release*: Mar 04, 2022, *status*: N/A, *requires*: N/A @@ -3029,14 +3040,14 @@ This list contains 1003 plugins. pytest embedded plugin for esp-idf project by qemu, not target chip :pypi:`pytest-embedded-serial` - *last release*: Feb 22, 2022, + *last release*: Mar 04, 2022, *status*: N/A, *requires*: N/A pytest embedded plugin for testing serial ports :pypi:`pytest-embedded-serial-esp` - *last release*: Feb 22, 2022, + *last release*: Mar 04, 2022, *status*: N/A, *requires*: N/A @@ -3498,7 +3509,7 @@ This list contains 1003 plugins. A pytest plugin to assert type annotations at runtime. :pypi:`pytest-flake8` - *last release*: Dec 16, 2020, + *last release*: Mar 05, 2022, *status*: 4 - Beta, *requires*: pytest (>=3.5) @@ -3512,8 +3523,8 @@ This list contains 1003 plugins. A pytest fixture for testing flake8 plugins. :pypi:`pytest-flake8-v2` - *last release*: Feb 24, 2022, - *status*: 4 - Beta, + *last release*: Mar 01, 2022, + *status*: 5 - Production/Stable, *requires*: pytest (>=7.0) pytest plugin to check FLAKE8 requirements @@ -3694,7 +3705,7 @@ This list contains 1003 plugins. For finding/executing Ghost Inspector tests :pypi:`pytest-girder` - *last release*: Feb 26, 2022, + *last release*: Mar 01, 2022, *status*: N/A, *requires*: N/A @@ -3869,7 +3880,7 @@ This list contains 1003 plugins. A pytest plugin for use with homeassistant custom components. :pypi:`pytest-homeassistant-custom-component` - *last release*: Feb 26, 2022, + *last release*: Mar 05, 2022, *status*: 3 - Alpha, *requires*: pytest (==7.0.1) @@ -3925,14 +3936,14 @@ This list contains 1003 plugins. optimized pytest plugin for generating HTML reports :pypi:`pytest-html-merger` - *last release*: Feb 22, 2022, + *last release*: Mar 02, 2022, *status*: N/A, *requires*: N/A Pytest HTML reports merging utility :pypi:`pytest-html-object-storage` - *last release*: Feb 23, 2022, + *last release*: Mar 04, 2022, *status*: 5 - Production/Stable, *requires*: N/A @@ -4135,9 +4146,9 @@ This list contains 1003 plugins. A simple image diff plugin for pytest :pypi:`pytest-insta` - *last release*: Apr 07, 2021, + *last release*: Feb 28, 2022, *status*: N/A, - *requires*: pytest (>=6.0.2,<7.0.0) + *requires*: pytest (>=6.0.2) A practical snapshot testing plugin for pytest @@ -4499,7 +4510,7 @@ This list contains 1003 plugins. Pytest plugin for AWS integration tests :pypi:`pytest-lockable` - *last release*: Nov 09, 2021, + *last release*: Feb 28, 2022, *status*: 5 - Production/Stable, *requires*: pytest @@ -4561,6 +4572,13 @@ This list contains 1003 plugins. Package for creating a pytest test run reprot + :pypi:`pytest-loguru` + *last release*: Feb 27, 2022, + *status*: 5 - Production/Stable, + *requires*: N/A + + Pytest Loguru + :pypi:`pytest-manual-marker` *last release*: Oct 11, 2021, *status*: 3 - Alpha, @@ -4905,7 +4923,7 @@ This list contains 1003 plugins. pytest plugin to help with testing figures output from Matplotlib :pypi:`pytest-mproc` - *last release*: Mar 07, 2021, + *last release*: Feb 28, 2022, *status*: 4 - Beta, *requires*: pytest @@ -4975,9 +4993,9 @@ This list contains 1003 plugins. Substitute for "pytest-mypy-plugins" for Python implementations which aren't supported by mypy. :pypi:`pytest-mypy-testing` - *last release*: Jun 13, 2021, + *last release*: Mar 02, 2022, *status*: N/A, - *requires*: pytest + *requires*: N/A Pytest plugin to check mypy output. @@ -5185,16 +5203,16 @@ This list contains 1003 plugins. Pytest plugin for detecting inadvertent open file handles :pypi:`pytest-opentmi` - *last release*: Feb 25, 2022, + *last release*: Feb 28, 2022, *status*: 5 - Production/Stable, *requires*: pytest (>=5.0) pytest plugin for publish results to opentmi :pypi:`pytest-operator` - *last release*: Feb 14, 2022, + *last release*: Mar 02, 2022, *status*: N/A, - *requires*: N/A + *requires*: pytest Fixtures for Operators @@ -5710,7 +5728,7 @@ This list contains 1003 plugins. pytest plugin for testing applications that use psqlgraph :pypi:`pytest-ptera` - *last release*: Oct 20, 2021, + *last release*: Mar 01, 2022, *status*: N/A, *requires*: pytest (>=6.2.4,<7.0.0) @@ -6297,6 +6315,13 @@ This list contains 1003 plugins. Pytest plugin to reverse test order. + :pypi:`pytest-rich` + *last release*: Mar 03, 2022, + *status*: 4 - Beta, + *requires*: pytest (>=7.0) + + Leverage rich for richer test session output + :pypi:`pytest-rich-reporter` *last release*: Feb 17, 2022, *status*: 1 - Planning, @@ -6452,7 +6477,7 @@ This list contains 1003 plugins. :pypi:`pytest-sbase` - *last release*: Feb 25, 2022, + *last release*: Mar 02, 2022, *status*: 5 - Production/Stable, *requires*: N/A @@ -6494,7 +6519,7 @@ This list contains 1003 plugins. pytest plugin for Selenium :pypi:`pytest-seleniumbase` - *last release*: Feb 25, 2022, + *last release*: Mar 02, 2022, *status*: 5 - Production/Stable, *requires*: N/A @@ -6886,7 +6911,7 @@ This list contains 1003 plugins. A Dynamic test tool for Splunk Apps and Add-ons :pypi:`pytest-splunk-addon-ui-smartx` - *last release*: Feb 07, 2022, + *last release*: Mar 01, 2022, *status*: N/A, *requires*: N/A @@ -7229,7 +7254,7 @@ This list contains 1003 plugins. pytest reporting plugin for testlink :pypi:`pytest-testmon` - *last release*: Feb 18, 2022, + *last release*: Mar 01, 2022, *status*: 4 - Beta, *requires*: N/A @@ -7452,6 +7477,13 @@ This list contains 1003 plugins. Cloud Jira Test Management (TM4J) PyTest reporter plugin + :pypi:`pytest-tmnet` + *last release*: Mar 01, 2022, + *status*: N/A, + *requires*: N/A + + A small example package + :pypi:`pytest-tmreport` *last release*: Nov 17, 2021, *status*: N/A, @@ -8041,7 +8073,7 @@ This list contains 1003 plugins. Extend py.test for RPC OpenStack testing. :pypi:`pytest-zulip` - *last release*: Feb 23, 2022, + *last release*: Mar 04, 2022, *status*: 5 - Production/Stable, *requires*: pytest From c0fd2d883940f1292d5e8234803beaacd08315e6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 7 Mar 2022 10:29:39 -0300 Subject: [PATCH 166/176] build(deps): Bump pytest-asyncio from 0.18.1 to 0.18.2 in /testing/plugins_integration (#9736) 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 7d63d38f9f1..f6d978a8c6a 100644 --- a/testing/plugins_integration/requirements.txt +++ b/testing/plugins_integration/requirements.txt @@ -1,6 +1,6 @@ anyio[curio,trio]==3.5.0 django==4.0.2 -pytest-asyncio==0.18.1 +pytest-asyncio==0.18.2 pytest-bdd==5.0.0 pytest-cov==3.0.0 pytest-django==4.5.2 From 4a8f8ada431974f2837260af3ed36299fd382814 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 7 Mar 2022 13:50:25 +0000 Subject: [PATCH 167/176] build(deps): Bump django from 4.0.2 to 4.0.3 in /testing/plugins_integration (#9737) 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 f6d978a8c6a..d7e56e3c5b7 100644 --- a/testing/plugins_integration/requirements.txt +++ b/testing/plugins_integration/requirements.txt @@ -1,5 +1,5 @@ anyio[curio,trio]==3.5.0 -django==4.0.2 +django==4.0.3 pytest-asyncio==0.18.2 pytest-bdd==5.0.0 pytest-cov==3.0.0 From 7f924b13a50a05b8dc894418fa7faf779201e129 Mon Sep 17 00:00:00 2001 From: Fabian Egli Date: Fri, 11 Mar 2022 11:15:28 +0100 Subject: [PATCH 168/176] Fix typo in deprecation documentation --- doc/en/deprecations.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/en/deprecations.rst b/doc/en/deprecations.rst index 1210947159b..91944b758f9 100644 --- a/doc/en/deprecations.rst +++ b/doc/en/deprecations.rst @@ -301,7 +301,7 @@ The ``pytest_warning_captured`` hook This hook has an `item` parameter which cannot be serialized by ``pytest-xdist``. -Use the ``pytest_warning_recored`` hook instead, which replaces the ``item`` parameter +Use the ``pytest_warning_recorded`` hook instead, which replaces the ``item`` parameter by a ``nodeid`` parameter. From d306ec0a7e1711d936e5bb98352a430bff758eae Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Sat, 12 Mar 2022 16:51:56 +0100 Subject: [PATCH 169/176] Update upcoming trainings (#9744) * Update upcoming trainings * Remove old-ish link * Revert "Remove old-ish link" This reverts commit 30d75f50887ca08d26aa02b6048f5334b40cf251. * Use crossref * Add past training --- doc/en/index.rst | 13 +++++++++---- doc/en/talks.rst | 2 ++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/doc/en/index.rst b/doc/en/index.rst index 9e9cf0b68a8..03a39aaaae8 100644 --- a/doc/en/index.rst +++ b/doc/en/index.rst @@ -1,11 +1,16 @@ :orphan: -.. - .. sidebar:: Next Open Trainings +.. sidebar:: Next Open Trainings + + - `PyConDE `__, April 11th 2022 (3h), Berlin, Germany + - `PyConIT `__, June 3rd 2022 (4h), Florence, Italy + - `Professional Testing with Python `_, via `Python Academy `_, March 7th to 9th 2023 (3 day in-depth training), Remote and Leipzig, Germany - - `Professional Testing with Python `_, via `Python Academy `_, February 1st to 3rd, 2022, Leipzig (Germany) and remote. + Also see :doc:`previous talks and blogposts `. - Also see `previous talks and blogposts `_. +.. + - `Europython `__, July 11th to 17th (3h), Dublin, Ireland + - `CH Open Workshoptage `__ (German), September 6th to 8th (1 day), Bern, Switzerland .. _features: diff --git a/doc/en/talks.rst b/doc/en/talks.rst index 0b195960ab2..160345614c8 100644 --- a/doc/en/talks.rst +++ b/doc/en/talks.rst @@ -17,6 +17,8 @@ Books Talks and blog postings --------------------------------------------- +- `pytest: Simple, rapid and fun testing with Python, `_ (@ 4:22:32), Florian Bruhin, WeAreDevelopers World Congress 2021 + - Webinar: `pytest: Test Driven Development für Python (German) `_, Florian Bruhin, via mylearning.ch, 2020 - Webinar: `Simplify Your Tests with Fixtures `_, Oliver Bestwalter, via JetBrains, 2020 From d53a5fb37194faf63ee5d74606cc883138879bc4 Mon Sep 17 00:00:00 2001 From: pytest bot Date: Sun, 13 Mar 2022 13:43:44 +0000 Subject: [PATCH 170/176] Prepare release version 7.1.0 --- changelog/5192.improvement.rst | 3 - changelog/8242.bugfix.rst | 3 - changelog/8838.breaking.rst | 15 ----- changelog/9362.improvement.rst | 1 - changelog/9437.breaking.rst | 1 - changelog/9493.bugfix.rst | 10 ---- changelog/9536.improvement.rst | 1 - changelog/9626.bugfix.rst | 3 - changelog/9644.improvement.rst | 4 -- changelog/9645.bugfix.rst | 1 - changelog/9678.improvement.rst | 3 - changelog/9692.improvement.rst | 3 - changelog/9708.bugfix.rst | 1 - changelog/9730.bugfix.rst | 1 - doc/en/announce/index.rst | 1 + doc/en/announce/release-7.1.0.rst | 48 ++++++++++++++++ doc/en/builtin.rst | 4 +- doc/en/changelog.rst | 92 +++++++++++++++++++++++++++++++ doc/en/example/reportingdemo.rst | 6 +- doc/en/getting-started.rst | 2 +- doc/en/how-to/assert.rst | 2 +- doc/en/how-to/output.rst | 4 +- extra/setup-py.test/setup.py | 1 + 23 files changed, 151 insertions(+), 59 deletions(-) delete mode 100644 changelog/5192.improvement.rst delete mode 100644 changelog/8242.bugfix.rst delete mode 100644 changelog/8838.breaking.rst delete mode 100644 changelog/9362.improvement.rst delete mode 100644 changelog/9437.breaking.rst delete mode 100644 changelog/9493.bugfix.rst delete mode 100644 changelog/9536.improvement.rst delete mode 100644 changelog/9626.bugfix.rst delete mode 100644 changelog/9644.improvement.rst delete mode 100644 changelog/9645.bugfix.rst delete mode 100644 changelog/9678.improvement.rst delete mode 100644 changelog/9692.improvement.rst delete mode 100644 changelog/9708.bugfix.rst delete mode 100644 changelog/9730.bugfix.rst create mode 100644 doc/en/announce/release-7.1.0.rst diff --git a/changelog/5192.improvement.rst b/changelog/5192.improvement.rst deleted file mode 100644 index c51077ae5f1..00000000000 --- a/changelog/5192.improvement.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fixed test output for some data types where ``-v`` would show less information. - -Also, when showing diffs for sequences, ``-q`` would produce full diffs instead of the expected diff. diff --git a/changelog/8242.bugfix.rst b/changelog/8242.bugfix.rst deleted file mode 100644 index eaa46142eea..00000000000 --- a/changelog/8242.bugfix.rst +++ /dev/null @@ -1,3 +0,0 @@ -The deprecation of raising :class:`unittest.SkipTest` to skip collection of -tests during the pytest collection phase is reverted - this is now a supported -feature again. diff --git a/changelog/8838.breaking.rst b/changelog/8838.breaking.rst deleted file mode 100644 index f5c1fead874..00000000000 --- a/changelog/8838.breaking.rst +++ /dev/null @@ -1,15 +0,0 @@ -As per our policy, the following features have been deprecated in the 6.X series and are now -removed: - -* ``pytest._fillfuncargs`` function. - -* ``pytest_warning_captured`` hook - use ``pytest_warning_recorded`` instead. - -* ``-k -foobar`` syntax - use ``-k 'not foobar'`` instead. - -* ``-k foobar:`` syntax. - -* ``pytest.collect`` module - import from ``pytest`` directly. - -For more information consult -`Deprecations and Removals `__ in the docs. diff --git a/changelog/9362.improvement.rst b/changelog/9362.improvement.rst deleted file mode 100644 index ad7f8042ca9..00000000000 --- a/changelog/9362.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -pytest now avoids specialized assert formatting when it is detected that the default ``__eq__`` is overridden in ``attrs`` or ``dataclasses``. diff --git a/changelog/9437.breaking.rst b/changelog/9437.breaking.rst deleted file mode 100644 index 60d4337f420..00000000000 --- a/changelog/9437.breaking.rst +++ /dev/null @@ -1 +0,0 @@ -Dropped support for Python 3.6, which reached `end-of-life `__ at 2021-12-23. diff --git a/changelog/9493.bugfix.rst b/changelog/9493.bugfix.rst deleted file mode 100644 index d99c80b7d2c..00000000000 --- a/changelog/9493.bugfix.rst +++ /dev/null @@ -1,10 +0,0 @@ -Symbolic link components are no longer resolved in conftest paths. -This means that if a conftest appears twice in collection tree, using symlinks, it will be executed twice. -For example, given - - tests/real/conftest.py - tests/real/test_it.py - tests/link -> tests/real - -running ``pytest tests`` now imports the conftest twice, once as ``tests/real/conftest.py`` and once as ``tests/link/conftest.py``. -This is a fix to match a similar change made to test collection itself in pytest 6.0 (see :pull:`6523` for details). diff --git a/changelog/9536.improvement.rst b/changelog/9536.improvement.rst deleted file mode 100644 index c7769602f54..00000000000 --- a/changelog/9536.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -When ``-vv`` is given on command line, show skipping and xfail reasons in full instead of truncating them to fit the terminal width. diff --git a/changelog/9626.bugfix.rst b/changelog/9626.bugfix.rst deleted file mode 100644 index 44d3734a1d2..00000000000 --- a/changelog/9626.bugfix.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fixed count of selected tests on terminal collection summary when there were errors or skipped modules. - -If there were errors or skipped modules on collection, pytest would mistakenly subtract those from the selected count. diff --git a/changelog/9644.improvement.rst b/changelog/9644.improvement.rst deleted file mode 100644 index 6e29fd57a79..00000000000 --- a/changelog/9644.improvement.rst +++ /dev/null @@ -1,4 +0,0 @@ -More information about the location of resources that led Python to raise :class:`ResourceWarning` can now -be obtained by enabling :mod:`tracemalloc`. - -See :ref:`resource-warnings` for more information. diff --git a/changelog/9645.bugfix.rst b/changelog/9645.bugfix.rst deleted file mode 100644 index 089a783dee6..00000000000 --- a/changelog/9645.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed regression where ``--import-mode=importlib`` used together with :envvar:`PYTHONPATH` or :confval:`pythonpath` would cause import errors in test suites. diff --git a/changelog/9678.improvement.rst b/changelog/9678.improvement.rst deleted file mode 100644 index d7bb1083a4d..00000000000 --- a/changelog/9678.improvement.rst +++ /dev/null @@ -1,3 +0,0 @@ -More types are now accepted in the ``ids`` argument to ``@pytest.mark.parametrize``. -Previously only `str`, `float`, `int` and `bool` were accepted; -now `bytes`, `complex`, `re.Pattern`, `Enum` and anything with a `__name__` are also accepted. diff --git a/changelog/9692.improvement.rst b/changelog/9692.improvement.rst deleted file mode 100644 index ecc57a68c22..00000000000 --- a/changelog/9692.improvement.rst +++ /dev/null @@ -1,3 +0,0 @@ -:func:`pytest.approx` now raises a :class:`TypeError` when given an unordered sequence (such as :class:`set`). - -Note that this implies that custom classes which only implement ``__iter__`` and ``__len__`` are no longer supported as they don't guarantee order. diff --git a/changelog/9708.bugfix.rst b/changelog/9708.bugfix.rst deleted file mode 100644 index 9defbbd578f..00000000000 --- a/changelog/9708.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -:fixture:`pytester` now requests a :fixture:`monkeypatch` fixture instead of creating one internally. This solves some issues with tests that involve pytest environment variables. diff --git a/changelog/9730.bugfix.rst b/changelog/9730.bugfix.rst deleted file mode 100644 index df30ab7e360..00000000000 --- a/changelog/9730.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Malformed ``pyproject.toml`` files now produce a clearer error message. diff --git a/doc/en/announce/index.rst b/doc/en/announce/index.rst index 9505b0b9e46..e55dd33e81e 100644 --- a/doc/en/announce/index.rst +++ b/doc/en/announce/index.rst @@ -6,6 +6,7 @@ Release announcements :maxdepth: 2 + release-7.1.0 release-7.0.1 release-7.0.0 release-7.0.0rc1 diff --git a/doc/en/announce/release-7.1.0.rst b/doc/en/announce/release-7.1.0.rst new file mode 100644 index 00000000000..3361e1c8a32 --- /dev/null +++ b/doc/en/announce/release-7.1.0.rst @@ -0,0 +1,48 @@ +pytest-7.1.0 +======================================= + +The pytest team is proud to announce the 7.1.0 release! + +This release contains new features, improvements, and bug fixes, +the full list of changes is available in the changelog: + + https://docs.pytest.org/en/stable/changelog.html + +For complete documentation, please visit: + + https://docs.pytest.org/en/stable/ + +As usual, you can upgrade from PyPI via: + + pip install -U pytest + +Thanks to all of the contributors to this release: + +* Akuli +* Andrew Svetlov +* Anthony Sottile +* Brett Holman +* Bruno Oliveira +* Chris NeJame +* Dan Alvizu +* Elijah DeLee +* Emmanuel Arias +* Fabian Egli +* Florian Bruhin +* Gabor Szabo +* Hasan Ramezani +* Hugo van Kemenade +* Kian Meng, Ang +* Kojo Idrissa +* Masaru Tsuchiyama +* Olga Matoula +* P. L. Lim +* Ran Benita +* Tobias Deiminger +* Yuval Shimon +* eduardo naufel schettino +* Éric + + +Happy testing, +The pytest Development Team diff --git a/doc/en/builtin.rst b/doc/en/builtin.rst index c7e7863b218..455ae88121f 100644 --- a/doc/en/builtin.rst +++ b/doc/en/builtin.rst @@ -65,7 +65,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a Fixture that returns a :py:class:`dict` that will be injected into the namespace of doctests. - pytestconfig [session scope] -- .../_pytest/fixtures.py:1365 + pytestconfig [session scope] -- .../_pytest/fixtures.py:1334 Session-scoped fixture that returns the session's :class:`pytest.Config` object. @@ -134,7 +134,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a .. _legacy_path: https://py.readthedocs.io/en/latest/path.html - caplog -- .../_pytest/logging.py:483 + caplog -- .../_pytest/logging.py:487 Access and control log capturing. Captured logs are available through the following properties/methods:: diff --git a/doc/en/changelog.rst b/doc/en/changelog.rst index 41a79ce5b2f..64a22cbc7b5 100644 --- a/doc/en/changelog.rst +++ b/doc/en/changelog.rst @@ -28,6 +28,98 @@ with advance notice in the **Deprecations** section of releases. .. towncrier release notes start +pytest 7.1.0 (2022-03-13) +========================= + +Breaking Changes +---------------- + +- `#8838 `_: As per our policy, the following features have been deprecated in the 6.X series and are now + removed: + + * ``pytest._fillfuncargs`` function. + + * ``pytest_warning_captured`` hook - use ``pytest_warning_recorded`` instead. + + * ``-k -foobar`` syntax - use ``-k 'not foobar'`` instead. + + * ``-k foobar:`` syntax. + + * ``pytest.collect`` module - import from ``pytest`` directly. + + For more information consult + `Deprecations and Removals `__ in the docs. + + +- `#9437 `_: Dropped support for Python 3.6, which reached `end-of-life `__ at 2021-12-23. + + + +Improvements +------------ + +- `#5192 `_: Fixed test output for some data types where ``-v`` would show less information. + + Also, when showing diffs for sequences, ``-q`` would produce full diffs instead of the expected diff. + + +- `#9362 `_: pytest now avoids specialized assert formatting when it is detected that the default ``__eq__`` is overridden in ``attrs`` or ``dataclasses``. + + +- `#9536 `_: When ``-vv`` is given on command line, show skipping and xfail reasons in full instead of truncating them to fit the terminal width. + + +- `#9644 `_: More information about the location of resources that led Python to raise :class:`ResourceWarning` can now + be obtained by enabling :mod:`tracemalloc`. + + See :ref:`resource-warnings` for more information. + + +- `#9678 `_: More types are now accepted in the ``ids`` argument to ``@pytest.mark.parametrize``. + Previously only `str`, `float`, `int` and `bool` were accepted; + now `bytes`, `complex`, `re.Pattern`, `Enum` and anything with a `__name__` are also accepted. + + +- `#9692 `_: :func:`pytest.approx` now raises a :class:`TypeError` when given an unordered sequence (such as :class:`set`). + + Note that this implies that custom classes which only implement ``__iter__`` and ``__len__`` are no longer supported as they don't guarantee order. + + + +Bug Fixes +--------- + +- `#8242 `_: The deprecation of raising :class:`unittest.SkipTest` to skip collection of + tests during the pytest collection phase is reverted - this is now a supported + feature again. + + +- `#9493 `_: Symbolic link components are no longer resolved in conftest paths. + This means that if a conftest appears twice in collection tree, using symlinks, it will be executed twice. + For example, given + + tests/real/conftest.py + tests/real/test_it.py + tests/link -> tests/real + + running ``pytest tests`` now imports the conftest twice, once as ``tests/real/conftest.py`` and once as ``tests/link/conftest.py``. + This is a fix to match a similar change made to test collection itself in pytest 6.0 (see :pull:`6523` for details). + + +- `#9626 `_: Fixed count of selected tests on terminal collection summary when there were errors or skipped modules. + + If there were errors or skipped modules on collection, pytest would mistakenly subtract those from the selected count. + + +- `#9645 `_: Fixed regression where ``--import-mode=importlib`` used together with :envvar:`PYTHONPATH` or :confval:`pythonpath` would cause import errors in test suites. + + +- `#9708 `_: :fixture:`pytester` now requests a :fixture:`monkeypatch` fixture instead of creating one internally. This solves some issues with tests that involve pytest environment variables. + + +- `#9730 `_: Malformed ``pyproject.toml`` files now produce a clearer error message. + + pytest 7.0.1 (2022-02-11) ========================= diff --git a/doc/en/example/reportingdemo.rst b/doc/en/example/reportingdemo.rst index cab93143615..4c1ae1c05af 100644 --- a/doc/en/example/reportingdemo.rst +++ b/doc/en/example/reportingdemo.rst @@ -155,7 +155,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: > assert [0, 1, 2] == [0, 1, 3] E assert [0, 1, 2] == [0, 1, 3] E At index 2 diff: 2 != 3 - E Use -v to get the full diff + E Use -v to get more diff failure_demo.py:63: AssertionError ______________ TestSpecialisedExplanations.test_eq_list_long _______________ @@ -168,7 +168,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: > assert a == b E assert [0, 0, 0, 0, 0, 0, ...] == [0, 0, 0, 0, 0, 0, ...] E At index 100 diff: 1 != 2 - E Use -v to get the full diff + E Use -v to get more diff failure_demo.py:68: AssertionError _________________ TestSpecialisedExplanations.test_eq_dict _________________ @@ -215,7 +215,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: > assert [1, 2] == [1, 2, 3] E assert [1, 2] == [1, 2, 3] E Right contains one more item: 3 - E Use -v to get the full diff + E Use -v to get more diff failure_demo.py:77: AssertionError _________________ TestSpecialisedExplanations.test_in_list _________________ diff --git a/doc/en/getting-started.rst b/doc/en/getting-started.rst index 79b88ced9e1..73f6fc53b48 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.0.1 + pytest 7.1.0 .. _`simpletest`: diff --git a/doc/en/how-to/assert.rst b/doc/en/how-to/assert.rst index cb70db6b8ed..65f16129142 100644 --- a/doc/en/how-to/assert.rst +++ b/doc/en/how-to/assert.rst @@ -201,7 +201,7 @@ if you run this module: E '1' E Extra items in the right set: E '5' - E Use -v to get the full diff + E Use -v to get more diff test_assert2.py:4: AssertionError ========================= short test summary info ========================== diff --git a/doc/en/how-to/output.rst b/doc/en/how-to/output.rst index 4b90988f49d..dc3a86ba29d 100644 --- a/doc/en/how-to/output.rst +++ b/doc/en/how-to/output.rst @@ -84,7 +84,7 @@ Executing pytest normally gives us this output (we are skipping the header to fo > assert fruits1 == fruits2 E AssertionError: assert ['banana', 'a...elon', 'kiwi'] == ['banana', 'a...elon', 'kiwi'] E At index 2 diff: 'grapes' != 'orange' - E Use -v to get the full diff + E Use -v to get more diff test_verbosity_example.py:8: AssertionError ____________________________ test_numbers_fail _____________________________ @@ -99,7 +99,7 @@ Executing pytest normally gives us this output (we are skipping the header to fo E {'1': 1, '2': 2, '3': 3, '4': 4} E Right contains 4 more items: E {'10': 10, '20': 20, '30': 30, '40': 40} - E Use -v to get the full diff + E Use -v to get more diff test_verbosity_example.py:14: AssertionError ___________________________ test_long_text_fail ____________________________ diff --git a/extra/setup-py.test/setup.py b/extra/setup-py.test/setup.py index d0560ce1f5f..97883852e2e 100644 --- a/extra/setup-py.test/setup.py +++ b/extra/setup-py.test/setup.py @@ -1,4 +1,5 @@ import sys + from distutils.core import setup if __name__ == "__main__": From 1dbffcc0b4d822b87ad9f90595ffab6d9beee769 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 13 Mar 2022 13:44:47 +0000 Subject: [PATCH 171/176] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- extra/setup-py.test/setup.py | 1 - 1 file changed, 1 deletion(-) diff --git a/extra/setup-py.test/setup.py b/extra/setup-py.test/setup.py index 97883852e2e..d0560ce1f5f 100644 --- a/extra/setup-py.test/setup.py +++ b/extra/setup-py.test/setup.py @@ -1,5 +1,4 @@ import sys - from distutils.core import setup if __name__ == "__main__": From f1df8074b3d9185313752cbc29b88d889a1879d9 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Thu, 17 Mar 2022 18:13:06 +0200 Subject: [PATCH 172/176] [7.1.x] config: restore pre-pytest 7.1.0 confcutdir exclusion behavior --- changelog/9767.bugfix.rst | 1 + src/_pytest/config/__init__.py | 6 +----- testing/test_conftest.py | 28 ++++++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 changelog/9767.bugfix.rst diff --git a/changelog/9767.bugfix.rst b/changelog/9767.bugfix.rst new file mode 100644 index 00000000000..7de316980b8 --- /dev/null +++ b/changelog/9767.bugfix.rst @@ -0,0 +1 @@ +Fixed a regression in pytest 7.1.0 where some conftest.py files outside of the source tree (e.g. in the `site-packages` directory) were not picked up. diff --git a/src/_pytest/config/__init__.py b/src/_pytest/config/__init__.py index f4818c861cf..91ad3f094ff 100644 --- a/src/_pytest/config/__init__.py +++ b/src/_pytest/config/__init__.py @@ -538,11 +538,7 @@ def _is_in_confcutdir(self, path: Path) -> bool: """ if self._confcutdir is None: return True - try: - path.relative_to(self._confcutdir) - except ValueError: - return False - return True + return path not in self._confcutdir.parents def _try_load_conftest( self, anchor: Path, importmode: Union[str, ImportMode], rootpath: Path diff --git a/testing/test_conftest.py b/testing/test_conftest.py index 4cbc2d14c36..68048204581 100644 --- a/testing/test_conftest.py +++ b/testing/test_conftest.py @@ -252,6 +252,34 @@ def pytest_addoption(parser): result.stdout.no_fnmatch_line("*warning: could not load initial*") +def test_installed_conftest_is_picked_up(pytester: Pytester, tmp_path: Path) -> None: + """When using `--pyargs` to run tests in an installed packages (located e.g. + in a site-packages in the PYTHONPATH), conftest files in there are picked + up. + + Regression test for #9767. + """ + # pytester dir - the source tree. + # tmp_path - the simulated site-packages dir (not in source tree). + + pytester.syspathinsert(tmp_path) + pytester.makepyprojecttoml("[tool.pytest.ini_options]") + tmp_path.joinpath("foo").mkdir() + tmp_path.joinpath("foo", "__init__.py").touch() + tmp_path.joinpath("foo", "conftest.py").write_text( + textwrap.dedent( + """\ + import pytest + @pytest.fixture + def fix(): return None + """ + ) + ) + tmp_path.joinpath("foo", "test_it.py").write_text("def test_it(fix): pass") + result = pytester.runpytest("--pyargs", "foo") + assert result.ret == 0 + + def test_conftest_symlink(pytester: Pytester) -> None: """`conftest.py` discovery follows normal path resolution and does not resolve symlinks.""" # Structure: From f4cfc596c6574abf68ed49503fd1b8ef1484125d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 17 Mar 2022 16:16:12 +0000 Subject: [PATCH 173/176] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- extra/setup-py.test/setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/extra/setup-py.test/setup.py b/extra/setup-py.test/setup.py index d0560ce1f5f..97883852e2e 100644 --- a/extra/setup-py.test/setup.py +++ b/extra/setup-py.test/setup.py @@ -1,4 +1,5 @@ import sys + from distutils.core import setup if __name__ == "__main__": From 10a14d13181fd69dd0eaf48bf5b3d389de896713 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Thu, 17 Mar 2022 18:17:17 +0200 Subject: [PATCH 174/176] [7.1.x] testing: fix tests when run under `-v` or `-vv` --- testing/test_assertrewrite.py | 48 +++++++---------------------------- 1 file changed, 9 insertions(+), 39 deletions(-) diff --git a/testing/test_assertrewrite.py b/testing/test_assertrewrite.py index 8f18e89c94f..a515bbae96b 100644 --- a/testing/test_assertrewrite.py +++ b/testing/test_assertrewrite.py @@ -204,16 +204,8 @@ def f3() -> None: def f4() -> None: assert sys == 42 # type: ignore[comparison-overlap] - verbose = request.config.getoption("verbose") msg = getmsg(f4, {"sys": sys}) - if verbose > 0: - assert msg == ( - "assert == 42\n" - " +\n" - " -42" - ) - else: - assert msg == "assert sys == 42" + assert msg == "assert sys == 42" def f5() -> None: assert cls == 42 # type: ignore[name-defined] # noqa: F821 @@ -224,20 +216,7 @@ class X: msg = getmsg(f5, {"cls": X}) assert msg is not None lines = msg.splitlines() - if verbose > 1: - assert lines == [ - f"assert {X!r} == 42", - f" +{X!r}", - " -42", - ] - elif verbose > 0: - assert lines == [ - "assert .X'> == 42", - f" +{X!r}", - " -42", - ] - else: - assert lines == ["assert cls == 42"] + assert lines == ["assert cls == 42"] def test_assertrepr_compare_same_width(self, request) -> None: """Should use same width/truncation with same initial width.""" @@ -279,14 +258,11 @@ def f() -> None: msg = getmsg(f, {"cls": Y}) assert msg is not None lines = msg.splitlines() - if request.config.getoption("verbose") > 0: - assert lines == ["assert 3 == 2", " +3", " -2"] - else: - assert lines == [ - "assert 3 == 2", - " + where 3 = Y.foo", - " + where Y = cls()", - ] + assert lines == [ + "assert 3 == 2", + " + where 3 = Y.foo", + " + where Y = cls()", + ] def test_assert_already_has_message(self) -> None: def f(): @@ -663,10 +639,7 @@ def f(): assert len(values) == 11 msg = getmsg(f) - if request.config.getoption("verbose") > 0: - assert msg == "assert 10 == 11\n +10\n -11" - else: - assert msg == "assert 10 == 11\n + where 10 = len([0, 1, 2, 3, 4, 5, ...])" + assert msg == "assert 10 == 11\n + where 10 = len([0, 1, 2, 3, 4, 5, ...])" def test_custom_reprcompare(self, monkeypatch) -> None: def my_reprcompare1(op, left, right) -> str: @@ -732,10 +705,7 @@ def __repr__(self): msg = getmsg(f) assert msg is not None lines = util._format_lines([msg]) - if request.config.getoption("verbose") > 0: - assert lines == ["assert 0 == 1\n +0\n -1"] - else: - assert lines == ["assert 0 == 1\n + where 1 = \\n{ \\n~ \\n}.a"] + assert lines == ["assert 0 == 1\n + where 1 = \\n{ \\n~ \\n}.a"] def test_custom_repr_non_ascii(self) -> None: def f() -> None: From 30d995ed25e6d76e85da140663e6253fa5b41935 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 17 Mar 2022 16:27:24 +0000 Subject: [PATCH 175/176] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- extra/setup-py.test/setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/extra/setup-py.test/setup.py b/extra/setup-py.test/setup.py index d0560ce1f5f..97883852e2e 100644 --- a/extra/setup-py.test/setup.py +++ b/extra/setup-py.test/setup.py @@ -1,4 +1,5 @@ import sys + from distutils.core import setup if __name__ == "__main__": From 0ffe9e07422dfec72479a6d056154ec8b9b0dbae Mon Sep 17 00:00:00 2001 From: pytest bot Date: Thu, 17 Mar 2022 20:21:30 +0000 Subject: [PATCH 176/176] Prepare release version 7.1.1 --- changelog/9767.bugfix.rst | 1 - doc/en/announce/index.rst | 1 + doc/en/announce/release-7.1.1.rst | 18 ++++++++++++++++++ doc/en/changelog.rst | 9 +++++++++ doc/en/getting-started.rst | 2 +- 5 files changed, 29 insertions(+), 2 deletions(-) delete mode 100644 changelog/9767.bugfix.rst create mode 100644 doc/en/announce/release-7.1.1.rst diff --git a/changelog/9767.bugfix.rst b/changelog/9767.bugfix.rst deleted file mode 100644 index 7de316980b8..00000000000 --- a/changelog/9767.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed a regression in pytest 7.1.0 where some conftest.py files outside of the source tree (e.g. in the `site-packages` directory) were not picked up. diff --git a/doc/en/announce/index.rst b/doc/en/announce/index.rst index e55dd33e81e..0da8b4037ed 100644 --- a/doc/en/announce/index.rst +++ b/doc/en/announce/index.rst @@ -6,6 +6,7 @@ Release announcements :maxdepth: 2 + release-7.1.1 release-7.1.0 release-7.0.1 release-7.0.0 diff --git a/doc/en/announce/release-7.1.1.rst b/doc/en/announce/release-7.1.1.rst new file mode 100644 index 00000000000..d271c4557a2 --- /dev/null +++ b/doc/en/announce/release-7.1.1.rst @@ -0,0 +1,18 @@ +pytest-7.1.1 +======================================= + +pytest 7.1.1 has just been released to PyPI. + +This is a bug-fix release, being a drop-in replacement. To upgrade:: + + pip install --upgrade pytest + +The full changelog is available at https://docs.pytest.org/en/stable/changelog.html. + +Thanks to all of the contributors to this release: + +* Ran Benita + + +Happy testing, +The pytest Development Team diff --git a/doc/en/changelog.rst b/doc/en/changelog.rst index 64a22cbc7b5..6ff85883e41 100644 --- a/doc/en/changelog.rst +++ b/doc/en/changelog.rst @@ -28,6 +28,15 @@ with advance notice in the **Deprecations** section of releases. .. towncrier release notes start +pytest 7.1.1 (2022-03-17) +========================= + +Bug Fixes +--------- + +- `#9767 `_: Fixed a regression in pytest 7.1.0 where some conftest.py files outside of the source tree (e.g. in the `site-packages` directory) were not picked up. + + pytest 7.1.0 (2022-03-13) ========================= diff --git a/doc/en/getting-started.rst b/doc/en/getting-started.rst index 73f6fc53b48..b856803f1f1 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.1.0 + pytest 7.1.1 .. _`simpletest`: