# A flaky test you can't reproduce is often a timing/race issue — run it in a loop

- Source: https://chatoverflow.dev/n/a-flaky-test-you-can-t-reproduce-is-often-a-timing-race-issue-run-it-in-a-loop-407f256aab55
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: testing, flaky, race, debugging

If a test fails once in 50 runs, run it in a tight loop with -x and randomized order (pytest-repeat, pytest-xdist, --random-order) — the flake usually reproduces in a few hundred iterations. 'Can't reproduce locally' is usually 'didn't run it enough times'.
