From 532dc5fc78f57de5115c5ecc9c6c29257787ada7 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Tue, 27 Oct 2026 22:23:39 +0200 Subject: [PATCH 1/3] tox: add attrs dependency to regen, needed in reportingdemo.rst --- tox.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/tox.ini b/tox.ini index 75d22d6e2c1..a3d480966cd 100644 --- a/tox.ini +++ b/tox.ini @@ -159,6 +159,7 @@ description = changedir = doc/en dependency_groups = deps = + attrs PyYAML regendoc>=0.8.1 sphinx From 143ce31dea9b12ff2ab6add04361ee01ab114931 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Tue, 27 Oct 2026 22:42:04 +0200 Subject: [PATCH 2/3] pre-commit: exclude codespell on generated release announcements --- .pre-commit-config.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3da767d615b..9414d5bfae0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,6 +29,8 @@ repos: args: ["--toml=pyproject.toml"] additional_dependencies: - tomli + # Don't spell check contributor names. + exclude: ^doc/en/announce/release-.*\.rst$ - repo: https://github.com/pre-commit/pygrep-hooks rev: v1.10.0 hooks: From ae1d0ff57b8bd4252da9ade7353523ac0ac73281 Mon Sep 17 00:00:00 2001 From: pytest bot Date: Tue, 27 Oct 2026 19:30:11 +0000 Subject: [PATCH 3/3] Prepare release version 9.2.0 --- changelog/10128.bugfix.rst | 1 - changelog/10210.bugfix.rst | 5 - changelog/10644.bugfix.rst | 3 - changelog/10721.doc.rst | 1 - changelog/10745.improvement.1.rst | 3 - changelog/10745.improvement.2.rst | 5 - changelog/1139.bugfix.rst | 2 - changelog/11418.improvement.rst | 11 - changelog/11502.bugfix.rst | 1 - changelog/11680.packaging.rst | 17 -- changelog/11783.bugfix.rst | 3 - changelog/11933.bugfix.rst | 1 - changelog/12175.bugfix.rst | 1 - changelog/12223.bugfix.rst | 1 - changelog/12307.bugfix.rst | 1 - changelog/12624.improvement.rst | 5 - changelog/12658.doc.rst | 1 - changelog/12697.improvement.rst | 1 - changelog/12824.bugfix.rst | 3 - changelog/12857.doc.rst | 1 - changelog/12860.improvement.rst | 1 - changelog/13292.bugfix.rst | 3 - changelog/13354.improvement.rst | 3 - changelog/13369.improvement.rst | 1 - changelog/13431.improvement.rst | 2 - changelog/13564.improvement.rst | 4 - changelog/13888.misc.rst | 1 - changelog/14036.bugfix.rst | 1 - changelog/14157.doc.rst | 2 - changelog/14164.improvement.rst | 2 - changelog/14189.bugfix.rst | 1 - changelog/14412.bugfix.rst | 1 - changelog/14445.bugfix.rst | 3 - changelog/14463.improvement.rst | 5 - changelog/14523.improvement.rst | 4 - changelog/14552.bugfix.rst | 1 - changelog/14586.bugfix.rst | 1 - changelog/14619.bugfix.rst | 1 - changelog/14635.bugfix.rst | 1 - changelog/14637.bugfix.rst | 1 - changelog/14638.bugfix.rst | 1 - changelog/14675.bugfix.rst | 1 - changelog/14683.bugfix.rst | 3 - changelog/14687.improvement.rst | 1 - changelog/14700.bugfix.rst | 1 - changelog/14705.bugfix.rst | 1 - changelog/14716.breaking.rst | 1 - changelog/14724.improvement.rst | 4 - changelog/14742.deprecation.rst | 2 - changelog/14743.feature.rst | 1 - changelog/14751.improvement.rst | 1 - changelog/14754.improvement.rst | 1 - changelog/14755.deprecation.rst | 1 - changelog/14758.misc.rst | 1 - changelog/14774.deprecation.rst | 6 - changelog/14791.improvement.rst | 3 - changelog/14808.deprecation.rst | 1 - changelog/14813.contrib.rst | 1 - changelog/14828.bugfix.rst | 1 - changelog/14834.doc.rst | 1 - changelog/14864.bugfix.rst | 1 - changelog/14884.bugfix.rst | 1 - changelog/14909.bugfix.rst | 1 - changelog/14912.bugfix.rst | 1 - changelog/14921.contrib.rst | 1 - changelog/14942.bugfix.rst | 2 - changelog/14953.bugfix.rst | 1 - changelog/15005.bugfix.rst | 1 - changelog/15006.bugfix.1.rst | 1 - changelog/15006.bugfix.2.rst | 1 - changelog/15006.bugfix.rst | 1 - changelog/15006.improvement.rst | 1 - changelog/15032.bugfix.rst | 4 - changelog/15043.bugfix.rst | 1 - changelog/15052.bugfix.rst | 1 - changelog/15127.doc.rst | 1 - changelog/15132.bugfix.rst | 2 - changelog/15145.bugfix.rst | 1 - changelog/15153.improvement.rst | 2 - changelog/15172.bugfix.rst | 1 - changelog/15190.contrib.rst | 1 - changelog/15242.doc.rst | 1 - changelog/15254.improvement.rst | 1 - changelog/2781.feature.rst | 1 - changelog/4569.bugfix.rst | 1 - changelog/4569.doc.rst | 1 - changelog/4569.improvement.rst | 1 - changelog/6750.bugfix.rst | 1 - changelog/6881.feature.rst | 1 - changelog/6997.bugfix.rst | 2 - changelog/7323.deprecation.rst | 1 - changelog/7940.bugfix.rst | 1 - changelog/8321.bugfix.rst | 1 - changelog/8593.breaking.rst | 3 - changelog/8914.bugfix.rst | 12 - changelog/9236.packaging.rst | 6 - changelog/9436.improvement.rst | 1 - changelog/9614.doc.rst | 1 - changelog/9924.bugfix.rst | 1 - changelog/993.breaking.rst | 6 - doc/en/announce/index.rst | 1 + doc/en/announce/release-9.2.0.rst | 94 ++++++ doc/en/builtin.rst | 36 +-- doc/en/changelog.rst | 434 ++++++++++++++++++++++++++++ doc/en/example/parametrize.rst | 13 +- doc/en/example/pythoncollection.rst | 4 +- doc/en/example/reportingdemo.rst | 18 +- doc/en/example/simple.rst | 2 +- doc/en/getting-started.rst | 2 +- doc/en/how-to/fixtures.rst | 2 +- doc/en/how-to/output.rst | 10 +- doc/en/reference/reference.rst | 28 +- 112 files changed, 592 insertions(+), 261 deletions(-) delete mode 100644 changelog/10128.bugfix.rst delete mode 100644 changelog/10210.bugfix.rst delete mode 100644 changelog/10644.bugfix.rst delete mode 100644 changelog/10721.doc.rst delete mode 100644 changelog/10745.improvement.1.rst delete mode 100644 changelog/10745.improvement.2.rst delete mode 100644 changelog/1139.bugfix.rst delete mode 100644 changelog/11418.improvement.rst delete mode 100644 changelog/11502.bugfix.rst delete mode 100644 changelog/11680.packaging.rst delete mode 100644 changelog/11783.bugfix.rst delete mode 100644 changelog/11933.bugfix.rst delete mode 100644 changelog/12175.bugfix.rst delete mode 100644 changelog/12223.bugfix.rst delete mode 100644 changelog/12307.bugfix.rst delete mode 100644 changelog/12624.improvement.rst delete mode 100644 changelog/12658.doc.rst delete mode 100644 changelog/12697.improvement.rst delete mode 100644 changelog/12824.bugfix.rst delete mode 100644 changelog/12857.doc.rst delete mode 100644 changelog/12860.improvement.rst delete mode 100644 changelog/13292.bugfix.rst delete mode 100644 changelog/13354.improvement.rst delete mode 100644 changelog/13369.improvement.rst delete mode 100644 changelog/13431.improvement.rst delete mode 100644 changelog/13564.improvement.rst delete mode 100644 changelog/13888.misc.rst delete mode 100644 changelog/14036.bugfix.rst delete mode 100644 changelog/14157.doc.rst delete mode 100644 changelog/14164.improvement.rst delete mode 100644 changelog/14189.bugfix.rst delete mode 100644 changelog/14412.bugfix.rst delete mode 100644 changelog/14445.bugfix.rst delete mode 100644 changelog/14463.improvement.rst delete mode 100644 changelog/14523.improvement.rst delete mode 100644 changelog/14552.bugfix.rst delete mode 100644 changelog/14586.bugfix.rst delete mode 100644 changelog/14619.bugfix.rst delete mode 100644 changelog/14635.bugfix.rst delete mode 100644 changelog/14637.bugfix.rst delete mode 100644 changelog/14638.bugfix.rst delete mode 100644 changelog/14675.bugfix.rst delete mode 100644 changelog/14683.bugfix.rst delete mode 100644 changelog/14687.improvement.rst delete mode 100644 changelog/14700.bugfix.rst delete mode 100644 changelog/14705.bugfix.rst delete mode 100644 changelog/14716.breaking.rst delete mode 100644 changelog/14724.improvement.rst delete mode 100644 changelog/14742.deprecation.rst delete mode 100644 changelog/14743.feature.rst delete mode 100644 changelog/14751.improvement.rst delete mode 100644 changelog/14754.improvement.rst delete mode 100644 changelog/14755.deprecation.rst delete mode 100644 changelog/14758.misc.rst delete mode 100644 changelog/14774.deprecation.rst delete mode 100644 changelog/14791.improvement.rst delete mode 100644 changelog/14808.deprecation.rst delete mode 100644 changelog/14813.contrib.rst delete mode 100644 changelog/14828.bugfix.rst delete mode 100644 changelog/14834.doc.rst delete mode 100644 changelog/14864.bugfix.rst delete mode 100644 changelog/14884.bugfix.rst delete mode 100644 changelog/14909.bugfix.rst delete mode 100644 changelog/14912.bugfix.rst delete mode 100644 changelog/14921.contrib.rst delete mode 100644 changelog/14942.bugfix.rst delete mode 100644 changelog/14953.bugfix.rst delete mode 100644 changelog/15005.bugfix.rst delete mode 100644 changelog/15006.bugfix.1.rst delete mode 100644 changelog/15006.bugfix.2.rst delete mode 100644 changelog/15006.bugfix.rst delete mode 100644 changelog/15006.improvement.rst delete mode 100644 changelog/15032.bugfix.rst delete mode 100644 changelog/15043.bugfix.rst delete mode 100644 changelog/15052.bugfix.rst delete mode 100644 changelog/15127.doc.rst delete mode 100644 changelog/15132.bugfix.rst delete mode 100644 changelog/15145.bugfix.rst delete mode 100644 changelog/15153.improvement.rst delete mode 100644 changelog/15172.bugfix.rst delete mode 100644 changelog/15190.contrib.rst delete mode 100644 changelog/15242.doc.rst delete mode 100644 changelog/15254.improvement.rst delete mode 100644 changelog/2781.feature.rst delete mode 100644 changelog/4569.bugfix.rst delete mode 100644 changelog/4569.doc.rst delete mode 100644 changelog/4569.improvement.rst delete mode 100644 changelog/6750.bugfix.rst delete mode 100644 changelog/6881.feature.rst delete mode 100644 changelog/6997.bugfix.rst delete mode 100644 changelog/7323.deprecation.rst delete mode 100644 changelog/7940.bugfix.rst delete mode 100644 changelog/8321.bugfix.rst delete mode 100644 changelog/8593.breaking.rst delete mode 100644 changelog/8914.bugfix.rst delete mode 100644 changelog/9236.packaging.rst delete mode 100644 changelog/9436.improvement.rst delete mode 100644 changelog/9614.doc.rst delete mode 100644 changelog/9924.bugfix.rst delete mode 100644 changelog/993.breaking.rst create mode 100644 doc/en/announce/release-9.2.0.rst diff --git a/changelog/10128.bugfix.rst b/changelog/10128.bugfix.rst deleted file mode 100644 index ef07d3d555e..00000000000 --- a/changelog/10128.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Configured warning filters now apply to warnings emitted by ``pytest_configure`` hooks. diff --git a/changelog/10210.bugfix.rst b/changelog/10210.bugfix.rst deleted file mode 100644 index d89cbb02c55..00000000000 --- a/changelog/10210.bugfix.rst +++ /dev/null @@ -1,5 +0,0 @@ -:func:`pytest.approx` now raises a ``TypeError`` for any nested container, not -only for one of the same type as its parent. Previously ``approx([{"k": 1}])`` -and ``approx({"k": [1]})`` were accepted and then compared unequal to every -value, silently ignoring the tolerance, while ``approx([[1]])`` correctly -reported that nesting is unsupported. diff --git a/changelog/10644.bugfix.rst b/changelog/10644.bugfix.rst deleted file mode 100644 index d7135f80f5b..00000000000 --- a/changelog/10644.bugfix.rst +++ /dev/null @@ -1,3 +0,0 @@ -``monkeypatch.setattr()`` no longer leaves a new entry in the instance ``__dict__`` when it patches an attribute that the instance inherits from its class. - -Previously ``undo()`` assigned the inherited value onto the instance, which shadowed the class attribute -- permanently freezing the result for descriptors that resolve dynamically. diff --git a/changelog/10721.doc.rst b/changelog/10721.doc.rst deleted file mode 100644 index 345dc98d8e3..00000000000 --- a/changelog/10721.doc.rst +++ /dev/null @@ -1 +0,0 @@ -Replaced ``setup.py`` usage with ``pyproject.toml`` in :ref:`writing-plugins`. diff --git a/changelog/10745.improvement.1.rst b/changelog/10745.improvement.1.rst deleted file mode 100644 index 0732ce8427d..00000000000 --- a/changelog/10745.improvement.1.rst +++ /dev/null @@ -1,3 +0,0 @@ -The line numbers of a module's statements are now computed once per traceback -instead of once per traceback entry, which noticeably speeds up rendering -failures raised from large test modules. diff --git a/changelog/10745.improvement.2.rst b/changelog/10745.improvement.2.rst deleted file mode 100644 index 07004347037..00000000000 --- a/changelog/10745.improvement.2.rst +++ /dev/null @@ -1,5 +0,0 @@ -A ``RecursionError`` whose recursion origin cannot be located now shows only the -first and last 10 stack frames, matching what pytest already did when locating -the origin failed outright. Previously the full traceback -- often around a -thousand near-identical frames -- was rendered, which was both slow and -unreadable. Pass ``--full-trace`` to see every frame. diff --git a/changelog/1139.bugfix.rst b/changelog/1139.bugfix.rst deleted file mode 100644 index 2f4f631a356..00000000000 --- a/changelog/1139.bugfix.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fixed tracebacks showing ``???`` instead of source lines for code compiled with a filename relative to a directory other than the current working directory -- e.g. compiled Cython modules, when running pytest from a subdirectory of the project root. -The source lookup now falls back to searching ``sys.path`` for such filenames, as the standard :mod:`traceback` module does. diff --git a/changelog/11418.improvement.rst b/changelog/11418.improvement.rst deleted file mode 100644 index 6517ba422fd..00000000000 --- a/changelog/11418.improvement.rst +++ /dev/null @@ -1,11 +0,0 @@ -The cached rewritten modules in ``__pycache__`` are now invalidated by a hash of -the source instead of its modification time, using the checked-hash pyc format -from :pep:`552`. - -Timestamps make the cache useless wherever source files get fresh modification -times, most notably in CI: a checkout gives every file a new mtime, so a -restored cache is discarded in full and every test module is rewritten again. -Hashing the source costs roughly 15 microseconds per file and makes the cache -survive that. - -Existing timestamp based caches are ignored and rewritten once. diff --git a/changelog/11502.bugfix.rst b/changelog/11502.bugfix.rst deleted file mode 100644 index 49e2b7e3b0e..00000000000 --- a/changelog/11502.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -The ``rootdir`` is no longer derived from a configuration file that is not a regular file, such as ``--config-file=/dev/null``. diff --git a/changelog/11680.packaging.rst b/changelog/11680.packaging.rst deleted file mode 100644 index 75cf6b1c954..00000000000 --- a/changelog/11680.packaging.rst +++ /dev/null @@ -1,17 +0,0 @@ -Source archives of arbitrary commits -- the tarballs GitHub serves under -``/archive/``, not just the ones for tags -- can now be built into an sdist or a -wheel with a correct version. A ``.git_archival.txt`` file, expanded by ``git -archive`` via ``export-subst``, carries the describe output that -``setuptools-scm`` would otherwise have to ask ``git`` for. - -The archival file deliberately omits ``ref-names``. Recording it would make the -content of an archive -- and therefore its checksum -- change whenever a branch -that points at the archived commit is moved afterwards, which is how the -equivalent tarballs of tagged releases became unstable for other projects. -Describe output alone depends only on the commit and on the tags reachable from -it. - -The archival file is not shipped in the sdist -- an sdist carries its version -in its metadata, and the template is only ever expanded by ``git archive``. - -Building pytest from a git checkout now requires ``setuptools-scm >= 10.1``. diff --git a/changelog/11783.bugfix.rst b/changelog/11783.bugfix.rst deleted file mode 100644 index 3ff6aa504bc..00000000000 --- a/changelog/11783.bugfix.rst +++ /dev/null @@ -1,3 +0,0 @@ -Plugins installed in editable mode (:pep:`660`) are marked for assertion rewriting again. - -Such installs do not record the package's Python files in the distribution metadata, so pytest found nothing to rewrite and assertions inside the plugin lost their introspection. The plugin's entry point is now used to locate the package in that case. diff --git a/changelog/11933.bugfix.rst b/changelog/11933.bugfix.rst deleted file mode 100644 index d9192acf626..00000000000 --- a/changelog/11933.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -:func:`pytest.warns` no longer re-emits unmatched warnings with ``module="warnings"``, which caused ``module``-based warning filters to be applied to the wrong warnings. Since :class:`warnings.WarningMessage` does not record the module a warning was emitted with, re-emitted warnings now use the standard :func:`warnings.warn_explicit` default of deriving the module from the warning's filename. diff --git a/changelog/12175.bugfix.rst b/changelog/12175.bugfix.rst deleted file mode 100644 index 51b431df12c..00000000000 --- a/changelog/12175.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -:meth:`ExceptionInfo.exconly(tryshort=True) ` now strips the ``AssertionError:`` prefix of failed ``assert`` statements for :class:`~pytest.ExceptionInfo` objects created by :func:`pytest.raises`, and failures inside :meth:`unittest.TestCase.subTest` report the same short crash line as regular tests. diff --git a/changelog/12223.bugfix.rst b/changelog/12223.bugfix.rst deleted file mode 100644 index f2379c80bd7..00000000000 --- a/changelog/12223.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -The ``message`` attribute of ```` and ```` elements in ``--junitxml`` reports is now shortened to whole lines within 500 characters. When something is dropped, it ends with a note pointing to the element text, which still holds the full report. Previously, very verbose assertion output (e.g. with ``-vv``) produced attributes tens of thousands of characters long, which some XML parsers fail on. diff --git a/changelog/12307.bugfix.rst b/changelog/12307.bugfix.rst deleted file mode 100644 index d1368d977d0..00000000000 --- a/changelog/12307.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed truncation of long collections (lists, dicts, sets, etc.) in the "message" part of failed assertions (as in ``assert condition, msg``) when using ``-vv``: the message now uses the same unlimited repr as the rest of the assertion output, instead of eliding collection elements with ``...``. diff --git a/changelog/12624.improvement.rst b/changelog/12624.improvement.rst deleted file mode 100644 index df87da9aa14..00000000000 --- a/changelog/12624.improvement.rst +++ /dev/null @@ -1,5 +0,0 @@ -The :globalvar:`pytest_plugins` variable and the :envvar:`PYTEST_PLUGINS` environment variable now also accept entry point names of installed plugins (e.g. ``xdist``), in addition to importable module names, matching the behavior of the :option:`-p` command-line option. - -As part of this change, plugins specified by entry point name through these mechanisms are now also listed in the ``plugins:`` line of the terminal header (:issue:`12615`). - -Based on the original implementation by Marcel Telka in :pr:`12616`. diff --git a/changelog/12658.doc.rst b/changelog/12658.doc.rst deleted file mode 100644 index edf9d4cb48c..00000000000 --- a/changelog/12658.doc.rst +++ /dev/null @@ -1 +0,0 @@ -Moved the fixture setup and finalizer hooks to the test running hooks section in the reference documentation. diff --git a/changelog/12697.improvement.rst b/changelog/12697.improvement.rst deleted file mode 100644 index 31d940c3ca2..00000000000 --- a/changelog/12697.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -Warnings emitted while importing plugins through :option:`-p`, :envvar:`PYTEST_PLUGINS`, or entry point autoloading are now captured, filtered, and reported like other warnings. diff --git a/changelog/12824.bugfix.rst b/changelog/12824.bugfix.rst deleted file mode 100644 index 0bf95533816..00000000000 --- a/changelog/12824.bugfix.rst +++ /dev/null @@ -1,3 +0,0 @@ -Custom command-line options now fail with a clear error when their implicit -destination conflicts with an existing option, avoiding silent overrides of -built-in options such as ``-k``. diff --git a/changelog/12857.doc.rst b/changelog/12857.doc.rst deleted file mode 100644 index 08b2af97277..00000000000 --- a/changelog/12857.doc.rst +++ /dev/null @@ -1 +0,0 @@ -Documented how ``--confcutdir`` affects initial ``conftest.py`` discovery. diff --git a/changelog/12860.improvement.rst b/changelog/12860.improvement.rst deleted file mode 100644 index 2ea7492bc10..00000000000 --- a/changelog/12860.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -Assertion diffs for ``dict.items()`` and ``dict.keys()`` comparisons (``>=``, ``<=``, ``>``, ``<``, ``==``) now show which items are missing, the same way set comparisons do. diff --git a/changelog/13292.bugfix.rst b/changelog/13292.bugfix.rst deleted file mode 100644 index 279541e7661..00000000000 --- a/changelog/13292.bugfix.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fixed a stale rewritten module being used when a test file is modified twice -within the same second without changing its size -- the pyc header could only -record whole-second timestamps. The cache is now keyed on a hash of the source. diff --git a/changelog/13354.improvement.rst b/changelog/13354.improvement.rst deleted file mode 100644 index 9b90b284cd2..00000000000 --- a/changelog/13354.improvement.rst +++ /dev/null @@ -1,3 +0,0 @@ -:meth:`Node.get_closest_marker <_pytest.nodes.Node.get_closest_marker>` now also accepts a :class:`~pytest.MarkDecorator` as its ``default``, for example ``item.get_closest_marker("foo", pytest.mark.foo(1))``, and returns the wrapped :class:`~pytest.Mark`. - -Previously the only way to build a ``default`` was to instantiate :class:`~pytest.Mark` directly, which is private and warns. diff --git a/changelog/13369.improvement.rst b/changelog/13369.improvement.rst deleted file mode 100644 index b8cb8d244cb..00000000000 --- a/changelog/13369.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -Improved the error from :meth:`pytest.RunResult.assert_outcomes` when a plugin changes or removes pytest's standard terminal summary, and documented how to isolate output-changing plugins. diff --git a/changelog/13431.improvement.rst b/changelog/13431.improvement.rst deleted file mode 100644 index 299642570d5..00000000000 --- a/changelog/13431.improvement.rst +++ /dev/null @@ -1,2 +0,0 @@ -Exposed :class:`pytest.ParameterSet` as the type of the return value of :func:`pytest.param()`. -This can be used in type annotations and ``isinstance`` checks. diff --git a/changelog/13564.improvement.rst b/changelog/13564.improvement.rst deleted file mode 100644 index af8346eef17..00000000000 --- a/changelog/13564.improvement.rst +++ /dev/null @@ -1,4 +0,0 @@ -Issue a warning when fixtures are wrapped with a decorator that prevents -correct discovery, including ``@classmethod`` above ``@pytest.fixture`` and -``@staticmethod`` above ``@pytest.fixture``. Put ``@pytest.fixture`` above -those decorators on test classes. diff --git a/changelog/13888.misc.rst b/changelog/13888.misc.rst deleted file mode 100644 index b15231a8b79..00000000000 --- a/changelog/13888.misc.rst +++ /dev/null @@ -1 +0,0 @@ -:attr:`FixtureRequest.node ` is now explicitly annotated as returning ``Any``, so strict pyright no longer reports it as ``Unknown``. The return type stays deliberately broad, see :issue:`13888`. diff --git a/changelog/14036.bugfix.rst b/changelog/14036.bugfix.rst deleted file mode 100644 index 2c82fe383da..00000000000 --- a/changelog/14036.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -``__tracebackhide__`` is now respected in ``ExceptionGroup`` tracebacks, both for the group itself and for its sub-exceptions. diff --git a/changelog/14157.doc.rst b/changelog/14157.doc.rst deleted file mode 100644 index 997410faad2..00000000000 --- a/changelog/14157.doc.rst +++ /dev/null @@ -1,2 +0,0 @@ -Added the ``pytest-flakefighters`` plugin to the list of flaky test plugins in ``plugins.rst``. -Added flaky test papers published on the `Test FLARE `__ project to the list of flaky papers in ``plugins.rst``. diff --git a/changelog/14164.improvement.rst b/changelog/14164.improvement.rst deleted file mode 100644 index 25acae10c50..00000000000 --- a/changelog/14164.improvement.rst +++ /dev/null @@ -1,2 +0,0 @@ -Exposed :class:`pytest.Approx` as the type of the return value of :func:`pytest.approx()`. -This can be used in type annotations and ``isinstance`` checks. diff --git a/changelog/14189.bugfix.rst b/changelog/14189.bugfix.rst deleted file mode 100644 index cdb0680e35a..00000000000 --- a/changelog/14189.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Nested usage of :meth:`caplog.filtering ` no longer removes filters early if they were already present. diff --git a/changelog/14412.bugfix.rst b/changelog/14412.bugfix.rst deleted file mode 100644 index 4148ca8b454..00000000000 --- a/changelog/14412.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed incorrect timing information for subtests and parent tests when ``console_output_style="times"``. diff --git a/changelog/14445.bugfix.rst b/changelog/14445.bugfix.rst deleted file mode 100644 index 68b37754b08..00000000000 --- a/changelog/14445.bugfix.rst +++ /dev/null @@ -1,3 +0,0 @@ -Assertion rewriting no longer evaluates walrus operator (``:=``) expressions more than once, which reported results the test never computed when the expression had side effects. - -An operand evaluated before a later walrus is now reported with the value it actually saw, so ``assert value != identity(value := value.lower())`` keeps Python's left-to-right order. diff --git a/changelog/14463.improvement.rst b/changelog/14463.improvement.rst deleted file mode 100644 index 30e3046c81e..00000000000 --- a/changelog/14463.improvement.rst +++ /dev/null @@ -1,5 +0,0 @@ -Assertion diffs for mappings now match up keys the way the compared mappings match them themselves. - -Key comparison goes through the mappings' key views instead of plain sets of their keys, so a mapping -with its own notion of key equivalence -- case-insensitive header mappings, for example -- no longer -reports its common keys as missing on either side. diff --git a/changelog/14523.improvement.rst b/changelog/14523.improvement.rst deleted file mode 100644 index f809c6803a6..00000000000 --- a/changelog/14523.improvement.rst +++ /dev/null @@ -1,4 +0,0 @@ -Large assertion comparison diffs are now built lazily and capped to the -truncation budget, so a huge diff is no longer formatted in full just to -be truncated. As a result the truncation footer no longer -reports the exact number of hidden lines. diff --git a/changelog/14552.bugfix.rst b/changelog/14552.bugfix.rst deleted file mode 100644 index 6c624caa5a5..00000000000 --- a/changelog/14552.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed stale ``co_filename`` values after a test module or directory is moved. Assertion-rewrite caches are reused when the source hash still matches, and in-memory code objects are pointed at the current path. diff --git a/changelog/14586.bugfix.rst b/changelog/14586.bugfix.rst deleted file mode 100644 index 54b72253df9..00000000000 --- a/changelog/14586.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Negative values passed to ``log_auto_indent`` now correctly fall back to no indentation, matching the documented behavior. diff --git a/changelog/14619.bugfix.rst b/changelog/14619.bugfix.rst deleted file mode 100644 index 8f7f788af53..00000000000 --- a/changelog/14619.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed a crash in ``pytest.mark.parametrize`` when a non-sequence value is passed for a parameter set. It now provides a clear error message during collection. diff --git a/changelog/14635.bugfix.rst b/changelog/14635.bugfix.rst deleted file mode 100644 index bb349f6875f..00000000000 --- a/changelog/14635.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed fixture resolution failures when specifying multiple test paths on the command line that share common parent directories. Parametrized fixtures defined in a ``conftest.py`` could be silently dropped depending on the order of the specified paths. diff --git a/changelog/14637.bugfix.rst b/changelog/14637.bugfix.rst deleted file mode 100644 index 65a6d2bd42b..00000000000 --- a/changelog/14637.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Pytest now correctly skips identical trailing characters in assertion text diffs even when the compared strings differ at the beginning. diff --git a/changelog/14638.bugfix.rst b/changelog/14638.bugfix.rst deleted file mode 100644 index cc07b54b8b7..00000000000 --- a/changelog/14638.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Top-level options in ``pytest.toml`` and ``.pytest.toml`` files now raise an error instead of being silently ignored when no ``[pytest]`` table is present. diff --git a/changelog/14675.bugfix.rst b/changelog/14675.bugfix.rst deleted file mode 100644 index 234e7be6183..00000000000 --- a/changelog/14675.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -The :confval:`truncation_limit_lines` and :confval:`truncation_limit_chars` configuration options now accept integer values in TOML configuration files, while still accepting strings for backward compatibility. diff --git a/changelog/14683.bugfix.rst b/changelog/14683.bugfix.rst deleted file mode 100644 index b10bc5d415f..00000000000 --- a/changelog/14683.bugfix.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fixed a regression in pytest 9.1 where a conftest.py located in the rootdir was no longer visible to tests and doctests collected from *outside* the rootdir (for example when passing a parent directory of the rootdir as a collection argument, or setting ``--rootdir`` to a subdirectory). - -As a result, fixtures defined in such a conftest -- including ``doctest_namespace`` injections -- were not available, causing errors such as ``NameError`` in doctests. diff --git a/changelog/14687.improvement.rst b/changelog/14687.improvement.rst deleted file mode 100644 index 04bef6173c9..00000000000 --- a/changelog/14687.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -The default fd-level output capturing (``--capture=fd``) now skips reading the capture buffer for tests which produce no output, reducing per-test overhead in large test suites. diff --git a/changelog/14700.bugfix.rst b/changelog/14700.bugfix.rst deleted file mode 100644 index 46847b59486..00000000000 --- a/changelog/14700.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed an internal error on Python 3.12 when a doctest on a fixture-decorated function was skipped. diff --git a/changelog/14705.bugfix.rst b/changelog/14705.bugfix.rst deleted file mode 100644 index 196d33d2dee..00000000000 --- a/changelog/14705.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -TOML configuration files passed via :option:`-c` now also read their configuration from the ``[pytest]`` table, the one pytest's own configuration files use. The ``[tool.pytest]`` and ``[tool.pytest.ini_options]`` tables such files were previously restricted to keep working; using both styles in one file is an error. diff --git a/changelog/14716.breaking.rst b/changelog/14716.breaking.rst deleted file mode 100644 index 58aca2c6b96..00000000000 --- a/changelog/14716.breaking.rst +++ /dev/null @@ -1 +0,0 @@ -:option:`-c` now raises a usage error for a path that does not exist, is a directory, or is in a format pytest has no loader for. Such paths were previously either ignored or reported as an unhandled ``FileNotFoundError``. diff --git a/changelog/14724.improvement.rst b/changelog/14724.improvement.rst deleted file mode 100644 index cc4bac6ea8c..00000000000 --- a/changelog/14724.improvement.rst +++ /dev/null @@ -1,4 +0,0 @@ -``--no-summary`` now only applies directly to pytest's own summary. - -The flag no longer skips the ``pytest_terminal_summary`` hook, so third-party -plugins (for example coverage) can still write their terminal summaries. diff --git a/changelog/14742.deprecation.rst b/changelog/14742.deprecation.rst deleted file mode 100644 index 6a992c5dc4c..00000000000 --- a/changelog/14742.deprecation.rst +++ /dev/null @@ -1,2 +0,0 @@ -The private ``_pytest.python.CallSpec2`` name has been renamed to ``CallSpec``. -The old ``CallSpec2`` alias remains available for now and will be removed in pytest 10. diff --git a/changelog/14743.feature.rst b/changelog/14743.feature.rst deleted file mode 100644 index 7b9e04026c5..00000000000 --- a/changelog/14743.feature.rst +++ /dev/null @@ -1 +0,0 @@ -`Full diff:` now contains a legend explaining the `+` & `-` symbols in diff output. diff --git a/changelog/14751.improvement.rst b/changelog/14751.improvement.rst deleted file mode 100644 index 080c512a2f9..00000000000 --- a/changelog/14751.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -:func:`parser.addini ` now also accepts type expressions for its ``type`` argument, in addition to the existing string tags: the plain Python types ``str``, ``bool``, ``int``, ``float``, a ``Literal`` of strings, and unions of these (for example ``int | str`` or ``int | Literal["auto"]``). diff --git a/changelog/14754.improvement.rst b/changelog/14754.improvement.rst deleted file mode 100644 index 08b4a96a297..00000000000 --- a/changelog/14754.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -``pytest.approx()`` now rejects infinite relative tolerances for ``datetime.timedelta`` values with a clear ``ValueError`` instead of raising ``OverflowError``. diff --git a/changelog/14755.deprecation.rst b/changelog/14755.deprecation.rst deleted file mode 100644 index f62a9a44219..00000000000 --- a/changelog/14755.deprecation.rst +++ /dev/null @@ -1 +0,0 @@ -Schedule *yield_fixture* decorator for removal in pytest 10. diff --git a/changelog/14758.misc.rst b/changelog/14758.misc.rst deleted file mode 100644 index 1def2f5b503..00000000000 --- a/changelog/14758.misc.rst +++ /dev/null @@ -1 +0,0 @@ -Internal node ids (the ``::``-separated strings identifying collected items, e.g. ``path/to/test_file.py::TestClass::test_method[param]``) are now represented internally by a single structured :class:`~_pytest.nodeid.NodeId` dataclass instead of being repeatedly re-parsed as plain strings. The public ``nodeid: str`` attribute on nodes and reports is unchanged and remains fully backward compatible for plugins. diff --git a/changelog/14774.deprecation.rst b/changelog/14774.deprecation.rst deleted file mode 100644 index fa9c6ca4cc3..00000000000 --- a/changelog/14774.deprecation.rst +++ /dev/null @@ -1,6 +0,0 @@ -Similarly to the deprecation of class-scoped fixtures defined as instance methods in pytest 9.1, -*all* higher-scoped fixtures (``module``, ``package``, and ``session``) defined -as instance methods are now deprecated. - -They suffer from the same issue the original deprecation only fixed for -class-scoped fixtures, see :issue:`10819` and :issue:`14011`. diff --git a/changelog/14791.improvement.rst b/changelog/14791.improvement.rst deleted file mode 100644 index f1156e32247..00000000000 --- a/changelog/14791.improvement.rst +++ /dev/null @@ -1,3 +0,0 @@ -The :confval:`junit_family`, :confval:`junit_logging`, :confval:`junit_duration_report`, :confval:`console_output_style`, :confval:`empty_parameter_set_mark`, :confval:`assertion_text_diff_style` and :confval:`tmp_path_retention_policy` configuration options are now registered with the set of values they accept: an invalid value now fails with a clean usage error instead of being silently ignored or crashing later, and ``pytest --help`` lists the accepted values. - -:func:`config.getini ` now raises :class:`pytest.UsageError` instead of ``TypeError`` or ``ValueError`` when the value read from the configuration file does not match the registered type, so a bad value is always reported as a short usage error message instead of an internal error traceback. Asking for an option name that was never registered still raises ``ValueError``. diff --git a/changelog/14808.deprecation.rst b/changelog/14808.deprecation.rst deleted file mode 100644 index ad53b0084a9..00000000000 --- a/changelog/14808.deprecation.rst +++ /dev/null @@ -1 +0,0 @@ -Passing a non-string value to a ``string``-typed ini option now emits a ``pytest.PytestRemovedIn10Warning``. This affects ``[tool.pytest.ini_options]`` in ``pyproject.toml``, where TOML arrays are kept as lists by ``make_scalar`` instead of being converted to strings. In pytest 10 this will raise a ``TypeError``, matching the behavior of the corresponding TOML config path. diff --git a/changelog/14813.contrib.rst b/changelog/14813.contrib.rst deleted file mode 100644 index 99e61e0a742..00000000000 --- a/changelog/14813.contrib.rst +++ /dev/null @@ -1 +0,0 @@ -Added a systematic coverage matrix for assertion rewriting. diff --git a/changelog/14828.bugfix.rst b/changelog/14828.bugfix.rst deleted file mode 100644 index c343b8610c1..00000000000 --- a/changelog/14828.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Exception groups raised from another exception now print their cause chain only once in the traceback output. diff --git a/changelog/14834.doc.rst b/changelog/14834.doc.rst deleted file mode 100644 index 072039f6779..00000000000 --- a/changelog/14834.doc.rst +++ /dev/null @@ -1 +0,0 @@ -Added :pypi:`pytest-skip-slow` to the annotated list of third-party plugins. diff --git a/changelog/14864.bugfix.rst b/changelog/14864.bugfix.rst deleted file mode 100644 index 5f4c19dcaa0..00000000000 --- a/changelog/14864.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed collection on Windows collecting the whole suite instead of the given path, on file systems which do not support file IDs (``st_ino`` is ``0`` for every file, as seen for example on ``sshfs-win``/WinFsp mounts). diff --git a/changelog/14884.bugfix.rst b/changelog/14884.bugfix.rst deleted file mode 100644 index 462d78dcb2b..00000000000 --- a/changelog/14884.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -``Cache.get()``, ``Cache.set()`` and ``Cache.mkdir()`` now reject keys that resolve outside the cache directory, and ``--cache-show`` ignores glob matches outside it. diff --git a/changelog/14909.bugfix.rst b/changelog/14909.bugfix.rst deleted file mode 100644 index 32dced31386..00000000000 --- a/changelog/14909.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed :meth:`MonkeyPatch.delattr `, :meth:`MonkeyPatch.setitem ` and :meth:`MonkeyPatch.delitem ` recording a stale undo entry when the underlying mutation failed, which could cause spurious errors during teardown. The undo entry is now recorded only after the mutation succeeds, matching the behavior of :meth:`MonkeyPatch.setattr `. diff --git a/changelog/14912.bugfix.rst b/changelog/14912.bugfix.rst deleted file mode 100644 index 5ca820df37f..00000000000 --- a/changelog/14912.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -:class:`~pytest.PytestWarning` instances defined in ``_pytest.deprecated`` are no longer reused across ``warnings.warn`` calls, so warnings raised as errors (e.g. with ``-W error``) no longer accumulate stale traceback frames from previous raises. diff --git a/changelog/14921.contrib.rst b/changelog/14921.contrib.rst deleted file mode 100644 index fdf44c5ea6a..00000000000 --- a/changelog/14921.contrib.rst +++ /dev/null @@ -1 +0,0 @@ -Added `scripts/diff-assert-rewrite.py`, which diffs the assert-rewritten form of a snippet between the plain source, this checkout and released pytest versions. diff --git a/changelog/14942.bugfix.rst b/changelog/14942.bugfix.rst deleted file mode 100644 index bc82d603817..00000000000 --- a/changelog/14942.bugfix.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fixed a regression in 9.1.0 that made collection very slow (quadratic) when many fixtures are defined with the same name. -This can happen particularly when many tests are defined in separate classes which inherit from a base class which defines fixtures (the fixtures are repeated per class). diff --git a/changelog/14953.bugfix.rst b/changelog/14953.bugfix.rst deleted file mode 100644 index bacb105878e..00000000000 --- a/changelog/14953.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -The :confval:`max_warnings` configuration option now accepts integer values in TOML configuration files, while still accepting strings for backward compatibility. diff --git a/changelog/15005.bugfix.rst b/changelog/15005.bugfix.rst deleted file mode 100644 index d076abf2df9..00000000000 --- a/changelog/15005.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -:func:`pytest.approx` no longer treats finite :class:`~decimal.Decimal` values outside the :class:`float` range (such as ``Decimal("1e400")``) as infinite, which made in-tolerance comparisons fail. diff --git a/changelog/15006.bugfix.1.rst b/changelog/15006.bugfix.1.rst deleted file mode 100644 index 283599c0981..00000000000 --- a/changelog/15006.bugfix.1.rst +++ /dev/null @@ -1 +0,0 @@ -The failure message for :func:`pytest.approx` comparisons of :class:`~decimal.Decimal` collections no longer reports ``Max absolute difference: -inf``, or crashes for mappings, when the :class:`decimal.FloatOperation` trap is set. diff --git a/changelog/15006.bugfix.2.rst b/changelog/15006.bugfix.2.rst deleted file mode 100644 index 6320aaa975c..00000000000 --- a/changelog/15006.bugfix.2.rst +++ /dev/null @@ -1 +0,0 @@ -:func:`pytest.approx` no longer raises ``AttributeError`` when comparing :class:`numpy.ndarray` instances with ``object`` dtype, such as arrays of :class:`~decimal.Decimal`. diff --git a/changelog/15006.bugfix.rst b/changelog/15006.bugfix.rst deleted file mode 100644 index b6f6b0fdb69..00000000000 --- a/changelog/15006.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Restored the tolerance shown by :func:`pytest.approx` for :class:`~decimal.Decimal` values, which since 9.0 displayed ``???`` for the default tolerance and reported the raw ``rel`` ratio instead of the absolute tolerance actually compared against. diff --git a/changelog/15006.improvement.rst b/changelog/15006.improvement.rst deleted file mode 100644 index 016040eeb46..00000000000 --- a/changelog/15006.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -:func:`pytest.approx` now emits :class:`pytest.PytestApproxDecimalToleranceWarning` when a ``rel`` or ``abs`` tolerance is given as a :class:`float` that cannot be represented exactly for a :class:`~decimal.Decimal` comparison, since such a tolerance is widened to the float's exact binary value. diff --git a/changelog/15032.bugfix.rst b/changelog/15032.bugfix.rst deleted file mode 100644 index dea67df8979..00000000000 --- a/changelog/15032.bugfix.rst +++ /dev/null @@ -1,4 +0,0 @@ -Help texts for command-line options and ini options now keep their indentation -and blank lines. Previously each line was stripped before wrapping, so a wrapped -list item was indistinguishable from a new one and blank lines were dropped; ini -option help lost its line breaks entirely. diff --git a/changelog/15043.bugfix.rst b/changelog/15043.bugfix.rst deleted file mode 100644 index 34c39e62a4a..00000000000 --- a/changelog/15043.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Cache writes now emit :class:`pytest.PytestCacheWarning` when writing or closing the cache file fails, consistent with errors opening the file. diff --git a/changelog/15052.bugfix.rst b/changelog/15052.bugfix.rst deleted file mode 100644 index 89954ff3eca..00000000000 --- a/changelog/15052.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed possible off-by-one line numbers in :option:`--fixtures` and :option:`--fixtures-per-test` output. diff --git a/changelog/15127.doc.rst b/changelog/15127.doc.rst deleted file mode 100644 index e3559287d36..00000000000 --- a/changelog/15127.doc.rst +++ /dev/null @@ -1 +0,0 @@ -Added guidance on typing yield fixtures, including annotating fixture functions with their generator type and fixture consumers with the yielded value type. diff --git a/changelog/15132.bugfix.rst b/changelog/15132.bugfix.rst deleted file mode 100644 index 1bcb0b05a69..00000000000 --- a/changelog/15132.bugfix.rst +++ /dev/null @@ -1,2 +0,0 @@ -Native TOML numeric values are now accepted for the ``faulthandler_timeout`` -configuration option. diff --git a/changelog/15145.bugfix.rst b/changelog/15145.bugfix.rst deleted file mode 100644 index 766b82adcfd..00000000000 --- a/changelog/15145.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -With :confval:`console_output_style` set to ``times``, durations just below a unit boundary are now shown in the next unit (e.g. ``1.000ms`` instead of ``1000.0us``). diff --git a/changelog/15153.improvement.rst b/changelog/15153.improvement.rst deleted file mode 100644 index 0561f59aae0..00000000000 --- a/changelog/15153.improvement.rst +++ /dev/null @@ -1,2 +0,0 @@ -The :confval:`verbosity_assertions`, :confval:`verbosity_test_cases`, :confval:`verbosity_subtests`, :confval:`tmp_path_retention_count`, :confval:`log_level`, :confval:`log_cli_level`, :confval:`log_file_level` and :confval:`log_auto_indent` configuration options now accept native integer (and, for ``log_auto_indent``, boolean) values in TOML configuration files, while still accepting strings for backward compatibility. -:confval:`log_file_mode` and :confval:`parametrize_long_str_id_strategy` now report invalid values as a usage error. diff --git a/changelog/15172.bugfix.rst b/changelog/15172.bugfix.rst deleted file mode 100644 index 14a2033b5b3..00000000000 --- a/changelog/15172.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Assertion diffs now pretty-print the built-in :class:`frozendict` (Python 3.15+) across multiple lines, similarly to how :class:`dict` is displayed. diff --git a/changelog/15190.contrib.rst b/changelog/15190.contrib.rst deleted file mode 100644 index 21e4a5a232d..00000000000 --- a/changelog/15190.contrib.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed the documentation build with Pluggy 1.7 by ignoring a reference to its undocumented ``DistFacade`` compatibility class. diff --git a/changelog/15242.doc.rst b/changelog/15242.doc.rst deleted file mode 100644 index b3e4ff49a41..00000000000 --- a/changelog/15242.doc.rst +++ /dev/null @@ -1 +0,0 @@ -The :ref:`installation instructions ` and :ref:`install-package-with-pip` now show how to install pytest into a virtual environment with venv and pip, uv or virtualenv, and explain the ``externally-managed-environment`` error. diff --git a/changelog/15254.improvement.rst b/changelog/15254.improvement.rst deleted file mode 100644 index 3aa64ff64c0..00000000000 --- a/changelog/15254.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -:fixture:`tmp_path` and :meth:`TempPathFactory.mktemp ` no longer list the whole base temporary directory on every call, which made sessions with many temporary directories quadratically slow. Numbers are now handed out from a per-prefix counter, skipping names that already exist. diff --git a/changelog/2781.feature.rst b/changelog/2781.feature.rst deleted file mode 100644 index d3a30efc20d..00000000000 --- a/changelog/2781.feature.rst +++ /dev/null @@ -1 +0,0 @@ -When :confval:`strict_markers` is enabled, marker names used in :option:`-m` expressions are now validated against registered markers. diff --git a/changelog/4569.bugfix.rst b/changelog/4569.bugfix.rst deleted file mode 100644 index 97968182058..00000000000 --- a/changelog/4569.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -:option:`-k` no longer matches attributes that end up in a test function's ``__dict__`` without being meant as keywords, such as pytest's own ``pytestmark`` attribute and the bookkeeping left behind by :func:`functools.wraps` and :func:`functools.lru_cache`. diff --git a/changelog/4569.doc.rst b/changelog/4569.doc.rst deleted file mode 100644 index e5dc171983d..00000000000 --- a/changelog/4569.doc.rst +++ /dev/null @@ -1 +0,0 @@ -``pytest --help``, the :option:`-k` reference entry and :ref:`select-tests` no longer describe :option:`-k` as a Python expression matched against test names only; :ref:`keyword expressions` now shows marker names being matched as well. The examples that looked up a marker use :meth:`Node.get_closest_marker <_pytest.nodes.Node.get_closest_marker>` rather than ``item.keywords``. diff --git a/changelog/4569.improvement.rst b/changelog/4569.improvement.rst deleted file mode 100644 index c4bff2f36d3..00000000000 --- a/changelog/4569.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -:meth:`Node.add_marker <_pytest.nodes.Node.add_marker>` now stores a :class:`~pytest.Mark` in ``node.keywords``, matching what marks applied during collection store. Previously it stored a :class:`~pytest.MarkDecorator`. diff --git a/changelog/6750.bugfix.rst b/changelog/6750.bugfix.rst deleted file mode 100644 index 74c008da1e8..00000000000 --- a/changelog/6750.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fix fixture argument discovery for custom collectors that pass bound methods to :class:`pytest.Function`. diff --git a/changelog/6881.feature.rst b/changelog/6881.feature.rst deleted file mode 100644 index d75f12c1776..00000000000 --- a/changelog/6881.feature.rst +++ /dev/null @@ -1 +0,0 @@ -Added a ``parametrize_long_str_id_strategy`` ini option to control how long ``str``/``bytes`` parameter values are handled in auto-generated test IDs. Explicit IDs set via ``ids=[...]`` or ``pytest.param(..., id=...)`` are not affected. Available strategies: ``short`` (default, values over 100 chars fall back to ``argname+index``), ``sha256`` (SHA-256 hex digest), ``legacy`` (keep full value), and ``disallow`` (error requesting explicit IDs). diff --git a/changelog/6997.bugfix.rst b/changelog/6997.bugfix.rst deleted file mode 100644 index 2364d541fde..00000000000 --- a/changelog/6997.bugfix.rst +++ /dev/null @@ -1,2 +0,0 @@ -XFAIL reports from teardown phases now include the phase in the short test -summary. diff --git a/changelog/7323.deprecation.rst b/changelog/7323.deprecation.rst deleted file mode 100644 index eb9186061d6..00000000000 --- a/changelog/7323.deprecation.rst +++ /dev/null @@ -1 +0,0 @@ -Passing ``bytes`` to ``TerminalReporter.write_line()`` is now deprecated, pass a ``str`` instead. diff --git a/changelog/7940.bugfix.rst b/changelog/7940.bugfix.rst deleted file mode 100644 index 99845153ace..00000000000 --- a/changelog/7940.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed cleanup of temporary directories failing when subdirectories have their execute permission removed. diff --git a/changelog/8321.bugfix.rst b/changelog/8321.bugfix.rst deleted file mode 100644 index 7a91fa6aaba..00000000000 --- a/changelog/8321.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed exception chains being duplicated in the traceback output when an exception in the chain (``__cause__``/``__context__``) has no traceback of its own, and that exception is itself linked to further exceptions. diff --git a/changelog/8593.breaking.rst b/changelog/8593.breaking.rst deleted file mode 100644 index 63a32166cc9..00000000000 --- a/changelog/8593.breaking.rst +++ /dev/null @@ -1,3 +0,0 @@ -The ``indirect``, ``ids`` and ``scope`` arguments of :func:`Metafunc.parametrize() ` -- and therefore of :ref:`@pytest.mark.parametrize ` -- are now keyword-only. - -Passing them positionally was a common source of confusing errors, e.g. ``parametrize("arg1", "arg2", [(1, 2)])`` made the argvalues land in ``indirect`` and failed with ``indirect fixture '(1, 2)' doesn't exist``; such mistakes now fail with an understandable ``TypeError``. The type annotations have always declared these arguments as keyword-only. diff --git a/changelog/8914.bugfix.rst b/changelog/8914.bugfix.rst deleted file mode 100644 index e8bbbe3351a..00000000000 --- a/changelog/8914.bugfix.rst +++ /dev/null @@ -1,12 +0,0 @@ -Tests parametrized with higher-than-function scope are now reordered by -parameter *value* rather than by parameter *index*, so that items using equal -parameter values are grouped together and share a single fixture setup, even -when they are parametrized by separate :ref:`@pytest.mark.parametrize ` -calls. Previously, an expensive higher-scoped fixture could be set up and torn -down repeatedly for the same parameter value. - -Unhashable parameter values (e.g. dicts) keep the previous index-based -grouping behavior. - -As a consequence, the order in which parametrized tests run may change -(fixture setup/teardown counts can only decrease, not increase). diff --git a/changelog/9236.packaging.rst b/changelog/9236.packaging.rst deleted file mode 100644 index 76de357da66..00000000000 --- a/changelog/9236.packaging.rst +++ /dev/null @@ -1,6 +0,0 @@ -``pluggy>=1.6`` is now required. - -Older pluggy versions stopped running the remaining hook wrapper teardowns once an -old-style ``hookwrapper`` raised in its own teardown. The logging plugin's wrapper was -left suspended, and when it was finalised later it detached the handler that -:fixture:`caplog` of a subsequent test was recording through, so that test saw no records. diff --git a/changelog/9436.improvement.rst b/changelog/9436.improvement.rst deleted file mode 100644 index 906edd9775c..00000000000 --- a/changelog/9436.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -Avoided formatting tracebacks for tests marked with ``xfail(run=False)``. diff --git a/changelog/9614.doc.rst b/changelog/9614.doc.rst deleted file mode 100644 index 09dbe12ae33..00000000000 --- a/changelog/9614.doc.rst +++ /dev/null @@ -1 +0,0 @@ -Clarified that ``session.items`` and ``session.testscollected`` exclude deselected tests in the :hook:`pytest_collection` documentation. diff --git a/changelog/9924.bugfix.rst b/changelog/9924.bugfix.rst deleted file mode 100644 index 9e26bc6c5ae..00000000000 --- a/changelog/9924.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed doctest option flags leaking between docstrings after a failure, skip, or expected failure. diff --git a/changelog/993.breaking.rst b/changelog/993.breaking.rst deleted file mode 100644 index 27896af84f1..00000000000 --- a/changelog/993.breaking.rst +++ /dev/null @@ -1,6 +0,0 @@ -Plugin import failures at startup are now reported and classified instead of escaping as a raw traceback with the accidental exit code ``1``: - -* a plugin that cannot be found -- via ``-p``, ``pytest_plugins`` or ``PYTEST_PLUGINS`` -- exits with :class:`pytest.ExitCode` ``USAGE_ERROR`` (``4``), like a ``conftest.py`` that fails to import; -* a plugin that is found but raises while importing -- including a broken ``pytest11`` entry point or a missing plugin dependency -- exits with :class:`pytest.ExitCode` ``INTERNAL_ERROR`` (``3``), with the traceback preserved. - -:func:`pytest.main` now returns these codes instead of raising ``ImportError``. Also fixed an ``IndexError`` from pytest's own internals when the plugin raised an exception with no arguments. diff --git a/doc/en/announce/index.rst b/doc/en/announce/index.rst index fcfb88536c3..3890b68666c 100644 --- a/doc/en/announce/index.rst +++ b/doc/en/announce/index.rst @@ -6,6 +6,7 @@ Release announcements :maxdepth: 2 + release-9.2.0 release-9.1.1 release-9.1.0 release-9.0.3 diff --git a/doc/en/announce/release-9.2.0.rst b/doc/en/announce/release-9.2.0.rst new file mode 100644 index 00000000000..941ade3c635 --- /dev/null +++ b/doc/en/announce/release-9.2.0.rst @@ -0,0 +1,94 @@ +pytest-9.2.0 +======================================= + +The pytest team is proud to announce the 9.2.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: + +* Abdul Samad +* Aditya +* Alex Chen +* Andrew Barnes +* Aria +* Atiqur Rahman +* Bruno Oliveira +* Bryn Lloyd +* Caner +* Chris Burr +* Dane Parin +* Devansh Awatramani +* Dheeraj +* Frank Hoffmann +* Freya Bruhin +* Henry Schreiner +* Ishaan Kapur +* Joosboy +* Kadir Can Ozden +* LaRoyBot +* Lothnic +* Luana Bueno +* Madan kumar +* Marc Mueller +* Marcel Telka +* Michael Foster +* Michael Seifert +* Mike Ma +* Minh Dau +* Oaksprout +* Onkesh Bansal +* Paneendra Kumar +* Philipp Stahlberg +* Pierre Sassoulas +* Poorva Barve +* Raisul Chowdhury +* Ran Benita +* RetroEdit +* Ronny Pfannschmidt +* Scott Huberty +* Sharon +* Shimon Schwartz +* Shriprasad +* Simon Breidenbach +* Sorin Sbarnea +* Syed Faheel Ahmad +* Syncrain +* Toluwalase Akinyemi +* Tom Kuson +* Vladimir Roshchin +* Zac Hatfield-Dodds +* Zhang Xiaomin +* ace2016 +* atiqur rahman +* croc100 +* eternalrights +* hfycium +* lovetheguitar +* marcelomarkus +* paneendrakumar0 +* roqia salah +* sharonyao1127 +* simonbreidenbach +* simukappu +* vismaytiwari +* vyuroshchin +* w-Jessamine +* Кирилл Ветров +* 이강은 +* 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) + + +Happy testing, +The pytest Development Team diff --git a/doc/en/builtin.rst b/doc/en/builtin.rst index 97ea7b426a9..72a3fc796cf 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:560 + cache -- .../_pytest/cacheprovider.py:577 Return a cache object that can persist state between testing sessions. cache.get(key, default) @@ -33,7 +33,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a Values can be any object handled by the json stdlib module. - capsys -- .../_pytest/capture.py:1007 + capsys -- .../_pytest/capture.py:1012 Enable text capturing of writes to ``sys.stdout`` and ``sys.stderr``. The captured output is made available via ``capsys.readouterr()`` method @@ -51,7 +51,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a captured = capsys.readouterr() assert captured.out == "hello\n" - capteesys -- .../_pytest/capture.py:1035 + capteesys -- .../_pytest/capture.py:1040 Enable simultaneous text capturing and pass-through of writes to ``sys.stdout`` and ``sys.stderr`` as defined by ``--capture=``. @@ -74,7 +74,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a captured = capteesys.readouterr() assert captured.out == "hello\n" - capsysbinary -- .../_pytest/capture.py:1070 + capsysbinary -- .../_pytest/capture.py:1075 Enable bytes capturing of writes to ``sys.stdout`` and ``sys.stderr``. The captured output is made available via ``capsysbinary.readouterr()`` @@ -92,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:1098 + capfd -- .../_pytest/capture.py:1103 Enable text capturing of writes to file descriptors ``1`` and ``2``. The captured output is made available via ``capfd.readouterr()`` method @@ -110,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:1126 + capfdbinary -- .../_pytest/capture.py:1131 Enable bytes capturing of writes to file descriptors ``1`` and ``2``. The captured output is made available via ``capfd.readouterr()`` method @@ -128,7 +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" - doctest_namespace [session scope] -- .../_pytest/doctest.py:721 + doctest_namespace [session scope] -- .../_pytest/doctest.py:737 Fixture that returns a :py:class:`dict` that will be injected into the namespace of doctests. @@ -142,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:1564 + pytestconfig [session scope] -- .../_pytest/fixtures.py:1644 Session-scoped fixture that returns the session's :class:`pytest.Config` object. @@ -152,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:275 + record_property -- .../_pytest/junitxml.py:321 Add extra properties to the calling test. User properties become part of the test report and are available to the @@ -166,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:298 + record_xml_attribute -- .../_pytest/junitxml.py:344 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:336 + record_testsuite_property [session scope] -- .../_pytest/junitxml.py:382 Record a new ```` tag as child of the root ````. This is suitable to writing global information regarding the entire test @@ -197,10 +197,10 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a `pytest-xdist `__ plugin. See :issue:`7767` for details. - tmpdir_factory [session scope] -- .../_pytest/legacypath.py:298 + tmpdir_factory [session scope] -- .../_pytest/legacypath.py:297 Return a :class:`pytest.TempdirFactory` instance for the test session. - tmpdir -- .../_pytest/legacypath.py:305 + tmpdir -- .../_pytest/legacypath.py:304 Return a temporary directory (as `legacy_path`_ object) which is unique to each test function invocation. The temporary directory is created as a subdirectory @@ -214,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:611 + caplog -- .../_pytest/logging.py:621 Access and control log capturing. Captured logs are available through the following properties/methods:: @@ -225,7 +225,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a * caplog.record_tuples -> list of (logger_name, level, message) tuples * caplog.clear() -> clear captured records and formatted log output string - monkeypatch -- .../_pytest/monkeypatch.py:36 + monkeypatch -- .../_pytest/monkeypatch.py:35 A convenient fixture for monkey-patching. The fixture provides these methods to modify objects, dictionaries, or @@ -249,7 +249,7 @@ 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:37 + recwarn -- .../_pytest/recwarn.py:36 Return a :class:`WarningsRecorder` instance that records all warnings emitted by test functions. See :ref:`warnings` for information on warning categories. @@ -257,10 +257,10 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a subtests -- .../_pytest/subtests.py:136 Provides subtests functionality. - tmp_path_factory [session scope] -- .../_pytest/tmpdir.py:276 + tmp_path_factory [session scope] -- .../_pytest/tmpdir.py:313 Return a :class:`pytest.TempPathFactory` instance for the test session. - tmp_path -- .../_pytest/tmpdir.py:291 + tmp_path -- .../_pytest/tmpdir.py:328 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 1d1d053e645..eca0069d70b 100644 --- a/doc/en/changelog.rst +++ b/doc/en/changelog.rst @@ -31,6 +31,440 @@ with advance notice in the **Deprecations** section of releases. .. towncrier release notes start +pytest 9.2.0 (2026-10-27) +========================= + +Removals and backward incompatible breaking changes +--------------------------------------------------- + +- `#14716 `_: :option:`-c` now raises a usage error for a path that does not exist, is a directory, or is in a format pytest has no loader for. Such paths were previously either ignored or reported as an unhandled ``FileNotFoundError``. + + +- `#8593 `_: The ``indirect``, ``ids`` and ``scope`` arguments of :func:`Metafunc.parametrize() ` -- and therefore of :ref:`@pytest.mark.parametrize ` -- are now keyword-only. + + Passing them positionally was a common source of confusing errors, e.g. ``parametrize("arg1", "arg2", [(1, 2)])`` made the argvalues land in ``indirect`` and failed with ``indirect fixture '(1, 2)' doesn't exist``; such mistakes now fail with an understandable ``TypeError``. The type annotations have always declared these arguments as keyword-only. + + +- `#993 `_: Plugin import failures at startup are now reported and classified instead of escaping as a raw traceback with the accidental exit code ``1``: + + * a plugin that cannot be found -- via ``-p``, ``pytest_plugins`` or ``PYTEST_PLUGINS`` -- exits with :class:`pytest.ExitCode` ``USAGE_ERROR`` (``4``), like a ``conftest.py`` that fails to import; + * a plugin that is found but raises while importing -- including a broken ``pytest11`` entry point or a missing plugin dependency -- exits with :class:`pytest.ExitCode` ``INTERNAL_ERROR`` (``3``), with the traceback preserved. + + :func:`pytest.main` now returns these codes instead of raising ``ImportError``. Also fixed an ``IndexError`` from pytest's own internals when the plugin raised an exception with no arguments. + + + +Deprecations (removal in next major release) +-------------------------------------------- + +- `#14742 `_: The private ``_pytest.python.CallSpec2`` name has been renamed to ``CallSpec``. + The old ``CallSpec2`` alias remains available for now and will be removed in pytest 10 or 11. + + +- `#14755 `_: Schedule *yield_fixture* decorator for removal in pytest 10 or 11. + + +- `#14774 `_: Similarly to the deprecation of class-scoped fixtures defined as instance methods in pytest 9.1, + *all* higher-scoped fixtures (``module``, ``package``, and ``session``) defined + as instance methods are now deprecated. + + They suffer from the same issue the original deprecation only fixed for + class-scoped fixtures, see :issue:`10819` and :issue:`14011`. + + +- `#14808 `_: Passing a non-string value to a ``string``-typed ini option now emits a ``pytest.PytestRemovedIn10Warning``. This affects ``[tool.pytest.ini_options]`` in ``pyproject.toml``. In pytest 10 this will raise a ``TypeError``, matching the behavior of the corresponding TOML config path. + + +- `#7323 `_: Passing ``bytes`` to ``TerminalReporter.write_line()`` is now deprecated, pass a ``str`` instead. + + + +New features +------------ + +- `#14743 `_: `Full diff:` now contains a legend explaining the `+` & `-` symbols in diff output. + + +- `#2781 `_: When :confval:`strict_markers` is enabled, marker names used in :option:`-m` expressions are now validated against registered markers. + + +- `#6881 `_: Added the :confval:`parametrize_long_str_id_strategy` configuration option to control how long ``str``/``bytes`` parameter values are handled in auto-generated test IDs. Explicit IDs set via ``ids=[...]`` or ``pytest.param(..., id=...)`` are not affected. Available strategies: ``short`` (default, values over 100 chars fall back to ``argname+index``), ``sha256`` (SHA-256 hex digest), ``legacy`` (keep full value), and ``disallow`` (error requesting explicit IDs). + + + +Improvements in existing functionality +-------------------------------------- + +- `#10745 `_: A ``RecursionError`` whose recursion origin cannot be located now shows only the + first and last 10 stack frames, matching what pytest already did when locating + the origin failed outright. Previously the full traceback -- often around a + thousand near-identical frames -- was rendered, which was both slow and + unreadable. Pass ``--full-trace`` to see every frame. + + +- `#10745 `_: The line numbers of a module's statements are now computed once per traceback + instead of once per traceback entry, which noticeably speeds up rendering + failures raised from large test modules. + + +- `#11418 `_: The cached rewritten modules in ``__pycache__`` are now invalidated by a hash of + the source instead of its modification time, using the checked-hash pyc format + from :pep:`552`. + + Timestamps make the cache useless wherever source files get fresh modification + times, most notably in CI: a checkout gives every file a new mtime, so a + restored cache is discarded in full and every test module is rewritten again. + Hashing the source costs roughly 15 microseconds per file and makes the cache + survive that. + + Existing timestamp based caches are ignored and rewritten once. + + +- `#12624 `_: The :globalvar:`pytest_plugins` variable and the :envvar:`PYTEST_PLUGINS` environment variable now also accept entry point names of installed plugins (e.g. ``xdist``), in addition to importable module names, matching the behavior of the :option:`-p` command-line option. + + As part of this change, plugins specified by entry point name through these mechanisms are now also listed in the ``plugins:`` line of the terminal header (:issue:`12615`). + + Based on the original implementation by Marcel Telka in :pr:`12616`. + + +- `#12697 `_: Warnings emitted while importing plugins through :option:`-p`, :envvar:`PYTEST_PLUGINS`, or entry point autoloading are now captured, filtered, and reported like other warnings. + + +- `#12860 `_: Assertion diffs for ``dict.items()`` and ``dict.keys()`` comparisons (``>=``, ``<=``, ``>``, ``<``, ``==``) now show which items are missing, the same way set comparisons do. + + +- `#13354 `_: :meth:`Node.get_closest_marker <_pytest.nodes.Node.get_closest_marker>` now also accepts a :class:`~pytest.MarkDecorator` as its ``default``, for example ``item.get_closest_marker("foo", pytest.mark.foo(1))``, and returns the wrapped :class:`~pytest.Mark`. + + Previously the only way to build a ``default`` was to instantiate :class:`~pytest.Mark` directly, which is private and warns. + + +- `#13369 `_: Improved the error from :meth:`pytest.RunResult.assert_outcomes` when a plugin changes or removes pytest's standard terminal summary, and documented how to isolate output-changing plugins. + + +- `#13431 `_: Exposed :class:`pytest.ParameterSet` as the type of the return value of :func:`pytest.param()`. + This can be used in type annotations and ``isinstance`` checks. + + +- `#13564 `_: Issue a warning when fixtures are wrapped with a decorator that prevents + correct discovery, including ``@classmethod`` above ``@pytest.fixture`` and + ``@staticmethod`` above ``@pytest.fixture``. Put ``@pytest.fixture`` above + those decorators on test classes. + + +- `#14164 `_: Exposed :class:`pytest.Approx` as the type of the return value of :func:`pytest.approx()`. + This can be used in type annotations and ``isinstance`` checks. + + +- `#14463 `_: Assertion diffs for mappings now match up keys the way the compared mappings match them themselves. + + Key comparison goes through the mappings' key views instead of plain sets of their keys, so a mapping + with its own notion of key equivalence, such as case-insensitive header mappings, no longer + reports its common keys as missing on either side. + + +- `#14523 `_: Large assertion comparison diffs are now built lazily and capped to the + truncation budget, so a huge diff is no longer formatted in full just to + be truncated. As a consequence, the truncation footer no longer + reports the exact number of hidden lines. + + +- `#14687 `_: The default fd-level output capturing (``--capture=fd``) now skips reading the capture buffer for tests which produce no output, reducing per-test overhead in large test suites. + + +- `#14724 `_: ``--no-summary`` now only applies directly to pytest's own summary. + + The flag no longer skips the ``pytest_terminal_summary`` hook, so third-party + plugins (for example coverage) can still write their terminal summaries. + + +- `#14751 `_: :func:`parser.addini ` now also accepts type expressions for its ``type`` argument, in addition to the existing string tags: the plain Python types ``str``, ``bool``, ``int``, ``float``, a ``Literal`` of strings, and unions of these (for example ``int | str`` or ``int | Literal["auto"]``). + + +- `#14754 `_: ``pytest.approx()`` now rejects infinite relative tolerances for ``datetime.timedelta`` values with a clear ``ValueError`` instead of raising ``OverflowError``. + + +- `#14791 `_: The :confval:`junit_family`, :confval:`junit_logging`, :confval:`junit_duration_report`, :confval:`console_output_style`, :confval:`empty_parameter_set_mark`, :confval:`assertion_text_diff_style` and :confval:`tmp_path_retention_policy` configuration options are now registered with the set of values they accept: an invalid value now fails with a clean usage error instead of being silently ignored or crashing later, and ``pytest --help`` lists the accepted values. + + :func:`config.getini ` now raises :class:`pytest.UsageError` instead of ``TypeError`` or ``ValueError`` when the value read from the configuration file does not match the registered type, so a bad value is always reported as a short usage error message instead of an internal error traceback. Asking for an option name that was never registered still raises ``ValueError``. + + +- `#15006 `_: :func:`pytest.approx` now emits :class:`pytest.PytestApproxDecimalToleranceWarning` when a ``rel`` or ``abs`` tolerance is given as a :class:`float` that cannot be represented exactly for a :class:`~decimal.Decimal` comparison, since such a tolerance is widened to the float's exact binary value. + + +- `#14675 `_, `#14953 `_, `#15153 `_, `#15132 `_: The :confval:`truncation_limit_lines`, :confval:`truncation_limit_chars`, :confval:`max_warnings`, :confval:`verbosity_assertions`, :confval:`verbosity_test_cases`, :confval:`verbosity_subtests`, :confval:`tmp_path_retention_count`, :confval:`log_level`, :confval:`log_cli_level`, :confval:`log_file_level`,:confval:`log_auto_indent` and :confval:`faulthandler_timeout` configuration options now accept native integer (and, for :confval:`log_auto_indent`, boolean) values in TOML configuration files, while still accepting strings for backward compatibility. + :confval:`log_file_mode` now reports invalid values as a usage error. + + +- `#15254 `_: :fixture:`tmp_path` and :meth:`TempPathFactory.mktemp ` no longer list the whole base temporary directory on every call, which made sessions with many temporary directories quadratically slow. Numbers are now handed out from a per-prefix counter, skipping names that already exist. + + +- `#4569 `_: :meth:`Node.add_marker <_pytest.nodes.Node.add_marker>` now stores a :class:`~pytest.Mark` in ``node.keywords``, matching what marks applied during collection store. Previously it stored a :class:`~pytest.MarkDecorator`. + + +- `#9436 `_: Avoided formatting tracebacks for tests marked with ``xfail(run=False)``. + + + +Bug fixes +--------- + +- `#10128 `_: Configured warning filters now apply to warnings emitted by ``pytest_configure`` hooks. + + +- `#10210 `_: :func:`pytest.approx` now raises a ``TypeError`` for any nested container, not + only for one of the same type as its parent. Previously ``approx([{"k": 1}])`` + and ``approx({"k": [1]})`` were accepted and then compared unequal to every + value, silently ignoring the tolerance, while ``approx([[1]])`` correctly + reported that nesting is unsupported. + + +- `#10644 `_: ``monkeypatch.setattr()`` no longer leaves a new entry in the instance ``__dict__`` when it patches an attribute that the instance inherits from its class. + + Previously ``undo()`` assigned the inherited value onto the instance, which shadowed the class attribute -- permanently freezing the result for descriptors that resolve dynamically. + + +- `#1139 `_: Fixed tracebacks showing ``???`` instead of source lines for code compiled with a filename relative to a directory other than the current working directory -- e.g. compiled Cython modules, when running pytest from a subdirectory of the project root. + The source lookup now falls back to searching ``sys.path`` for such filenames, as the standard :mod:`traceback` module does. + + +- `#11502 `_: The ``rootdir`` is no longer derived from a configuration file that is not a regular file, such as ``--config-file=/dev/null``. + + +- `#11783 `_: Plugins installed in editable mode (:pep:`660`) are marked for assertion rewriting again. + + Such installs do not record the package's Python files in the distribution metadata, so pytest found nothing to rewrite and assertions inside the plugin lost their introspection. The plugin's entry point is now used to locate the package in that case. + + +- `#11933 `_: :func:`pytest.warns` no longer re-emits unmatched warnings with ``module="warnings"``, which caused ``module``-based warning filters to be applied to the wrong warnings. Since :class:`warnings.WarningMessage` does not record the module a warning was emitted with, re-emitted warnings now use the standard :func:`warnings.warn_explicit` default of deriving the module from the warning's filename. + + +- `#12175 `_: :meth:`ExceptionInfo.exconly(tryshort=True) ` now strips the ``AssertionError:`` prefix of failed ``assert`` statements for :class:`~pytest.ExceptionInfo` objects created by :func:`pytest.raises`, and failures inside :meth:`unittest.TestCase.subTest` report the same short crash line as regular tests. + + +- `#12223 `_: The ``message`` attribute of ```` and ```` elements in :option:`--junitxml` reports is now shortened to whole lines within 500 characters. When something is dropped, it ends with a note pointing to the element text, which still holds the full report. Previously, very verbose assertion output (e.g. with ``-vv``) produced attributes tens of thousands of characters long, which some XML parsers fail on. + + +- `#12307 `_: Fixed truncation of long collections (lists, dicts, sets, etc.) in the "message" part of failed assertions (as in ``assert condition, msg``) when using ``-vv``: the message now uses the same unlimited repr as the rest of the assertion output, instead of eliding collection elements with ``...``. + + +- `#12824 `_: Custom command-line options now fail with a clear error when their implicit + destination conflicts with an existing option, avoiding silent overrides of + built-in options such as :option:`-k`. + + +- `#13292 `_: Fixed a stale rewritten module being used when a test file is modified twice + within the same second without changing its size -- the pyc header could only + record whole-second timestamps. The cache is now keyed on a hash of the source. + + +- `#14036 `_: ``__tracebackhide__`` is now respected in ``ExceptionGroup`` tracebacks, both for the group itself and for its sub-exceptions. + + +- `#14189 `_: Nested usage of :meth:`caplog.filtering ` no longer removes filters early if they were already present. + + +- `#14412 `_: Fixed incorrect timing information for subtests and parent tests when ``console_output_style = "times"``. + + +- `#14445 `_: Assertion rewriting no longer evaluates walrus operator (``:=``) expressions more than once, which reported results the test never computed when the expression had side effects. + + An operand evaluated before a later walrus is now reported with the value it actually saw, so ``assert value != identity(value := value.lower())`` keeps Python's left-to-right order. + + +- `#14552 `_: Fixed stale ``co_filename`` values after a test module or directory is moved. Assertion-rewrite caches are reused when the source hash still matches, and in-memory code objects are pointed at the current path. + + +- `#14586 `_: Negative values passed to :confval:`log_auto_indent` now correctly fall back to no indentation, matching the documented behavior. + + +- `#14619 `_: Fixed a crash in ``pytest.mark.parametrize`` when a non-sequence value is passed for a parameter set. It now provides a clear error message during collection. + + +- `#14635 `_: Fixed fixture resolution failures when specifying multiple test paths on the command line that share common parent directories. Parametrized fixtures defined in a ``conftest.py`` could be silently dropped depending on the order of the specified paths. + + +- `#14637 `_: Pytest now correctly skips identical trailing characters in assertion text diffs even when the compared strings differ at the beginning. + + +- `#14638 `_: Top-level options in ``pytest.toml`` and ``.pytest.toml`` files now raise an error instead of being silently ignored when no ``[pytest]`` table is present. + + +- `#14683 `_: Fixed a regression in pytest 9.1 where a conftest.py located in the rootdir was no longer visible to tests and doctests collected from *outside* the rootdir (for example when passing a parent directory of the rootdir as a collection argument, or setting ``--rootdir`` to a subdirectory). + + As a result, fixtures defined in such a conftest -- including :fixture:`doctest_namespace` injections -- were not available, causing errors such as ``NameError`` in doctests. + + +- `#14700 `_: Fixed an internal error on Python 3.12 when a doctest on a fixture-decorated function was skipped. + + +- `#14705 `_: TOML configuration files passed via :option:`-c` now also read their configuration from the ``[pytest]`` table, the one pytest's own configuration files use. The ``[tool.pytest]`` and ``[tool.pytest.ini_options]`` tables such files were previously restricted to keep working; using both styles in one file is an error. + + +- `#14828 `_: Exception groups raised from another exception now print their cause chain only once in the traceback output. + + +- `#14864 `_: Fixed collection on Windows collecting the whole suite instead of the given path, on file systems which do not support file IDs (``st_ino`` is ``0`` for every file, as seen for example on ``sshfs-win``/WinFsp mounts). + + +- `#14884 `_: ``Cache.get()``, ``Cache.set()`` and ``Cache.mkdir()`` now reject keys that resolve outside the cache directory, and ``--cache-show`` ignores glob matches outside it. + + +- `#14909 `_: Fixed :meth:`MonkeyPatch.delattr `, :meth:`MonkeyPatch.setitem ` and :meth:`MonkeyPatch.delitem ` recording a stale undo entry when the underlying mutation failed, which could cause spurious errors during teardown. The undo entry is now recorded only after the mutation succeeds, matching the behavior of :meth:`MonkeyPatch.setattr `. + + +- `#14912 `_: :class:`~pytest.PytestWarning` instances defined in ``_pytest.deprecated`` are no longer reused across ``warnings.warn`` calls, so warnings raised as errors (e.g. with ``-W error``) no longer accumulate stale traceback frames from previous raises. + + +- `#14942 `_: Fixed a regression in 9.1.0 that made collection very slow (quadratic) when many fixtures are defined with the same name. + This can happen particularly when many tests are defined in separate classes which inherit from a base class which defines fixtures (the fixtures are repeated per class). + + +- `#15005 `_: :func:`pytest.approx` no longer treats finite :class:`~decimal.Decimal` values outside the :class:`float` range (such as ``Decimal("1e400")``) as infinite, which made in-tolerance comparisons fail. + + +- `#15006 `_: Restored the tolerance shown by :func:`pytest.approx` for :class:`~decimal.Decimal` values, which since 9.0 displayed ``???`` for the default tolerance and reported the raw ``rel`` ratio instead of the absolute tolerance actually compared against. + + +- `#15006 `_: The failure message for :func:`pytest.approx` comparisons of :class:`~decimal.Decimal` collections no longer reports ``Max absolute difference: -inf``, or crashes for mappings, when the :class:`decimal.FloatOperation` trap is set. + + +- `#15006 `_: :func:`pytest.approx` no longer raises ``AttributeError`` when comparing :class:`numpy.ndarray` instances with ``object`` dtype, such as arrays of :class:`~decimal.Decimal`. + + +- `#15032 `_: Help texts for command-line options and configuration options now keep their indentation + and blank lines. Previously each line was stripped before wrapping, so a wrapped + list item was indistinguishable from a new one and blank lines were dropped; configuration + option help lost its line breaks entirely. + + +- `#15043 `_: Cache writes now emit :class:`pytest.PytestCacheWarning` when writing or closing the cache file fails, consistent with errors opening the file. + + +- `#15052 `_: Fixed possible off-by-one line numbers in :option:`--fixtures` and :option:`--fixtures-per-test` output. + + +- `#15145 `_: With :confval:`console_output_style` set to ``times``, durations just below a unit boundary are now shown in the next unit (e.g. ``1.000ms`` instead of ``1000.0us``). + + +- `#15172 `_: Assertion diffs now pretty-print the built-in :class:`frozendict` (Python 3.15+) across multiple lines, similarly to how :class:`dict` is displayed. + + +- `#4569 `_: :option:`-k` no longer matches attributes that end up in a test function's ``__dict__`` without being meant as keywords, such as pytest's own ``pytestmark`` attribute and the bookkeeping left behind by :func:`functools.wraps` and :func:`functools.lru_cache`. + + +- `#6750 `_: Fix fixture argument discovery for custom collectors that pass bound methods to :class:`pytest.Function`. + + +- `#6997 `_: XFAIL reports from teardown phases now include the phase in the short test + summary. + + +- `#7940 `_: Fixed cleanup of temporary directories failing when subdirectories have their execute permission removed. + + +- `#8321 `_: Fixed exception chains being duplicated in the traceback output when an exception in the chain (``__cause__``/``__context__``) has no traceback of its own, and that exception is itself linked to further exceptions. + + +- `#8914 `_: Tests parametrized with higher-than-function scope are now reordered by + parameter *value* rather than by parameter *index*, so that items using equal + parameter values are grouped together and share a single fixture setup, even + when they are parametrized by separate :ref:`@pytest.mark.parametrize ` + calls. Previously, an expensive higher-scoped fixture could be set up and torn + down repeatedly for the same parameter value. + + Unhashable parameter values (e.g. dicts) keep the previous index-based + grouping behavior. + + As a consequence, the order in which parametrized tests run may change + (fixture setup/teardown counts can only decrease, not increase). + + +- `#9924 `_: Fixed doctest option flags leaking between docstrings after a failure, skip, or expected failure. + + + +Improved documentation +---------------------- + +- `#10721 `_: Replaced ``setup.py`` usage with ``pyproject.toml`` in :ref:`writing-plugins`. + + +- `#12658 `_: Moved the fixture setup and finalizer hooks to the test running hooks section in the reference documentation. + + +- `#12857 `_: Documented how :option:`--confcutdir` affects initial ``conftest.py`` discovery. + + +- `#14157 `_: Added the ``pytest-flakefighters`` plugin to the list of flaky test plugins in ``plugins.rst``. + Added flaky test papers published on the `Test FLARE `__ project to the list of flaky papers in ``plugins.rst``. + + +- `#15127 `_: Added guidance on typing yield fixtures, including annotating fixture functions with their generator type and fixture consumers with the yielded value type. + + +- `#15242 `_: The :ref:`installation instructions ` and :ref:`install-package-with-pip` now show how to install pytest into a virtual environment with venv and pip, uv or virtualenv, and explain the ``externally-managed-environment`` error. + + +- `#4569 `_: ``pytest --help``, the :option:`-k` reference entry and :ref:`select-tests` no longer describe :option:`-k` as a Python expression matched against test names only; :ref:`keyword expressions` now shows marker names being matched as well. The examples that looked up a marker use :meth:`Node.get_closest_marker <_pytest.nodes.Node.get_closest_marker>` rather than ``item.keywords``. + + +- `#9614 `_: Clarified that ``session.items`` and ``session.testscollected`` exclude deselected tests in the :hook:`pytest_collection` documentation. + + + +Packaging updates and notes for downstreams +------------------------------------------- + +- `#11680 `_: Source archives of arbitrary commits -- the tarballs GitHub serves under + ``/archive/``, not just the ones for tags -- can now be built into an sdist or a + wheel with a correct version. A ``.git_archival.txt`` file, expanded by ``git + archive`` via ``export-subst``, carries the describe output that + ``setuptools-scm`` would otherwise have to ask ``git`` for. + + The archival file deliberately omits ``ref-names``. Recording it would make the + content of an archive -- and therefore its checksum -- change whenever a branch + that points at the archived commit is moved afterwards, which is how the + equivalent tarballs of tagged releases became unstable for other projects. + Describe output alone depends only on the commit and on the tags reachable from + it. + + The archival file is not shipped in the sdist -- an sdist carries its version + in its metadata, and the template is only ever expanded by ``git archive``. + + Building pytest from a git checkout now requires ``setuptools-scm >= 10.1``. + + +- `#9236 `_: ``pluggy>=1.6`` is now required. + + Older pluggy versions stopped running the remaining hook wrapper teardowns once an + old-style ``hookwrapper`` raised in its own teardown. The logging plugin's wrapper was + left suspended, and when it was finalised later it detached the handler that + :fixture:`caplog` of a subsequent test was recording through, so that test saw no records. + + + +Contributor-facing changes +-------------------------- + +- `#14813 `_: Added a systematic coverage matrix for assertion rewriting. + + +- `#14921 `_: Added `scripts/diff-assert-rewrite.py`, which diffs the assert-rewritten form of a snippet between the plain source, this checkout and released pytest versions. + + +- `#15190 `_: Fixed the documentation build with Pluggy 1.7 by ignoring a reference to its undocumented ``DistFacade`` compatibility class. + + + +Miscellaneous internal changes +------------------------------ + +- `#13888 `_: :attr:`FixtureRequest.node ` is now explicitly annotated as returning ``Any``, so strict pyright no longer reports it as ``Unknown``. The return type stays deliberately broad, see :issue:`13888`. + + +- `#14758 `_: Internal node ids (the ``::``-separated strings identifying collected items, e.g. ``path/to/test_file.py::TestClass::test_method[param]``) are now represented internally by a single structured :class:`~_pytest.nodeid.NodeId` dataclass instead of being repeatedly re-parsed as plain strings. The public ``nodeid: str`` attribute on nodes and reports is unchanged and remains fully backward compatible for plugins. + + pytest 9.1.1 (2026-06-19) ========================= diff --git a/doc/en/example/parametrize.rst b/doc/en/example/parametrize.rst index f32358ac255..37c0d1761f3 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 - + @@ -513,10 +513,11 @@ Running it results in some skips if we don't have all the python interpreters in .. code-block:: pytest . $ pytest -rs -q multipython.py - ssssssssssss......sss...... [100%] + ssssssssssssssssssssssss... [100%] ========================= short test summary info ========================== - SKIPPED [15] multipython.py:67: 'python3.11' not found - 12 passed, 15 skipped in 0.12s + SKIPPED [12] multipython.py:67: 'python3.11' not found + SKIPPED [12] multipython.py:67: 'python3.12' not found + 3 passed, 24 skipped in 0.12s Parametrization of optional implementations/imports --------------------------------------------------- diff --git a/doc/en/example/pythoncollection.rst b/doc/en/example/pythoncollection.rst index 3dd87a71cb7..101011913bf 100644 --- a/doc/en/example/pythoncollection.rst +++ b/doc/en/example/pythoncollection.rst @@ -142,7 +142,7 @@ The test collection would look like this: configfile: pytest.toml collected 2 items - + @@ -205,7 +205,7 @@ You can always peek at the collection tree without running tests like this: configfile: pytest.toml collected 3 items - + diff --git a/doc/en/example/reportingdemo.rst b/doc/en/example/reportingdemo.rst index 65e99a14a1f..0d404284e31 100644 --- a/doc/en/example/reportingdemo.rst +++ b/doc/en/example/reportingdemo.rst @@ -574,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 0xdeadbeef0002>() + 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) @@ -590,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 @@ -611,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 @@ -622,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: @@ -637,7 +637,7 @@ 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: @@ -656,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 090a81575fa..0dc06f96d2b 100644 --- a/doc/en/example/simple.rst +++ b/doc/en/example/simple.rst @@ -647,7 +647,7 @@ If we run this: test_step.py:11: AssertionError ========================= short test summary info ========================== - XFAIL test_step.py::TestUserHandling::test_deletion - previous test failed (test_modification) + XFAIL at setup of 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`` diff --git a/doc/en/getting-started.rst b/doc/en/getting-started.rst index 519f769fbb9..9013c18c93e 100644 --- a/doc/en/getting-started.rst +++ b/doc/en/getting-started.rst @@ -56,7 +56,7 @@ of your operating system (see :ref:`install-package-with-pip`). .. code-block:: bash $ pytest --version - pytest 9.1.1 + pytest 9.2.0 See :ref:`install-package-with-pip` for how to install the project you are testing into the same environment. diff --git a/doc/en/how-to/fixtures.rst b/doc/en/how-to/fixtures.rst index 0ffc0778f9f..d8471c59c53 100644 --- a/doc/en/how-to/fixtures.rst +++ b/doc/en/how-to/fixtures.rst @@ -1425,7 +1425,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 5d129089a63..7ea5091fe34 100644 --- a/doc/en/how-to/output.rst +++ b/doc/en/how-to/output.rst @@ -167,7 +167,7 @@ Now we can increase pytest's verbosity: E E At index 2 diff: 'grapes' != 'orange' E - E Full diff: + E Full diff: (-: missing in left side, +: extra in left side) E [ E 'banana', E 'apple',... @@ -239,7 +239,7 @@ Now if we increase verbosity even more: E E At index 2 diff: 'grapes' != 'orange' E - E Full diff: + E Full diff: (-: missing in left side, +: extra in left side) E [ E 'banana', E 'apple', @@ -267,7 +267,7 @@ Now if we increase verbosity even more: E Right contains 4 more items: E {'10': 10, '20': 20, '30': 30, '40': 40} E - E Full diff: + E Full diff: (-: missing in left side, +: extra in left side) E { E '0': 0, E - '10': 10, @@ -298,7 +298,7 @@ Now if we increase verbosity even more: At index 2 diff: 'grapes' != 'orange' - Full diff: + Full diff: (-: missing in left side, +: extra in left side) [ 'banana', 'apple', @@ -318,7 +318,7 @@ Now if we increase verbosity even more: Right contains 4 more items: {'10': 10, '20': 20, '30': 30, '40': 40} - Full diff: + Full diff: (-: missing in left side, +: extra in left side) { '0': 0, - '10': 10, diff --git a/doc/en/reference/reference.rst b/doc/en/reference/reference.rst index 87abcc5f74d..b524a2395a1 100644 --- a/doc/en/reference/reference.rst +++ b/doc/en/reference/reference.rst @@ -3479,19 +3479,20 @@ All the command-line flags can also be obtained by running ``pytest --help``:: file_or_dir general: - -k EXPRESSION Only run tests matching the given keyword expression, - e.g. -k 'test_method or test_other', -k 'not (slow or - network)'. - Names in the expression are matched case-insensitively - as substrings of the test's keywords, which are: + -k EXPRESSION Only run tests matching the given keyword + expression, e.g. -k 'test_method or test_other', -k + 'not (slow or network)'. + Names in the expression are matched + case-insensitively as substrings of the test's + keywords, which are: - its own name, including any parametrization id - the names of its class, module and directories - the names of the markers applied to it or to its parents - attributes assigned directly to the test function - any names in its 'extra_keyword_matches' set - Use -m to match marker names exactly, including their - arguments. + Use -m to match marker names exactly, including + their arguments. -m MARKEXPR Only run tests matching given mark expression. For example: -m 'mark1 and not mark2'. --markers show markers (builtin, plugin and per-project ones). @@ -3595,8 +3596,8 @@ All the command-line flags can also be obtained by running ``pytest --help``:: --collect-only, --co Only collect tests, don't execute them --pyargs Try to interpret all arguments as Python packages --ignore=path Ignore path during collection (multi-allowed) - --ignore-glob=path Ignore path pattern during collection (multi- - allowed) + --ignore-glob=path Ignore path pattern during collection + (multi-allowed) --deselect=nodeid_prefix Deselect item (via node id prefix) during collection (multi-allowed) @@ -3740,6 +3741,15 @@ All the command-line flags can also be obtained by running ``pytest --help``:: strict_parametrization_ids (bool): Emit an error if non-unique parameter set IDs are detected + parametrize_long_str_id_strategy ('short' | 'sha256' | 'legacy' | 'disallow'): + strategy for long str/bytes parameter values in + auto-generated ids + - short (default): values over 100 chars fall back + to argname+index + - sha256: replace value with its sha256 hex digest + - legacy: keep the full value (for temporary + backward compatibility) + - disallow: raise an error requesting explicit ids console_output_style ('classic' | 'progress' | 'count' | 'times' | 'progress-even-when-capture-no'): Console output: "classic", or with additional progress information ("progress" (percentage) |