Skip to main content

flakedetective

Find out which tests are flaky, what the evidence suggests, and exactly how to prove it. Local, no account, no test-suite rewrite.

CI license: MIT PyPI python

demo

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

  1. Run your existing command N times, capturing both streams. No plugins, no fixtures, no changes to your suite.
  2. Parse failures into per-test observations. Shipped parsers: pytest, jest, unittest. --parser overrides auto-detection.
  3. Cluster by test id, so a test that failed 3 of 20 runs is one row with a 15% score, not three log lines.
  4. Hypothesise a cause from the failure text (network, timeout, shared state, randomness, concurrency, filesystem) and attach the number of runs supporting it.
  5. 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 auto inside 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.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flakedetective 0.2.0
File Size Uploaded Provenance Actions
flakedetective-0.2.0.tar.gz 23.7 kB With provenance Details for flakedetective-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for flakedetective 0.2.0
File Interpreter ABI Platform Actions
flakedetective-0.2.0-py3-none-any.whl Python 3 none any Details for flakedetective-0.2.0-py3-none-any.whl

Total release size: 43.5 kB

Release files / flakedetective-0.2.0.tar.gz

Download URL flakedetective-0.2.0.tar.gz
Size 23.7 kB
Tags Source
SHA-256 checksum
How to use checksums
377ba58cb9a680d26397463076b7c754f443cb5256a3d910143ed388c65e7d64
BLAKE2b-256 checksum
How to use checksums
9db606a3f8f1dccd2d372473c78a5a52d08d6f9a7308bf33bae633f5d535edfc
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 31, 2026.

Transparency log

Release files / flakedetective-0.2.0-py3-none-any.whl

Download URL flakedetective-0.2.0-py3-none-any.whl
Size 19.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
435e27309fa00cdf6ba1ddf4b54e48cf536a6713a8c112d105766588e834c2bd
BLAKE2b-256 checksum
How to use checksums
0ba8feb03eb003347cb055ba080b1de180287889337a227bcdea418ecf651c75
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 31, 2026.

Transparency log

Security for flakedetective 0.2.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.

Select from 2 files

Attestation for flakedetective-0.2.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 31, 2026.

Transparency log

A 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.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page