Registry / testing / pytest-fail-slow

pytest-fail-slow

JSON →
library0.6.0pypypi✓ verified 85d ago

A pytest plugin that fails tests exceeding a configurable duration. v0.6.0 supports both marker-level and command-line slow time thresholds; actively maintained.

pip install pytest-fail-slow
INSTALL
IMPORT
SIG · PYTEST-FAIL-SLOW
P
pytest-fail-slow
testingpythonv0.6.0
Install
2.8s avg
Import
Disk
29MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.6.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 30.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.8s · import 0.000s · 31MB
29MB installed
● package 29MB
Code
Verified usage

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

pytest_addoption
from pytest_fail_slow import pytest_addoption
from pytest_fail_slow import fail_slow
pytest_configure
from pytest_fail_slow import pytest_configure
pytest_runtest_setup
from pytest_fail_slow import pytest_runtest_setup

Enable plugin and use @fail_slow decorator to set per-test maximum duration in seconds.

# conftest.py pytest_plugins = ['pytest_fail_slow'] # then in test import pytest from pytest_fail_slow import fail_slow @fail_slow(0.5) def test_fast_enough(): import time time.sleep(0.1) assert True
Debug
Known issues
gotchaThe @fail_slow decorator must be applied after @pytest.mark.slow or similar markers; order matters because the decorator reads the test's current marker info.
fix
Place @fail_slow closest to the function, above other custom decorators.
affects: all
gotchaThe plugin only works with pytest's default runner; custom runners may silently ignore the fail_slow marker.
fix
Use the default pytest runner.
affects: all
deprecatedThe CLI option --fail-slow is deprecated in v0.6.0; use --fail-slow-seconds instead.
fix
Use `--fail-slow-seconds <seconds>` from command line.
affects: >=0.6.0
Upgrade
Version history
0.6.0latest on PyPI · released Jun 1, 2024
Audit
Dependencies
pytestrequiredplugin requires pytest runtime
Agent activity
4 hits · last 30 days
node
4
Resources
pytest-fail-slow — pip install pytest-fail-slow · libregistry