Skip to content
rpytest GitHub

Home / Use cases / CI test hot paths

Continuous integration

CI test hot paths

Drop fixed per-invocation cost from retries, last-failed reruns, and shards without adding a plugin dependency.

The problem

CI pipelines invoke pytest repeatedly — a full run, a --lf rerun after a flake, sometimes several shards. Each invocation re-pays interpreter startup, plugin import, and collection, and pytest-xdist re-pays worker startup on top. On suites with heavy plugin import graphs, that fixed cost dominates wall clock before a single test body executes.

How rpytest solves it

CI parallel + shard
$ rpytest -n auto --shard 0 --total-shards 4
[collection cached · 4 workers, duration-balanced]
412 passed, 3 skipped in 8.7s

Questions

+ Do I still need pytest-xdist in CI?

Not for parallel execution — rpytest -n auto is built in with duration-aware scheduling. Keep xdist only if you depend on its specific distribution semantics like dist=loadfile or loadgroup.

+ Are exit codes and JUnit XML CI-safe?

Yes. Exit codes and JUnit XML match pytest exactly by design, so your CI gates and test-report tooling keep working unchanged.

Swap it in on your own suite