flakedetective
Find out which tests are flaky, what the evidence suggests, and exactly how to prove it. Local, no account, no test-suite rewrite.
Install
pipx install git+https://github.com/mgkvibez/flakedetective.git
Use it
# run the suite 20 times and get a ranked verdict
flakedetective run --runs 20 -- pytest -q
# same for a JS project (auto-detects jest output)
flakedetective run --runs 15 -- npm test
# print a quarantine snippet you can paste into pyproject.toml
flakedetective quarantine --min-score 0.3
Exit codes are part of the contract: 0 nothing flaky, 3 flaky tests found, 2 bad usage. Gate CI on 3 without parsing text.
Why it exists
A flaky test is worse than a failing one: the failure tells you nothing, so you re-run, then you start ignoring the suite. Most teams know that something is flaky, not which test or why. This runs your suite a number of times, counts real observations, and separates three states that get conflated:
- flaky — it both passed and failed,
- broken — it failed every time (not flaky, just broken: fix it),
- stable — never failed.
Only the first one deserves the word.
How it works
- Run your existing command N times, capturing both streams. No plugins, no fixtures, no changes to your suite.
- Parse failures into per-test observations. Shipped parsers: pytest, jest, unittest.
--parseroverrides auto-detection. - Cluster by test id, so a test that failed 3 of 20 runs is one row with a 15% score, not three log lines.
- Hypothesise a cause from the failure text (network, timeout, shared state, randomness, concurrency, filesystem) and attach the number of runs supporting it.
- Prove it: every flaky test gets a copy-pasteable repro loop, and you get a quarantine snippet so the suite goes green while you fix things one at a time.
Honest limits, because they matter:
- A cause is a hypothesis from the failure text until you reproduce it. The report says so on every run.
- pytest can deselect an individual test, so its snippet is exact. Jest has no per-test config, so its snippet scopes the ignore to files and marks the tests to skip in place.
- Runs are serial. A test that only flakes under parallel execution needs
-n autoinside your own command.
The ledger (.flakedetective/runs.jsonl) is append-only, so flakedetective analyze can re-read history without re-running anything. CI can collect runs on a schedule and analyze them later.
Contributing
Open an issue before a PR. Adding a harness is one function plus one fixture in tests/ (see flakedetective/parsers.py and the PARSERS table); keep it dependency-free and add a test that fails without your parser.
Run the gate before pushing:
bash scripts/verify.sh
It runs four checks: install, version consistency, the suite, and a CLI smoke that asserts the documented exit code.
License
MIT.
Metadata
Release files for flakedetective 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| flakedetective-0.1.0.tar.gz | 15.3 kB | With provenance | Details for flakedetective-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| flakedetective-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for flakedetective-0.1.0-py3-none-any.whl |
Total release size: 29.0 kB
Release files / flakedetective-0.1.0.tar.gz
| Download URL | flakedetective-0.1.0.tar.gz |
|---|---|
| Size | 15.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
59909e696cd69d71439d7935e2c6757398bbc00ff84ba27da35080a31ab9a15a
|
|
BLAKE2b-256 checksum How to use checksums |
3a2904e4b94f935ad73134d59999b4b7db50dafbc43e3b5ee51db05f85fd629e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logRelease files / flakedetective-0.1.0-py3-none-any.whl
| Download URL | flakedetective-0.1.0-py3-none-any.whl |
|---|---|
| Size | 13.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fafd26f979618cd42494ef79f84cbbab04243a2a64661adab687f463fbc29e04
|
|
BLAKE2b-256 checksum How to use checksums |
785ee5ea64173506799632a52680ced8fe22b83fb4a685369292d4e9f6b51f87
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logSecurity for flakedetective 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for flakedetective-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.