diff --git a/changelog/10224.improvement.rst b/changelog/10224.improvement.rst deleted file mode 100644 index 93afe9e2c1e..00000000000 --- a/changelog/10224.improvement.rst +++ /dev/null @@ -1,18 +0,0 @@ -pytest's ``short`` and ``long`` traceback styles (:ref:`how-to-modifying-python-tb-printing`) -now have partial :pep:`657` support and will show specific code segments in the -traceback. - -.. code-block:: pytest - - ================================= FAILURES ================================= - _______________________ test_gets_correct_tracebacks _______________________ - - test_tracebacks.py:12: in test_gets_correct_tracebacks - assert manhattan_distance(p1, p2) == 1 - ^^^^^^^^^^^^^^^^^^^^^^^^^^ - test_tracebacks.py:6: in manhattan_distance - return abs(point_1.x - point_2.x) + abs(point_1.y - point_2.y) - ^^^^^^^^^ - E AttributeError: 'NoneType' object has no attribute 'x' - --- by :user:`ammaraskar` diff --git a/changelog/10404.bugfix.rst b/changelog/10404.bugfix.rst deleted file mode 100644 index 4c98ea03d64..00000000000 --- a/changelog/10404.bugfix.rst +++ /dev/null @@ -1,7 +0,0 @@ -Apply filterwarnings from config/cli as soon as possible, and revert them as late as possible -so that warnings as errors are collected throughout the pytest run and before the -unraisable and threadexcept hooks are removed. - -This allows very late warnings and unraisable/threadexcept exceptions to fail the test suite. - -This also changes the warning that the lsof plugin issues from PytestWarning to the new warning PytestFDWarning so it can be more easily filtered. diff --git a/changelog/10839.deprecation.rst b/changelog/10839.deprecation.rst deleted file mode 100644 index a3e2cbf51d0..00000000000 --- a/changelog/10839.deprecation.rst +++ /dev/null @@ -1 +0,0 @@ -Requesting an asynchronous fixture without a `pytest_fixture_setup` hook that resolves it will now give a DeprecationWarning. This most commonly happens if a sync test requests an async fixture. This should have no effect on a majority of users with async tests or fixtures using async pytest plugins, but may affect non-standard hook setups or ``autouse=True``. For guidance on how to work around this warning see :ref:`sync-test-async-fixture`. diff --git a/changelog/11067.bugfix.rst b/changelog/11067.bugfix.rst deleted file mode 100644 index 4e3cb8e7dd7..00000000000 --- a/changelog/11067.bugfix.rst +++ /dev/null @@ -1,3 +0,0 @@ -The test report is now consistent regardless if the test xfailed via :ref:`pytest.mark.xfail ` or :func:`pytest.fail`. - -Previously, *xfailed* tests via the marker would have the string ``"reason: "`` prefixed to the message, while those *xfailed* via the function did not. The prefix has been removed. diff --git a/changelog/11118.improvement.rst b/changelog/11118.improvement.rst deleted file mode 100644 index 4760dbe9d64..00000000000 --- a/changelog/11118.improvement.rst +++ /dev/null @@ -1,3 +0,0 @@ -Now :confval:`pythonpath` configures `$PYTHONPATH` earlier than before during the initialization process, which now also affects plugins loaded via the `-p` command-line option. - --- by :user:`millerdev` diff --git a/changelog/11372.breaking.rst b/changelog/11372.breaking.rst deleted file mode 100644 index f4b5c3c6f6b..00000000000 --- a/changelog/11372.breaking.rst +++ /dev/null @@ -1 +0,0 @@ -Async tests will now fail, instead of warning+skipping, if you don't have any suitable plugin installed. diff --git a/changelog/11381.improvement.rst b/changelog/11381.improvement.rst deleted file mode 100644 index 74c080cc188..00000000000 --- a/changelog/11381.improvement.rst +++ /dev/null @@ -1,17 +0,0 @@ -The ``type`` parameter of the ``parser.addini`` method now accepts `"int"` and ``"float"`` parameters, facilitating the parsing of configuration values in the configuration file. - -Example: - -.. code-block:: python - - def pytest_addoption(parser): - parser.addini("int_value", type="int", default=2, help="my int value") - parser.addini("float_value", type="float", default=4.2, help="my float value") - -The `pytest.ini` file: - -.. code-block:: ini - - [pytest] - int_value = 3 - float_value = 5.4 diff --git a/changelog/11525.improvement.rst b/changelog/11525.improvement.rst deleted file mode 100644 index 1935ce59343..00000000000 --- a/changelog/11525.improvement.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fixtures are now clearly represented in the output as a "fixture object", not as a normal function as before, making it easy for beginners to catch mistakes such as referencing a fixture declared in the same module but not requested in the test function. - --- by :user:`the-compiler` and :user:`glyphack` diff --git a/changelog/11538.feature.rst b/changelog/11538.feature.rst deleted file mode 100644 index d6473b8fe73..00000000000 --- a/changelog/11538.feature.rst +++ /dev/null @@ -1 +0,0 @@ -Added :class:`pytest.RaisesGroup` as an equivalent to :func:`pytest.raises` for expecting :exc:`ExceptionGroup`. Also adds :class:`pytest.RaisesExc` which is now the logic behind :func:`pytest.raises` and used as parameter to :class:`pytest.RaisesGroup`. ``RaisesGroup`` includes the ability to specify multiple different expected exceptions, the structure of nested exception groups, and flags for emulating :ref:`except* `. See :ref:`assert-matching-exception-groups` and docstrings for more information. diff --git a/changelog/12008.bugfix.rst b/changelog/12008.bugfix.rst deleted file mode 100644 index b9680b89236..00000000000 --- a/changelog/12008.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -In :pr:`11220`, an unintended change in reordering was introduced by changing the way indices were assigned to direct params. More specifically, before that change, the indices of direct params to metafunc's callspecs were assigned after all parametrizations took place. Now, that change is reverted. diff --git a/changelog/12017.contrib.rst b/changelog/12017.contrib.rst deleted file mode 100644 index ec1861893b3..00000000000 --- a/changelog/12017.contrib.rst +++ /dev/null @@ -1,7 +0,0 @@ -Mixed internal improvements: - -* Migrate formatting to f-strings in some tests. -* Use type-safe constructs in JUnitXML tests. -* Moved`` MockTiming`` into ``_pytest.timing``. - --- by :user:`RonnyPfannschmidt` diff --git a/changelog/12081.feature.rst b/changelog/12081.feature.rst deleted file mode 100644 index 6538fbf30f8..00000000000 --- a/changelog/12081.feature.rst +++ /dev/null @@ -1 +0,0 @@ -Added :fixture:`capteesys` to capture AND pass output to next handler set by ``--capture=``. diff --git a/changelog/12346.breaking.rst b/changelog/12346.breaking.rst deleted file mode 100644 index 7013cf734c8..00000000000 --- a/changelog/12346.breaking.rst +++ /dev/null @@ -1 +0,0 @@ -Tests will now fail, instead of raising a warning, if they return any value other than None. diff --git a/changelog/12426.improvement.rst b/changelog/12426.improvement.rst deleted file mode 100644 index 0da1f838aea..00000000000 --- a/changelog/12426.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -A warning is now issued when :ref:`pytest.mark.usefixtures ref` is used without specifying any fixtures. Previously, empty usefixtures markers were silently ignored. diff --git a/changelog/12504.feature.rst b/changelog/12504.feature.rst deleted file mode 100644 index d72b97958c2..00000000000 --- a/changelog/12504.feature.rst +++ /dev/null @@ -1 +0,0 @@ -:func:`pytest.mark.xfail` now accepts :class:`pytest.RaisesGroup` for the ``raises`` parameter when you expect an exception group. You can also pass a :class:`pytest.RaisesExc` if you e.g. want to make use of the ``check`` parameter. diff --git a/changelog/12535.doc.rst b/changelog/12535.doc.rst deleted file mode 100644 index d43c1c822ea..00000000000 --- a/changelog/12535.doc.rst +++ /dev/null @@ -1,4 +0,0 @@ -`This -example` -showed ``print`` statements that do not exactly reflect what the -different branches actually do. The fix makes the example more precise. diff --git a/changelog/12647.contrib.rst b/changelog/12647.contrib.rst deleted file mode 100644 index 1d7a3181778..00000000000 --- a/changelog/12647.contrib.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed running the test suite with the ``hypothesis`` pytest plugin. diff --git a/changelog/12707.improvement.rst b/changelog/12707.improvement.rst deleted file mode 100644 index 4684b6561c8..00000000000 --- a/changelog/12707.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -Exception chains can be navigated when dropped into Pdb in Python 3.13+. diff --git a/changelog/12713.feature.rst b/changelog/12713.feature.rst deleted file mode 100644 index 90867b87eae..00000000000 --- a/changelog/12713.feature.rst +++ /dev/null @@ -1,3 +0,0 @@ -New `--force-short-summary` option to force condensed summary output regardless of verbosity level. - -This lets users still see condensed summary output of failures for quick reference in log files from job outputs, being especially useful if non-condensed output is very verbose. diff --git a/changelog/12736.improvement.rst b/changelog/12736.improvement.rst deleted file mode 100644 index 5fdb14e2ef5..00000000000 --- a/changelog/12736.improvement.rst +++ /dev/null @@ -1,3 +0,0 @@ -Added a new attribute `name` with the fixed value `"pytest tests"` to the root tag `testsuites` of the junit-xml generated by pytest. - -This attribute is part of many junit-xml specifications and is even part of the `junit-10.xsd` specification that pytest's implementation is based on. diff --git a/changelog/12749.feature.rst b/changelog/12749.feature.rst deleted file mode 100644 index c3b7ca5d321..00000000000 --- a/changelog/12749.feature.rst +++ /dev/null @@ -1,21 +0,0 @@ -pytest traditionally collects classes/functions in the test module namespace even if they are imported from another file. - -For example: - -.. code-block:: python - - # contents of src/domain.py - class Testament: ... - - - # contents of tests/test_testament.py - from domain import Testament - - - def test_testament(): ... - -In this scenario with the default options, pytest will collect the class `Testament` from `tests/test_testament.py` because it starts with `Test`, even though in this case it is a production class being imported in the test module namespace. - -This behavior can now be prevented by setting the new :confval:`collect_imported_tests` configuration option to ``false``, which will make pytest collect classes/functions from test files **only** if they are defined in that file. - --- by :user:`FreerGit` diff --git a/changelog/12765.feature.rst b/changelog/12765.feature.rst deleted file mode 100644 index 193c75621f7..00000000000 --- a/changelog/12765.feature.rst +++ /dev/null @@ -1,3 +0,0 @@ -Thresholds to trigger snippet truncation can now be set with :confval:`truncation_limit_lines` and :confval:`truncation_limit_chars`. - -See :ref:`truncation-params` for more information. diff --git a/changelog/12863.bugfix.rst b/changelog/12863.bugfix.rst deleted file mode 100644 index 0b1c397a08e..00000000000 --- a/changelog/12863.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fix applying markers, including :ref:`pytest.mark.parametrize ` when placed above `@staticmethod` or `@classmethod`. diff --git a/changelog/12874.breaking.rst b/changelog/12874.breaking.rst deleted file mode 100644 index a442586eeb5..00000000000 --- a/changelog/12874.breaking.rst +++ /dev/null @@ -1 +0,0 @@ -We dropped support for Python 3.8 following its end of life (2024-10-07). diff --git a/changelog/12929.bugfix.rst b/changelog/12929.bugfix.rst deleted file mode 100644 index fcf490d83e2..00000000000 --- a/changelog/12929.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Handle StopIteration from test cases, setup and teardown correctly. diff --git a/changelog/12938.bugfix.rst b/changelog/12938.bugfix.rst deleted file mode 100644 index d54d73bdbf5..00000000000 --- a/changelog/12938.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed ``--durations-min`` argument not respected if ``-vv`` is used. diff --git a/changelog/12943.improvement.rst b/changelog/12943.improvement.rst deleted file mode 100644 index eb8ac63650a..00000000000 --- a/changelog/12943.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -If a test fails with an exceptiongroup with a single exception, the contained exception will now be displayed in the short test summary info. diff --git a/changelog/12946.bugfix.rst b/changelog/12946.bugfix.rst deleted file mode 100644 index b11da09e7ae..00000000000 --- a/changelog/12946.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed missing help for :mod:`pdb` commands wrapped by pytest -- by :user:`adamchainz`. diff --git a/changelog/12958.improvement.rst b/changelog/12958.improvement.rst deleted file mode 100644 index ee8dc8c0710..00000000000 --- a/changelog/12958.improvement.rst +++ /dev/null @@ -1,9 +0,0 @@ -A number of :ref:`unraisable ` enhancements: - -* Set the unraisable hook as early as possible and unset it as late as possible, to collect the most possible number of unraisable exceptions. -* Call the garbage collector just before unsetting the unraisable hook, to collect any straggling exceptions. -* Collect multiple unraisable exceptions per test phase. -* Report the :mod:`tracemalloc` allocation traceback (if available). -* Avoid using a generator based hook to allow handling :class:`StopIteration` in test failures. -* Report the unraisable exception as the cause of the :class:`pytest.PytestUnraisableExceptionWarning` exception if raised. -* Compute the ``repr`` of the unraisable object in the unraisable hook so you get the latest information if available, and should help with resurrection of the object. diff --git a/changelog/12960.breaking.rst b/changelog/12960.breaking.rst deleted file mode 100644 index 3ab87e6fe23..00000000000 --- a/changelog/12960.breaking.rst +++ /dev/null @@ -1,3 +0,0 @@ -Test functions containing a yield now cause an explicit error. They have not been run since pytest 4.0, and were previously marked as an expected failure and deprecation warning. - -See :ref:`the docs ` for more information. diff --git a/changelog/12981.bugfix.rst b/changelog/12981.bugfix.rst deleted file mode 100644 index 5fc8e29656f..00000000000 --- a/changelog/12981.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Prevent exceptions in :func:`pytest.Config.add_cleanup` callbacks preventing further cleanups. diff --git a/changelog/13010.improvement.rst b/changelog/13010.improvement.rst deleted file mode 100644 index d6b814f090e..00000000000 --- a/changelog/13010.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -:func:`pytest.approx` now can compare collections that contain numbers and non-numbers mixed. diff --git a/changelog/13016.improvement.rst b/changelog/13016.improvement.rst deleted file mode 100644 index 634672ab69b..00000000000 --- a/changelog/13016.improvement.rst +++ /dev/null @@ -1,8 +0,0 @@ -A number of :ref:`threadexception ` enhancements: - -* Set the excepthook as early as possible and unset it as late as possible, to collect the most possible number of unhandled exceptions from threads. -* Collect multiple thread exceptions per test phase. -* Report the :mod:`tracemalloc` allocation traceback (if available). -* Avoid using a generator based hook to allow handling :class:`StopIteration` in test failures. -* Report the thread exception as the cause of the :class:`pytest.PytestUnhandledThreadExceptionWarning` exception if raised. -* Extract the ``name`` of the thread object in the excepthook which should help with resurrection of the thread. diff --git a/changelog/13031.improvement.rst b/changelog/13031.improvement.rst deleted file mode 100644 index c6c64c4673a..00000000000 --- a/changelog/13031.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -An empty parameter set as in ``pytest.mark.parametrize([], ids=idfunc)`` will no longer trigger a call to ``idfunc`` with internal objects. diff --git a/changelog/13047.bugfix.rst b/changelog/13047.bugfix.rst deleted file mode 100644 index 399e860505c..00000000000 --- a/changelog/13047.bugfix.rst +++ /dev/null @@ -1,17 +0,0 @@ -Restore :func:`pytest.approx` handling of equality checks between `bool` and `numpy.bool_` types. - -Comparing `bool` and `numpy.bool_` using :func:`pytest.approx` accidentally changed in version `8.3.4` and `8.3.5` to no longer match: - -.. code-block:: pycon - - >>> import numpy as np - >>> from pytest import approx - >>> [np.True_, np.True_] == pytest.approx([True, True]) - False - -This has now been fixed: - -.. code-block:: pycon - - >>> [np.True_, np.True_] == pytest.approx([True, True]) - True diff --git a/changelog/13115.improvement.rst b/changelog/13115.improvement.rst deleted file mode 100644 index 9ac45820917..00000000000 --- a/changelog/13115.improvement.rst +++ /dev/null @@ -1,8 +0,0 @@ -Allows supplying ``ExceptionGroup[Exception]`` and ``BaseExceptionGroup[BaseException]`` to ``pytest.raises`` to keep full typing on :class:`ExceptionInfo `: - -.. code-block:: python - - with pytest.raises(ExceptionGroup[Exception]) as exc_info: - some_function() - -Parametrizing with other exception types remains an error - we do not check the types of child exceptions and thus do not permit code that might look like we do. diff --git a/changelog/13119.bugfix.rst b/changelog/13119.bugfix.rst deleted file mode 100644 index b7e56af9bb8..00000000000 --- a/changelog/13119.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Improved handling of invalid regex patterns for filter warnings by providing a clear error message. diff --git a/changelog/13122.improvement.rst b/changelog/13122.improvement.rst deleted file mode 100644 index c302713b320..00000000000 --- a/changelog/13122.improvement.rst +++ /dev/null @@ -1,15 +0,0 @@ -The ``--stepwise`` mode received a number of improvements: - -* It no longer forgets the last failed test in case pytest is executed later without the flag. - - This enables the following workflow: - - 1. Execute pytest with ``--stepwise``, pytest then stops at the first failing test; - 2. Iteratively update the code and run the test in isolation, without the ``--stepwise`` flag (for example in an IDE), until it is fixed. - 3. Execute pytest with ``--stepwise`` again and pytest will continue from the previously failed test, and if it passes, continue on to the next tests. - - Previously, at step 3, pytest would start from the beginning, forgetting the previously failed test. - - This change however might cause issues if the ``--stepwise`` mode is used far apart in time, as the state might get stale, so the internal state will be reset automatically in case the test suite changes (for now only the number of tests are considered for this, we might change/improve this on the future). - -* New ``--stepwise-reset``/``--sw-reset`` flag, allowing the user to explicitly reset the stepwise state and restart the workflow from the beginning. diff --git a/changelog/13125.feature.rst b/changelog/13125.feature.rst deleted file mode 100644 index 0c7d66c1169..00000000000 --- a/changelog/13125.feature.rst +++ /dev/null @@ -1 +0,0 @@ -:confval:`console_output_style` now supports ``times`` to show execution time of each test. diff --git a/changelog/13175.bugfix.rst b/changelog/13175.bugfix.rst deleted file mode 100644 index bdbb72b41e1..00000000000 --- a/changelog/13175.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -The diff is now also highlighted correctly when comparing two strings. diff --git a/changelog/13192.feature.1.rst b/changelog/13192.feature.1.rst deleted file mode 100644 index 71fb06f7d70..00000000000 --- a/changelog/13192.feature.1.rst +++ /dev/null @@ -1 +0,0 @@ -:func:`pytest.raises` will now print a helpful string diff if matching fails and the match parameter has ``^`` and ``$`` and is otherwise escaped. diff --git a/changelog/13192.feature.2.rst b/changelog/13192.feature.2.rst deleted file mode 100644 index 0ffa0e1496a..00000000000 --- a/changelog/13192.feature.2.rst +++ /dev/null @@ -1 +0,0 @@ -You can now pass :func:`with pytest.raises(check=fn): `, where ``fn`` is a function which takes a raised exception and returns a boolean. The ``raises`` fails if no exception was raised (as usual), passes if an exception is raised and ``fn`` returns ``True`` (as well as ``match`` and the type matching, if specified, which are checked before), and propagates the exception if ``fn`` returns ``False`` (which likely also fails the test). diff --git a/changelog/13192.feature.rst b/changelog/13192.feature.rst deleted file mode 100644 index 97f31ce233c..00000000000 --- a/changelog/13192.feature.rst +++ /dev/null @@ -1 +0,0 @@ -:func:`pytest.raises` will now raise a warning when passing an empty string to ``match``, as this will match against any value. Use ``match="^$"`` if you want to check that an exception has no message. diff --git a/changelog/13218.doc.rst b/changelog/13218.doc.rst deleted file mode 100644 index 907a817e895..00000000000 --- a/changelog/13218.doc.rst +++ /dev/null @@ -1 +0,0 @@ -Pointed out in the :func:`pytest.approx` documentation that it considers booleans unequal to numeric zero or one. diff --git a/changelog/13221.doc.rst b/changelog/13221.doc.rst deleted file mode 100644 index cfd35f821b4..00000000000 --- a/changelog/13221.doc.rst +++ /dev/null @@ -1 +0,0 @@ -Improved grouping of CLI options in the ``--help`` output. diff --git a/changelog/13228.feature.rst b/changelog/13228.feature.rst deleted file mode 100644 index c5d84182313..00000000000 --- a/changelog/13228.feature.rst +++ /dev/null @@ -1,3 +0,0 @@ -:ref:`hidden-param` can now be used in ``id`` of :func:`pytest.param` or in -``ids`` of :py:func:`Metafunc.parametrize `. -It hides the parameter set from the test name. diff --git a/changelog/13248.bugfix.rst b/changelog/13248.bugfix.rst deleted file mode 100644 index 2ebb102fd07..00000000000 --- a/changelog/13248.bugfix.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fixed an issue where passing a ``scope`` in :py:func:`Metafunc.parametrize ` with ``indirect=True`` -could result in other fixtures being unable to depend on the parametrized fixture. diff --git a/changelog/13253.feature.rst b/changelog/13253.feature.rst deleted file mode 100644 index e497c207223..00000000000 --- a/changelog/13253.feature.rst +++ /dev/null @@ -1 +0,0 @@ -New flag: :ref:`--disable-plugin-autoload ` which works as an alternative to :envvar:`PYTEST_DISABLE_PLUGIN_AUTOLOAD` when setting environment variables is inconvenient; and allows setting it in config files with :confval:`addopts`. diff --git a/changelog/13291.bugfix.rst b/changelog/13291.bugfix.rst deleted file mode 100644 index 03ce06b697a..00000000000 --- a/changelog/13291.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed ``repr`` of ``attrs`` objects in assertion failure messages when using ``attrs>=25.2``. diff --git a/changelog/13308.improvement.rst b/changelog/13308.improvement.rst deleted file mode 100644 index 70018c66d59..00000000000 --- a/changelog/13308.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -Added official support for Python 3.14. diff --git a/changelog/13312.bugfix.rst b/changelog/13312.bugfix.rst deleted file mode 100644 index 62ad36879f5..00000000000 --- a/changelog/13312.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed a possible ``KeyError`` crash on PyPy during collection of tests involving higher-scoped parameters. diff --git a/changelog/13317.packaging.rst b/changelog/13317.packaging.rst deleted file mode 100644 index 94171cb1ef3..00000000000 --- a/changelog/13317.packaging.rst +++ /dev/null @@ -1,4 +0,0 @@ -Specified minimum allowed versions of ``colorama``, ``iniconfig``, -and ``packaging``; and bumped the minimum allowed version -of ``exceptiongroup`` for ``python_version<'3.11'`` from a release -candidate to a full release. diff --git a/changelog/13345.bugfix.rst b/changelog/13345.bugfix.rst deleted file mode 100644 index 5010888aa08..00000000000 --- a/changelog/13345.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fix type hints for :attr:`pytest.TestReport.when` and :attr:`pytest.TestReport.location`. diff --git a/changelog/13377.bugfix.rst b/changelog/13377.bugfix.rst deleted file mode 100644 index 15755481f7f..00000000000 --- a/changelog/13377.bugfix.rst +++ /dev/null @@ -1,12 +0,0 @@ -Fixed handling of test methods with positional-only parameter syntax. - -Now, methods are supported that formally define ``self`` as positional-only -and/or fixture parameters as keyword-only, e.g.: - -.. code-block:: python - - class TestClass: - - def test_method(self, /, *, fixture): ... - -Before, this caused an internal error in pytest. diff --git a/changelog/13380.improvement.rst b/changelog/13380.improvement.rst deleted file mode 100644 index 51f374fbf01..00000000000 --- a/changelog/13380.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -Fix :class:`ExceptionGroup` traceback filtering to exclude pytest internals. diff --git a/changelog/13384.bugfix.rst b/changelog/13384.bugfix.rst deleted file mode 100644 index e93d01dcab0..00000000000 --- a/changelog/13384.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed an issue where pytest could report negative durations. diff --git a/changelog/13415.improvement.rst b/changelog/13415.improvement.rst deleted file mode 100644 index 61667f15c7b..00000000000 --- a/changelog/13415.improvement.rst +++ /dev/null @@ -1,5 +0,0 @@ -The author metadata of the BibTex example is now correctly formatted with last names following first names. -An example of BibLaTex has been added. -BibTex and BibLaTex examples now clearly indicate that what is cited is software. - --- by :user:`willynilly` diff --git a/changelog/13420.bugfix.rst b/changelog/13420.bugfix.rst deleted file mode 100644 index 02f7372a759..00000000000 --- a/changelog/13420.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Added ``lru_cache`` to ``nodes._check_initialpaths_for_relpath``. diff --git a/changelog/13420.improvement.rst b/changelog/13420.improvement.rst deleted file mode 100644 index 54fe50a72b0..00000000000 --- a/changelog/13420.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -Improved test collection performance by optimizing path resolution used in ``FSCollector``. diff --git a/changelog/13457.improvement.rst b/changelog/13457.improvement.rst deleted file mode 100644 index 3937384b322..00000000000 --- a/changelog/13457.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -The error message about duplicate parametrization no longer displays an internal stack trace. diff --git a/changelog/4112.improvement.rst b/changelog/4112.improvement.rst deleted file mode 100644 index 426b87ffa19..00000000000 --- a/changelog/4112.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -Using :ref:`pytest.mark.usefixtures ` on :func:`pytest.param` now produces an error instead of silently doing nothing. diff --git a/changelog/5473.improvement.rst b/changelog/5473.improvement.rst deleted file mode 100644 index 1b9ab006d49..00000000000 --- a/changelog/5473.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -Replace `:` with `;` in the assertion rewrite warning message so it can be filtered using standard Python warning filters before calling :func:`pytest.main`. diff --git a/changelog/6649.doc.rst b/changelog/6649.doc.rst deleted file mode 100644 index cf5bb781b87..00000000000 --- a/changelog/6649.doc.rst +++ /dev/null @@ -1 +0,0 @@ -Added :class:`~pytest.TerminalReporter` to the :ref:`api-reference` documentation page. diff --git a/changelog/6649.misc.rst b/changelog/6649.misc.rst deleted file mode 100644 index cec8c3f4506..00000000000 --- a/changelog/6649.misc.rst +++ /dev/null @@ -1 +0,0 @@ -Added :class:`~pytest.TerminalReporter` to the public pytest API, as it is part of the signature of the :hook:`pytest_terminal_summary` hook. diff --git a/changelog/6985.improvement.rst b/changelog/6985.improvement.rst deleted file mode 100644 index 34ee8edc77d..00000000000 --- a/changelog/6985.improvement.rst +++ /dev/null @@ -1,21 +0,0 @@ -Improved :func:`pytest.approx` to enhance the readability of value ranges and tolerances between 0.001 and 1000. - * The `repr` method now provides clearer output for values within those ranges, making it easier to interpret the results. - * Previously, the output for those ranges of values and tolerances was displayed in scientific notation (e.g., `42 ± 1.0e+00`). The updated method now presents the tolerance as a decimal for better readability (e.g., `42 ± 1`). - - Example: - - **Previous Output:** - - .. code-block:: console - - >>> pytest.approx(42, abs=1) - 42 ± 1.0e+00 - - **Current Output:** - - .. code-block:: console - - >>> pytest.approx(42, abs=1) - 42 ± 1 - - -- by :user:`fazeelghafoor` diff --git a/changelog/7683.improvement.rst b/changelog/7683.improvement.rst deleted file mode 100644 index 311abe4df93..00000000000 --- a/changelog/7683.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -The formerly optional ``pygments`` dependency is now required, causing output always to be source-highlighted (unless disabled via the ``--code-highlight=no`` CLI option). diff --git a/changelog/8612.doc.rst b/changelog/8612.doc.rst deleted file mode 100644 index 6ab4102ace4..00000000000 --- a/changelog/8612.doc.rst +++ /dev/null @@ -1,5 +0,0 @@ -Add a recipe for handling abstract test classes in the documentation. - -A new example has been added to the documentation to demonstrate how to use a mixin class to handle abstract -test classes without manually setting the ``__test__`` attribute for subclasses. -This ensures that subclasses of abstract test classes are automatically collected by pytest. diff --git a/changelog/9037.bugfix.rst b/changelog/9037.bugfix.rst deleted file mode 100644 index 5367452337e..00000000000 --- a/changelog/9037.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Honor :confval:`disable_test_id_escaping_and_forfeit_all_rights_to_community_support` when escaping ids in parametrized tests. diff --git a/doc/en/announce/index.rst b/doc/en/announce/index.rst index 51edc964a0c..702fd26dd0d 100644 --- a/doc/en/announce/index.rst +++ b/doc/en/announce/index.rst @@ -6,6 +6,7 @@ Release announcements :maxdepth: 2 + release-8.4.0 release-8.3.5 release-8.3.4 release-8.3.3 diff --git a/doc/en/announce/release-8.4.0.rst b/doc/en/announce/release-8.4.0.rst new file mode 100644 index 00000000000..65e80a55919 --- /dev/null +++ b/doc/en/announce/release-8.4.0.rst @@ -0,0 +1,106 @@ +pytest-8.4.0 +======================================= + +The pytest team is proud to announce the 8.4.0 release! + +This release contains new features, improvements, and bug fixes, +the full list of changes is available in the changelog: + + https://docs.pytest.org/en/stable/changelog.html + +For complete documentation, please visit: + + https://docs.pytest.org/en/stable/ + +As usual, you can upgrade from PyPI via: + + pip install -U pytest + +Thanks to all of the contributors to this release: + +* Adam Johnson +* Ammar Askar +* Andrew Pikul +* Andy Freeland +* Anthony Sottile +* Anton Zhilin +* Arpit Gupta +* Ashley Whetter +* Avasam +* Bahram Farahmand +* Brigitta Sipőcz +* Bruno Oliveira +* Callum Scott +* Christian Clauss +* Christopher Head +* Daara +* Daniel Miller +* Deysha Rivera +* Emil Hjelm +* Eugene Mwangi +* Florian Bruhin +* Frank Hoffmann +* GTowers1 +* Guillaume Gauvrit +* Gupta Arpit +* Harmin Parra Rueda +* Jakob van Santen +* Jason N. White +* Jiajun Xu +* John Litborn +* Julian Valentin +* JulianJvn +* Kenny Y +* Leonardus Chen +* Marcelo Duarte Trevisani +* Marcin Augustynów +* Natalia Mokeeva +* Nathan Rousseau +* Nauman Ahmed +* Nick Murphy +* Oleksandr Zavertniev +* Pavel Zhukov +* Peter Gessler +* Pierre Sassoulas +* Pradeep Kumar +* Ran Benita +* Reagan Lee +* Rob Arrow +* Ronny Pfannschmidt +* Sadra Barikbin +* Sam Bull +* Samuel Bronson +* Sashko +* Serge Smertin +* Shaygan Hooshyari +* Stefaan Lippens +* Stefan Zimmermann +* Stephen McDowell +* Sviatoslav Sydorenko +* Sviatoslav Sydorenko (Святослав Сидоренко) +* Thomas Grainger +* TobiMcNamobi +* Tobias Alex-Petersen +* Tony Narlock +* Vincent (Wen Yu) Ge +* Virendra Patil +* Will Riley +* Yann Dirson +* Zac Hatfield-Dodds +* delta87 +* dongfangtianyu +* eitanwass +* fazeelghafoor +* ikappaki +* jakkdl +* maugu +* moajo +* mwychung +* polkapolka +* suspe +* sven +* 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) + + +Happy testing, +The pytest Development Team diff --git a/doc/en/builtin.rst b/doc/en/builtin.rst index 8aa6fef681c..b129d0a763f 100644 --- a/doc/en/builtin.rst +++ b/doc/en/builtin.rst @@ -22,7 +22,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a cachedir: .pytest_cache rootdir: /home/sweet/project collected 0 items - cache -- .../_pytest/cacheprovider.py:556 + cache -- .../_pytest/cacheprovider.py:555 Return a cache object that can persist state between testing sessions. cache.get(key, default) @@ -33,7 +33,48 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a Values can be any object handled by the json stdlib module. - capsysbinary -- .../_pytest/capture.py:1024 + capsys -- .../_pytest/capture.py:1000 + 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. + + Returns an instance of :class:`CaptureFixture[str] `. + + Example: + + .. code-block:: python + + def test_output(capsys): + print("hello") + captured = capsys.readouterr() + assert captured.out == "hello\n" + + capteesys -- .../_pytest/capture.py:1028 + Enable simultaneous text capturing and pass-through of writes + to ``sys.stdout`` and ``sys.stderr`` as defined by ``--capture=``. + + + The captured output is made available via ``capteesys.readouterr()`` method + calls, which return a ``(out, err)`` namedtuple. + ``out`` and ``err`` will be ``text`` objects. + + The output is also passed-through, allowing it to be "live-printed", + reported, or both as defined by ``--capture=``. + + Returns an instance of :class:`CaptureFixture[str] `. + + Example: + + .. code-block:: python + + def test_output(capsys): + print("hello") + captured = capteesys.readouterr() + assert captured.out == "hello\n" + + capsysbinary -- .../_pytest/capture.py:1063 Enable bytes capturing of writes to ``sys.stdout`` and ``sys.stderr``. The captured output is made available via ``capsysbinary.readouterr()`` @@ -51,7 +92,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a captured = capsysbinary.readouterr() assert captured.out == b"hello\n" - capfd -- .../_pytest/capture.py:1052 + capfd -- .../_pytest/capture.py:1091 Enable text capturing of writes to file descriptors ``1`` and ``2``. The captured output is made available via ``capfd.readouterr()`` method @@ -69,7 +110,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a captured = capfd.readouterr() assert captured.out == "hello\n" - capfdbinary -- .../_pytest/capture.py:1080 + capfdbinary -- .../_pytest/capture.py:1119 Enable bytes capturing of writes to file descriptors ``1`` and ``2``. The captured output is made available via ``capfd.readouterr()`` method @@ -87,25 +128,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a captured = capfdbinary.readouterr() assert captured.out == b"hello\n" - capsys -- .../_pytest/capture.py:996 - 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. - - Returns an instance of :class:`CaptureFixture[str] `. - - Example: - - .. code-block:: python - - def test_output(capsys): - print("hello") - captured = capsys.readouterr() - assert captured.out == "hello\n" - - doctest_namespace [session scope] -- .../_pytest/doctest.py:741 + doctest_namespace [session scope] -- .../_pytest/doctest.py:740 Fixture that returns a :py:class:`dict` that will be injected into the namespace of doctests. @@ -119,7 +142,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a For more details: :ref:`doctest_namespace`. - pytestconfig [session scope] -- .../_pytest/fixtures.py:1345 + pytestconfig [session scope] -- .../_pytest/fixtures.py:1424 Session-scoped fixture that returns the session's :class:`pytest.Config` object. @@ -129,7 +152,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a if pytestconfig.get_verbosity() > 0: ... - record_property -- .../_pytest/junitxml.py:280 + record_property -- .../_pytest/junitxml.py:277 Add extra properties to the calling test. User properties become part of the test report and are available to the @@ -143,13 +166,13 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a def test_function(record_property): record_property("example_key", 1) - record_xml_attribute -- .../_pytest/junitxml.py:303 + record_xml_attribute -- .../_pytest/junitxml.py:300 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] -- .../_pytest/junitxml.py:341 + record_testsuite_property [session scope] -- .../_pytest/junitxml.py:338 Record a new ```` tag as child of the root ````. This is suitable to writing global information regarding the entire test @@ -191,7 +214,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a .. _legacy_path: https://py.readthedocs.io/en/latest/path.html - caplog -- .../_pytest/logging.py:598 + caplog -- .../_pytest/logging.py:596 Access and control log capturing. Captured logs are available through the following properties/methods:: @@ -226,15 +249,15 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a To undo modifications done by the fixture in a contained scope, use :meth:`context() `. - recwarn -- .../_pytest/recwarn.py:35 + recwarn -- .../_pytest/recwarn.py:34 Return a :class:`WarningsRecorder` instance that records all warnings emitted by test functions. See :ref:`warnings` for information on warning categories. - tmp_path_factory [session scope] -- .../_pytest/tmpdir.py:241 + tmp_path_factory [session scope] -- .../_pytest/tmpdir.py:240 Return a :class:`pytest.TempPathFactory` instance for the test session. - tmp_path -- .../_pytest/tmpdir.py:256 + tmp_path -- .../_pytest/tmpdir.py:255 Return a temporary directory (as :class:`pathlib.Path` object) which is unique to each test function invocation. The temporary directory is created as a subdirectory diff --git a/doc/en/changelog.rst b/doc/en/changelog.rst index c92cd7d4263..73073ffca1c 100644 --- a/doc/en/changelog.rst +++ b/doc/en/changelog.rst @@ -31,6 +31,427 @@ with advance notice in the **Deprecations** section of releases. .. towncrier release notes start +pytest 8.4.0 (2025-06-02) +========================= + +Removals and backward incompatible breaking changes +--------------------------------------------------- + +- `#11372 `_: Async tests will now fail, instead of warning+skipping, if you don't have any suitable plugin installed. + + +- `#12346 `_: Tests will now fail, instead of raising a warning, if they return any value other than None. + + +- `#12874 `_: We dropped support for Python 3.8 following its end of life (2024-10-07). + + +- `#12960 `_: Test functions containing a yield now cause an explicit error. They have not been run since pytest 4.0, and were previously marked as an expected failure and deprecation warning. + + See :ref:`the docs ` for more information. + + + +Deprecations (removal in next major release) +-------------------------------------------- + +- `#10839 `_: Requesting an asynchronous fixture without a `pytest_fixture_setup` hook that resolves it will now give a DeprecationWarning. This most commonly happens if a sync test requests an async fixture. This should have no effect on a majority of users with async tests or fixtures using async pytest plugins, but may affect non-standard hook setups or ``autouse=True``. For guidance on how to work around this warning see :ref:`sync-test-async-fixture`. + + + +New features +------------ + +- `#11538 `_: Added :class:`pytest.RaisesGroup` as an equivalent to :func:`pytest.raises` for expecting :exc:`ExceptionGroup`. Also adds :class:`pytest.RaisesExc` which is now the logic behind :func:`pytest.raises` and used as parameter to :class:`pytest.RaisesGroup`. ``RaisesGroup`` includes the ability to specify multiple different expected exceptions, the structure of nested exception groups, and flags for emulating :ref:`except* `. See :ref:`assert-matching-exception-groups` and docstrings for more information. + + +- `#12081 `_: Added :fixture:`capteesys` to capture AND pass output to next handler set by ``--capture=``. + + +- `#12504 `_: :func:`pytest.mark.xfail` now accepts :class:`pytest.RaisesGroup` for the ``raises`` parameter when you expect an exception group. You can also pass a :class:`pytest.RaisesExc` if you e.g. want to make use of the ``check`` parameter. + + +- `#12713 `_: New `--force-short-summary` option to force condensed summary output regardless of verbosity level. + + This lets users still see condensed summary output of failures for quick reference in log files from job outputs, being especially useful if non-condensed output is very verbose. + + +- `#12749 `_: pytest traditionally collects classes/functions in the test module namespace even if they are imported from another file. + + For example: + + .. code-block:: python + + # contents of src/domain.py + class Testament: ... + + + # contents of tests/test_testament.py + from domain import Testament + + + def test_testament(): ... + + In this scenario with the default options, pytest will collect the class `Testament` from `tests/test_testament.py` because it starts with `Test`, even though in this case it is a production class being imported in the test module namespace. + + This behavior can now be prevented by setting the new :confval:`collect_imported_tests` configuration option to ``false``, which will make pytest collect classes/functions from test files **only** if they are defined in that file. + + -- by :user:`FreerGit` + + +- `#12765 `_: Thresholds to trigger snippet truncation can now be set with :confval:`truncation_limit_lines` and :confval:`truncation_limit_chars`. + + See :ref:`truncation-params` for more information. + + +- `#13125 `_: :confval:`console_output_style` now supports ``times`` to show execution time of each test. + + +- `#13192 `_: :func:`pytest.raises` will now raise a warning when passing an empty string to ``match``, as this will match against any value. Use ``match="^$"`` if you want to check that an exception has no message. + + +- `#13192 `_: :func:`pytest.raises` will now print a helpful string diff if matching fails and the match parameter has ``^`` and ``$`` and is otherwise escaped. + + +- `#13192 `_: You can now pass :func:`with pytest.raises(check=fn): `, where ``fn`` is a function which takes a raised exception and returns a boolean. The ``raises`` fails if no exception was raised (as usual), passes if an exception is raised and ``fn`` returns ``True`` (as well as ``match`` and the type matching, if specified, which are checked before), and propagates the exception if ``fn`` returns ``False`` (which likely also fails the test). + + +- `#13228 `_: :ref:`hidden-param` can now be used in ``id`` of :func:`pytest.param` or in + ``ids`` of :py:func:`Metafunc.parametrize `. + It hides the parameter set from the test name. + + +- `#13253 `_: New flag: :ref:`--disable-plugin-autoload ` which works as an alternative to :envvar:`PYTEST_DISABLE_PLUGIN_AUTOLOAD` when setting environment variables is inconvenient; and allows setting it in config files with :confval:`addopts`. + + + +Improvements in existing functionality +-------------------------------------- + +- `#10224 `_: pytest's ``short`` and ``long`` traceback styles (:ref:`how-to-modifying-python-tb-printing`) + now have partial :pep:`657` support and will show specific code segments in the + traceback. + + .. code-block:: pytest + + ================================= FAILURES ================================= + _______________________ test_gets_correct_tracebacks _______________________ + + test_tracebacks.py:12: in test_gets_correct_tracebacks + assert manhattan_distance(p1, p2) == 1 + ^^^^^^^^^^^^^^^^^^^^^^^^^^ + test_tracebacks.py:6: in manhattan_distance + return abs(point_1.x - point_2.x) + abs(point_1.y - point_2.y) + ^^^^^^^^^ + E AttributeError: 'NoneType' object has no attribute 'x' + + -- by :user:`ammaraskar` + + +- `#11118 `_: Now :confval:`pythonpath` configures `$PYTHONPATH` earlier than before during the initialization process, which now also affects plugins loaded via the `-p` command-line option. + + -- by :user:`millerdev` + + +- `#11381 `_: The ``type`` parameter of the ``parser.addini`` method now accepts `"int"` and ``"float"`` parameters, facilitating the parsing of configuration values in the configuration file. + + Example: + + .. code-block:: python + + def pytest_addoption(parser): + parser.addini("int_value", type="int", default=2, help="my int value") + parser.addini("float_value", type="float", default=4.2, help="my float value") + + The `pytest.ini` file: + + .. code-block:: ini + + [pytest] + int_value = 3 + float_value = 5.4 + + +- `#11525 `_: Fixtures are now clearly represented in the output as a "fixture object", not as a normal function as before, making it easy for beginners to catch mistakes such as referencing a fixture declared in the same module but not requested in the test function. + + -- by :user:`the-compiler` and :user:`glyphack` + + +- `#12426 `_: A warning is now issued when :ref:`pytest.mark.usefixtures ref` is used without specifying any fixtures. Previously, empty usefixtures markers were silently ignored. + + +- `#12707 `_: Exception chains can be navigated when dropped into Pdb in Python 3.13+. + + +- `#12736 `_: Added a new attribute `name` with the fixed value `"pytest tests"` to the root tag `testsuites` of the junit-xml generated by pytest. + + This attribute is part of many junit-xml specifications and is even part of the `junit-10.xsd` specification that pytest's implementation is based on. + + +- `#12943 `_: If a test fails with an exceptiongroup with a single exception, the contained exception will now be displayed in the short test summary info. + + +- `#12958 `_: A number of :ref:`unraisable ` enhancements: + + * Set the unraisable hook as early as possible and unset it as late as possible, to collect the most possible number of unraisable exceptions. + * Call the garbage collector just before unsetting the unraisable hook, to collect any straggling exceptions. + * Collect multiple unraisable exceptions per test phase. + * Report the :mod:`tracemalloc` allocation traceback (if available). + * Avoid using a generator based hook to allow handling :class:`StopIteration` in test failures. + * Report the unraisable exception as the cause of the :class:`pytest.PytestUnraisableExceptionWarning` exception if raised. + * Compute the ``repr`` of the unraisable object in the unraisable hook so you get the latest information if available, and should help with resurrection of the object. + + +- `#13010 `_: :func:`pytest.approx` now can compare collections that contain numbers and non-numbers mixed. + + +- `#13016 `_: A number of :ref:`threadexception ` enhancements: + + * Set the excepthook as early as possible and unset it as late as possible, to collect the most possible number of unhandled exceptions from threads. + * Collect multiple thread exceptions per test phase. + * Report the :mod:`tracemalloc` allocation traceback (if available). + * Avoid using a generator based hook to allow handling :class:`StopIteration` in test failures. + * Report the thread exception as the cause of the :class:`pytest.PytestUnhandledThreadExceptionWarning` exception if raised. + * Extract the ``name`` of the thread object in the excepthook which should help with resurrection of the thread. + + +- `#13031 `_: An empty parameter set as in ``pytest.mark.parametrize([], ids=idfunc)`` will no longer trigger a call to ``idfunc`` with internal objects. + + +- `#13115 `_: Allows supplying ``ExceptionGroup[Exception]`` and ``BaseExceptionGroup[BaseException]`` to ``pytest.raises`` to keep full typing on :class:`ExceptionInfo `: + + .. code-block:: python + + with pytest.raises(ExceptionGroup[Exception]) as exc_info: + some_function() + + Parametrizing with other exception types remains an error - we do not check the types of child exceptions and thus do not permit code that might look like we do. + + +- `#13122 `_: The ``--stepwise`` mode received a number of improvements: + + * It no longer forgets the last failed test in case pytest is executed later without the flag. + + This enables the following workflow: + + 1. Execute pytest with ``--stepwise``, pytest then stops at the first failing test; + 2. Iteratively update the code and run the test in isolation, without the ``--stepwise`` flag (for example in an IDE), until it is fixed. + 3. Execute pytest with ``--stepwise`` again and pytest will continue from the previously failed test, and if it passes, continue on to the next tests. + + Previously, at step 3, pytest would start from the beginning, forgetting the previously failed test. + + This change however might cause issues if the ``--stepwise`` mode is used far apart in time, as the state might get stale, so the internal state will be reset automatically in case the test suite changes (for now only the number of tests are considered for this, we might change/improve this on the future). + + * New ``--stepwise-reset``/``--sw-reset`` flag, allowing the user to explicitly reset the stepwise state and restart the workflow from the beginning. + + +- `#13308 `_: Added official support for Python 3.14. + + +- `#13380 `_: Fix :class:`ExceptionGroup` traceback filtering to exclude pytest internals. + + +- `#13415 `_: The author metadata of the BibTex example is now correctly formatted with last names following first names. + An example of BibLaTex has been added. + BibTex and BibLaTex examples now clearly indicate that what is cited is software. + + -- by :user:`willynilly` + + +- `#13420 `_: Improved test collection performance by optimizing path resolution used in ``FSCollector``. + + +- `#13457 `_: The error message about duplicate parametrization no longer displays an internal stack trace. + + +- `#4112 `_: Using :ref:`pytest.mark.usefixtures ` on :func:`pytest.param` now produces an error instead of silently doing nothing. + + +- `#5473 `_: Replace `:` with `;` in the assertion rewrite warning message so it can be filtered using standard Python warning filters before calling :func:`pytest.main`. + + +- `#6985 `_: Improved :func:`pytest.approx` to enhance the readability of value ranges and tolerances between 0.001 and 1000. + * The `repr` method now provides clearer output for values within those ranges, making it easier to interpret the results. + * Previously, the output for those ranges of values and tolerances was displayed in scientific notation (e.g., `42 ± 1.0e+00`). The updated method now presents the tolerance as a decimal for better readability (e.g., `42 ± 1`). + + Example: + + **Previous Output:** + + .. code-block:: console + + >>> pytest.approx(42, abs=1) + 42 ± 1.0e+00 + + **Current Output:** + + .. code-block:: console + + >>> pytest.approx(42, abs=1) + 42 ± 1 + + -- by :user:`fazeelghafoor` + + +- `#7683 `_: The formerly optional ``pygments`` dependency is now required, causing output always to be source-highlighted (unless disabled via the ``--code-highlight=no`` CLI option). + + + +Bug fixes +--------- + +- `#10404 `_: Apply filterwarnings from config/cli as soon as possible, and revert them as late as possible + so that warnings as errors are collected throughout the pytest run and before the + unraisable and threadexcept hooks are removed. + + This allows very late warnings and unraisable/threadexcept exceptions to fail the test suite. + + This also changes the warning that the lsof plugin issues from PytestWarning to the new warning PytestFDWarning so it can be more easily filtered. + + +- `#11067 `_: The test report is now consistent regardless if the test xfailed via :ref:`pytest.mark.xfail ` or :func:`pytest.fail`. + + Previously, *xfailed* tests via the marker would have the string ``"reason: "`` prefixed to the message, while those *xfailed* via the function did not. The prefix has been removed. + + +- `#12008 `_: In :pr:`11220`, an unintended change in reordering was introduced by changing the way indices were assigned to direct params. More specifically, before that change, the indices of direct params to metafunc's callspecs were assigned after all parametrizations took place. Now, that change is reverted. + + +- `#12863 `_: Fix applying markers, including :ref:`pytest.mark.parametrize ` when placed above `@staticmethod` or `@classmethod`. + + +- `#12929 `_: Handle StopIteration from test cases, setup and teardown correctly. + + +- `#12938 `_: Fixed ``--durations-min`` argument not respected if ``-vv`` is used. + + +- `#12946 `_: Fixed missing help for :mod:`pdb` commands wrapped by pytest -- by :user:`adamchainz`. + + +- `#12981 `_: Prevent exceptions in :func:`pytest.Config.add_cleanup` callbacks preventing further cleanups. + + +- `#13047 `_: Restore :func:`pytest.approx` handling of equality checks between `bool` and `numpy.bool_` types. + + Comparing `bool` and `numpy.bool_` using :func:`pytest.approx` accidentally changed in version `8.3.4` and `8.3.5` to no longer match: + + .. code-block:: pycon + + >>> import numpy as np + >>> from pytest import approx + >>> [np.True_, np.True_] == pytest.approx([True, True]) + False + + This has now been fixed: + + .. code-block:: pycon + + >>> [np.True_, np.True_] == pytest.approx([True, True]) + True + + +- `#13119 `_: Improved handling of invalid regex patterns for filter warnings by providing a clear error message. + + +- `#13175 `_: The diff is now also highlighted correctly when comparing two strings. + + +- `#13248 `_: Fixed an issue where passing a ``scope`` in :py:func:`Metafunc.parametrize ` with ``indirect=True`` + could result in other fixtures being unable to depend on the parametrized fixture. + + +- `#13291 `_: Fixed ``repr`` of ``attrs`` objects in assertion failure messages when using ``attrs>=25.2``. + + +- `#13312 `_: Fixed a possible ``KeyError`` crash on PyPy during collection of tests involving higher-scoped parameters. + + +- `#13345 `_: Fix type hints for :attr:`pytest.TestReport.when` and :attr:`pytest.TestReport.location`. + + +- `#13377 `_: Fixed handling of test methods with positional-only parameter syntax. + + Now, methods are supported that formally define ``self`` as positional-only + and/or fixture parameters as keyword-only, e.g.: + + .. code-block:: python + + class TestClass: + + def test_method(self, /, *, fixture): ... + + Before, this caused an internal error in pytest. + + +- `#13384 `_: Fixed an issue where pytest could report negative durations. + + +- `#13420 `_: Added ``lru_cache`` to ``nodes._check_initialpaths_for_relpath``. + + +- `#9037 `_: Honor :confval:`disable_test_id_escaping_and_forfeit_all_rights_to_community_support` when escaping ids in parametrized tests. + + + +Improved documentation +---------------------- + +- `#12535 `_: `This + example` + showed ``print`` statements that do not exactly reflect what the + different branches actually do. The fix makes the example more precise. + + +- `#13218 `_: Pointed out in the :func:`pytest.approx` documentation that it considers booleans unequal to numeric zero or one. + + +- `#13221 `_: Improved grouping of CLI options in the ``--help`` output. + + +- `#6649 `_: Added :class:`~pytest.TerminalReporter` to the :ref:`api-reference` documentation page. + + +- `#8612 `_: Add a recipe for handling abstract test classes in the documentation. + + A new example has been added to the documentation to demonstrate how to use a mixin class to handle abstract + test classes without manually setting the ``__test__`` attribute for subclasses. + This ensures that subclasses of abstract test classes are automatically collected by pytest. + + + +Packaging updates and notes for downstreams +------------------------------------------- + +- `#13317 `_: Specified minimum allowed versions of ``colorama``, ``iniconfig``, + and ``packaging``; and bumped the minimum allowed version + of ``exceptiongroup`` for ``python_version<'3.11'`` from a release + candidate to a full release. + + + +Contributor-facing changes +-------------------------- + +- `#12017 `_: Mixed internal improvements: + + * Migrate formatting to f-strings in some tests. + * Use type-safe constructs in JUnitXML tests. + * Moved`` MockTiming`` into ``_pytest.timing``. + + -- by :user:`RonnyPfannschmidt` + + +- `#12647 `_: Fixed running the test suite with the ``hypothesis`` pytest plugin. + + + +Miscellaneous internal changes +------------------------------ + +- `#6649 `_: Added :class:`~pytest.TerminalReporter` to the public pytest API, as it is part of the signature of the :hook:`pytest_terminal_summary` hook. + + pytest 8.3.5 (2025-03-02) ========================= diff --git a/doc/en/example/parametrize.rst b/doc/en/example/parametrize.rst index 69e715c9db1..c3848db5112 100644 --- a/doc/en/example/parametrize.rst +++ b/doc/en/example/parametrize.rst @@ -162,7 +162,7 @@ objects, they are still using the default pytest representation: rootdir: /home/sweet/project collected 8 items - + @@ -239,7 +239,7 @@ If you just collect tests you'll also nicely see 'advanced' and 'basic' as varia rootdir: /home/sweet/project collected 4 items - + @@ -318,7 +318,7 @@ Let's first see how it looks like at collection time: rootdir: /home/sweet/project collected 2 items - + diff --git a/doc/en/example/pythoncollection.rst b/doc/en/example/pythoncollection.rst index 6a3b143d580..760140390cb 100644 --- a/doc/en/example/pythoncollection.rst +++ b/doc/en/example/pythoncollection.rst @@ -152,7 +152,7 @@ The test collection would look like this: configfile: pytest.ini collected 2 items - + @@ -215,7 +215,7 @@ You can always peek at the collection tree without running tests like this: configfile: pytest.ini collected 3 items - + diff --git a/doc/en/example/reportingdemo.rst b/doc/en/example/reportingdemo.rst index 5e48815bbc9..8040ee9b957 100644 --- a/doc/en/example/reportingdemo.rst +++ b/doc/en/example/reportingdemo.rst @@ -384,6 +384,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: i = Foo() > assert i.b == 2 + ^^^ failure_demo.py:148: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ @@ -446,6 +447,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: def test_tupleerror(self): > a, b = [1] # noqa: F841 + ^^^^ E ValueError: not enough values to unpack (expected 2, got 1) failure_demo.py:177: ValueError @@ -457,6 +459,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: items = [1, 2, 3] print(f"items is {items!r}") > a, b = items.pop() + ^^^^ E TypeError: cannot unpack non-iterable int object failure_demo.py:182: TypeError @@ -468,6 +471,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: def test_some_error(self): > if namenotexi: # noqa: F821 + ^^^^^^^^^^ E NameError: name 'namenotexi' is not defined failure_demo.py:185: NameError @@ -526,6 +530,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: def test_z1_unpack_error(self): items = [] > a, b = items + ^^^^ E ValueError: not enough values to unpack (expected 2, got 0) failure_demo.py:219: ValueError @@ -536,6 +541,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: def test_z2_type_error(self): items = 3 > a, b = items + ^^^^ E TypeError: cannot unpack non-iterable int object failure_demo.py:223: TypeError @@ -568,12 +574,12 @@ Here is a nice run of several failures and how ``pytest`` presents things: E + where False = ('456') E + where = '123'.startswith E + where '123' = .f at 0xdeadbeef0029>() - E + and '456' = .g at 0xdeadbeef0003>() + E + and '456' = .g at 0xdeadbeef002a>() failure_demo.py:237: AssertionError _____________________ TestMoreErrors.test_global_func ______________________ - self = + self = def test_global_func(self): > assert isinstance(globf(42), float) @@ -584,18 +590,18 @@ Here is a nice run of several failures and how ``pytest`` presents things: failure_demo.py:240: AssertionError _______________________ TestMoreErrors.test_instance _______________________ - self = + self = def test_instance(self): self.x = 6 * 7 > assert self.x != 42 E assert 42 != 42 - E + where 42 = .x + E + where 42 = .x failure_demo.py:244: AssertionError _______________________ TestMoreErrors.test_compare ________________________ - self = + self = def test_compare(self): > assert globf(10) < 5 @@ -605,7 +611,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: failure_demo.py:247: AssertionError _____________________ TestMoreErrors.test_try_finally ______________________ - self = + self = def test_try_finally(self): x = 1 @@ -616,7 +622,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: failure_demo.py:252: AssertionError ___________________ TestCustomAssertMsg.test_single_line ___________________ - self = + self = def test_single_line(self): class A: @@ -631,16 +637,16 @@ Here is a nice run of several failures and how ``pytest`` presents things: failure_demo.py:263: AssertionError ____________________ TestCustomAssertMsg.test_multiline ____________________ - self = + self = def test_multiline(self): class A: a = 1 b = 2 - > assert ( - A.a == b - ), "A.a appears not to be b\nor does not appear to be b\none of those" + > assert A.a == b, ( + "A.a appears not to be b\nor does not appear to be b\none of those" + ) E AssertionError: A.a appears not to be b E or does not appear to be b E one of those @@ -650,7 +656,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: failure_demo.py:270: AssertionError ___________________ TestCustomAssertMsg.test_custom_repr ___________________ - self = + self = def test_custom_repr(self): class JSON: diff --git a/doc/en/example/simple.rst b/doc/en/example/simple.rst index 69d973e51d0..c1a444bea18 100644 --- a/doc/en/example/simple.rst +++ b/doc/en/example/simple.rst @@ -104,6 +104,7 @@ Let's run this without supplying our new option: elif cmdopt == "type2": print("second") > assert 0 # to see what was printed + ^^^^^^^^ E assert 0 test_sample.py:6: AssertionError @@ -130,6 +131,7 @@ And now with supplying a command line option: elif cmdopt == "type2": print("second") > assert 0 # to see what was printed + ^^^^^^^^ E assert 0 test_sample.py:6: AssertionError @@ -646,7 +648,7 @@ If we run this: test_step.py:11: AssertionError ========================= short test summary info ========================== - XFAIL test_step.py::TestUserHandling::test_deletion - reason: previous test failed (test_modification) + XFAIL test_step.py::TestUserHandling::test_deletion - previous test failed (test_modification) ================== 1 failed, 2 passed, 1 xfailed in 0.12s ================== We'll see that ``test_deletion`` was not executed because ``test_modification`` @@ -725,7 +727,7 @@ We can run this: file /home/sweet/project/b/test_error.py, line 1 def test_root(db): # no db here, will error out E fixture 'db' not found - > available fixtures: cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory + > available fixtures: cache, capfd, capfdbinary, caplog, capsys, capsysbinary, capteesys, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory > use 'pytest --fixtures [testpath]' for help on them. /home/sweet/project/b/test_error.py:1 @@ -736,6 +738,7 @@ We can run this: def test_a1(db): > assert 0, db # to show value + ^^^^^^^^^^^^ E AssertionError: E assert 0 @@ -746,6 +749,7 @@ We can run this: def test_a2(db): > assert 0, db # to show value + ^^^^^^^^^^^^ E AssertionError: E assert 0 @@ -946,7 +950,7 @@ and run it: rootdir: /home/sweet/project collected 3 items - test_module.py Esetting up a test failed or skipped test_module.py::test_setup_fails + test_module.py Esetting up a test failed test_module.py::test_setup_fails Fexecuting test failed or skipped test_module.py::test_call_fails F diff --git a/doc/en/getting-started.rst b/doc/en/getting-started.rst index 41469de3864..c92e97f556e 100644 --- a/doc/en/getting-started.rst +++ b/doc/en/getting-started.rst @@ -22,7 +22,7 @@ Install ``pytest`` .. code-block:: bash $ pytest --version - pytest 8.3.5 + pytest 8.4.0 .. _`simpletest`: diff --git a/doc/en/how-to/cache.rst b/doc/en/how-to/cache.rst index a3b2a862534..e3209b79359 100644 --- a/doc/en/how-to/cache.rst +++ b/doc/en/how-to/cache.rst @@ -289,8 +289,6 @@ You can always peek at the content of the cache using the {'test_caching.py::test_function': True} cache/nodeids contains: ['test_caching.py::test_function'] - cache/stepwise contains: - [] example/value contains: 42 diff --git a/doc/en/how-to/capture-warnings.rst b/doc/en/how-to/capture-warnings.rst index 4b1de6f3704..a9bd894b6fd 100644 --- a/doc/en/how-to/capture-warnings.rst +++ b/doc/en/how-to/capture-warnings.rst @@ -66,6 +66,7 @@ as an error: def test_one(): > assert api_v1() == 1 + ^^^^^^^^ test_show_warnings.py:10: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ diff --git a/doc/en/how-to/fixtures.rst b/doc/en/how-to/fixtures.rst index 8f84e4867a6..a86fd1065fd 100644 --- a/doc/en/how-to/fixtures.rst +++ b/doc/en/how-to/fixtures.rst @@ -449,6 +449,7 @@ marked ``smtp_connection`` fixture function. Running the test looks like this: assert response == 250 assert b"smtp.gmail.com" in msg > assert 0 # for demo purposes + ^^^^^^^^ E assert 0 test_module.py:7: AssertionError @@ -460,6 +461,7 @@ marked ``smtp_connection`` fixture function. Running the test looks like this: response, msg = smtp_connection.noop() assert response == 250 > assert 0 # for demo purposes + ^^^^^^^^ E assert 0 test_module.py:13: AssertionError @@ -1308,6 +1310,7 @@ So let's just do another run: assert response == 250 assert b"smtp.gmail.com" in msg > assert 0 # for demo purposes + ^^^^^^^^ E assert 0 test_module.py:7: AssertionError @@ -1319,6 +1322,7 @@ So let's just do another run: response, msg = smtp_connection.noop() assert response == 250 > assert 0 # for demo purposes + ^^^^^^^^ E assert 0 test_module.py:13: AssertionError @@ -1343,6 +1347,7 @@ So let's just do another run: response, msg = smtp_connection.noop() assert response == 250 > assert 0 # for demo purposes + ^^^^^^^^ E assert 0 test_module.py:13: AssertionError @@ -1418,7 +1423,7 @@ Running the above tests results in the following test IDs being used: rootdir: /home/sweet/project collected 12 items - + diff --git a/doc/en/how-to/output.rst b/doc/en/how-to/output.rst index cb9276c7ea0..bc98b816484 100644 --- a/doc/en/how-to/output.rst +++ b/doc/en/how-to/output.rst @@ -447,7 +447,7 @@ Example: ================================= XPASSES ================================== ========================= short test summary info ========================== SKIPPED [1] test_example.py:22: skipping this test - XFAIL test_example.py::test_xfail - reason: xfailing this test + XFAIL test_example.py::test_xfail - xfailing this test XPASS test_example.py::test_xpass - always xfail ERROR test_example.py::test_error - assert 0 FAILED test_example.py::test_fail - assert 0 diff --git a/doc/en/how-to/parametrize.rst b/doc/en/how-to/parametrize.rst index 5a16684eb96..d7c12c1a1f4 100644 --- a/doc/en/how-to/parametrize.rst +++ b/doc/en/how-to/parametrize.rst @@ -281,7 +281,7 @@ list: $ pytest -q -rs test_strings.py s [100%] ========================= short test summary info ========================== - SKIPPED [1] test_strings.py: got empty parameter set ['stringinput'], function test_valid_string at /home/sweet/project/test_strings.py:2 + SKIPPED [1] test_strings.py: got empty parameter set for (stringinput) 1 skipped in 0.12s Note that when calling ``metafunc.parametrize`` multiple times with different parameter sets, all parameter names across diff --git a/doc/en/how-to/unittest.rst b/doc/en/how-to/unittest.rst index 62e32b6d28f..ba98b366d04 100644 --- a/doc/en/how-to/unittest.rst +++ b/doc/en/how-to/unittest.rst @@ -154,6 +154,7 @@ the ``self.db`` values in the traceback: def test_method1(self): assert hasattr(self, "db") > assert 0, self.db # fail for demo purposes + ^^^^^^^^^^^^^^^^^ E AssertionError: .DummyDB object at 0xdeadbeef0001> E assert 0 @@ -164,6 +165,7 @@ the ``self.db`` values in the traceback: def test_method2(self): > assert 0, self.db # fail for demo purposes + ^^^^^^^^^^^^^^^^^ E AssertionError: .DummyDB object at 0xdeadbeef0001> E assert 0 diff --git a/doc/en/reference/reference.rst b/doc/en/reference/reference.rst index d3dd14a8681..b0535ef6589 100644 --- a/doc/en/reference/reference.rst +++ b/doc/en/reference/reference.rst @@ -2093,6 +2093,12 @@ All the command-line flags can be obtained by running ``pytest --help``:: example: -m 'mark1 and not mark2'. --markers show markers (builtin, plugin and per-project ones). -x, --exitfirst Exit instantly on first error or failed test + --maxfail=num Exit after first num failures or errors + --strict-config Any warnings encountered while parsing the `pytest` + section of the configuration file raise errors + --strict-markers Markers not registered in the `markers` section of + the configuration file raise errors + --strict (Deprecated) alias to --strict-markers --fixtures, --funcargs Show available fixtures, sorted by plugin appearance (fixtures with leading '_' are only shown with '-v') @@ -2131,15 +2137,21 @@ All the command-line flags can be obtained by running ``pytest --help``:: --sw-skip, --stepwise-skip Ignore the first failing test but stop on the next failing test. Implicitly enables --stepwise. + --sw-reset, --stepwise-reset + Resets stepwise state, restarting the stepwise + workflow. Implicitly enables --stepwise. Reporting: --durations=N Show N slowest setup/test durations (N=0 for all) --durations-min=N Minimal duration in seconds for inclusion in slowest - list. Default: 0.005. + list. Default: 0.005 (or 0.0 if -vv is given). -v, --verbose Increase verbosity --no-header Disable header --no-summary Disable summary --no-fold-skipped Do not fold skipped tests in short summary. + --force-short-summary + Force condensed summary output regardless of + verbosity level. -q, --quiet Decrease verbosity --verbosity=VERBOSE Set verbosity. Default: 0. -r chars Show extra test summary info as specified by chars: @@ -2174,22 +2186,6 @@ All the command-line flags can be obtained by running ``pytest --help``:: -W, --pythonwarnings PYTHONWARNINGS Set which warnings to report, see -W option of Python itself - --maxfail=num Exit after first num failures or errors - --strict-config Any warnings encountered while parsing the `pytest` - section of the configuration file raise errors - --strict-markers Markers not registered in the `markers` section of - the configuration file raise errors - --strict (Deprecated) alias to --strict-markers - -c, --config-file FILE - Load configuration from `FILE` instead of trying to - locate one of the implicit configuration files. - --continue-on-collection-errors - Force test execution even if collection errors occur - --rootdir=ROOTDIR Define root directory for tests. Can be relative - path: 'root_dir', './root_dir', - 'root_dir/another_dir/'; absolute path: - '/home/user/root_dir'; path with variables: - '$HOME/root_dir'. collection: --collect-only, --co Only collect tests, don't execute them @@ -2205,6 +2201,8 @@ All the command-line flags can be obtained by running ``pytest --help``:: --keep-duplicates Keep duplicate tests --collect-in-virtualenv Don't ignore tests in a local virtualenv directory + --continue-on-collection-errors + Force test execution even if collection errors occur --import-mode={prepend,append,importlib} Prepend/append to sys.path when importing test modules and conftest files. Default: prepend. @@ -2220,6 +2218,14 @@ All the command-line flags can be obtained by running ``pytest --help``:: failure test session debugging and configuration: + -c, --config-file FILE + Load configuration from `FILE` instead of trying to + locate one of the implicit configuration files. + --rootdir=ROOTDIR Define root directory for tests. Can be relative + path: 'root_dir', './root_dir', + 'root_dir/another_dir/'; absolute path: + '/home/user/root_dir'; path with variables: + '$HOME/root_dir'. --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 @@ -2228,7 +2234,13 @@ All the command-line flags can be obtained by running ``pytest --help``:: -h, --help Show help message and configuration info -p name Early-load given plugin module name or entry point (multi-allowed). To avoid loading of plugins, use - the `no:` prefix, e.g. `no:doctest`. + the `no:` prefix, e.g. `no:doctest`. See also + --disable-plugin-autoload. + --disable-plugin-autoload + Disable plugin auto-loading through entry point + packaging metadata. Only plugins explicitly + specified in -p or env var PYTEST_PLUGINS will be + loaded. --trace-config Trace considerations of conftest.py files --debug=[DEBUG_FILE_NAME] Store internal tracing debug information in this log @@ -2283,13 +2295,16 @@ All the command-line flags can be obtained by running ``pytest --help``:: markers (linelist): Register new markers for test functions empty_parameter_set_mark (string): Default marker for empty parametersets - norecursedirs (args): Directory patterns to avoid for recursion - testpaths (args): Directories to search for tests when no files or - directories are given on the command line filterwarnings (linelist): Each line specifies a pattern for warnings.filterwarnings. Processed after -W/--pythonwarnings. + norecursedirs (args): Directory patterns to avoid for recursion + testpaths (args): Directories to search for tests when no files or + directories are given on the command line + collect_imported_tests (bool): + Whether to collect tests in imported modules outside + `testpaths` consider_namespace_packages (bool): Consider namespace packages when resolving module names during import @@ -2329,6 +2344,12 @@ All the command-line flags can be obtained by running ``pytest --help``:: enable_assertion_pass_hook (bool): Enables the pytest_assertion_pass hook. Make sure to delete any previously generated pyc cache files. + truncation_limit_lines (string): + Set threshold of LINES after which truncation will + take effect + truncation_limit_chars (string): + Set threshold of CHARS after which truncation will + take effect verbosity_assertions (string): Specify a verbosity level for assertions, overriding the main level. Higher levels will provide more @@ -2373,12 +2394,12 @@ All the command-line flags can be obtained by running ``pytest --help``:: Default value for --log-file-date-format log_auto_indent (string): Default value for --log-auto-indent - pythonpath (paths): Add paths to sys.path faulthandler_timeout (string): Dump the traceback of all threads if a test takes more than TIMEOUT seconds to finish addopts (args): Extra command line options minversion (string): Minimally required pytest version + pythonpath (paths): Add paths to sys.path required_plugins (args): Plugins that must be present for pytest to run