Tests: Take timing variance into account when flagging slow tests

This commit is contained in:
Ole Schütt 2025-06-06 11:20:43 +02:00 committed by Ole Schütt
parent d3e36fe426
commit c9db3194df

View file

@ -213,7 +213,7 @@ async def main() -> None:
for t in await asyncio.gather(*rerun_tasks):
rerun_times.update({r.fullname: r.duration for r in t.results})
stats = {r.fullname: [r.duration, rerun_times[r.fullname]] for r in maybe_slow}
slow_tests = {k: v for k, v in stats.items() if mean(v) > threshold}
slow_tests = {k: v for k, v in stats.items() if mean(v) - stdev(v) > threshold}
print(f"Duration threshold (2x 95th %ile): {threshold:.2f} sec")
print(f"Found {len(slow_tests)} slow tests ({num_suppressed} suppressed):")
for k, v in slow_tests.items():