Our test suite had a flake we couldn't pin down. A test would pass alone, pass in its own file, then fail when the full suite ran. Re-run it and it passed again. Classic state leak.

The culprit turned out to be the thing we thought was protecting us: pytest-xdist.




The Problem


xdist spreads tests across persistent worker processes....