Pytest: Show human readable times on summary

Created on 7 Aug 2019  路  12Comments  路  Source: pytest-dev/pytest

Currently the test summary shows the total time in seconds:

============== 11 passed in 174.98 seconds ==============

I propose we show a human-readable times instead:

============== 11 passed in 2:54.98 seconds =============
reporting enhancement proposal

Most helpful comment

Here's how the last 2 suggestions look like, using pytest's own summary so we can look at a real case:

====== 2377 passed, 85 skipped, 11 xfailed, 1 warnings in 342.63 seconds ======= 

Changes to:

==== 2377 passed, 85 skipped, 11 xfailed, 1 warnings in 342.63s (00:05:42) =====

I personally like it. 馃憤

All 12 comments

maybe I'm wrong but I kinda like the base 10 time as-is

We have long running test suites at work, so I suspect showing the time in minutes is more helpful. I will conduct a quick survey around the office to gather more data.

nice idea, unit may need adaption, it reads strange as proposed

i wonder if rounding would help at certain time frames

aka roughly 3 minutes instead of 2:58.34 or 3:02.1 but that kind of formatting should be outsourced ^^

I don't think fractions of a second are interesting, but "roughly 3 minutes" would certainly annoy me when trying to e.g. speed up my testsuite.

I also prefer to tend to be more exact than adding an approximation, and I agree dropping the fractions of a second is reasonable.

So I think we are converging to this:

============ 11 passed in 2:54 =============

We might also consider adding the unit:

============ 11 passed in 2:54s =============

I made a quick poll here at work, so far it is unanimous to have the human-readable times.

My $0.02: "[hh:]mm:ss" should be clear enough. IMHO adding "s" makes it more ambiguous as now you can't be sure if it's 2min 45s or 2.54s.

@The-Compiler fair enough.

What about leaving both information, as both are useful, e.g.:

============ 11 passed in 174.98 s (02:55) =============

I guess @tadeu 's suggestion looks good. However I think using hh:mm:ss would be more interesting, e.g.,

============ 11 passed in 174.98 s (00:02:54) =============

I am aware that tests are not supposed to take hours to run, but using the complete notation seems to eliminate any confusion.

Here's how the last 2 suggestions look like, using pytest's own summary so we can look at a real case:

====== 2377 passed, 85 skipped, 11 xfailed, 1 warnings in 342.63 seconds ======= 

Changes to:

==== 2377 passed, 85 skipped, 11 xfailed, 1 warnings in 342.63s (00:05:42) =====

I personally like it. 馃憤

Also we should not show the human-readable part if the test suite takes less than X seconds, perhaps with X=60.

I'm fine with both, just as long as I can still read a base 10 time without having to convert in my head to compare 馃槅

Was this page helpful?
0 / 5 - 0 ratings