Skip to main content

pytest-extra-durations

Get more info about the speed of your test suite.

It works with pytest-xdist too.

Installation

You can install "pytest-extra-durations" via pip:

pip install pytest-extra-durations

Usage

This plugin provides three types of information.

The sum of all tests/setup/teardown durations

This can give you more info than the total time displayed by pytest because it's not influenced by the number of workers in pytest-dist, or the collection time.

Exemple:

============== Sum of all tests durations ===============
1.95s

This will be displayed all the time and can't be turned off unless you uninstall this plugin.

The sum of all the tests durations of a module

This will tell you how much time it took to execute all the tests in a given file. The API is similar to the one of --durations in the Pytest CLI.

pytest --modules-durations=4 ./path/to/test/directory

gives:

=============== slowest 4 modules durations =============
1.17s tensorflow_addons/activations/tests/sparsemax_test.py
0.28s tensorflow_addons/activations/tests/gelu_test.py
0.10s tensorflow_addons/activations/tests/softshrink_test.py
0.09s tensorflow_addons/activations/tests/rrelu_test.py

The sum of all the tests durations of a test function

A test function can produce multiple tests, that can be executed on different workers too. This will sum the durations of all tests, setups and teardown produced by a single test function, and report the slower ones.

The API is similar to the one of --durations in the Pytest CLI.

pytest --functions-durations=4 ./path/to/test/directory

gives:

============ slowest test functions =============
0.99s tensorflow_addons/activations/tests/sparsemax_test.py::test_gradient_against_estimate
0.17s tensorflow_addons/activations/tests/gelu_test.py::test_same_as_py_func
0.09s tensorflow_addons/activations/tests/softshrink_test.py::test_same_as_py_func
0.08s tensorflow_addons/activations/tests/gelu_test.py::test_gelu
0.08s tensorflow_addons/activations/tests/rrelu_test.py::test_theoretical_gradients

TODO:

  • Integration with line_profiler

License

Distributed under the terms of the MIT_ license, "pytest-extra-durations" is free and open source software

Metadata

Release files for pytest-extra-durations 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-extra-durations 0.1.3
File Size Uploaded
pytest-extra-durations-0.1.3.tar.gz 4.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-extra-durations 0.1.3
File Interpreter ABI Platform
pytest_extra_durations-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 8.7 kB

Release files / pytest-extra-durations-0.1.3.tar.gz

Download URL pytest-extra-durations-0.1.3.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b67a681e3432285c0201451f328782ee65f8e5592c5739cd732d315545de82a4
BLAKE2b-256 checksum
How to use checksums
9e9c9f42b36184b5cbb4ea8e4a8c6402fe9772afba8fa3d22bb488d8886cdcf0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

Release files / pytest_extra_durations-0.1.3-py3-none-any.whl

Download URL pytest_extra_durations-0.1.3-py3-none-any.whl
Size 4.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5ad27c7302cc124884e04bd8feafa5995e2997c0805b3ce4189f9ff1288e1091
BLAKE2b-256 checksum
How to use checksums
c48aba599f530bf58e2fc70d3722a548974beddfab49aec480770714f53f0545
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page