Sourced from pytest's releases.
9.1.0
pytest 9.1.0 (2026-06-13)
Removals and backward incompatible breaking changes
#14533: When using
--doctest-modules, autouse fixtures withmodule,packageorsessionscope that are defined inline in Python test modules (not plugins or conftests) will now possibly execute twice.If this is undesirable, move the fixture definition to a
conftest.pyfile if possible.Technical explanation for those interested: When using --doctest-modules, pytest possibly collects Python modules twice, once as
pytest.Moduleand once as aDoctestModule(depending on the configuration). Due to improvements in pytest's fixture implementation, if e.g. theDoctestModulecollects a fixture, it is now visible to it only, and not to theModule. This means that both need to register the fixtures independently.Deprecations (removal in next major release)
#10819: Added a deprecation warning for class-scoped fixtures defined as instance methods (without
@classmethod). Such fixtures set attributes on a different instance than the test methods use, leading to unexpected behavior. Use@classmethoddecorator instead -- byyastcher.See
10819and14011.#12882: Calling
request.getfixturevalue() <pytest.FixtureRequest.getfixturevalue>during teardown to request a fixture that was not already requested is now deprecated and will become an error in pytest 10.See
dynamic-fixture-request-during-teardownfor details.#13409: Using non-
~collections.abc.Collectioniterables (such as generators, iterators, or custom iterable objects) for theargvaluesparameter in@pytest.mark.parametrize <pytest.mark.parametrize ref>andmetafunc.parametrize <pytest.Metafunc.parametrize>is now deprecated.These iterables get exhausted after the first iteration, leading to tests getting unexpectedly skipped in cases such as running
pytest.main()multiple times, using class-level parametrize decorators, or collecting tests multiple times.See
parametrize-iteratorsfor details and suggestions.#13946: The private
config.inicfgattribute is now deprecated. Useconfig.getini() <pytest.Config.getini>to access configuration values instead.See
config-inicfgfor more details.#14004: Passing
baseidto~pytest.FixtureDefornodeidstrings to fixture registration APIs is now deprecated. These are internal pytest APIs that are used by some plugins.Use the
nodeparameter instead for fixture scoping. This enables more robust node-based matching instead of string prefix matching. If you've usednodeid=None, passnode=sessioninstead.This will be removed in pytest 10.
#14335: The method of configuring hooks using markers, deprecated since pytest 7.2, is now scheduled to be removed in pytest 10. See
hook-markersfor more details.#14434: The
--pastebinoption is now deprecated.
... (truncated)
b2522cf
Prepare release version 9.1.0368d2fc
[refactor] Tighten SetComparisonFunction to
Iterator[str] (#14587)ff77cd8
[refactor] Make base assertion comparisons return an iterator instead of
a li...0d8491a
build(deps): Bump actions/stale from 10.2.0 to 10.3.04a809d9
Merge pull request #14568
from pytest-dev/register-fixture5dfa385
Fix recursion traceback test to cover all styles (#14582)f52ff0c
Add pytest.register_fixturea8ac094
Merge pull request #14567
from pytest-dev/more-visibility-deprecatee5620cd
[pre-commit.ci] pre-commit autoupdate (#14577)2ce9c6d
Merge pull request #14540
from minbang930/fix-14533-doctest-module-fixtures