Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

A pytest plugin to get durations on a per-function basis and per module basis.

Project description


Get more info about the speed of your test suite.

It works with pytest-xdist too.


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

pip install pytest-extra-durations


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.


============== Sum of all tests durations ===============

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


=============== slowest 4 modules durations =============
1.17s tensorflow_addons/activations/tests/
0.28s tensorflow_addons/activations/tests/
0.10s tensorflow_addons/activations/tests/
0.09s tensorflow_addons/activations/tests/

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


============ slowest test functions =============
0.99s tensorflow_addons/activations/tests/
0.17s tensorflow_addons/activations/tests/
0.09s tensorflow_addons/activations/tests/
0.08s tensorflow_addons/activations/tests/
0.08s tensorflow_addons/activations/tests/


  • Integration with line_profiler


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

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pytest-extra-durations, version 0.1.3
Filename, size File type Python version Upload date Hashes
Filename, size pytest_extra_durations-0.1.3-py3-none-any.whl (4.4 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size pytest-extra-durations-0.1.3.tar.gz (4.2 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page