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
Metadata
Release files for pytest-flakelens 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 |
|---|---|---|---|---|
| pytest_flakelens-0.1.0.tar.gz | 14.8 kB | Without provenance | Details for pytest_flakelens-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pytest_flakelens-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for pytest_flakelens-0.1.0-py3-none-any.whl |
Total release size: 27.2 kB
Release files / pytest_flakelens-0.1.0.tar.gz
| Download URL | pytest_flakelens-0.1.0.tar.gz |
|---|---|
| Size | 14.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0d621ad0ba4351de24f5aca154ea4ad30e4b5f91ef9fe23d7a091de0c284fd41
|
|
BLAKE2b-256 checksum How to use checksums |
fa30fb022240d531dea47603ad11396f2628640c722b6a933db598fee997fd39
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.4
|
Release files / pytest_flakelens-0.1.0-py3-none-any.whl
| Download URL | pytest_flakelens-0.1.0-py3-none-any.whl |
|---|---|
| Size | 12.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fc52829476c39688da65ffd9f74cb6f7a59cdd1f325c94b3d1b89247d8fee560
|
|
BLAKE2b-256 checksum How to use checksums |
00f2ca61912dcd802f3fd36d6d449ae995a2e002a680c3091682798db2af0935
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.4
|
Security for pytest-flakelens 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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.