pytest-fail-slow
Fail tests that take too long to run
Decision gist · record as of 2026-08-14
Yes. The plugin is lightweight, actively maintained, permissively licensed, and solves a concrete problem—catching performance regressions in test suites. Install it if you need to enforce test duration limits in CI or detect slow tests without stopping them early.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.8 or higher and pytest 7.0 or higher.
- Low friction installation with no compiled dependencies.
- The package is actively maintained, with recent commits and a stable release cadence since its initial release in 2021.
License · maintenance · safety
permissive license (permissive) — Licensed under MIT (permissive), so you can use it freely in commercial and private projects without restriction or obligation to share modifications.
last release 2024-06-01 (804 days) · last repo commit 2026-07-20 · 11 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 176,356 downloads/mo, #10,245 on PyPI
Alternatives
Verify before relying
pip install pytest-fail-slow
import pytest
@pytest.mark.fail_slow("5s")
def test_something():
pass- Whether the plugin integrates cleanly with other pytest plugins in typical test suites.
- Performance overhead of duration tracking across large test suites.
What it is and what it does
pytest-fail-slow is a pytest plugin that enforces test duration limits by marking tests as failed when they exceed a specified time threshold. It operates in two modes: you can apply a `fail_slow` marker to individual tests with a duration cutoff, or pass a `--fail-slow DURATION` option to pytest to apply a global cutoff to all unmarked tests. The plugin also supports a `fail_slow_setup` marker to fail tests if their fixture setup stages exceed a duration limit. Tests run to completion even when they exceed the threshold—if you want to stop them early, the plugin documentation recommends pytest-timeout instead.
The plugin accepts durations in multiple units (seconds, milliseconds, hours, etc.) and supports conditional enabling via an `enabled` keyword argument, allowing you to apply different thresholds or disable checks based on environment variables or pytest configuration. It is actively maintained, supports Python 3.8 through 3.12 on both CPython and PyPy, and includes type hints.
Use it for
- Enforce maximum test duration in CI pipelines to catch performance regressions before they reach production.
- Mark tests that are intentionally slow (e.g., integration tests) with a higher threshold to distinguish them from unit tests.
- Conditionally fail slow tests only in CI environments while allowing longer runs during local development.
- Detect fixture setup overhead by monitoring setup duration separately from test execution time.
- Apply a blanket duration limit across all tests via command-line option without modifying test code.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
The plugin is lightweight, actively maintained, permissively licensed, and solves a concrete problem—catching performance regressions in test suites. Install it if you need to enforce test duration limits in CI or detect slow tests without stopping them early.
Install
pytest-fail-slow on PyPI
Before you install
Low friction installation with no compiled dependencies. The package is actively maintained, with recent commits and a stable release cadence since its initial release in 2021.
Requires Python 3.8 or higher and pytest 7.0 or higher.
License in practice
Licensed under MIT (permissive), so you can use it freely in commercial and private projects without restriction or obligation to share modifications.
Quickstart
pip install pytest-fail-slow
import pytest
@pytest.mark.fail_slow("5s")
def test_something():
pass
Verify before relying
- Whether the plugin integrates cleanly with other pytest plugins in typical test suites.
- Performance overhead of duration tracking across large test suites.
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release >=3.8 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packagespluggypytest |
| Maintenance | Actively maintained 804 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 176,356 / month, #10,245 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Environment :: PluginsFramework :: PytestIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: TestingTyping :: Typed |
Evidence: pytest_fail_slow-0.6.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “pytest slow test detection”
- pytest-fail-slowA pytest plugin that marks tests as failed if they exceed a specified…
- pytest-timeoutAborts pytest tests that exceed a specified time limit, with stack…
- pytest-skip-slowA pytest plugin that skips tests marked with `@pytest.mark.slow` or…
Give your agent the search over MCP, or paste the wish link into any chat.
More Testing packages
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.
virtualenv creates isolated Python environments where packages can be installed independently without affecting the system Python or other projects.
Coverage.py measures which lines of Python code are executed during test runs, reporting coverage percentages and identifying untested code paths.
Install it if you want to measure test completeness or enforce coverage thresholds in your project.
pytest-asyncio is a pytest plugin that enables writing and running async test functions using the asyncio library, allowing developers to await code directly within test cases.
Install it if you write tests for any asyncio-based code.
A pytest plugin that generates test reports in Common Test Report Format (CTRF) as JSON, compatible with pytest-xdist and pytest-playwright for distributed and browser-based testing.
Install it if you need CTRF-formatted test output for CI/CD integration or cross-tool reporting.
See also pytest-integration · pytest-timeout · pytest-retry · pytest-raises · pytest-timeouts · pytest-durations · pytest-order · pytest-tornado · coverage-threshold · pytest-loop