Skip to content

Commit 6da7bcc

Browse files
committed
Use less extreme values for min and max timedelta in tests
When getting so close to the limits, weird things can happen, so we should give some extra room to avoid flaky errors. Signed-off-by: Leandro Lucarella <[email protected]>
1 parent c518a74 commit 6da7bcc

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

tests/test_timer.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,12 @@ def event_loop() -> Iterator[async_solipsism.EventLoop]:
3131
loop.close()
3232

3333

34-
_max_timedelta_microseconds = (
35-
int(
36-
timedelta.max.total_seconds() * 1_000_000,
37-
)
38-
- 1
39-
)
34+
# We give some extra room (dividing by 10) to the max and min to avoid flaky errors
35+
# failing when getting too close to the limits, as these are not realistic scenarios and
36+
# weird things can happen.
37+
_max_timedelta_microseconds = int(timedelta.max.total_seconds() * 1_000_000 / 10)
4038

41-
_min_timedelta_microseconds = (
42-
int(
43-
timedelta.min.total_seconds() * 1_000_000,
44-
)
45-
+ 1
46-
)
39+
_min_timedelta_microseconds = int(timedelta.min.total_seconds() * 1_000_000 / 10)
4740

4841
_calculate_next_tick_time_args = {
4942
"now": st.integers(),

0 commit comments

Comments
 (0)