]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.11] gh-90867: test.support.wait_process() uses LONG_TIMEOUT (#99071) (#99098)
authorVictor Stinner <vstinner@python.org>
Fri, 4 Nov 2022 14:50:51 +0000 (15:50 +0100)
committerGitHub <noreply@github.com>
Fri, 4 Nov 2022 14:50:51 +0000 (15:50 +0100)
The test.support.wait_process() function now uses a timeout of
LONG_TIMEOUT seconds by default, instead of SHORT_TIMEOUT.  It
doesn't matter if a Python buildbot is slower, it only matters that
the process completes. The timeout should just be shorter than
"forever".

(cherry picked from commit f09da28768b77713566e932e912f107b6b57e8fd)

Lib/test/support/__init__.py

index 8ee8147f4161d0cd0d3f6fe647e2b1fdfe0553ef..c33f90d8071df97b65934e14ae2195ac400f0bc8 100644 (file)
@@ -2078,7 +2078,7 @@ def wait_process(pid, *, exitcode, timeout=None):
 
     Raise an AssertionError if the process exit code is not equal to exitcode.
 
-    If the process runs longer than timeout seconds (SHORT_TIMEOUT by default),
+    If the process runs longer than timeout seconds (LONG_TIMEOUT by default),
     kill the process (if signal.SIGKILL is available) and raise an
     AssertionError. The timeout feature is not available on Windows.
     """
@@ -2086,7 +2086,7 @@ def wait_process(pid, *, exitcode, timeout=None):
         import signal
 
         if timeout is None:
-            timeout = SHORT_TIMEOUT
+            timeout = LONG_TIMEOUT
         t0 = time.monotonic()
         sleep = 0.001
         max_sleep = 0.1
@@ -2097,7 +2097,7 @@ def wait_process(pid, *, exitcode, timeout=None):
             # process is still running
 
             dt = time.monotonic() - t0
-            if dt > SHORT_TIMEOUT:
+            if dt > timeout:
                 try:
                     os.kill(pid, signal.SIGKILL)
                     os.waitpid(pid, 0)