diff --git a/src/_pytest/runner.py b/src/_pytest/runner.py index 833d288f0..794690ddb 100644 --- a/src/_pytest/runner.py +++ b/src/_pytest/runner.py @@ -77,8 +77,7 @@ def pytest_terminal_summary(terminalreporter: "TerminalReporter") -> None: dlist.append(rep) if not dlist: return - dlist.sort(key=lambda x: x.duration) # type: ignore[no-any-return] - dlist.reverse() + dlist.sort(key=lambda x: x.duration, reverse=True) # type: ignore[no-any-return] if not durations: tr.write_sep("=", "slowest durations") else: