summaryrefslogtreecommitdiffstats
path: root/Lib/test/test__xxsubinterpreters.py
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2022-06-15 09:42:10 (GMT)
committerGitHub <noreply@github.com>2022-06-15 09:42:10 (GMT)
commit7e9eaad864349d2cfd4c9ffc4453aba03b2cbc16 (patch)
tree7bc4498a4c5ad027208a714ff9281d2f4639e301 /Lib/test/test__xxsubinterpreters.py
parent4e9fa71d7e8e2f322f0b81b315ddc921f57384c0 (diff)
downloadcpython-7e9eaad864349d2cfd4c9ffc4453aba03b2cbc16.zip
cpython-7e9eaad864349d2cfd4c9ffc4453aba03b2cbc16.tar.gz
cpython-7e9eaad864349d2cfd4c9ffc4453aba03b2cbc16.tar.bz2
Add test.support.busy_retry() (#93770)
Add busy_retry() and sleeping_retry() functions to test.support.
Diffstat (limited to 'Lib/test/test__xxsubinterpreters.py')
-rw-r--r--Lib/test/test__xxsubinterpreters.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/Lib/test/test__xxsubinterpreters.py b/Lib/test/test__xxsubinterpreters.py
index 5d0ed9e..f20aae8 100644
--- a/Lib/test/test__xxsubinterpreters.py
+++ b/Lib/test/test__xxsubinterpreters.py
@@ -45,12 +45,11 @@ def _wait_for_interp_to_run(interp, timeout=None):
# run subinterpreter eariler than the main thread in multiprocess.
if timeout is None:
timeout = support.SHORT_TIMEOUT
- start_time = time.monotonic()
- deadline = start_time + timeout
- while not interpreters.is_running(interp):
- if time.monotonic() > deadline:
- raise RuntimeError('interp is not running')
- time.sleep(0.010)
+ for _ in support.sleeping_retry(timeout, error=False):
+ if interpreters.is_running(interp):
+ break
+ else:
+ raise RuntimeError('interp is not running')
@contextlib.contextmanager