]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-110393: Remove watchdog with hardcoded timeout (#110400)
authorVictor Stinner <vstinner@python.org>
Thu, 5 Oct 2023 15:02:48 +0000 (17:02 +0200)
committerGitHub <noreply@github.com>
Thu, 5 Oct 2023 15:02:48 +0000 (15:02 +0000)
test_builtin and test_socketserver no longer use signal.alarm() to
implement a watchdog with a hardcoded timeout (2 and 60 seconds).
Python test runner regrtest has two watchdogs: faulthandler and
timeout on running worker processes. Tests using short hardcoded
timeout can fail on slowest buildbots just because the timeout is too
short.

Lib/test/test_builtin.py
Lib/test/test_socketserver.py

index 33cb248ff6e82b0c03ab5a0ad97f933b5329eae6..b7966f8f03875b301a2e9ad3c3d724b72bc7d23a 100644 (file)
@@ -2203,8 +2203,6 @@ class PtyTests(unittest.TestCase):
         if pid == 0:
             # Child
             try:
-                # Make sure we don't get stuck if there's a problem
-                signal.alarm(2)
                 os.close(r)
                 with open(w, "w") as wpipe:
                     child(wpipe)
index c81d559cde315dbb897c8b53131ef9712f2b9441..0f62f9eb200e42ddb4303fadc675e78b5b8f66bc 100644 (file)
@@ -32,11 +32,6 @@ requires_unix_sockets = unittest.skipUnless(HAVE_UNIX_SOCKETS,
 HAVE_FORKING = test.support.has_fork_support
 requires_forking = unittest.skipUnless(HAVE_FORKING, 'requires forking')
 
-def signal_alarm(n):
-    """Call signal.alarm when it exists (i.e. not on Windows)."""
-    if hasattr(signal, 'alarm'):
-        signal.alarm(n)
-
 # Remember real select() to avoid interferences with mocking
 _real_select = select.select
 
@@ -68,12 +63,10 @@ class SocketServerTest(unittest.TestCase):
     """Test all socket servers."""
 
     def setUp(self):
-        signal_alarm(60)  # Kill deadlocks after 60 seconds.
         self.port_seed = 0
         self.test_files = []
 
     def tearDown(self):
-        signal_alarm(0)  # Didn't deadlock.
         reap_children()
 
         for fn in self.test_files: