# pytest 9.0.0 - Product: pytest (https://whatsnew.fyi/product/pytest) - Vendor: pytest - Date: 2025-11-08 - Version: 9.0.0 - Original notes: https://github.com/pytest-dev/pytest/releases/tag/9.0.0 - Permalink: https://whatsnew.fyi/product/pytest/releases/9.0.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:** `--strict` (inferred by a model) - **Behavior changed:** `$CI` (from the vendor's breaking-changes section) - **Requirement raised:** `Python 3.9` → `3.10` (from the vendor's breaking-changes section) - **Behavior changed:** `PytestRemovedIn9Warning` (from the vendor's breaking-changes section) - **Behavior changed:** `--version` (inferred by a model) - **Behavior changed:** `pytester.plugins` (inferred by a model) - **Behavior changed:** `pytest x.py[a]` (inferred by a model) - **Behavior changed:** `pytest a/ a/b` → `pytest a` (from the vendor's breaking-changes section) - **Requirement raised:** `iniconfig` → `1.0.1` (inferred by a model) - **Requirement raised:** `packaging` → `22.0.0` (inferred by a model) - **Deprecated:** `monkeypatch.syspath_prepend()` → `native namespace packages` (from the vendor's deprecations section) - **added** — Support for subtests has been added as an alternative to parametrization, useful when parametrization values are not all known at collection time - **added** — Added support for native TOML configuration files in pyproject.toml under the [tool.pytest] table, as well as pytest.toml or .pytest.toml files - **added** — Added a strict mode enabled by the strict configuration option that enables strict_config, strict_markers, strict_parametrization_ids, and strict_xfail - **added** — Added the strict_parametrization_ids configuration option to emit an error if non-unique parameter set IDs are detected - **added** — Added support for displaying test session progress in the terminal tab using the OSC 9;4; ANSI sequence - **added** — Support PEP420 implicit namespace packages as --pyargs target when consider_namespace_packages is true in the config - **added** — Added a new faulthandler_exit_on_timeout configuration option set to false by default to let faulthandler interrupt the pytest process after a timeout in case of deadlock - **added** — Added support for configuration option aliases via the aliases parameter in Parser.addini() - **changed** — The previously-deprecated --strict command-line flag now enables strict mode - **changed** — unittest.TestCase.subTest is now also supported #### pytest 9.0.0 (2025-11-05) ##### New features - [\#1367](https://github.com/pytest-dev/pytest/issues/1367): **Support for subtests** has been added. `subtests ` are an alternative to parametrization, useful in situations where the parametrization values are not all known at collection time. Example: ``` python def contains_docstring(p: Path) -> bool: """Return True if the given Python file contains a top-level docstring.""" ... def test_py_files_contain_docstring(subtests: pytest.Subtests) -> None: for path in Path.cwd().glob("*.py"): with subtests.test(path=str(path)): assert contains_docstring(path) ``` Each assert failure or error is caught by the context manager and reported individually, giving a clear picture of all files that are missing a docstring. In addition, `unittest.TestCase.subTest` is now also supported. This feature was originally implemented as a separate plugin in [pytest-subtests](https://github.com/pytest-dev/pytest-subtests), but since then has been merged into the core. > [!NOTE] > This feature is experimental and will likely evolve in future releases. By that we mean that we might change how subtests are reported on failure, but the functionality and how to use it are stable. - [\#13743](https://github.com/pytest-dev/pytest/issues/13743): Added support for **native TOML configuration files**. While pytest, since version 6, supports configuration in `pyproject.toml` files under `[tool.pytest.ini_options]`, it does so in an "INI compatibility mode", where all configuration values are treated as strings or list of strings. Now, pytest supports the native TOML data model. In `pyproject.toml`, the native TOML configuration is under the `[tool.pytest]` table. ``` toml # pyproject.toml [tool.pytest] minversion = "9.0" addopts = ["-ra", "-q"] testpaths = [ "tests", "integration", ] ``` The `[tool.pytest.ini_options]` table remains supported, but both tables cannot be used at the same time. If you prefer to use a separate configuration file, or don't use `pyproject.toml`, you can use `pytest.toml` or `.pytest.toml`: ``` toml # pytest.toml or .pytest.toml [pytest] minversion = "9.0" addopts = ["-ra", "-q"] testpaths = [ "tests", "integration", ] ``` The documentation now (sometimes) shows configuration snippets in both TOML and INI formats, in a tabbed interface. See `config file formats` for full details. - [\#13823](https://github.com/pytest-dev/pytest/issues/13823): Added a **"strict mode"** enabled by the `strict` configuration option. When set to `true`, the `strict` option currently enables - `strict_config` - `strict_markers` - `strict_parametrization_ids` - `strict_xfail` The individual strictness options can be explicitly set to override the global `strict` setting. The previously-deprecated `--strict` command-line flag now enables strict mode. If pytest adds new strictness options in the future, they will also be enabled in strict mode. Therefore, you should only enable strict mode if you use a pinned/locked version of pytest, or if you want to proactively adopt new strictness options as they are added. See `strict mode` for more details. - [\#13737](https://github.com/pytest-dev/pytest/issues/13737): Added the `strict_parametrization_ids` configuration option. When set, pytest emits an error if it detects non-unique parameter set IDs, rather than automatically making the IDs unique by adding 0, 1, ... to them. This can be particularly useful for catching unintended duplicates. - [\#13072](https://github.com/pytest-dev/pytest/issues/13072): Added support for displaying test session **progress in the terminal tab** using the [OSC 9;4;](https://conemu.github.io/en/AnsiEscapeCodes.html#ConEmu_specific_OSC) ANSI sequence. When pytest runs i _[Truncated at 4000 characters — full notes: https://github.com/pytest-dev/pytest/releases/tag/9.0.0]_