Exclude durations that are 0.00 seconds long.#4086
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4086 +/- ##
==========================================
- Coverage 94.5% 94.49% -0.02%
==========================================
Files 109 109
Lines 23813 23820 +7
Branches 2349 2351 +2
==========================================
+ Hits 22504 22508 +4
- Misses 1001 1004 +3
Partials 308 308
Continue to review full report at Codecov.
|
RonnyPfannschmidt
left a comment
There was a problem hiding this comment.
at first glance this looks great, nice simple and opt-out-able
nicoddemus
left a comment
There was a problem hiding this comment.
Great work @jeffreyrack, thanks!
I made a few minor comments, please let me know what you think.
Also, I think we can mention this in the docs. I think just adding something like:
By default, pytest will not show test durations that are too small (<0.01s) unless ``-vv`` is
passed on the command-line.To the end of the blurb in https://docs.pytest.org/en/latest/usage.html?highlight=durations#profiling-test-execution-duration would be enough.
| @@ -0,0 +1 @@ | |||
| Exclude 0.00 second entries from ``--duration`` output. | |||
There was a problem hiding this comment.
please complete with ... output, unless ``-vv`` is passed on the command-line.
| dlist = dlist[:durations] | ||
|
|
||
| for rep in dlist: | ||
| if verbose < 2 and rep.duration < 0.01: |
There was a problem hiding this comment.
should this take into account rounding (< 0.005 or whatever?)
is 0.009 displayed as 0.01? (I don't know, this could be fine already!)
There was a problem hiding this comment.
It uses 02.2f for formatting:
>>> '%02.2fs' % 0.009
'0.01s'
So I think this is fine as is. 👍
There was a problem hiding this comment.
wouldn't that mean it isn't fine since it's not displayed as 0.00s?
There was a problem hiding this comment.
it's certainly an edge case of an edge case though 😆
|
Thanks a lot @jeffreyrack, appreciate it! |
Implements #4063 by excluding 0.00 second long durations from the --durations output unless -vv is used.