One Word Faster: Parallelizing Your Pytest Suite Without Rewriting a Line
Your pytest suite runs one test at a time. The usual fix: pytest-xdisthelps, but it schedules by file, so one slow file pins one worker, and it's something you have to remember to turn on.
rstest is a pytest-compatible test runner that flips the default: parallel
out of the box, scheduled per-test rather than per-file, and crash-safe when
a native test segfaults. Crucially, it isn't a reimplementation, it vendors
real pytest, so your fixtures, plugins, config, and flags all work unchanged.
You replace one word on the command line.
This talk covers how the drop-in claim actually holds, an honest reading of
the benchmarks (where it wins, where it only ties), and the diagnostic tools:
--doctor--watch--changed
These make it worth adopting even when the raw speedup is zero.
The novelty is the new test runner that makes your life easier and how it fits into the agentic coding eco system.
Python teams share the same pain: pytest is single-process, so runs slow as
suites grow. The standard remedy, pytest-xdist, distributes across processes
but schedules by file, one slow file becomes a floor no worker count can
lower and it's opt-in, easy to forget, and in many cases not used.
rstest takes a different posture. Parallelism is the default. Work is
distributed at test granularity with duration-aware scheduling that starts
the slowest tests first. A crashing worker costs one FAILED line, not the
whole run. What makes this safe to adopt: rstest vendors real pytest and
runs your tests through it. The Rust layer does orchestration only worker
pool, scheduling, crash recovery, report merging and never touches test
semantics. Fixtures, conftest, parametrize, marks, assertion introspection,
installed plugins, config files, and the flag surface behave exactly as under
pytest.
The talk is deliberately honest about limits:
- The compatibility contract. At
-n 0, rstest is one pytest session,
byte-exact, the escape hatch and diagnostic. In parallel, outcomes hold
for parallel-safe tests. Hidden timing/ordering/shared-state assumptions
can flake under concurrency, exactly as under xdist. - The one real cost. The vendored core is pytest 9, so a pytest-8-pinned
suite inherits a pytest-9 upgrade, "upgrade first, then a one-word change." - Benchmarks read straight. Across four real suites (201,127 tests,
per-test outcome-diffed at 100% parity): a wait-bound suite drops 160s→68s,
a CPU-bound suite ties xdist rather than beating it, small suites save
under a second. Shape predicts the result.
The second half covers --doctor (why a suite is slow), --watch
(import-graph-affected reruns), --changed, and monorepo mode, a benefit that
survives even at zero speedup. Attendees leave able to evaluate rstest on
their own suite in about thirty seconds.
I have over 15 years of experience across different domains: Healthcare, Automative, Music, Marketing.
I am a big believer in open source and contributing back to the community, as I have contributed to several open sources.
Most recently, cofounded Kovant, where I am the CTO, leading the technical team, including the tooling to ensure velocity of delivery, making developer's life easier and nicer.