# pytest 8.4.2 - Product: pytest (https://whatsnew.fyi/product/pytest) - Vendor: pytest - Date: 2025-09-04 - Version: 8.4.2 - Original notes: https://github.com/pytest-dev/pytest/releases/tag/8.4.2 - Permalink: https://whatsnew.fyi/product/pytest/releases/8.4.2 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'. --- - **fixed** — Fixed a crash when using console_output_style with times and a module is skipped - **fixed** — Fixed a crash when using pytest.approx and decimal.Decimal instances with the decimal.FloatOperation trap set - **fixed** — No longer evaluate type annotations in Python 3.14 when inspecting function signatures to prevent crashes during module collection - **changed** — Added missing int and float variants to the Literal type annotation of the type parameter in pytest.Parser.addini - **fixed** — pytest.approx now only imports numpy if NumPy is already in sys.modules #### pytest 8.4.2 (2025-09-03) ##### Bug fixes - [#13478](https://github.com/pytest-dev/pytest/issues/13478): Fixed a crash when using `console_output_style`{.interpreted-text role="confval"} with `times` and a module is skipped. - [#13530](https://github.com/pytest-dev/pytest/issues/13530): Fixed a crash when using `pytest.approx`{.interpreted-text role="func"} and `decimal.Decimal`{.interpreted-text role="class"} instances with the `decimal.FloatOperation`{.interpreted-text role="class"} trap set. - [#13549](https://github.com/pytest-dev/pytest/issues/13549): No longer evaluate type annotations in Python `3.14` when inspecting function signatures. This prevents crashes during module collection when modules do not explicitly use `from __future__ import annotations` and import types for annotations within a `if TYPE_CHECKING:` block. - [#13559](https://github.com/pytest-dev/pytest/issues/13559): Added missing [int]{.title-ref} and [float]{.title-ref} variants to the [Literal]{.title-ref} type annotation of the [type]{.title-ref} parameter in `pytest.Parser.addini`{.interpreted-text role="meth"}. - [#13563](https://github.com/pytest-dev/pytest/issues/13563): `pytest.approx`{.interpreted-text role="func"} now only imports `numpy` if NumPy is already in `sys.modules`. This fixes unconditional import behavior introduced in [8.4.0]{.title-ref}. ##### Improved documentation - [#13577](https://github.com/pytest-dev/pytest/issues/13577): Clarify that `pytest_generate_tests` is discovered in test modules/classes; other hooks must be in `conftest.py` or plugins. ##### Contributor-facing changes - [#13480](https://github.com/pytest-dev/pytest/issues/13480): Self-testing: fixed a few test failures when run with `-Wdefault` or a similar override. - [#13547](https://github.com/pytest-dev/pytest/issues/13547): Self-testing: corrected expected message for `test_doctest_unexpected_exception` in Python `3.14`. - [#13684](https://github.com/pytest-dev/pytest/issues/13684): Make pytest\'s own testsuite insensitive to the presence of the `CI` environment variable \-- by `ogrisel`{.interpreted-text role="user"}.