Registry / testing / pytest-timer

pytest-timer

JSON →
library1.0.0pypypi✓ verified 82d ago

A pytest plugin that measures the duration of each test and displays the slowest tests. Current version 1.0.0. Released October 2021, no recent updates.

pip install pytest-timer
INSTALL
IMPORT
SIG · PYTEST-TIMER
P
pytest-timer
testingpythonv1.0.0
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.

timer
import pytest_timer
from pytest_timer import timer

Install plugin, then run 'pytest --timer' to see top slowest tests.

# In terminal, run pytest with --timer option # Example test file: test_example.py def test_slow(): import time time.sleep(0.5) assert True def test_fast(): assert 1 + 1 == 2
Debug
Known issues
gotchaPlugin only shows slow tests when --timer flag is used; not enabled by default.
fix
Run pytest with '--timer' flag.
affects: all
gotchaOutput format shows duration in seconds with 3 decimal places; may be hard to read for very fast tests.
fix
Use '--timer-top-n' to adjust number of displayed tests.
affects: all
Upgrade
Version history
1.0.0latest on PyPI · released Dec 26, 2023
Audit
Dependencies

No dependency data recorded yet.

Agent activity
10 hits · last 30 days
node
10
Resources
pytest-timer — pip install pytest-timer · libregistry