mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-38614: Add timeout constants to test.support (GH-16964)
Add timeout constants to test.support: * LOOPBACK_TIMEOUT * INTERNET_TIMEOUT * SHORT_TIMEOUT * LONG_TIMEOUT
This commit is contained in:
parent
865c3b257f
commit
24c6258269
6 changed files with 145 additions and 26 deletions
|
@ -37,7 +37,6 @@ except ImportError:
|
|||
HOST = support.HOST
|
||||
# test unicode string and carriage return
|
||||
MSG = 'Michael Gilfix was here\u1234\r\n'.encode('utf-8')
|
||||
MAIN_TIMEOUT = 60.0
|
||||
|
||||
VSOCKPORT = 1234
|
||||
AIX = platform.system() == "AIX"
|
||||
|
@ -2527,7 +2526,7 @@ class SendrecvmsgBase(ThreadSafeCleanupTestCase):
|
|||
|
||||
# Time in seconds to wait before considering a test failed, or
|
||||
# None for no timeout. Not all tests actually set a timeout.
|
||||
fail_timeout = 3.0
|
||||
fail_timeout = support.LOOPBACK_TIMEOUT
|
||||
|
||||
def setUp(self):
|
||||
self.misc_event = threading.Event()
|
||||
|
@ -4320,7 +4319,7 @@ class InterruptedTimeoutBase(unittest.TestCase):
|
|||
self.addCleanup(signal.signal, signal.SIGALRM, orig_alrm_handler)
|
||||
|
||||
# Timeout for socket operations
|
||||
timeout = 4.0
|
||||
timeout = support.LOOPBACK_TIMEOUT
|
||||
|
||||
# Provide setAlarm() method to schedule delivery of SIGALRM after
|
||||
# given number of seconds, or cancel it if zero, and an
|
||||
|
@ -4610,7 +4609,7 @@ class NonBlockingTCPTests(ThreadedTCPSocketTest):
|
|||
|
||||
self.event.set()
|
||||
|
||||
read, write, err = select.select([self.serv], [], [], MAIN_TIMEOUT)
|
||||
read, write, err = select.select([self.serv], [], [], support.LONG_TIMEOUT)
|
||||
if self.serv not in read:
|
||||
self.fail("Error trying to do accept after select.")
|
||||
|
||||
|
@ -4638,7 +4637,7 @@ class NonBlockingTCPTests(ThreadedTCPSocketTest):
|
|||
|
||||
self.event.set()
|
||||
|
||||
read, write, err = select.select([conn], [], [], MAIN_TIMEOUT)
|
||||
read, write, err = select.select([conn], [], [], support.LONG_TIMEOUT)
|
||||
if conn not in read:
|
||||
self.fail("Error during select call to non-blocking socket.")
|
||||
|
||||
|
@ -5838,8 +5837,7 @@ class SendfileUsingSendTest(ThreadedTCPSocketTest):
|
|||
FILESIZE = (10 * 1024 * 1024) # 10 MiB
|
||||
BUFSIZE = 8192
|
||||
FILEDATA = b""
|
||||
# bpo-37553: This is taking longer than 2 seconds on Windows ARM32 buildbot
|
||||
TIMEOUT = 10 if sys.platform == 'win32' and platform.machine() == 'ARM' else 2
|
||||
TIMEOUT = support.LOOPBACK_TIMEOUT
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
|
@ -5865,7 +5863,7 @@ class SendfileUsingSendTest(ThreadedTCPSocketTest):
|
|||
support.unlink(support.TESTFN)
|
||||
|
||||
def accept_conn(self):
|
||||
self.serv.settimeout(MAIN_TIMEOUT)
|
||||
self.serv.settimeout(support.LONG_TIMEOUT)
|
||||
conn, addr = self.serv.accept()
|
||||
conn.settimeout(self.TIMEOUT)
|
||||
self.addCleanup(conn.close)
|
||||
|
@ -6369,7 +6367,7 @@ class CreateServerTest(unittest.TestCase):
|
|||
|
||||
|
||||
class CreateServerFunctionalTest(unittest.TestCase):
|
||||
timeout = 3
|
||||
timeout = support.LOOPBACK_TIMEOUT
|
||||
|
||||
def setUp(self):
|
||||
self.thread = None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue