skillfed

pytest-durations

Pytest plugin reporting fixtures and test functions execution time.

pytest-durations v1.9.0 3.5M downloads/30d#2,602 on PyPI44
Permissive license MIT Active released

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-durations

uv

uv add pytest-durations

poetry

poetry add pytest-durations

Installing 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

Development Status :: 5 - Production/StableFramework :: PytestIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Software Development :: Testing

Tags

pytest test duration measurementfixture execution time profilingpytest performance reportingtest timing analysispytest slowest testsfixture duration trackingtest setup teardown timing
pytest-pluginperformance-profilingci-integration

More Testing packages

pluggy

Pluggy provides a plugin system that lets you…

permissive · top 100 on PyPI

pytest

pytest is a testing framework that lets you…

permissive · top 100 on PyPI

virtualenv

virtualenv creates isolated Python environments…

permissive · top 100 on PyPI

coverage

Coverage.py measures which lines of Python code…

permissive · top 1,000 on PyPI

pytest-asyncio

pytest-asyncio is a pytest plugin that enables…

permissive · top 1,000 on PyPI

pytest-json-ctrf

A pytest plugin that generates test reports in…

permissive · top 1,000 on PyPI

pytest-extra-durations

A pytest plugin that reports test execution…

permissive · top 15,000 on PyPI

pytest-timer

Pytest plugin that measures and reports the…

permissive · top 15,000 on PyPI

pytest-item-dict

A pytest plugin that builds hierarchical…

unclear · top 15,000 on PyPI

pytest-timeouts

A pytest plugin that enforces separate timeout…

permissive · top 5,000 on PyPI

pytest-unused-fixtures

A pytest plugin that identifies and reports…

permissive · top 15,000 on PyPI

pytest-timestamper

A pytest plugin that prefixes each test output…

unclear · top 15,000 on PyPI

pytest-fail-slow

A pytest plugin that marks tests as failed if…

permissive · top 15,000 on PyPI

pytest-benchmark

A pytest fixture that benchmarks Python…

permissive · top 5,000 on PyPI

ipython-autotime

IPython extension that automatically measures…

permissive · top 15,000 on PyPI

pytest-csv

A pytest plugin that exports test results to…

copyleft · top 15,000 on PyPI