Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c98b019

Browse files
authored
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.
1 parent bbc8b79 commit c98b019

3 files changed

Lines changed: 6 additions & 5 deletions

File tree

Lib/test/_test_multiprocessing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,15 +295,15 @@ def test_parent_process(self):
295295
target=self._test_create_grandchild_process, args=(wconn, ))
296296
p.start()
297297

298-
if not rconn.poll(timeout=60):
298+
if not rconn.poll(timeout=support.LONG_TIMEOUT):
299299
raise AssertionError("Could not communicate with child process")
300300
parent_process_status = rconn.recv()
301301
self.assertEqual(parent_process_status, "alive")
302302

303303
p.terminate()
304304
p.join()
305305

306-
if not rconn.poll(timeout=60):
306+
if not rconn.poll(timeout=support.LONG_TIMEOUT):
307307
raise AssertionError("Could not communicate with child process")
308308
parent_process_status = rconn.recv()
309309
self.assertEqual(parent_process_status, "not alive")

Lib/test/test_asyncio/test_sslproto.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from asyncio import log
1717
from asyncio import protocols
1818
from asyncio import sslproto
19+
from test import support
1920
from test.test_asyncio import utils as test_utils
2021
from test.test_asyncio import functional as func_tests
2122

@@ -163,7 +164,7 @@ def test_write_after_closing(self):
163164
class BaseStartTLS(func_tests.FunctionalTestCaseMixin):
164165

165166
PAYLOAD_SIZE = 1024 * 100
166-
TIMEOUT = 60
167+
TIMEOUT = support.LONG_TIMEOUT
167168

168169
def new_loop(self):
169170
raise NotImplementedError

Lib/test/test_logging.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,8 +1059,8 @@ class TestUnixDatagramServer(TestUDPServer):
10591059
# - end of server_helper section
10601060

10611061
class SMTPHandlerTest(BaseTest):
1062-
# bpo-14314, bpo-19665, bpo-34092: don't wait forever, timeout of 1 minute
1063-
TIMEOUT = 60.0
1062+
# bpo-14314, bpo-19665, bpo-34092: don't wait forever
1063+
TIMEOUT = support.LONG_TIMEOUT
10641064

10651065
def test_basic(self):
10661066
sockmap = {}

0 commit comments

Comments
 (0)