Skip to main content

Pytest reporter that streams test results, retries and artifacts to a FlakeLens server

Project description

pytest-flakelens

The pytest reporter for FlakeLens — a self-hosted test observability platform with AI agents that fix flaky tests, not just flag them.

This plugin streams your test results, retries, and Playwright artifacts (screenshots, traces) to a FlakeLens server as the run happens. It never fails your test session: if the server is unreachable, it logs one warning and gets out of the way.

Install

pip install pytest-flakelens

Use

Point it at your FlakeLens server and give it a project key (create a project in the FlakeLens dashboard to get one):

# pytest.ini  (or [tool.pytest.ini_options] in pyproject.toml)
[pytest]
flakelens_url = https://flakelens.your-company.com
export FLAKELENS_API_KEY=flk_your_project_key
pytest

That's it — every run now appears in your dashboard with run history, flaky-test scoring, failure records, and the AI analysis / auto-fix agents.

Recommended options (Playwright)

addopts = --screenshot only-on-failure --tracing retain-on-failure --reruns 2

Failure screenshots and Playwright traces are captured automatically; --reruns (via pytest-rerunfailures) feeds intra-run flaky detection.

Configuration

Setting (pytest.ini) Env var Default
flakelens_url FLAKELENS_URL
flakelens_api_key FLAKELENS_API_KEY
flakelens_enabled FLAKELENS_ENABLED auto (on when url + key are set)
flakelens_framework FLAKELENS_FRAMEWORK auto-detected
flakelens_batch_size FLAKELENS_BATCH_SIZE 20
flakelens_upload_artifacts FLAKELENS_UPLOAD_ARTIFACTS true

Branch/commit metadata is auto-read from GITHUB_* in CI (or set FLAKELENS_BRANCH / FLAKELENS_COMMIT).

Markers

  • @pytest.mark.quarantine — FlakeLens-managed: runs the test as a non-strict xfail so a known-flaky test stops blocking CI while the fix agent works on it, while still reporting its real pass/fail.

Attach files

def test_thing(testwarden_attach):
    testwarden_attach("path/to/file.png", kind="screenshot")

Not on pytest?

FlakeLens also ingests JUnit XML from any framework (Selenium/Java, Jest, Cypress, Go, .NET…) via a single upload — see the FlakeLens docs.

License

MIT

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

pytest_flakelens-0.1.0.tar.gz (14.8 kB view details)

Uploaded Source

Built Distribution

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

pytest_flakelens-0.1.0-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file pytest_flakelens-0.1.0.tar.gz.

File metadata

  • Download URL: pytest_flakelens-0.1.0.tar.gz
  • Upload date:
  • Size: 14.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.4

File hashes

Hashes for pytest_flakelens-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0d621ad0ba4351de24f5aca154ea4ad30e4b5f91ef9fe23d7a091de0c284fd41
MD5 5abdba12969593eba6444e42395c5c81
BLAKE2b-256 fa30fb022240d531dea47603ad11396f2628640c722b6a933db598fee997fd39

See more details on using hashes here.

File details

Details for the file pytest_flakelens-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_flakelens-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fc52829476c39688da65ffd9f74cb6f7a59cdd1f325c94b3d1b89247d8fee560
MD5 bcb137efc8faec94c888eae55cf145b5
BLAKE2b-256 00f2ca61912dcd802f3fd36d6d449ae995a2e002a680c3091682798db2af0935

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