How to detect and fix flaky tests in Pytest
What are flaky tests? Flaky tests produce different results each time you run them. This means you can rerun the same CI job on the same commit 10 times and see inconsistent results. These flaky tests are the tests that fail and block your PRs when you fix a typo or bump a dependency, even though your changes couldn’t have possibly broken a test. They’re the tests that make you habitually hit the rerun job button when tests fail. Why do flaky tests occur? Flaky tests are most common in integration tests and e2e (end-to-end) tests. These tests tend to be complex and can be flaky for a multitude of reasons. Flaky test code (bad) Flaky application code (really bad) Flaky infrastructure (pain

What are flaky tests?
Flaky tests produce different results each time you run them. This means you can rerun the same CI job on the same commit 10 times and see inconsistent results. These flaky tests are the tests that fail and block your PRs when you fix a typo or bump a dependency, even though your changes couldn’t have possibly broken a test. They’re the tests that make you habitually hit the rerun job button when tests fail.
Why do flaky tests occur?
Flaky tests are most common in integration tests and e2e (end-to-end) tests. These tests tend to be complex and can be flaky for a multitude of reasons.
- Flaky test code (bad)
- Flaky application code (really bad)
- Flaky infrastructure (pain