pytest-durations
Pytest plugin reporting fixtures and test functions execution time.
What it is and what it does
pytest-durations is a pytest plugin that breaks down test execution time into separate measurements for fixtures, test setup, test calls, and teardown phases. Unlike pytest's built-in --durations flag, it isolates fixture durations from test function durations and accounts for fixtures with scope larger than "function" by subtracting their time from the test duration, giving you a clearer picture of what's actually slow in your test suite.
The plugin integrates directly into pytest and offers granular reporting options: you can filter which sections to display (fixture, call, setup, teardown), choose how to group results (by module, class, or function), select which statistics to show (total, num, min, med, max, and percentiles p90/p95/p99), and export results as JSON for CI integration. It works with pytest-xdist for distributed testing and handles time-traveling packages like freezegun.
Use it for:
- Identify slow fixtures that are blocking your test suite and prioritize optimization efforts.
- Compare test performance across modules or classes to find which parts of your codebase have the slowest tests.
- Export timing data as JSON to track test performance trends over time in CI/CD pipelines.
- Debug test setup and teardown overhead separately from the actual test logic execution time.
- Use percentile columns to understand the distribution of test durations rather than just min/max values.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A pytest plugin that measures and reports fixture and test function execution times separately, with support for xdist and time-traveling packages.
Yes. This is a lightweight, actively maintained plugin with no security vulnerabilities, permissive licensing, and a single stable dependency. Install it if you need finer-grained visibility into test performance than pytest's built-in --durations provides, especially for large test suites where fixture overhead is significant.
Install
pytest-durations on PyPI
pip
pip install pytest-durationsuv
uv add pytest-durationspoetry
poetry add pytest-durationsInstalling pytest-durations
Before you install
Low friction: pure Python wheel with only pytest as a runtime dependency. Actively maintained with a release on 2026-08-14 and 44 repository stars.
License in practice
MIT license (permissive) — you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
Quickstart
pip install pytest-durations
pytest --pytest-durations=10
# Shows fixture and test durations separately in the report
Requires Python 3.10 or later (supports up to 3.14).
Verify before relying
- Whether the plugin's percentile columns (p90, p95, p99) are available in all output formats or only in specific configurations.
- Performance overhead of the plugin on very large test suites with thousands of tests.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (<4.0,>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — pytest |
| Maintenance | actively maintained — 0 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 3,493,107/month — #2,602 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pytest_durations-1.9.0-py3-none-any.whl
Tags
More Testing packages
Pluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
virtualenvvirtualenv creates isolated Python environments…
permissive · top 100 on PyPI
coverageCoverage.py measures which lines of Python code…
permissive · top 1,000 on PyPI
pytest-asynciopytest-asyncio is a pytest plugin that enables…
permissive · top 1,000 on PyPI
pytest-json-ctrfA pytest plugin that generates test reports in…
permissive · top 1,000 on PyPI
pytest-extra-durationsA pytest plugin that reports test execution…
permissive · top 15,000 on PyPI
pytest-timerPytest plugin that measures and reports the…
permissive · top 15,000 on PyPI
pytest-item-dictA pytest plugin that builds hierarchical…
unclear · top 15,000 on PyPI
pytest-timeoutsA pytest plugin that enforces separate timeout…
permissive · top 5,000 on PyPI
pytest-unused-fixturesA pytest plugin that identifies and reports…
permissive · top 15,000 on PyPI
pytest-timestamperA pytest plugin that prefixes each test output…
unclear · top 15,000 on PyPI
pytest-fail-slowA pytest plugin that marks tests as failed if…
permissive · top 15,000 on PyPI
pytest-benchmarkA pytest fixture that benchmarks Python…
permissive · top 5,000 on PyPI
ipython-autotimeIPython extension that automatically measures…
permissive · top 15,000 on PyPI
pytest-csvA pytest plugin that exports test results to…
copyleft · top 15,000 on PyPI