Registry / testing / pytest-ignore-flaky

pytest-ignore-flaky

JSON →
library2.2.1pypypi✓ verified 87d ago

A pytest plugin to automatically ignore failures from flaky tests. Current version 2.2.1, requires Python >=3.8. Release cadence is irregular; last update was in 2023.

pip install pytest-ignore-flaky
INSTALL
IMPORT
SIG · PYTEST-IGNORE-FLAK
P
pytest-ignore-flaky
testingpythonv2.2.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pytest_ignore_flaky
✓ import pytest_ignore_flaky
No common wrong import; the plugin is auto-discovered by pytest.

Mark a flaky test with @pytest.mark.flaky and specify max_runs (default 3) and min_passes (default 1). The plugin retries the test up to max_runs times, ignoring failures if min_passes is met.

# content of conftest.py or test file import pytest @pytest.mark.flaky(max_runs=3, min_passes=2) def test_flaky_example(): import random assert random.choice([True, False])
Debug
Known issues
gotchaThe plugin only works on tests marked with @pytest.mark.flaky; it does not automatically retry all failing tests.
fix
Add the flaky mark to each test you want retried, or use --force-flaky to make all tests flaky.
affects: all
gotchaThe --ignore-flaky flag (used to ignore flaky failures) can be dangerous if misused, as it may hide real test failures.
fix
In newer versions, use --flaky-ignore instead of --ignore-flaky. Check the output logs carefully.
affects: <2.0.0
deprecatedThe --ignore-flaky command-line option was deprecated in 2.0.0 and replaced with --flaky-ignore.
fix
Use --flaky-ignore instead of --ignore-flaky.
affects: >=2.0.0
Errors
Common errors & fixes
Error: pytest: error: unrecognized arguments: --ignore-flaky
The --ignore-flaky flag was renamed to --flaky-ignore in version 2.0.0.
fix
Use --flaky-ignore instead of --ignore-flaky.
ModuleNotFoundError: No module named 'pytest_ignore_flaky'
The plugin is not installed or not in the Python environment.
fix
Run 'pip install pytest-ignore-flaky' and ensure the virtual environment is activated.
AttributeError: module 'pytest' has no attribute 'mark'
The pytest 'mark' attribute is not used correctly; should be @pytest.mark.flaky.
fix
Use the decorator as @pytest.mark.flaky(max_runs=3, min_passes=1). Ensure pytest is imported.
Upgrade
Version history
2.2.1latest on PyPI · released Apr 20, 2024
Audit
Dependencies
pytestrequiredRequired: pytest plugin
Agent activity
2 hits · last 30 days
node
2
Resources
pytest-ignore-flaky — pip install pytest-ignore-flaky · libregistry