(terminalreporter: "TerminalReporter")
| 68 | |
| 69 | |
| 70 | def pytest_terminal_summary(terminalreporter: "TerminalReporter") -> None: |
| 71 | durations = terminalreporter.config.option.durations |
| 72 | durations_min = terminalreporter.config.option.durations_min |
| 73 | verbose = terminalreporter.config.getvalue("verbose") |
| 74 | if durations is None: |
| 75 | return |
| 76 | tr = terminalreporter |
| 77 | dlist = [] |
| 78 | for replist in tr.stats.values(): |
| 79 | for rep in replist: |
| 80 | if hasattr(rep, "duration"): |
| 81 | dlist.append(rep) |
| 82 | if not dlist: |
| 83 | return |
| 84 | dlist.sort(key=lambda x: x.duration, reverse=True) # type: ignore[no-any-return] |
| 85 | if not durations: |
| 86 | tr.write_sep("=", "slowest durations") |
| 87 | else: |
| 88 | tr.write_sep("=", "slowest %s durations" % durations) |
| 89 | dlist = dlist[:durations] |
| 90 | |
| 91 | for i, rep in enumerate(dlist): |
| 92 | if verbose < 2 and rep.duration < durations_min: |
| 93 | tr.write_line("") |
| 94 | tr.write_line( |
| 95 | "(%s durations < %gs hidden. Use -vv to show these durations.)" |
| 96 | % (len(dlist) - i, durations_min) |
| 97 | ) |
| 98 | break |
| 99 | tr.write_line(f"{rep.duration:02.2f}s {rep.when:<8} {rep.nodeid}") |
| 100 | |
| 101 | |
| 102 | def pytest_sessionstart(session: "Session") -> None: |
nothing calls this directly
no test coverage detected