Skip to content

Commit d487a95

Browse files
committed
less racy way test_ensure_task_limit_window_passed
1 parent 474d856 commit d487a95

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tests/units/utils/test_tasks.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,10 @@ async def test_ensure_task_limit_window_passed():
7575
"""Test that ensure_task raises after exceeding exception limit within the limit window."""
7676
call_count = 0
7777

78-
async def faulty_coro(): # noqa: RUF029
78+
async def faulty_coro():
7979
nonlocal call_count
8080
call_count += 1
81+
await asyncio.sleep(0.05)
8182
if call_count > 3:
8283
raise RuntimeError("Test Passed") # noqa: EM101
8384
raise ValueError("Should have been suppressed") # noqa: EM101
@@ -88,7 +89,7 @@ async def faulty_coro(): # noqa: RUF029
8889
task_attribute="task",
8990
coro_function=faulty_coro,
9091
suppress_exceptions=[ValueError],
91-
exception_delay=0.05,
92+
exception_delay=0,
9293
exception_limit=3,
9394
exception_limit_window=0.1,
9495
)

0 commit comments

Comments
 (0)