diff options
author | Victor Stinner <vstinner@python.org> | 2023-09-25 13:27:36 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-25 13:27:36 (GMT) |
commit | f29bc9c9a0a6794c6b8a9e84a7ba9237b427a10a (patch) | |
tree | 49f4d53bbda7fc6673f386c17a10fded5407d001 | |
parent | bccc1b78002c924e8f4121fea5de7df5eb127548 (diff) | |
download | cpython-f29bc9c9a0a6794c6b8a9e84a7ba9237b427a10a.zip cpython-f29bc9c9a0a6794c6b8a9e84a7ba9237b427a10a.tar.gz cpython-f29bc9c9a0a6794c6b8a9e84a7ba9237b427a10a.tar.bz2 |
gh-109833: Fix asyncio test_wait_for() (#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.
-rw-r--r-- | Lib/test/test_asyncio/test_waitfor.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/test/test_asyncio/test_waitfor.py b/Lib/test/test_asyncio/test_waitfor.py index d5c02ba..e714b15 100644 --- a/Lib/test/test_asyncio/test_waitfor.py +++ b/Lib/test/test_asyncio/test_waitfor.py @@ -1,6 +1,7 @@ import asyncio import unittest import time +from test import support def tearDownModule(): @@ -130,7 +131,7 @@ class AsyncioWaitForTest(unittest.IsolatedAsyncioTestCase): nonlocal foo_running foo_running = True try: - await asyncio.sleep(10) + await asyncio.sleep(support.LONG_TIMEOUT) finally: foo_running = False return 'done' @@ -144,7 +145,7 @@ class AsyncioWaitForTest(unittest.IsolatedAsyncioTestCase): self.assertTrue(fut.done()) # it should have been cancelled due to the timeout self.assertTrue(fut.cancelled()) - self.assertLess(t1 - t0, 0.5) + self.assertLess(t1 - t0, support.SHORT_TIMEOUT) self.assertEqual(foo_running, False) async def test_wait_for_blocking(self): |