Skip to content

Commit efd6bfb

Browse files
authored
Improve aio utils tests to validate high lock contention (#655)
1 parent 3c61d03 commit efd6bfb

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

tests/utils/test_aio.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,12 @@ async def _hold_condition():
3737
task = asyncio.ensure_future(_hold_condition())
3838
await asyncio.sleep(0.1)
3939

40-
async with test_cond:
41-
await aioutils.wait_condition_or_timeout(test_cond, 0.1)
40+
async def _async_wait_or_timeout():
41+
async with test_cond:
42+
await aioutils.wait_condition_or_timeout(test_cond, 0.1)
43+
44+
# Test high lock contention
45+
await asyncio.gather(*[_async_wait_or_timeout() for _ in range(100)])
4246

4347
task.cancel()
4448
with contextlib.suppress(asyncio.CancelledError):

0 commit comments

Comments
 (0)