summaryrefslogtreecommitdiffstats
path: root/Lib/test/_test_multiprocessing.py
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2022-06-15 16:49:14 (GMT)
committerGitHub <noreply@github.com>2022-06-15 16:49:14 (GMT)
commit50e0866f8792941d2aea8937c63d1cb37bbc35cf (patch)
tree39d7ab435d4e961ca1212c5ab6453b0bb687376b /Lib/test/_test_multiprocessing.py
parent46e455f21c23b03fd68055fbd97e9d0c449f00a5 (diff)
downloadcpython-50e0866f8792941d2aea8937c63d1cb37bbc35cf.zip
cpython-50e0866f8792941d2aea8937c63d1cb37bbc35cf.tar.gz
cpython-50e0866f8792941d2aea8937c63d1cb37bbc35cf.tar.bz2
Tests call sleeping_retry() with SHORT_TIMEOUT (#93870)
Tests now call busy_retry() and sleeping_retry() with SHORT_TIMEOUT or LONG_TIMEOUT (of test.support), rather than hardcoded constants. Add also WAIT_ACTIVE_CHILDREN_TIMEOUT constant to _test_multiprocessing.
Diffstat (limited to 'Lib/test/_test_multiprocessing.py')
-rw-r--r--Lib/test/_test_multiprocessing.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py
index dca5a19..b20bc0b 100644
--- a/Lib/test/_test_multiprocessing.py
+++ b/Lib/test/_test_multiprocessing.py
@@ -124,6 +124,8 @@ else:
# BaseManager.shutdown_timeout
SHUTDOWN_TIMEOUT = support.SHORT_TIMEOUT
+WAIT_ACTIVE_CHILDREN_TIMEOUT = 5.0
+
HAVE_GETVALUE = not getattr(_multiprocessing,
'HAVE_BROKEN_SEM_GETVALUE', False)
@@ -5569,8 +5571,9 @@ class TestSyncManagerTypes(unittest.TestCase):
# if there are other children too (see #17395).
join_process(self.proc)
+ timeout = WAIT_ACTIVE_CHILDREN_TIMEOUT
start_time = time.monotonic()
- for _ in support.sleeping_retry(5.0, error=False):
+ for _ in support.sleeping_retry(timeout, error=False):
if len(multiprocessing.active_children()) <= 1:
break
else:
@@ -5875,8 +5878,9 @@ class ManagerMixin(BaseMixin):
# only the manager process should be returned by active_children()
# but this can take a bit on slow machines, so wait a few seconds
# if there are other children too (see #17395)
+ timeout = WAIT_ACTIVE_CHILDREN_TIMEOUT
start_time = time.monotonic()
- for _ in support.sleeping_retry(5.0, error=False):
+ for _ in support.sleeping_retry(timeout, error=False):
if len(multiprocessing.active_children()) <= 1:
break
else: