A timer for the phases of Pytest's execution.
A plugin to use with Pytest to measure execution time of tests.
Distinctly different from the
--durations option of pytest,
this plugin measures specific pytest startup/collection phases.
pytest hooks to measure execution time of phases.
- Python 3.7 or later.
- Pytest 6.2 or later.
Install the plugin with any approach for your project.
pip install pytest-execution-timer
poetry add --dev pytest-execution-timer
pipenv install --dev pytest-execution-timer
Or add it to your
Enable the plugin with the
--execution-timer option when running
$ pytest --execution-timer ... Durations of pytest phases in seconds (min 100ms): 0.662 pytest_runtestloop
Control the threshold (default 100ms) by passing
--minimum-duration=<value in ms>:
$ pytest --execution-timer --minimum-duration=1000 # 1 second
Understanding the output
The best ay to start is to compare the difference of the
and the overall duration of the test run. Example:
Durations of pytest phases in seconds (min 100ms): 0.666 pytest_runtestloop ====== 4 passed in 0.68s ======
In this example, there's not much lost between the test run and the
meaning that the startup and collection phases are not taking too much time.
If there's a larger difference in the timings, look to other emitted phases to understand what's taking the most time.
Distributed under the terms of the MIT license,
"pytest-execution-timer" is free and open source software.
LICENSE for more information.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Hashes for pytest-execution-timer-0.1.0.tar.gz
Hashes for pytest_execution_timer-0.1.0-py3-none-any.whl