Guides¶
Task-oriented how-tos. Start with the one that matches what you are doing.
Migrating¶
- Migrating from pytest: what changes when you switch, and how to fall back
- Upgrading to pytest 9: rstest vendors pytest 9.2.0; how to get a suite written for older pytest green on it
- Migrating from pytest-xdist: flag map, differences, and the CPU-bound case
Running tests well¶
- Parallel safety: rails for tests that can't parallelize, plus worker-count, memory and BLAS-thread sizing
- Suite diagnostics: reading
--doctor - Wait-bound / IO suites: suites dominated by sleeps, network, and timeouts
- Local dev / inner loop: fast edit-run cycles on your machine
- Watch mode: the edit loop
- Debugging a test:
breakpoint()/pdb, attaching VS Code or PyCharm with--debug - Selecting changed tests:
--changedvia import graph or coverage index - Running only what changed since green:
--since-green(diff against the last green commit) and--incremental(skip unchanged green tests, no git) - Flaky tests: reruns, flake history, quarantine, auto-quarantine
- Catching slowdowns: fail CI when a test or the whole suite gets slower
- Resource leaks: detecting and gating tests that leak threads and file descriptors
- Replaying a CI failure locally: re-run a failed CI job's per-worker schedule with
rstest replay - Monorepos: one command across a multi-package repo
- Running on Windows: install, what differs (timeouts, Ctrl+C, no fork pool), validation level and CI tips
CI¶
- CI quickstart: GitHub Actions, Django and monorepo worked examples, doctor trending
- CI output formats:
--outputstyles for CI annotations and machine-readable streams - More CI systems: GitLab CI, Azure Pipelines, CircleCI, Jenkins, Buildkite, AWS CodeBuild, Google Cloud Build, pre-commit
- Shared cache across CI jobs: merging durations, flakes, run history, coverage and the green snapshot across jobs
- Sharding across CI jobs: splitting one suite over N machines with
--shard K/N
Plugins and coverage¶
- Your plugin stack: checking the plugins you depend on before switching
- Plugins: how plugin loading works, what's verified
- Coverage: pytest-cov under parallel workers
Coding agents¶
- Agent skills: install the
migrate-to-rstestandrstest-triageskills for Claude Code, Codex, and other agents