From 38a156172606a5f1587b5589ddc403d899669263 Mon Sep 17 00:00:00 2001 From: pytest bot Date: Mon, 28 Jun 2021 19:21:58 +0000 Subject: [PATCH] Prepare release version 7.0.0rc1 --- changelog/5105.doc.rst | 1 - changelog/7259.feature.rst | 7 - changelog/7469.deprecation.rst | 12 -- changelog/7469.feature.rst | 19 -- changelog/7856.feature.rst | 2 - changelog/8061.bugfix.rst | 1 - changelog/8144.feature.rst | 7 - 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.deprecation.rst | 1 - changelog/8251.feature.rst | 1 - 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/8384.bugfix.rst | 1 - changelog/8394.bugfix.rst | 1 - changelog/8403.improvement.rst | 5 - changelog/8411.trivial.rst | 1 - changelog/8421.feature.rst | 1 - changelog/8447.deprecation.rst | 4 - changelog/8456.bugfix.rst | 1 - changelog/8464.bugfix.rst | 1 - changelog/8494.feature.rst | 1 - changelog/8503.trivial.rst | 4 - changelog/8509.improvement.rst | 5 - changelog/8548.bugfix.rst | 1 - changelog/8606.feature.rst | 5 - changelog/8645.improvement.rst | 4 - changelog/8655.doc.rst | 1 - changelog/8761.feature.rst | 1 - doc/en/announce/index.rst | 1 + doc/en/announce/release-7.0.0rc1.rst | 88 +++++++++ doc/en/builtin.rst | 143 ++------------- doc/en/changelog.rst | 227 ++++++++++++++++++++++++ doc/en/example/markers.rst | 28 +-- doc/en/example/nonpython.rst | 26 ++- doc/en/example/parametrize.rst | 14 +- doc/en/example/pythoncollection.rst | 6 +- doc/en/example/reportingdemo.rst | 2 +- doc/en/example/simple.rst | 25 +-- doc/en/getting-started.rst | 10 +- doc/en/how-to/assert.rst | 6 +- doc/en/how-to/cache.rst | 215 +++++++++++++++++++++- doc/en/how-to/capture-stdout-stderr.rst | 2 +- doc/en/how-to/capture-warnings.rst | 2 +- doc/en/how-to/doctest.rst | 4 +- doc/en/how-to/fixtures.rst | 10 +- doc/en/how-to/output.rst | 49 +++-- doc/en/how-to/parametrize.rst | 4 +- doc/en/how-to/tmpdir.rst | 2 +- doc/en/how-to/unittest.rst | 2 +- doc/en/how-to/usage.rst | 26 +-- doc/en/how-to/writing_plugins.rst | 2 +- doc/en/index.rst | 2 +- doc/en/reference/reference.rst | 6 +- 61 files changed, 655 insertions(+), 374 deletions(-) delete mode 100644 changelog/5105.doc.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/7856.feature.rst delete mode 100644 changelog/8061.bugfix.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.deprecation.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/8384.bugfix.rst delete mode 100644 changelog/8394.bugfix.rst delete mode 100644 changelog/8403.improvement.rst delete mode 100644 changelog/8411.trivial.rst delete mode 100644 changelog/8421.feature.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/8494.feature.rst delete mode 100644 changelog/8503.trivial.rst delete mode 100644 changelog/8509.improvement.rst delete mode 100644 changelog/8548.bugfix.rst delete mode 100644 changelog/8606.feature.rst delete mode 100644 changelog/8645.improvement.rst delete mode 100644 changelog/8655.doc.rst delete mode 100644 changelog/8761.feature.rst create mode 100644 doc/en/announce/release-7.0.0rc1.rst 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/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 3762306c736..00000000000 --- a/changelog/7469.deprecation.rst +++ /dev/null @@ -1,12 +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`` - -These have always been considered private, but now issue a deprecation warning, which may become a hard error in pytest 7.0.0. diff --git a/changelog/7469.feature.rst b/changelog/7469.feature.rst deleted file mode 100644 index 9922631fee9..00000000000 --- a/changelog/7469.feature.rst +++ /dev/null @@ -1,19 +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. - -Constructing 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 7.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/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/8061.bugfix.rst b/changelog/8061.bugfix.rst deleted file mode 100644 index 2c8980fb34e..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/8144.feature.rst b/changelog/8144.feature.rst deleted file mode 100644 index 01f40e21521..00000000000 --- a/changelog/8144.feature.rst +++ /dev/null @@ -1,7 +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 ``fspath`` parameter (equivalent to existing ``path`` parameter). -- :func:`pytest_collect_file <_pytest.hookspec.pytest_collect_file>` - The ``fspath`` parameter (equivalent to existing ``path`` parameter). -- :func:`pytest_pycollect_makemodule <_pytest.hookspec.pytest_pycollect_makemodule>` - The ``fspath`` parameter (equivalent to existing ``path`` parameter). -- :func:`pytest_report_header <_pytest.hookspec.pytest_report_header>` - The ``startpath`` parameter (equivalent to existing ``startdir`` parameter). -- :func:`pytest_report_collectionfinish <_pytest.hookspec.pytest_report_collectionfinish>` - The ``startpath`` parameter (equivalent to existing ``startdir`` parameter). 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 b2e8566eaa9..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 `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 0a9319d9cd5..00000000000 --- a/changelog/8248.trivial.rst +++ /dev/null @@ -1 +0,0 @@ -Internal Restructure: let python.PyObjMixing inherit from nodes.Node to carry over typing information. diff --git a/changelog/8251.deprecation.rst b/changelog/8251.deprecation.rst deleted file mode 100644 index 1d988bfc83b..00000000000 --- a/changelog/8251.deprecation.rst +++ /dev/null @@ -1 +0,0 @@ -Deprecate ``Node.fspath`` as we plan to move off `py.path.local `__ and switch to :mod:``pathlib``. diff --git a/changelog/8251.feature.rst b/changelog/8251.feature.rst deleted file mode 100644 index 49aede797a0..00000000000 --- a/changelog/8251.feature.rst +++ /dev/null @@ -1 +0,0 @@ -Implement ``Node.path`` as a ``pathlib.Path``. 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 c30dcf5d13e..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 7 (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/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/8411.trivial.rst b/changelog/8411.trivial.rst deleted file mode 100644 index 8f169a900fa..00000000000 --- a/changelog/8411.trivial.rst +++ /dev/null @@ -1 +0,0 @@ -Assert the outcomes for the issue 518 test and fix the test. 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/8447.deprecation.rst b/changelog/8447.deprecation.rst deleted file mode 100644 index d1011f8c849..00000000000 --- a/changelog/8447.deprecation.rst +++ /dev/null @@ -1,4 +0,0 @@ -Defining a custom pytest node type which is both an item and a collector now issues a warning. -It was never sanely supported and triggers hard to debug errors. - -Instead, a separate collector node should be used, which collects the item. See :ref:`non-python tests` for an example. 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/8494.feature.rst b/changelog/8494.feature.rst deleted file mode 100644 index eca51d0deb9..00000000000 --- a/changelog/8494.feature.rst +++ /dev/null @@ -1 +0,0 @@ -Python 3.10 is now supported. diff --git a/changelog/8503.trivial.rst b/changelog/8503.trivial.rst deleted file mode 100644 index 26f660bbf3f..00000000000 --- a/changelog/8503.trivial.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 d72e8e487f6..00000000000 --- a/changelog/8509.improvement.rst +++ /dev/null @@ -1,5 +0,0 @@ -Fixed issue where `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/8606.feature.rst b/changelog/8606.feature.rst deleted file mode 100644 index 9705ffe75d6..00000000000 --- a/changelog/8606.feature.rst +++ /dev/null @@ -1,5 +0,0 @@ -pytest invocations with ``--fixtures-per-test`` and ``--fixtures`` have been enabled 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.improvement.rst b/changelog/8645.improvement.rst deleted file mode 100644 index b3a68b0b8c8..00000000000 --- a/changelog/8645.improvement.rst +++ /dev/null @@ -1,4 +0,0 @@ -Reducing confusion from `pytest.warns(None)` by: - -- Allowing no arguments to be passed in order to catch any exception (no argument defaults to `Warning`). -- Emit a deprecation warning if passed `None`. 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/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/doc/en/announce/index.rst b/doc/en/announce/index.rst index 7751405a196..676dcb88d84 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.4 release-6.2.3 release-6.2.2 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..5dfd7af648c --- /dev/null +++ b/doc/en/announce/release-7.0.0rc1.rst @@ -0,0 +1,88 @@ +pytest-7.0.0rc1 +======================================= + +pytest 7.0.0rc1 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: + +* Abdelrahman Elbehery +* Adam Johnson +* Albert Villanova del Moral +* Alexandros Tzannes +* Andreas Motl +* Anthony Sottile +* Anton +* Benjamin Wohlwend +* Bruno Oliveira +* Chris NeJame +* Chris Rose +* Christian Steinmeyer +* Christophe Bedard +* Daniele Procida +* Denis Laxalde +* Dominic Davis-Foster +* Feanil Patel +* Florian Bruhin +* Gergely Imreh +* Hong Xu +* Jakob van Santen +* James Bourbeau +* James Gerity +* Jason Haugen +* Jeff Widman +* Johannes Maron +* Jürgen Gmach +* Kale Kundert +* MapleCCC +* Matthew Hughes +* Maximilian Cosmo Sitter +* Mehera Emrich +* Miro Hrončok +* Miroslav Šedivý +* Nico Schlömer +* Olga Matoula +* Parth Patel +* Pax +* Petr Viktorin +* Pierre Mourlanne +* Rahul Kumaresan +* Ran Benita +* Ronny Pfannschmidt +* Ross Vandegrift +* Saiprasad Kale +* Simon K +* Srip +* Stefaan Lippens +* Sylvain Bellemare +* Tadeu Manoel +* Tarcísio Fischer +* Thomas Grainger +* Vincent Poulailleau +* Zac Hatfield-Dodds +* Zack Kneupper +* alshapton +* antonblr +* bengartner +* bluetech +* bot2x +* dependabot[bot] +* hauntsaninja +* maskypy40 +* mefmund +* mobius-crypt +* pre-commit-ci[bot] +* pytest bot +* sousajf1 +* sousajo +* symonk +* wim glenn + + +Happy testing, +The pytest Development Team diff --git a/doc/en/builtin.rst b/doc/en/builtin.rst index ea2f27a4c9f..8a8f638d466 100644 --- a/doc/en/builtin.rst +++ b/doc/en/builtin.rst @@ -17,168 +17,63 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a .. code-block:: pytest $ pytest -q --fixtures - cache + cache -- ../../..$PYTHON_PREFIX/lib/python3.8/site-packages/_pytest/cacheprovider.py:519 Return a cache object that can persist state between testing sessions. - cache.get(key, default) - cache.set(key, value) - - Keys must be ``/`` separated strings, where the first part is usually the - name of your plugin or application to avoid clashes with other cache users. - - Values can be any object handled by the json stdlib module. - - capsys + capsys -- ../../..$PYTHON_PREFIX/lib/python3.8/site-packages/_pytest/capture.py:903 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 + capsysbinary -- ../../..$PYTHON_PREFIX/lib/python3.8/site-packages/_pytest/capture.py:920 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 + capfd -- ../../..$PYTHON_PREFIX/lib/python3.8/site-packages/_pytest/capture.py:937 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 + capfdbinary -- ../../..$PYTHON_PREFIX/lib/python3.8/site-packages/_pytest/capture.py:954 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] + doctest_namespace [session scope] -- ../../..$PYTHON_PREFIX/lib/python3.8/site-packages/_pytest/doctest.py:722 Fixture that returns a :py:class:`dict` that will be injected into the namespace of doctests. - pytestconfig [session scope] - Session-scoped fixture that returns the :class:`pytest.Config` object. - - Example:: + pytestconfig [session scope] -- ../../..$PYTHON_PREFIX/lib/python3.8/site-packages/_pytest/fixtures.py:1381 + Session-scoped fixture that returns the session's :class:`pytest.Config` + object. - def test_foo(pytestconfig): - if pytestconfig.getoption("verbose") > 0: - ... - - record_property + record_property -- ../../..$PYTHON_PREFIX/lib/python3.8/site-packages/_pytest/junitxml.py:282 Add extra properties to the calling test. - User properties become part of the test report and are available to the - configured reporters, like JUnit XML. - - The fixture is callable with ``name, value``. The value is automatically - XML-encoded. - - Example:: - - def test_function(record_property): - record_property("example_key", 1) - - record_xml_attribute + record_xml_attribute -- ../../..$PYTHON_PREFIX/lib/python3.8/site-packages/_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] + record_testsuite_property [session scope] -- ../../..$PYTHON_PREFIX/lib/python3.8/site-packages/_pytest/junitxml.py:343 Record a new ```` tag as child of the root ````. - This is suitable to writing global information regarding the entire test - suite, and is compatible with ``xunit2`` JUnit family. - - This is a ``session``-scoped fixture which is called with ``(name, value)``. Example: - - .. code-block:: python - - def test_foo(record_testsuite_property): - record_testsuite_property("ARCH", "PPC") - record_testsuite_property("STORAGE_TYPE", "CEPH") - - ``name`` must be a string, ``value`` will be converted to a string and properly xml-escaped. - - .. warning:: - - Currently this fixture **does not work** with the - `pytest-xdist `__ plugin. See issue - `#7767 `__ for details. - - caplog + caplog -- ../../..$PYTHON_PREFIX/lib/python3.8/site-packages/_pytest/logging.py:476 Access and control log capturing. - Captured logs are available through the following properties/methods:: - - * caplog.messages -> list of format-interpolated log messages - * caplog.text -> string containing formatted log output - * caplog.records -> list of logging.LogRecord instances - * caplog.record_tuples -> list of (logger_name, level, message) tuples - * caplog.clear() -> clear captured records and formatted log output string - - monkeypatch + monkeypatch -- ../../..$PYTHON_PREFIX/lib/python3.8/site-packages/_pytest/monkeypatch.py:29 A convenient fixture for monkey-patching. - The fixture provides these methods to modify objects, dictionaries or - os.environ:: - - monkeypatch.setattr(obj, name, value, raising=True) - monkeypatch.delattr(obj, name, raising=True) - monkeypatch.setitem(mapping, name, value) - monkeypatch.delitem(obj, name, raising=True) - monkeypatch.setenv(name, value, prepend=False) - monkeypatch.delenv(name, raising=True) - monkeypatch.syspath_prepend(path) - monkeypatch.chdir(path) - - All modifications will be undone after the requesting test function or - fixture has finished. The ``raising`` parameter determines if a KeyError - or AttributeError will be raised if the set/deletion operation has no target. - - recwarn + recwarn -- ../../..$PYTHON_PREFIX/lib/python3.8/site-packages/_pytest/recwarn.py:29 Return a :class:`WarningsRecorder` instance that records all warnings emitted by test functions. - See https://docs.python.org/library/warnings.html for information - on warning categories. - - tmpdir_factory [session scope] + tmpdir_factory [session scope] -- ../../..$PYTHON_PREFIX/lib/python3.8/site-packages/_pytest/tmpdir.py:210 Return a :class:`pytest.TempdirFactory` instance for the test session. - tmp_path_factory [session scope] + tmp_path_factory [session scope] -- ../../..$PYTHON_PREFIX/lib/python3.8/site-packages/_pytest/tmpdir.py:217 Return a :class:`pytest.TempPathFactory` instance for the test session. - tmpdir + tmpdir -- ../../..$PYTHON_PREFIX/lib/python3.8/site-packages/_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 `py.path.local`_ path object. - - .. _`py.path.local`: https://py.readthedocs.io/en/latest/path.html - - tmp_path + tmp_path -- ../../..$PYTHON_PREFIX/lib/python3.8/site-packages/_pytest/tmpdir.py:250 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 :class:`pathlib.Path` object. - no tests ran in 0.12s diff --git a/doc/en/changelog.rst b/doc/en/changelog.rst index e2b2635af9d..a68e1cd8f2b 100644 --- a/doc/en/changelog.rst +++ b/doc/en/changelog.rst @@ -28,6 +28,233 @@ with advance notice in the **Deprecations** section of releases. .. towncrier release notes start +pytest 7.0.0rc1 (2021-06-28) +Breaking Changes +---------------- + +- `#8246 `_: ``--version`` now writes version information to ``stdout`` rather than ``stderr``. + + + +Deprecations +------------ + +- `#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`` + + These have always been considered private, but now issue a deprecation warning, which may become a hard error in pytest 7.0.0. + + +- `#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 `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. + + +- `#8251 `_: Deprecate ``Node.fspath`` as we plan to move off `py.path.local `__ and switch to :mod:``pathlib``. + + +- `#8315 `_: Several behaviors of :meth:`Parser.addoption ` are now + scheduled for removal in pytest 7 (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 item and a collector now issues a warning. + It was never sanely supported and triggers hard to debug errors. + + Instead, a separate collector node should be used, which collects the item. See :ref:`non-python tests` for an example. + + + +Features +-------- + +- `#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. + + Constructing 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 7.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 ``fspath`` parameter (equivalent to existing ``path`` parameter). + - :func:`pytest_collect_file <_pytest.hookspec.pytest_collect_file>` - The ``fspath`` parameter (equivalent to existing ``path`` parameter). + - :func:`pytest_pycollect_makemodule <_pytest.hookspec.pytest_pycollect_makemodule>` - The ``fspath`` parameter (equivalent to existing ``path`` parameter). + - :func:`pytest_report_header <_pytest.hookspec.pytest_report_header>` - The ``startpath`` parameter (equivalent to existing ``startdir`` parameter). + - :func:`pytest_report_collectionfinish <_pytest.hookspec.pytest_report_collectionfinish>` - The ``startpath`` parameter (equivalent to existing ``startdir`` parameter). + + +- `#8251 `_: Implement ``Node.path`` as a ``pathlib.Path``. + + +- `#8421 `_: :func:`pytest.approx` now works on :class:`~decimal.Decimal` within mappings/dicts and sequences/lists. + + +- `#8494 `_: Python 3.10 is now supported. + + +- `#8606 `_: pytest invocations with ``--fixtures-per-test`` and ``--fixtures`` have been enabled 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). + + + +Improvements +------------ + +- `#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 `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. + + +- `#8645 `_: Reducing confusion from `pytest.warns(None)` by: + + - Allowing no arguments to be passed in order to catch any exception (no argument defaults to `Warning`). + - Emit a deprecation warning if passed `None`. + + + +Bug Fixes +--------- + +- `#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. + + +- `#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 ````. + + +- `#8548 `_: Introduce fix to handle precision width in ``log-cli-format`` in turn to fix output coloring for certain formats. + + + +Improved Documentation +---------------------- + +- `#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. + + + +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``. + + +- `#8248 `_: Internal Restructure: let python.PyObjMixing inherit from nodes.Node to carry over typing information. + + +- `#8411 `_: Assert the outcomes for the issue 518 test and fix the test. + + +- `#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. + + pytest 6.2.4 (2021-05-04) ========================= diff --git a/doc/en/example/markers.rst b/doc/en/example/markers.rst index f0effa02631..90d39d4ee19 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-0.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR 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-0.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR 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-0.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR 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-0.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR 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-0.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR 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-0.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR 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-0.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR 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-0.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collecting ... collected 4 items / 2 deselected / 2 selected @@ -397,7 +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-0.x.y + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 1 item @@ -412,7 +412,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-0.x.y + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 1 item @@ -605,7 +605,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-0.x.y + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 4 items @@ -622,7 +622,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-0.x.y + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 4 items / 3 deselected / 1 selected @@ -686,7 +686,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-0.x.y + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 4 items / 2 deselected / 2 selected @@ -713,7 +713,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-0.x.y + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 4 items / 1 deselected / 3 selected diff --git a/doc/en/example/nonpython.rst b/doc/en/example/nonpython.rst index a3477fe1e1d..ac3295fef37 100644 --- a/doc/en/example/nonpython.rst +++ b/doc/en/example/nonpython.rst @@ -29,7 +29,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-0.x.y + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR/nonpython collected 2 items @@ -41,9 +41,17 @@ now execute the test specification: usecase execution failed spec failed: 'some': 'other' no further details known at this point. + ============================= warnings summary ============================= + test_simple.yaml::hello + test_simple.yaml::ok + $REGENDOC_TMPDIR/nonpython/conftest.py:43: PytestDeprecationWarning: YamlItem.fspath is deprecated and will be replaced by YamlItem.path. + see https://docs.pytest.org/en/latest/deprecations.html#node-fspath-in-favor-of-pathlib-and-node-path + return self.fspath, 0, f"usecase: {self.name}" + + -- Docs: https://docs.pytest.org/en/stable/warnings.html ========================= short test summary info ========================== FAILED test_simple.yaml::hello - ======================= 1 failed, 1 passed in 0.12s ======================== + ================= 1 failed, 1 passed, 2 warnings in 0.12s ================== .. regendoc:wipe @@ -66,7 +74,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-0.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR/nonpython collecting ... collected 2 items @@ -79,9 +87,17 @@ consulted when reporting in ``verbose`` mode: usecase execution failed spec failed: 'some': 'other' no further details known at this point. + ============================= warnings summary ============================= + test_simple.yaml::hello + test_simple.yaml::ok + $REGENDOC_TMPDIR/nonpython/conftest.py:43: PytestDeprecationWarning: YamlItem.fspath is deprecated and will be replaced by YamlItem.path. + see https://docs.pytest.org/en/latest/deprecations.html#node-fspath-in-favor-of-pathlib-and-node-path + return self.fspath, 0, f"usecase: {self.name}" + + -- Docs: https://docs.pytest.org/en/stable/warnings.html ========================= short test summary info ========================== FAILED test_simple.yaml::hello - ======================= 1 failed, 1 passed in 0.12s ======================== + ================= 1 failed, 1 passed, 2 warnings in 0.12s ================== .. regendoc:wipe @@ -92,7 +108,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-0.x.y + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR/nonpython collected 2 items diff --git a/doc/en/example/parametrize.rst b/doc/en/example/parametrize.rst index f358fe50091..d795b430419 100644 --- a/doc/en/example/parametrize.rst +++ b/doc/en/example/parametrize.rst @@ -160,7 +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-0.x.y + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 8 items @@ -225,7 +225,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-0.x.y + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 4 items @@ -240,7 +240,7 @@ 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-0.x.y + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 4 items @@ -319,7 +319,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-0.x.y + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 2 items @@ -418,7 +418,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-0.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collecting ... collected 1 item @@ -573,7 +573,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-0.x.y + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 2 items @@ -635,7 +635,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-0.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collecting ... collected 24 items / 21 deselected / 3 selected diff --git a/doc/en/example/pythoncollection.rst b/doc/en/example/pythoncollection.rst index a6ce2e742e5..4d29f9c6e1d 100644 --- a/doc/en/example/pythoncollection.rst +++ b/doc/en/example/pythoncollection.rst @@ -147,7 +147,7 @@ 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-0.x.y + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR, configfile: pytest.ini collected 2 items @@ -209,7 +209,7 @@ 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-0.x.y + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR, configfile: pytest.ini collected 3 items @@ -291,7 +291,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-0.x.y + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR, configfile: pytest.ini collected 0 items diff --git a/doc/en/example/reportingdemo.rst b/doc/en/example/reportingdemo.rst index 6e7dbe49683..ac29ac88905 100644 --- a/doc/en/example/reportingdemo.rst +++ b/doc/en/example/reportingdemo.rst @@ -9,7 +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-0.x.y + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR/assertion collected 44 items diff --git a/doc/en/example/simple.rst b/doc/en/example/simple.rst index 131534a1744..c806e2b6452 100644 --- a/doc/en/example/simple.rst +++ b/doc/en/example/simple.rst @@ -166,6 +166,7 @@ Now we'll get feedback on a bad argument: ERROR: usage: pytest [options] [file_or_dir] [file_or_dir] [...] pytest: error: argument --cmdopt: invalid choice: 'type3' (choose from 'type1', 'type2') + If you need to provide more detailed error messages, you can use the ``type`` parameter and raise ``pytest.UsageError``: @@ -231,7 +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-0.x.y + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 0 items @@ -296,7 +297,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-0.x.y + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 2 items @@ -313,7 +314,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-0.x.y + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 2 items @@ -457,7 +458,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-0.x.y + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache project deps: mylib-1.1 rootdir: $REGENDOC_TMPDIR @@ -486,7 +487,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-0.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python cachedir: $PYTHON_PREFIX/.pytest_cache info1: did you know that ... did you? @@ -501,7 +502,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-0.x.y + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 0 items @@ -541,7 +542,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-0.x.y + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 3 items @@ -647,7 +648,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-0.x.y + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 4 items @@ -731,7 +732,7 @@ We can run this: $ pytest =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 7 items @@ -850,7 +851,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-0.x.y + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 2 items @@ -860,7 +861,7 @@ and run them: ================================= FAILURES ================================= ________________________________ test_fail1 ________________________________ - tmp_path = Path('PYTEST_TMPDIR/test_fail10') + tmp_path = PosixPath('PYTEST_TMPDIR/test_fail10') def test_fail1(tmp_path): > assert 0 @@ -957,7 +958,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-0.x.y + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 3 items diff --git a/doc/en/getting-started.rst b/doc/en/getting-started.rst index 707087a9af7..2c05d01cee5 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.2.4 + pytest 7.0.0rc1 .. _`simpletest`: @@ -47,7 +47,7 @@ The test $ pytest =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 1 item @@ -196,7 +196,7 @@ This is outlined below: test_class_demo.py:9: AssertionError ========================= short test summary info ========================== FAILED test_class_demo.py::TestClassDemoInstance::test_two - assert 0 == 1 - 1 failed, 1 passed in 0.04s + 1 failed, 1 passed in 0.12s Note that attributes added at class level are *class attributes*, so they will be shared between tests. @@ -221,14 +221,14 @@ List the name ``tmp_path`` in the test function signature and ``pytest`` will lo ================================= FAILURES ================================= _____________________________ test_needsfiles ______________________________ - tmp_path = Path('PYTEST_TMPDIR/test_needsfiles0') + tmp_path = PosixPath('PYTEST_TMPDIR/test_needsfiles0') def test_needsfiles(tmp_path): print(tmp_path) > assert 0 E assert 0 - test_tmpdir.py:3: AssertionError + test_tmp_path.py:3: AssertionError --------------------------- Captured stdout call --------------------------- PYTEST_TMPDIR/test_needsfiles0 ========================= short test summary info ========================== diff --git a/doc/en/how-to/assert.rst b/doc/en/how-to/assert.rst index 9269743dbda..a90b09a13f5 100644 --- a/doc/en/how-to/assert.rst +++ b/doc/en/how-to/assert.rst @@ -29,7 +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-0.x.y + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 1 item @@ -184,7 +184,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-0.x.y + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 1 item @@ -205,7 +205,7 @@ if you run this module: E '5' E Use -v to get the full diff - test_assert2.py:6: AssertionError + test_assert2.py:4: AssertionError ========================= short test summary info ========================== FAILED test_assert2.py::test_set_comparison - AssertionError: assert {'0'... ============================ 1 failed in 0.12s ============================= diff --git a/doc/en/how-to/cache.rst b/doc/en/how-to/cache.rst index ae865fe280e..1e59760c8d1 100644 --- a/doc/en/how-to/cache.rst +++ b/doc/en/how-to/cache.rst @@ -86,7 +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-0.x.y + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 2 items @@ -133,7 +133,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-0.x.y + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 50 items @@ -277,20 +277,158 @@ 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-0.x.y + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR cachedir: $PYTHON_PREFIX/.pytest_cache --------------------------- cache values for '*' --------------------------- cache/lastfailed contains: - {'test_50.py::test_num[17]': True, + {'a/test_db.py::test_a1': True, + 'a/test_db2.py::test_a2': True, + 'b/test_error.py::test_root': True, + 'failure_demo.py::TestCustomAssertMsg::test_custom_repr': True, + 'failure_demo.py::TestCustomAssertMsg::test_multiline': True, + 'failure_demo.py::TestCustomAssertMsg::test_single_line': True, + 'failure_demo.py::TestFailing::test_not': True, + 'failure_demo.py::TestFailing::test_simple': True, + 'failure_demo.py::TestFailing::test_simple_multiline': True, + 'failure_demo.py::TestMoreErrors::test_compare': True, + 'failure_demo.py::TestMoreErrors::test_complex_error': True, + 'failure_demo.py::TestMoreErrors::test_global_func': True, + 'failure_demo.py::TestMoreErrors::test_instance': True, + 'failure_demo.py::TestMoreErrors::test_startswith': True, + 'failure_demo.py::TestMoreErrors::test_startswith_nested': True, + 'failure_demo.py::TestMoreErrors::test_try_finally': True, + 'failure_demo.py::TestMoreErrors::test_z1_unpack_error': True, + 'failure_demo.py::TestMoreErrors::test_z2_type_error': True, + 'failure_demo.py::TestRaises::test_raise': True, + 'failure_demo.py::TestRaises::test_raises': True, + 'failure_demo.py::TestRaises::test_raises_doesnt': True, + 'failure_demo.py::TestRaises::test_reinterpret_fails_with_print_for_the_fun_of_it': True, + 'failure_demo.py::TestRaises::test_some_error': True, + 'failure_demo.py::TestRaises::test_tupleerror': True, + 'failure_demo.py::TestSpecialisedExplanations::test_eq_attrs': True, + 'failure_demo.py::TestSpecialisedExplanations::test_eq_dataclass': True, + 'failure_demo.py::TestSpecialisedExplanations::test_eq_dict': True, + 'failure_demo.py::TestSpecialisedExplanations::test_eq_list': True, + 'failure_demo.py::TestSpecialisedExplanations::test_eq_list_long': True, + 'failure_demo.py::TestSpecialisedExplanations::test_eq_long_text': True, + 'failure_demo.py::TestSpecialisedExplanations::test_eq_long_text_multiline': True, + 'failure_demo.py::TestSpecialisedExplanations::test_eq_longer_list': True, + 'failure_demo.py::TestSpecialisedExplanations::test_eq_multiline_text': True, + 'failure_demo.py::TestSpecialisedExplanations::test_eq_set': True, + 'failure_demo.py::TestSpecialisedExplanations::test_eq_similar_text': True, + 'failure_demo.py::TestSpecialisedExplanations::test_eq_text': True, + 'failure_demo.py::TestSpecialisedExplanations::test_in_list': True, + 'failure_demo.py::TestSpecialisedExplanations::test_not_in_text_multiline': True, + 'failure_demo.py::TestSpecialisedExplanations::test_not_in_text_single': True, + 'failure_demo.py::TestSpecialisedExplanations::test_not_in_text_single_long': True, + 'failure_demo.py::TestSpecialisedExplanations::test_not_in_text_single_long_term': True, + 'failure_demo.py::test_attribute': True, + 'failure_demo.py::test_attribute_failure': True, + 'failure_demo.py::test_attribute_instance': True, + 'failure_demo.py::test_attribute_multiple': True, + 'failure_demo.py::test_dynamic_compile_shows_nicely': True, + 'failure_demo.py::test_generative[3-6]': True, + 'test_50.py::test_num[17]': True, 'test_50.py::test_num[25]': True, 'test_assert1.py::test_function': True, 'test_assert2.py::test_set_comparison': True, + 'test_backends.py::test_db_initialized[d2]': True, 'test_caching.py::test_function': True, - 'test_foocompare.py::test_compare': True} + 'test_checkconfig.py::test_something': True, + 'test_class.py::TestClass::test_two': True, + 'test_class_demo.py::TestClassDemoInstance::test_two': True, + 'test_compute.py::test_compute[4]': True, + 'test_foocompare.py::test_compare': True, + 'test_module.py::test_call_fails': True, + 'test_module.py::test_event_simple': True, + 'test_module.py::test_fail1': True, + 'test_module.py::test_fail2': True, + 'test_module.py::test_interface_complex': True, + 'test_module.py::test_interface_simple': True, + 'test_module.py::test_setup_fails': True, + 'test_parametrize.py::TestClass::test_equals[1-2]': True, + 'test_sample.py::test_answer': True, + 'test_simple.yaml::hello': True, + 'test_step.py::TestUserHandling::test_modification': True, + 'test_tmp_path.py::test_needsfiles': True} cache/nodeids contains: - ['test_50.py::test_num[0]', + ['a/test_db.py::test_a1', + 'a/test_db2.py::test_a2', + 'b/test_error.py::test_root', + 'failure_demo.py::TestCustomAssertMsg::test_custom_repr', + 'failure_demo.py::TestCustomAssertMsg::test_multiline', + 'failure_demo.py::TestCustomAssertMsg::test_single_line', + 'failure_demo.py::TestFailing::test_not', + 'failure_demo.py::TestFailing::test_simple', + 'failure_demo.py::TestFailing::test_simple_multiline', + 'failure_demo.py::TestMoreErrors::test_compare', + 'failure_demo.py::TestMoreErrors::test_complex_error', + 'failure_demo.py::TestMoreErrors::test_global_func', + 'failure_demo.py::TestMoreErrors::test_instance', + 'failure_demo.py::TestMoreErrors::test_startswith', + 'failure_demo.py::TestMoreErrors::test_startswith_nested', + 'failure_demo.py::TestMoreErrors::test_try_finally', + 'failure_demo.py::TestMoreErrors::test_z1_unpack_error', + 'failure_demo.py::TestMoreErrors::test_z2_type_error', + 'failure_demo.py::TestRaises::test_raise', + 'failure_demo.py::TestRaises::test_raises', + 'failure_demo.py::TestRaises::test_raises_doesnt', + 'failure_demo.py::TestRaises::test_reinterpret_fails_with_print_for_the_fun_of_it', + 'failure_demo.py::TestRaises::test_some_error', + 'failure_demo.py::TestRaises::test_tupleerror', + 'failure_demo.py::TestSpecialisedExplanations::test_eq_attrs', + 'failure_demo.py::TestSpecialisedExplanations::test_eq_dataclass', + 'failure_demo.py::TestSpecialisedExplanations::test_eq_dict', + 'failure_demo.py::TestSpecialisedExplanations::test_eq_list', + 'failure_demo.py::TestSpecialisedExplanations::test_eq_list_long', + 'failure_demo.py::TestSpecialisedExplanations::test_eq_long_text', + 'failure_demo.py::TestSpecialisedExplanations::test_eq_long_text_multiline', + 'failure_demo.py::TestSpecialisedExplanations::test_eq_longer_list', + 'failure_demo.py::TestSpecialisedExplanations::test_eq_multiline_text', + 'failure_demo.py::TestSpecialisedExplanations::test_eq_set', + 'failure_demo.py::TestSpecialisedExplanations::test_eq_similar_text', + 'failure_demo.py::TestSpecialisedExplanations::test_eq_text', + 'failure_demo.py::TestSpecialisedExplanations::test_in_list', + 'failure_demo.py::TestSpecialisedExplanations::test_not_in_text_multiline', + 'failure_demo.py::TestSpecialisedExplanations::test_not_in_text_single', + 'failure_demo.py::TestSpecialisedExplanations::test_not_in_text_single_long', + 'failure_demo.py::TestSpecialisedExplanations::test_not_in_text_single_long_term', + 'failure_demo.py::test_attribute', + 'failure_demo.py::test_attribute_failure', + 'failure_demo.py::test_attribute_instance', + 'failure_demo.py::test_attribute_multiple', + 'failure_demo.py::test_dynamic_compile_shows_nicely', + 'failure_demo.py::test_generative[3-6]', + 'multipython.py::test_basic_objects[python3.5-python3.5-42]', + 'multipython.py::test_basic_objects[python3.5-python3.5-obj1]', + 'multipython.py::test_basic_objects[python3.5-python3.5-obj2]', + 'multipython.py::test_basic_objects[python3.5-python3.6-42]', + 'multipython.py::test_basic_objects[python3.5-python3.6-obj1]', + 'multipython.py::test_basic_objects[python3.5-python3.6-obj2]', + 'multipython.py::test_basic_objects[python3.5-python3.7-42]', + 'multipython.py::test_basic_objects[python3.5-python3.7-obj1]', + 'multipython.py::test_basic_objects[python3.5-python3.7-obj2]', + 'multipython.py::test_basic_objects[python3.6-python3.5-42]', + 'multipython.py::test_basic_objects[python3.6-python3.5-obj1]', + 'multipython.py::test_basic_objects[python3.6-python3.5-obj2]', + 'multipython.py::test_basic_objects[python3.6-python3.6-42]', + 'multipython.py::test_basic_objects[python3.6-python3.6-obj1]', + 'multipython.py::test_basic_objects[python3.6-python3.6-obj2]', + 'multipython.py::test_basic_objects[python3.6-python3.7-42]', + 'multipython.py::test_basic_objects[python3.6-python3.7-obj1]', + 'multipython.py::test_basic_objects[python3.6-python3.7-obj2]', + 'multipython.py::test_basic_objects[python3.7-python3.5-42]', + 'multipython.py::test_basic_objects[python3.7-python3.5-obj1]', + 'multipython.py::test_basic_objects[python3.7-python3.5-obj2]', + 'multipython.py::test_basic_objects[python3.7-python3.6-42]', + 'multipython.py::test_basic_objects[python3.7-python3.6-obj1]', + 'multipython.py::test_basic_objects[python3.7-python3.6-obj2]', + 'multipython.py::test_basic_objects[python3.7-python3.7-42]', + 'multipython.py::test_basic_objects[python3.7-python3.7-obj1]', + 'multipython.py::test_basic_objects[python3.7-python3.7-obj2]', + 'test_50.py::test_num[0]', 'test_50.py::test_num[10]', 'test_50.py::test_num[11]', 'test_50.py::test_num[12]', @@ -342,8 +480,69 @@ You can always peek at the content of the cache using the 'test_50.py::test_num[9]', 'test_assert1.py::test_function', 'test_assert2.py::test_set_comparison', + 'test_backends.py::test_db_initialized[d1]', + 'test_backends.py::test_db_initialized[d2]', 'test_caching.py::test_function', - 'test_foocompare.py::test_compare'] + 'test_checkconfig.py::test_something', + 'test_class.py::TestClass::test_one', + 'test_class.py::TestClass::test_two', + 'test_class_demo.py::TestClassDemoInstance::test_one', + 'test_class_demo.py::TestClassDemoInstance::test_two', + 'test_compute.py::test_compute[0]', + 'test_compute.py::test_compute[1]', + 'test_compute.py::test_compute[2]', + 'test_compute.py::test_compute[3]', + 'test_compute.py::test_compute[4]', + 'test_custom_marker.py::test_with_args', + 'test_foocompare.py::test_compare', + 'test_indirect_list.py::test_indirect[a-b]', + 'test_mark_three_times.py::TestClass::test_something', + 'test_module.py::SomeTest::test_unit1', + 'test_module.py::TestHello::test_method1', + 'test_module.py::TestHello::test_method2', + 'test_module.py::TestOther::test_other', + 'test_module.py::test_call_fails', + 'test_module.py::test_event_simple', + 'test_module.py::test_fail1', + 'test_module.py::test_fail2', + 'test_module.py::test_func1[opt1]', + 'test_module.py::test_func1[opt2]', + 'test_module.py::test_func_fast', + 'test_module.py::test_func_slow', + 'test_module.py::test_interface_complex', + 'test_module.py::test_interface_simple', + 'test_module.py::test_setup_fails', + 'test_parametrize.py::TestClass::test_equals[1-2]', + 'test_parametrize.py::TestClass::test_equals[3-3]', + 'test_parametrize.py::TestClass::test_zerodivision[1-0]', + 'test_plat.py::test_if_apple_is_evil', + 'test_plat.py::test_if_linux_works', + 'test_plat.py::test_if_win32_crashes', + 'test_plat.py::test_runs_everywhere', + 'test_pytest_param_example.py::test_eval[1+7-8]', + 'test_pytest_param_example.py::test_eval[basic_2+4]', + 'test_pytest_param_example.py::test_eval[basic_6*9]', + 'test_sample.py::test_answer', + 'test_scenarios.py::TestSampleWithScenarios::test_demo1[advanced]', + 'test_scenarios.py::TestSampleWithScenarios::test_demo1[basic]', + 'test_scenarios.py::TestSampleWithScenarios::test_demo2[advanced]', + 'test_scenarios.py::TestSampleWithScenarios::test_demo2[basic]', + 'test_server.py::TestClass::test_method', + 'test_server.py::test_another', + 'test_server.py::test_send_http', + 'test_server.py::test_something_quick', + 'test_simple.yaml::hello', + 'test_simple.yaml::ok', + 'test_some_are_slow.py::test_funcfast', + 'test_some_are_slow.py::test_funcslow1', + 'test_some_are_slow.py::test_funcslow2', + 'test_someenv.py::test_basic_db_operation', + 'test_step.py::TestUserHandling::test_deletion', + 'test_step.py::TestUserHandling::test_login', + 'test_step.py::TestUserHandling::test_modification', + 'test_step.py::test_normal', + 'test_sysexit.py::test_mytest', + 'test_tmp_path.py::test_needsfiles'] cache/stepwise contains: [] example/value contains: @@ -358,7 +557,7 @@ filtering: $ pytest --cache-show example/* =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR cachedir: $PYTHON_PREFIX/.pytest_cache diff --git a/doc/en/how-to/capture-stdout-stderr.rst b/doc/en/how-to/capture-stdout-stderr.rst index ea0063853ec..392da5c2311 100644 --- a/doc/en/how-to/capture-stdout-stderr.rst +++ b/doc/en/how-to/capture-stdout-stderr.rst @@ -83,7 +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-0.x.y + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 2 items diff --git a/doc/en/how-to/capture-warnings.rst b/doc/en/how-to/capture-warnings.rst index cfee585cbb1..396d0007a65 100644 --- a/doc/en/how-to/capture-warnings.rst +++ b/doc/en/how-to/capture-warnings.rst @@ -28,7 +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-0.x.y + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 1 item diff --git a/doc/en/how-to/doctest.rst b/doc/en/how-to/doctest.rst index 559d7c35ccf..d223f94d569 100644 --- a/doc/en/how-to/doctest.rst +++ b/doc/en/how-to/doctest.rst @@ -30,7 +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-0.x.y + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 1 item @@ -59,7 +59,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-0.x.y + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 2 items diff --git a/doc/en/how-to/fixtures.rst b/doc/en/how-to/fixtures.rst index 1bd4173d9b5..76daea11e74 100644 --- a/doc/en/how-to/fixtures.rst +++ b/doc/en/how-to/fixtures.rst @@ -432,7 +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-0.x.y + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 2 items @@ -1331,7 +1331,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-0.x.y + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 11 items @@ -1384,7 +1384,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-0.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collecting ... collected 3 items @@ -1434,7 +1434,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-0.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collecting ... collected 2 items @@ -1514,7 +1514,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-0.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collecting ... collected 8 items diff --git a/doc/en/how-to/output.rst b/doc/en/how-to/output.rst index 9f922b841df..186d01bfc51 100644 --- a/doc/en/how-to/output.rst +++ b/doc/en/how-to/output.rst @@ -68,13 +68,13 @@ Executing pytest normally gives us this output (we are skipping the header to fo .. code-block:: pytest $ pytest --no-header - =========================== test session starts =========================== + =========================== test session starts ============================ collected 4 items test_verbosity_example.py .FFF [100%] - ================================ FAILURES ================================= - _____________________________ test_words_fail _____________________________ + ================================= FAILURES ================================= + _____________________________ test_words_fail ______________________________ def test_words_fail(): fruits1 = ["banana", "apple", "grapes", "melon", "kiwi"] @@ -85,7 +85,7 @@ Executing pytest normally gives us this output (we are skipping the header to fo E Use -v to get the full diff test_verbosity_example.py:8: AssertionError - ____________________________ test_numbers_fail ____________________________ + ____________________________ test_numbers_fail _____________________________ def test_numbers_fail(): number_to_text1 = {str(x): x for x in range(5)} @@ -100,7 +100,7 @@ Executing pytest normally gives us this output (we are skipping the header to fo E Use -v to get the full diff test_verbosity_example.py:14: AssertionError - ___________________________ test_long_text_fail ___________________________ + ___________________________ test_long_text_fail ____________________________ def test_long_text_fail(): long_text = "Lorem ipsum dolor sit amet " * 10 @@ -108,11 +108,11 @@ Executing pytest normally gives us this output (we are skipping the header to fo E AssertionError: assert 'hello world' in 'Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ips... sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet ' test_verbosity_example.py:19: AssertionError - ========================= short test summary info ========================= + ========================= short test summary info ========================== FAILED test_verbosity_example.py::test_words_fail - AssertionError: asser... FAILED test_verbosity_example.py::test_numbers_fail - AssertionError: ass... FAILED test_verbosity_example.py::test_long_text_fail - AssertionError: a... - ======================= 3 failed, 1 passed in 0.08s ======================= + ======================= 3 failed, 1 passed in 0.12s ======================== Notice that: @@ -127,7 +127,7 @@ Now we can increase pytest's verbosity: .. code-block:: pytest $ pytest --no-header -v - =========================== test session starts =========================== + =========================== test session starts ============================ collecting ... collected 4 items test_verbosity_example.py::test_ok PASSED [ 25%] @@ -135,8 +135,8 @@ Now we can increase pytest's verbosity: test_verbosity_example.py::test_numbers_fail FAILED [ 75%] test_verbosity_example.py::test_long_text_fail FAILED [100%] - ================================ FAILURES ================================= - _____________________________ test_words_fail _____________________________ + ================================= FAILURES ================================= + _____________________________ test_words_fail ______________________________ def test_words_fail(): fruits1 = ["banana", "apple", "grapes", "melon", "kiwi"] @@ -151,7 +151,7 @@ Now we can increase pytest's verbosity: E ? ^ ^ + test_verbosity_example.py:8: AssertionError - ____________________________ test_numbers_fail ____________________________ + ____________________________ test_numbers_fail _____________________________ def test_numbers_fail(): number_to_text1 = {str(x): x for x in range(5)} @@ -169,7 +169,7 @@ Now we can increase pytest's verbosity: E ...Full output truncated (3 lines hidden), use '-vv' to show test_verbosity_example.py:14: AssertionError - ___________________________ test_long_text_fail ___________________________ + ___________________________ test_long_text_fail ____________________________ def test_long_text_fail(): long_text = "Lorem ipsum dolor sit amet " * 10 @@ -177,11 +177,11 @@ Now we can increase pytest's verbosity: E AssertionError: assert 'hello world' in 'Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet ' test_verbosity_example.py:19: AssertionError - ========================= short test summary info ========================= + ========================= short test summary info ========================== FAILED test_verbosity_example.py::test_words_fail - AssertionError: asser... FAILED test_verbosity_example.py::test_numbers_fail - AssertionError: ass... FAILED test_verbosity_example.py::test_long_text_fail - AssertionError: a... - ======================= 3 failed, 1 passed in 0.07s ======================= + ======================= 3 failed, 1 passed in 0.12s ======================== Notice now that: @@ -196,7 +196,7 @@ Now if we increase verbosity even more: .. code-block:: pytest $ pytest --no-header -vv - =========================== test session starts =========================== + =========================== test session starts ============================ collecting ... collected 4 items test_verbosity_example.py::test_ok PASSED [ 25%] @@ -204,8 +204,8 @@ Now if we increase verbosity even more: test_verbosity_example.py::test_numbers_fail FAILED [ 75%] test_verbosity_example.py::test_long_text_fail FAILED [100%] - ================================ FAILURES ================================= - _____________________________ test_words_fail _____________________________ + ================================= FAILURES ================================= + _____________________________ test_words_fail ______________________________ def test_words_fail(): fruits1 = ["banana", "apple", "grapes", "melon", "kiwi"] @@ -220,7 +220,7 @@ Now if we increase verbosity even more: E ? ^ ^ + test_verbosity_example.py:8: AssertionError - ____________________________ test_numbers_fail ____________________________ + ____________________________ test_numbers_fail _____________________________ def test_numbers_fail(): number_to_text1 = {str(x): x for x in range(5)} @@ -239,7 +239,7 @@ Now if we increase verbosity even more: E + {'0': 0, '1': 1, '2': 2, '3': 3, '4': 4} test_verbosity_example.py:14: AssertionError - ___________________________ test_long_text_fail ___________________________ + ___________________________ test_long_text_fail ____________________________ def test_long_text_fail(): long_text = "Lorem ipsum dolor sit amet " * 10 @@ -247,11 +247,11 @@ Now if we increase verbosity even more: E AssertionError: assert 'hello world' in 'Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet ' test_verbosity_example.py:19: AssertionError - ========================= short test summary info ========================= + ========================= short test summary info ========================== FAILED test_verbosity_example.py::test_words_fail - AssertionError: asser... FAILED test_verbosity_example.py::test_numbers_fail - AssertionError: ass... FAILED test_verbosity_example.py::test_long_text_fail - AssertionError: a... - ======================= 3 failed, 1 passed in 0.07s ======================= + ======================= 3 failed, 1 passed in 0.12s ======================== Notice now that: @@ -321,7 +321,7 @@ Example: $ pytest -ra =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 6 items @@ -379,7 +379,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-0.x.y + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 6 items @@ -415,7 +415,7 @@ captured output: $ pytest -rpP =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 6 items @@ -447,7 +447,6 @@ captured output: PASSED test_example.py::test_ok == 1 failed, 1 passed, 1 skipped, 1 xfailed, 1 xpassed, 1 error in 0.12s === - Creating resultlog format files -------------------------------------------------- diff --git a/doc/en/how-to/parametrize.rst b/doc/en/how-to/parametrize.rst index 7f5f6ea0cd8..7ab42df4f2f 100644 --- a/doc/en/how-to/parametrize.rst +++ b/doc/en/how-to/parametrize.rst @@ -56,7 +56,7 @@ them in turn: $ pytest =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 3 items @@ -134,7 +134,7 @@ Let's run this: $ pytest =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 3 items diff --git a/doc/en/how-to/tmpdir.rst b/doc/en/how-to/tmpdir.rst index 1823c8a4e1b..c60a48422c1 100644 --- a/doc/en/how-to/tmpdir.rst +++ b/doc/en/how-to/tmpdir.rst @@ -36,7 +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-0.x.y + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 1 item diff --git a/doc/en/how-to/unittest.rst b/doc/en/how-to/unittest.rst index 2e5763f834c..bed40a6eca7 100644 --- a/doc/en/how-to/unittest.rst +++ b/doc/en/how-to/unittest.rst @@ -137,7 +137,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-0.x.y + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 2 items diff --git a/doc/en/how-to/usage.rst b/doc/en/how-to/usage.rst index ce8247b44ee..1634c081e66 100644 --- a/doc/en/how-to/usage.rst +++ b/doc/en/how-to/usage.rst @@ -200,28 +200,10 @@ hook was invoked: .. code-block:: pytest $ python myinvoke.py - .FEsxX. [100%]*** test run reporting finishing - - ================================== ERRORS ================================== - _______________________ ERROR at setup of test_error _______________________ - - @pytest.fixture - def error_fixture(): - > assert 0 - E assert 0 - - test_example.py:6: AssertionError - ================================= FAILURES ================================= - ________________________________ test_fail _________________________________ - - def test_fail(): - > assert 0 - E assert 0 - - test_example.py:14: AssertionError - ========================= short test summary info ========================== - FAILED test_example.py::test_fail - assert 0 - ERROR test_example.py::test_error - assert 0 + Traceback (most recent call last): + File "myinvoke.py", line 10, in + sys.exit(pytest.main(["-qq"], plugins=[MyPlugin()])) + NameError: name 'sys' is not defined .. note:: diff --git a/doc/en/how-to/writing_plugins.rst b/doc/en/how-to/writing_plugins.rst index 3b58a833320..f9dc2b9ffbe 100644 --- a/doc/en/how-to/writing_plugins.rst +++ b/doc/en/how-to/writing_plugins.rst @@ -442,7 +442,7 @@ Additionally it is possible to copy examples for an example folder before runnin $ pytest =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR, configfile: pytest.ini collected 2 items diff --git a/doc/en/index.rst b/doc/en/index.rst index 08d195e7aaa..d87d718098a 100644 --- a/doc/en/index.rst +++ b/doc/en/index.rst @@ -46,7 +46,7 @@ To execute it: $ pytest =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-7.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 1 item diff --git a/doc/en/reference/reference.rst b/doc/en/reference/reference.rst index 1fe0563ee65..30d99bd9e4d 100644 --- a/doc/en/reference/reference.rst +++ b/doc/en/reference/reference.rst @@ -1761,8 +1761,8 @@ All the command-line flags can be obtained by running ``pytest --help``:: --pdb start the interactive Python debugger on errors or KeyboardInterrupt. --pdbcls=modulename:classname - start a custom interactive Python debugger on - errors. For example: + specify a custom interactive Python debugger for use + with --pdb.For example: --pdbcls=IPython.terminal.debugger:TerminalPdb --trace Immediately break when running each test. --capture=method per-test capturing method: one of fd|sys|no|tee-sys. @@ -1874,7 +1874,7 @@ All the command-line flags can be obtained by running ``pytest --help``:: --basetemp=dir base temporary directory for this test run.(warning: this directory is removed if it exists) -V, --version display pytest version and information about - plugins.When given twice, also display information + plugins. When given twice, also display information about plugins. -h, --help show help message and configuration info -p name early-load given plugin module name or entry point