From 9f980e70f1f507e47ad4c6f527c557b7c45ca572 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 25 Sep 2023 14:59:15 +0200 Subject: [PATCH] gh-109833: Fix asyncio test_wait_for() Expect the test to be "short" but don't measure the exact performance of the CI. By default, SHORT_TIMEOUT is about 30 seconds and LONG_TIMEOUT is about 5 minutes. --- Lib/test/test_asyncio/test_waitfor.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_asyncio/test_waitfor.py b/Lib/test/test_asyncio/test_waitfor.py index d5c02ba4a01df9..e714b154c5cadf 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 @@ async def foo(): 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 @@ async def foo(): 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):