Skip to content

Commit 641e489

Browse files
vstinnerGlyphack
authored andcommitted
pythongh-109833: Fix asyncio test_wait_for() (python#109834)
Expect the test to be "short" but don't measure the exact performance of the CI. SHORT_TIMEOUT is about 30 seconds whereas the cancelled coroutine takes around 1 hour.
1 parent 41d58be commit 641e489

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Lib/test/test_asyncio/test_waitfor.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import asyncio
22
import unittest
33
import time
4+
from test import support
45

56

67
def tearDownModule():
@@ -130,7 +131,7 @@ async def foo():
130131
nonlocal foo_running
131132
foo_running = True
132133
try:
133-
await asyncio.sleep(10)
134+
await asyncio.sleep(support.LONG_TIMEOUT)
134135
finally:
135136
foo_running = False
136137
return 'done'
@@ -144,7 +145,7 @@ async def foo():
144145
self.assertTrue(fut.done())
145146
# it should have been cancelled due to the timeout
146147
self.assertTrue(fut.cancelled())
147-
self.assertLess(t1 - t0, 0.5)
148+
self.assertLess(t1 - t0, support.SHORT_TIMEOUT)
148149
self.assertEqual(foo_running, False)
149150

150151
async def test_wait_for_blocking(self):

0 commit comments

Comments
 (0)