8000 Avoid timing issues with test. · python/cpython@169294e · GitHub
[go: up one dir, main page]

Skip to content

Commit 169294e

Browse files
Avoid timing issues with test.
1 parent 54d0118 commit 169294e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Lib/test/test_asyncio/test_tasks.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,11 +1010,12 @@ def gen():
10101010

10111011
def test_wait_for_cancellation_race_condition(self):
10121012
async def inner():
1013-
await asyncio.wait_for(asyncio.sleep(1), timeout=2)
1013+
with contextlib.suppress(asyncio.CancelledError):
1014+
await asyncio.sleep(1)
10141015
return 1
10151016

10161017
async def main():
1017-
result = await asyncio.wait_for(inner(), timeout=1)
1018+
result = await asyncio.wait_for(inner(), timeout=.01)
10181019
assert result == 1
10191020

10201021
asyncio.run(main())

0 commit comments

Comments
 (0)
0