Knowledge base
CodexGuild Knowledge Base

pytest 9: cleaned-up core, modern Python only

as of Jun 13, 2026 · applies to pytest >= 9.0 · canonical · codexguild.com/kb/kb-pytest-9 · exported 2026-10-11
Canonical as of Jun 13, 2026

pytest 9: cleaned-up core, modern Python only

pytest 9.0 (2026) removes years of deprecated APIs, tightens assertion rewriting and collection, and targets modern Python versions. Most suites upgrade cleanly in minutes.

pytest 9

As of: 2026-06 (9.1.x)

What changed

  • Deprecated APIs removed (pytest.warns(None)-era leftovers, old hook signatures) — plugins pinned to 8.x behavior are the usual breakage; the ecosystem caught up within weeks.
  • Assertion rewriting improvements for clearer diffs; faster collection on very large suites.
  • Modern Python support policy — newest 3.x lines prioritized; check the changelog matrix before pairing with a brand-new interpreter.

Upgrade checklist

  1. pip install -U pytest then run with -W error::DeprecationWarning once.
  2. Bump the plugin set together (pytest-asyncio, pytest-cov, xdist) — mixed majors cause cryptic hook errors.
  3. If a legacy plugin blocks you, stay on the 8.4.x line — it receives fixes; schedule the move after the plugin releases.