summaryrefslogtreecommitdiffstats
path: root/Lib/test/libregrtest
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2019-10-30 11:41:43 (GMT)
committerGitHub <noreply@github.com>2019-10-30 11:41:43 (GMT)
commit24c6258269acd842914450f55491690ba87dded9 (patch)
tree2276de8de900c3463a3e0823f92562f83b0f07c5 /Lib/test/libregrtest
parent865c3b257fe38154a4320c7ee6afb416f665b9c2 (diff)
downloadcpython-24c6258269acd842914450f55491690ba87dded9.zip
cpython-24c6258269acd842914450f55491690ba87dded9.tar.gz
cpython-24c6258269acd842914450f55491690ba87dded9.tar.bz2
bpo-38614: Add timeout constants to test.support (GH-16964)
Add timeout constants to test.support: * LOOPBACK_TIMEOUT * INTERNET_TIMEOUT * SHORT_TIMEOUT * LONG_TIMEOUT
Diffstat (limited to 'Lib/test/libregrtest')
-rw-r--r--Lib/test/libregrtest/setup.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/libregrtest/setup.py b/Lib/test/libregrtest/setup.py
index 5254e7f..ce81496 100644
--- a/Lib/test/libregrtest/setup.py
+++ b/Lib/test/libregrtest/setup.py
@@ -81,6 +81,17 @@ def setup_tests(ns):
setup_unraisable_hook()
+ if ns.timeout is not None:
+ # For a slow buildbot worker, increase SHORT_TIMEOUT and LONG_TIMEOUT
+ support.SHORT_TIMEOUT = max(support.SHORT_TIMEOUT, ns.timeout / 40)
+ support.LONG_TIMEOUT = max(support.LONG_TIMEOUT, ns.timeout / 4)
+
+ # If --timeout is short: reduce timeouts
+ support.LOOPBACK_TIMEOUT = min(support.LOOPBACK_TIMEOUT, ns.timeout)
+ support.INTERNET_TIMEOUT = min(support.INTERNET_TIMEOUT, ns.timeout)
+ support.SHORT_TIMEOUT = min(support.SHORT_TIMEOUT, ns.timeout)
+ support.LONG_TIMEOUT = min(support.LONG_TIMEOUT, ns.timeout)
+
def suppress_msvcrt_asserts(verbose):
try: