pytest-timer
Porting of nose-timer plugin for pytest. A timer plugin for pytest (how much time does every test take?).
Install
To install the latest release from PyPI:
pip install pytest-timer
To install pytest-timer with termcolor for colored durations:
pip install pytest-timer[termcolor]
To install pytest-timer with colorama for colored durations:
pip install pytest-timer[colorama]
Or to install the latest development version from Git:
pip install git+git://github.com/skudriashev/pytest-timer.git
Or to install the latest from source:
git clone https://github.com/skudriashev/pytest-timer.git
cd pytest-timer
pip install .
You can also make a developer install if you plan on modifying the source frequently:
pip install -e .
Usage
After installing pytest-timer plugin the following report will be added:
========================== pytest-timer ==========================
[success] tests/test_plugin.py::TestPlugin::test_loaded2: 0.0002s
[success] tests/test_plugin.py::TestPlugin::test_loaded: 0.0002s
How do I show only the n slowest tests?
For example, to show only the 10 slowest tests, run pytest with the --timer-top-n flag:
pytest --timer-top-n 10
How do I turn off pretty colors?
In some cases, you may want to disable colors completely. This is done by using the --timer-no-color flag.
This is useful when running tests in a headless console.
How do I filter results by colors?
It is possible to filter results by color. To do so, you can use the --timer-filter flag:
pytest --timer-filter ok
pytest --timer-filter warning
pytest --timer-filter error
Or to apply several filters at once:
pytest --timer-filter warning,error
License
pytest-timer is MIT Licensed library.
Contribute
- Check for open issues or open a fresh issue to start a discussion around a feature idea or a bug.
- Fork the repository on GitHub to start making your changes to the master branch (or branch off of it).
- Write a test which shows that the bug was fixed or that the feature works as expected.
- Send a pull request and bug the maintainer until it gets merged and published.
- Make sure to add yourself to the author's file in setup.py and the Contributors section below :)
Contributors
Metadata
Release files for pytest-timer 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pytest-timer-1.0.0.tar.gz | 5.8 kB | Without provenance | Details for pytest-timer-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pytest_timer-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for pytest_timer-1.0.0-py3-none-any.whl |
Total release size: 11.1 kB
Release files / pytest-timer-1.0.0.tar.gz
| Download URL | pytest-timer-1.0.0.tar.gz |
|---|---|
| Size | 5.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c65a36970e4425c0fd43bdf63b60359b353382632b08418c7c25918ec18a3829
|
|
BLAKE2b-256 checksum How to use checksums |
b1f7bc223798d5cccf2f03ed224a6fdceae005d06ae33fbd302741da9eb9e95a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Release files / pytest_timer-1.0.0-py3-none-any.whl
| Download URL | pytest_timer-1.0.0-py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
60f16a6d98dd5e8ce3e57ece829592f6e081e18be9f1b20e5bc93e5e7196b065
|
|
BLAKE2b-256 checksum How to use checksums |
9148486b6ff8b910852affeab5b628910f8faa861450a37c21c19902b798ebda
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Security for pytest-timer 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.