Skip to content

Commit

Permalink
Fix timer test timing on slow platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
kdeldycke committed Nov 29, 2024
1 parent f621b5f commit cf65fde
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions tests/test_timer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"))
Expand Down

0 comments on commit cf65fde

Please sign in to comment.