question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Show run-time (total or mean?) per module

See original GitHub issue

In the latest version (3.3+ I think), pytest shows an overall percentage of completion in a column behind the test-module names.

I have a couple of modules which take quite a long time, and identifying slow-running test modules might help optimise the tests a bit. But I’m not always actively looking at the console output while the tests are running.

Having some kind of timing information might be interesting.

The existing --durations argument only shows the runtime of the top-n slowest unit-tests. But if you have a couple tests which cannot be improved for speed, those always show up in that list which may hide other slow-running tests.

For example, imagine a sub-optimal setup/teardown on a module. This can easily increase the overall run-time very quickly and can also be easy to remedy. Identifying modules where the unit-tests run on average slower than on other modules might help.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
nicoddemuscommented, Dec 14, 2017

Hey @exhuma,

I think the idea is good, but I think once we do that we might start to come up with other interesting measurements (for instance, sort by fixture setup/teardown instead of total module time) and that doesn’t scale well to add to the core I think.

Perhaps creating a plugin (pytest-timings? 😉) might be a better approach in the long run, because it might grow interesting new measurements on its own.

1reaction
Zac-HDcommented, Oct 29, 2019

Closing this issue with a recommendation to use the pytest-harvest plugin - thanks smarie!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python Measure the Execution Time of a Program - PYnative
Note: This solution measures the Wall time, i.e., total elapsed time, not a CPU time. The below steps show how to measure the...
Read more >
Measure execution time with timeit in Python - nkmk note
In Python, you can easily measure the execution time with the timeit module of the standard library.timeit — Measure execution time of small ......
Read more >
Module Basics : TechWeb - Boston University
Below is a basic sequence of module commands to use to get started using modules on the SCC. List all available modules by...
Read more >
timeit — Measure execution time of small code snippets ...
This module provides a simple way to time small bits of Python code. It has both a Command-Line Interface as well as a...
Read more >
Understand the Azure IoT Edge runtime and its architecture
Routing can be used by devices or modules built with the Azure IoT Device SDKs using the AMQP protocol. All messaging IoT Hub...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found