Skip to main content

Local CI guard for flaky tests: parse JUnit XML, retry, and auto-quarantine

Project description

flakewall

CI PyPI Code style: black License: MIT Python

Language-agnostic flaky test guard for CI. Parse JUnit XML, score flakiness, quarantine known flakes, and selectively retry tests (pytest/jest) – all via a tiny CLI.

What it does (simple explanation)

Flaky tests are tests that sometimes pass and sometimes fail without code changes. flakewall helps you:

  • Identify flaky candidates by scanning JUnit XML across runs
  • Prevent known flakes from breaking CI (quarantine)
  • Optionally re-run failing tests to prove they’re flaky (then auto-quarantine)

Why it’s useful

  • Works with any language that can emit JUnit XML
  • No vendor lock-in, no background service – just a small CLI
  • Plays nicely with your existing CI and test runner

Install

Pick one of the following (no PyPI required):

From source (recommended for dev):

git clone https://github.com/Cicatriiz/flakewall.git
cd flakewall
make dev   # creates venv and installs in editable mode
# or
python -m venv .venv && . .venv/bin/activate && pip install -e .[dev]

pipx (isolated, global CLI without polluting system site-packages):

pipx install git+https://github.com/Cicatriiz/flakewall.git

Docker (no local Python required):

docker run --rm -v "$PWD":/work -w /work python:3.11-slim bash -lc \
  "pip install git+https://github.com/Cicatriiz/flakewall.git && flakewall --help"

From PyPI (optional):

pip install flakewall

Quick start

# 1) Generate JUnit XML in your test run
pytest --junitxml=reports/junit.xml

# 2) Initialize config files
flakewall init

# 3) Guard CI: exit non‑zero only if non‑quarantined failures exist
flakewall guard --junit "reports/**/*.xml"

# 4) Score flakiness across multiple reports (optional)
flakewall score --junit "reports/**/*.xml" --min-total 2 --json > flakewall_score.json

# 5) Retry specific failing tests (pytest/jest) and optionally auto‑quarantine
flakewall retry --framework pytest --from-junit "reports/**/*.xml" --max-retries 1 --auto-quarantine

Commands

  • init – creates .flakewall/config.yml and .flakewall/quarantine.yml
  • report – lists current failing test IDs and marks quarantined ones
  • guard – exits 0 if failures ⊆ quarantine; else exits 1
  • score – detects pass/fail flips across JUnit files; supports --json
  • auto-quarantine – adds flip-prone tests above a --threshold to quarantine
  • retry – re-runs tests (pytest/jest) up to --max-retries; can --auto-quarantine proofs of flakiness; supports --json

Configuration

Files created by init under .flakewall/:

  • config.yml – for example:
    retries: 0
    report_glob: "**/junit*.xml"
    
  • quarantine.yml – list of quarantined test IDs:
    quarantined:
      - package.module::TestClass::test_name
    

CI examples

  • GitHub Actions: examples/ci/github-actions.yml
  • GitLab CI: examples/ci/gitlab-ci.yml
  • CircleCI: examples/ci/circleci-config.yml
  • Azure Pipelines: examples/ci/azure-pipelines.yml
  • Jenkins: examples/ci/Jenkinsfile

Supported inputs and runners

  • Input: JUnit XML (generic, from any language)
  • Retry adapters: pytest, jest (dry‑run friendly, configurable base command)

Notes and limitations

  • Quarantine is a local YAML list – keep it under review in code review.
  • Flake scoring is minimal (requires only JUnit XML). It doesn’t depend on long CI history.
  • Jest retry selection uses -t <name>; include file path in test ID if multiple names collide.

Contributing

See CONTRIBUTING.md for dev setup and releasing.

License

MIT – see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flakewall-0.1.2.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flakewall-0.1.2-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file flakewall-0.1.2.tar.gz.

File metadata

  • Download URL: flakewall-0.1.2.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for flakewall-0.1.2.tar.gz
Algorithm Hash digest
SHA256 ad974dfd780489451d1a90fc3a5f69daa38f30bfb247fa877311e91eabf8ef78
MD5 790cfa89ca6f3a2718f66bbe7b4c289a
BLAKE2b-256 d0388b7778e3ea0dce6467cdcb448fc0b6da1fd27b55fc8a2455fc24c164b521

See more details on using hashes here.

File details

Details for the file flakewall-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: flakewall-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for flakewall-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b16bf2284861d6595d0ed459d9df6bf87f2a644f739b5823cf10f16ccf2c39a8
MD5 269a8c2b2d7040a7a3d7d60cb9729764
BLAKE2b-256 909cc2e28df1612e251c445c75b869efb8d214b54ac6e1655e919cef4f5df2a7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page