File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -52,10 +52,19 @@ def pytest_addoption(parser: Parser) -> None:
52
52
metavar = "N" ,
53
53
help = "show N slowest setup/test durations (N=0 for all)." ,
54
54
)
55
+ group .addoption (
56
+ "--durations-min" ,
57
+ action = "store" ,
58
+ type = float ,
59
+ default = 0.005 ,
60
+ metavar = "N" ,
61
+ help = "Minimal duration in seconds for inclusion in slowest list. Default 0.005" ,
62
+ )
55
63
56
64
57
65
def pytest_terminal_summary (terminalreporter : "TerminalReporter" ) -> None :
58
66
durations = terminalreporter .config .option .durations
67
+ durations_min = terminalreporter .config .option .durations_min
59
68
verbose = terminalreporter .config .getvalue ("verbose" )
60
69
if durations is None :
61
70
return
@@ -76,11 +85,11 @@ def pytest_terminal_summary(terminalreporter: "TerminalReporter") -> None:
76
85
dlist = dlist [:durations ]
77
86
78
87
for i , rep in enumerate (dlist ):
79
- if verbose < 2 and rep .duration < 0.005 :
88
+ if verbose < 2 and rep .duration < durations_min :
80
89
tr .write_line ("" )
81
90
tr .write_line (
82
- "(%s durations < 0.005s hidden. Use -vv to show these durations.)"
83
- % (len (dlist ) - i )
91
+ "(%s durations < %gs hidden. Use -vv to show these durations.)"
92
+ % (len (dlist ) - i , durations_min )
84
93
)
85
94
break
86
95
tr .write_line ("{:02.2f}s {:<8} {}" .format (rep .duration , rep .when , rep .nodeid ))
You can’t perform that action at this time.
0 commit comments