Pytest plugin implementing flaky test failure detection and classification.
Project description
Pytest FlakeFighters
Pytest plugin implementing flaky test failure detection and classification.
Features
- Implements the DeFlaker algorithm for pytest
Installation
You can install "pytest-flakefighters" by cloning this repo and running pip install . from the root directory.
If you intend to develop the plugin, run pip install -e .[dev] instead.
We eventually intend to distribute our tool on PyPI.
Usage
FlakeFighter is intended to run on git repositories that have test suites runnable with pytest.
Once you have installed FlakeFighter, you can run it from the root directory of your repo simply by running pytest in your usual way.
FlakeFighter has the following arguments.
--target-commit=TARGET_COMMIT
The target (newer) commit hash. Defaults to HEAD (the most recent commit).
--source-commit=SOURCE_COMMIT
The source (older) commit hash. Defaults to HEAD^ (the previous commit to target).
--repo=REPO_ROOT The commit hash to compare against.
--suppress-flaky-failures-exit-code
Return OK exit code if the only failures are flaky failures.
--no-save Do not save this run to the database of previous flakefighters runs.
-M LOAD_MAX_RUNS, --load-max-runs=LOAD_MAX_RUNS
The maximum number of previous runs to consider.
-D DATABASE_URL, --database-url=DATABASE_URL
The database URL. Defaults to 'flakefighter.db' in current working directory.
--store-max-runs=STORE_MAX_RUNS
The maximum number of previous flakefighters runs to store. Default is to store all.
--time-immemorial=TIME_IMMEMORIAL
How long to store flakefighters runs for, specified as `days:hours:minutes`. E.g. to store
tests for one week, use 7:0:0.
Contributing
Contributions are very welcome. Tests can be run with pytest, please ensure the coverage at least stays the same before you submit a pull request.
Flake Fighters
Our plugin is made up of a collection of heuristics that come together to help inform whether a test failure is genuine or flaky.
These come in two "flavours": those which run live after each test, and those which run at the end of the entire test suite.
Both extend the base class FlakeFighter and implement the flaky_failure method, which returns True if the test is deemed to be flaky.
Issues
If you encounter any problems, please file an issue along with a detailed description.
This pytest plugin was generated with Cookiecutter along with @hackebrot's cookiecutter-pytest-plugin template.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pytest_flakefighters-0.2.0.tar.gz.
File metadata
- Download URL: pytest_flakefighters-0.2.0.tar.gz
- Upload date:
- Size: 123.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b6981f93a763b172212248a8f68b273959407efaec108be61f946b54fc77ddfb
|
|
| MD5 |
b86cc78340cd4edef7f3dcc1a8d2e36a
|
|
| BLAKE2b-256 |
49f3919692df0e0698a643f6148bb0800c7471989410277ebf0c345249c19718
|
File details
Details for the file pytest_flakefighters-0.2.0-py3-none-any.whl.
File metadata
- Download URL: pytest_flakefighters-0.2.0-py3-none-any.whl
- Upload date:
- Size: 21.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d0e5bd231ce136fabf7d0c12f49e7d4cf3d0ba235edb002b57220df7513b5e2
|
|
| MD5 |
a712be5070bfb0d57cda20ffb65fa70c
|
|
| BLAKE2b-256 |
64cd1f4d31ade9d8fe1503dc54b4a4b3963ae9886d90921f7baa40ef8f44f371
|