# pytest 9.1.0 - Product: pytest (https://whatsnew.fyi/product/pytest) - Vendor: pytest - Date: 2026-06-13 - Version: 9.1.0 - Original notes: https://github.com/pytest-dev/pytest/releases/tag/9.1.0 - Permalink: https://whatsnew.fyi/product/pytest/releases/9.1.0 What's New is an index, not a publisher: every entry below links to the vendor's own release notes, which are the authoritative source. Entries are labelled where they are hand-curated sample data, pre-releases, or drawn from a secondary source such as a developer blog. Reuse: release facts (products, versions, dates, links, CVE ids and flags) are open data under CC BY 4.0, from the API at https://whatsnew.fyi/api/v1 or the nightly dataset at https://github.com/whatsnew-fyi/dataset. The summaries, labels and curation are © What's New: quote freely with attribution and a link back; wholesale republication of them is not permitted — terms: https://whatsnew.fyi/terms. The vendors' own release notes remain their publishers'. --- Changes to check: - **Behavior changed:** `--doctest-modules` (from the vendor's breaking-changes section) - **Deprecated:** `request.getfixturevalue()` (from the vendor's deprecations section) - **Deprecated:** `config.inicfg` → `config.getini()` (from the vendor's deprecations section) - **Deprecated:** `baseid` → `node` (from the vendor's deprecations section) - **Deprecated:** `--pastebin` → `pytest-pastebin` (from the vendor's deprecations section) - **Deprecated:** `pytest.console_main` → `pytest.main` (from the vendor's deprecations section) - **Deprecated:** `FixtureDef.has_location` (from the vendor's deprecations section) - **Behavior changed:** `pytest_exception_interact` (inferred by a model) - **Behavior changed:** `@pytest.mark.parametrize` (inferred by a model) - **removed** — When using --doctest-modules, autouse fixtures with module, package or session scope that are defined inline in Python test modules will now possibly execute twice - **deprecated** — Class-scoped fixtures defined as instance methods without @classmethod decorator are now deprecated - **deprecated** — Calling request.getfixturevalue() during teardown to request a fixture that was not already requested is now deprecated - **deprecated** — Using non-Collection iterables such as generators, iterators, or custom iterable objects for the argvalues parameter in @pytest.mark.parametrize and metafunc.parametrize is now deprecated - **deprecated** — The private config.inicfg attribute is now deprecated, use config.getini() instead - **deprecated** — Passing baseid to FixtureDef or nodeid strings to fixture registration APIs is now deprecated, use the node parameter instead - **deprecated** — The method of configuring hooks using markers is now scheduled to be removed in pytest 10 - **deprecated** — The --pastebin option is now deprecated - **deprecated** — The private FixtureDef.has_location attribute is now deprecated - **deprecated** — pytest.console_main is now deprecated, use pytest.main instead - **added** — Added pytest.register_fixture() to register fixtures using an imperative interface - **added** — Added --report-chars long CLI option - **added** — Added --max-warnings command-line option and max_warnings configuration option to fail the test run when the number of warnings exceeds a given threshold - **added** — Added the assertion_text_diff_style configuration option for rendering string equality failures as separate Left: and Right: blocks instead of ndiff output - **added** — Added support for datetime and timedelta comparisons with pytest.approx - **changed** — pytest.warns now shows "Regex pattern did not match" instead of "DID NOT WARN" when warnings were emitted but the match pattern did not match - **changed** — Improved output of --fixtures-per-test by excluding internal-implementation fixtures generated by @pytest.mark.parametrize and similar #### pytest 9.1.0 (2026-06-13) ##### Removals and backward incompatible breaking changes - [\#14533](https://github.com/pytest-dev/pytest/issues/14533): When using `--doctest-modules`, autouse fixtures with `module`, `package` or `session` scope 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.py` file if possible. Technical explanation for those interested: When using --doctest-modules, pytest possibly collects Python modules twice, once as `pytest.Module` and once as a `DoctestModule` (depending on the configuration). Due to improvements in pytest's fixture implementation, if e.g. the `DoctestModule` collects a fixture, it is now visible to it only, and not to the `Module`. This means that both need to register the fixtures independently. ##### Deprecations (removal in next major release) - [\#10819](https://github.com/pytest-dev/pytest/issues/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 `@classmethod` decorator instead -- by `yastcher`. See `10819` and `14011`. - [\#12882](https://github.com/pytest-dev/pytest/issues/12882): Calling `request.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-teardown` for details. - [\#13409](https://github.com/pytest-dev/pytest/issues/13409): Using non-`~collections.abc.Collection` iterables (such as generators, iterators, or custom iterable objects) for the `argvalues` parameter in `@pytest.mark.parametrize ` and `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-iterators` for details and suggestions. - [\#13946](https://github.com/pytest-dev/pytest/issues/13946): The private `config.inicfg` attribute is now deprecated. Use `config.getini() ` to access configuration values instead. See `config-inicfg` for more details. - [\#14004](https://github.com/pytest-dev/pytest/issues/14004): Passing `baseid` to `~pytest.FixtureDef` or `nodeid` strings to fixture registration APIs is now deprecated. These are internal pytest APIs that are used by some plugins. Use the `node` parameter instead for fixture scoping. This enables more robust node-based matching instead of string prefix matching. If you've used `nodeid=None`, pass `node=session` instead. This will be removed in pytest 10. - [\#14335](https://github.com/pytest-dev/pytest/issues/14335): The method of configuring hooks using markers, deprecated since pytest 7.2, is now scheduled to be removed in pytest 10. See `hook-markers` for more details. - [\#14434](https://github.com/pytest-dev/pytest/issues/14434): The `--pastebin` option is now deprecated. The same functionality is now available in an external plugin, `pytest-pastebin`. See `pastebin-deprecated` for more details. - [\#14513](https://github.com/pytest-dev/pytest/issues/14513): The private `FixtureDef.has_location` attribute is now deprecated and will be removed in pytest 10. See `fixturedef-has-location-deprecated` for details. - [\#1764](https://github.com/pytest-dev/pytest/issues/1764): `pytest.console_main` is now deprecated and will be removed in pytest 10. It was never intended for programmatic use; use `pytest.main` instead. ##### New features - [\#12376](https://github.com/pytest-dev/py _[Truncated at 4000 characters — full notes: https://github.com/pytest-dev/pytest/releases/tag/9.1.0]_