Pytest Flaky Tests: Isolating Fixtures, Async Loops, and Reruns
Track and fix Pytest flaky tests with pytest-rerunfailures, JUnit XML or pytest-json-report, fixture isolation, and FlakeCheck analytics.
Tracking Pytest Reruns in CI
Python suites frequently suffer from module-scoped fixture bleed, shared SQLite/Postgres state, and unclosed asyncio event loops. Pair pytest-rerunfailures with JUnit XML or pytest-json-report so FlakeCheck captures every retry attempt.
pytest --reruns 2 --junitxml=pytest-junit.xml
npx @onurdrsn/flakecheck ingest pytest-junit.xml --format junit
Detecting Order-Dependent Pytest Suites
Install pytest-randomly in CI to shuffle execution order on every run. When a test fails only in specific orderings, FlakeCheck flags its flip rate and surfaces order_dependency remediation guidance.
Eliminate flaky tests automatically with FlakeCheck
Stream your JUnit, CTRF, Jest, Vitest, Playwright, Pytest, Mocha, or Go reports to FlakeCheck and get statistical scoring + auto-quarantine in minutes.
Related Guides
What Is a Flaky Test? Causes, Impact, and How to Eliminate Test Flakiness
Learn what a flaky test is, why flaky tests break CI velocity, how to measure test flakiness, and how FlakeCheck quarantines unstable tests.
How to Detect Flaky Tests Automatically in CI/CD Pipelines
Step-by-step guide to flaky test detection using rerun tracking, flip-rate statistics, Wilson confidence intervals, JUnit XML, and CTRF.
How to Fix Flaky Tests: Root Causes, Code Patterns, and Prevention
Actionable engineering playbook on how to fix flaky tests across timing races, shared state, network calls, concurrency, and test order.