summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_wait3.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_wait3.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_wait3.py')
-rw-r--r--Lib/test/test_wait3.py5
1 files changed, 1 insertions, 4 deletions
diff --git a/Lib/test/test_wait3.py b/Lib/test/test_wait3.py
index 4ec7690..15d66ae 100644
--- a/Lib/test/test_wait3.py
+++ b/Lib/test/test_wait3.py
@@ -4,7 +4,6 @@
import os
import subprocess
import sys
-import time
import unittest
from test.fork_wait import ForkWait
from test import support
@@ -20,14 +19,12 @@ class Wait3Test(ForkWait):
# This many iterations can be required, since some previously run
# tests (e.g. test_ctypes) could have spawned a lot of children
# very quickly.
- deadline = time.monotonic() + support.SHORT_TIMEOUT
- while time.monotonic() <= deadline:
+ for _ in support.sleeping_retry(support.SHORT_TIMEOUT, error=False):
# wait3() shouldn't hang, but some of the buildbots seem to hang
# in the forking tests. This is an attempt to fix the problem.
spid, status, rusage = os.wait3(os.WNOHANG)
if spid == cpid:
break
- time.sleep(0.1)
self.assertEqual(spid, cpid)
self.assertEqual(os.waitstatus_to_exitcode(status), exitcode)