From cf65fdeb60914f7b8f03c7dda14da689bdee2e2e Mon Sep 17 00:00:00 2001 From: Kevin Deldycke Date: Fri, 29 Nov 2024 10:38:35 +0400 Subject: [PATCH] Fix timer test timing on slow platforms --- tests/test_timer.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/test_timer.py b/tests/test_timer.py index 3397539db..43922fd03 100644 --- a/tests/test_timer.py +++ b/tests/test_timer.py @@ -47,13 +47,13 @@ def slow_subcommand(): @parametrize( - "subcommand_id, time_min, time_max", + "subcommand_id, time_min", ( - ("fast", 0.01, 0.2), - ("slow", 0.1, 1), + ("fast", 0.01), + ("slow", 0.1), ), ) -def test_integrated_time_option(invoke, subcommand_id, time_min, time_max): +def test_integrated_time_option(invoke, subcommand_id, time_min): result = invoke(integrated_timer, "--time", f"{subcommand_id}-subcommand") assert result.exit_code == 0 assert not result.stderr @@ -63,7 +63,8 @@ def test_integrated_time_option(invoke, subcommand_id, time_min, time_max): result.stdout, ) assert group - assert time_min < float(group.groupdict()["time"]) < time_max + # Hard-code upper bound to avoid flakiness on slow platforms like macOS. + assert time_min < float(group.groupdict()["time"]) < 10 @parametrize("subcommand_id", ("fast", "slow"))