[Python-checkins] bpo-38614: Use test.support.LONG_TIMEOUT constant (GH-17562)

Victor Stinner webhook-mailer at python.org
Tue Dec 10 15:12:32 EST 2019


https://github.com/python/cpython/commit/c98b0199a984430312833ef403d265be314f7244
commit: c98b0199a984430312833ef403d265be314f7244
branch: master
author: Victor Stinner <vstinner at python.org>
committer: GitHub <noreply at github.com>
date: 2019-12-10T21:12:26+01:00
summary:

bpo-38614: Use test.support.LONG_TIMEOUT constant (GH-17562)

Replace hardcoded timeout constants in tests with LONG_TIMEOUT of
test.support, so it's easier to ajdust this timeout for all tests at
once.

LONG_TIMEOUT is 5 minutes by default, but it can be longer depending
on --timeout command line option.

files:
M Lib/test/_test_multiprocessing.py
M Lib/test/test_asyncio/test_sslproto.py
M Lib/test/test_logging.py

diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py
index 611291cbbaf93..86f3d1ca3a36a 100644
--- a/Lib/test/_test_multiprocessing.py
+++ b/Lib/test/_test_multiprocessing.py
@@ -295,7 +295,7 @@ def test_parent_process(self):
             target=self._test_create_grandchild_process, args=(wconn, ))
         p.start()
 
-        if not rconn.poll(timeout=60):
+        if not rconn.poll(timeout=support.LONG_TIMEOUT):
             raise AssertionError("Could not communicate with child process")
         parent_process_status = rconn.recv()
         self.assertEqual(parent_process_status, "alive")
@@ -303,7 +303,7 @@ def test_parent_process(self):
         p.terminate()
         p.join()
 
-        if not rconn.poll(timeout=60):
+        if not rconn.poll(timeout=support.LONG_TIMEOUT):
             raise AssertionError("Could not communicate with child process")
         parent_process_status = rconn.recv()
         self.assertEqual(parent_process_status, "not alive")
diff --git a/Lib/test/test_asyncio/test_sslproto.py b/Lib/test/test_asyncio/test_sslproto.py
index 7ba3d7361ad8a..8e9d4c5194f6f 100644
--- a/Lib/test/test_asyncio/test_sslproto.py
+++ b/Lib/test/test_asyncio/test_sslproto.py
@@ -16,6 +16,7 @@
 from asyncio import log
 from asyncio import protocols
 from asyncio import sslproto
+from test import support
 from test.test_asyncio import utils as test_utils
 from test.test_asyncio import functional as func_tests
 
@@ -163,7 +164,7 @@ def test_write_after_closing(self):
 class BaseStartTLS(func_tests.FunctionalTestCaseMixin):
 
     PAYLOAD_SIZE = 1024 * 100
-    TIMEOUT = 60
+    TIMEOUT = support.LONG_TIMEOUT
 
     def new_loop(self):
         raise NotImplementedError
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py
index 3b135b8ddf966..4feed03fec2a8 100644
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -1059,8 +1059,8 @@ class TestUnixDatagramServer(TestUDPServer):
 # - end of server_helper section
 
 class SMTPHandlerTest(BaseTest):
-    # bpo-14314, bpo-19665, bpo-34092: don't wait forever, timeout of 1 minute
-    TIMEOUT = 60.0
+    # bpo-14314, bpo-19665, bpo-34092: don't wait forever
+    TIMEOUT = support.LONG_TIMEOUT
 
     def test_basic(self):
         sockmap = {}



More information about the Python-checkins mailing list