aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_asyncio/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_asyncio/utils.py')
-rw-r--r--Lib/test/test_asyncio/utils.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/Lib/test/test_asyncio/utils.py b/Lib/test/test_asyncio/utils.py
index c32494d40cc..07ef33d3fc2 100644
--- a/Lib/test/test_asyncio/utils.py
+++ b/Lib/test/test_asyncio/utils.py
@@ -109,13 +109,12 @@ def run_briefly(loop):
def run_until(loop, pred, timeout=support.SHORT_TIMEOUT):
- deadline = time.monotonic() + timeout
- while not pred():
- if timeout is not None:
- timeout = deadline - time.monotonic()
- if timeout <= 0:
- raise futures.TimeoutError()
+ for _ in support.busy_retry(timeout, error=False):
+ if pred():
+ break
loop.run_until_complete(tasks.sleep(0.001))
+ else:
+ raise futures.TimeoutError()
def run_once(loop):