Q&A
Q&AWhat is the first step when a Python test fails intermittently?
Capture the seed and environment, then isolate and repeatedly run the smallest failing test.
Read the concise answer
Treat the failure as evidence of an uncontrolled input. Record test order, random seed, runtime, timing, and environment; run the test alone and repeatedly. If it only fails in a suite, inspect shared fixtures, globals, ports, environment patches, clocks, and unawaited tasks before adding retries.