
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
pytest-execution-timer
Advanced tools
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.
Leverages pytest
hooks to measure execution time of phases.
Requires:
Install the plugin with any approach for your project.
Some examples:
pip install pytest-execution-timer
poetry add --dev pytest-execution-timer
pipenv install --dev pytest-execution-timer
Or add it to your requirements.txt
file.
Enable the plugin with the --execution-timer
option when running pytest
:
$ 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
The best ay to start is to compare the difference of the pytest_runtestloop
duration
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 pytest_runtestloop
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.
These can then be examined directly, or use other tools like profilers or import timings.
Distributed under the terms of the MIT license,
"pytest-execution-timer" is free and open source software.
See LICENSE
for more information.
FAQs
A timer for the phases of Pytest's execution.
We found that pytest-execution-timer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.