MCPcopy Index your code
hub / github.com/python/cpython / setup_tests

Function setup_tests

Lib/test/libregrtest/setup.py:99–149  ·  view source on GitHub ↗
(runtests: RunTests)

Source from the content-addressed store, hash-verified

97
98
99def setup_tests(runtests: RunTests) -> None:
100 support.verbose = runtests.verbose
101 support.failfast = runtests.fail_fast
102 support.PGO = runtests.pgo
103 support.PGO_EXTENDED = runtests.pgo_extended
104
105 set_match_tests(runtests.match_tests)
106
107 if runtests.use_junit:
108 support.junit_xml_list = []
109 from .testresult import RegressionTestResult
110 RegressionTestResult.USE_XML = True
111 else:
112 support.junit_xml_list = None
113
114 if runtests.memory_limit is not None:
115 support.set_memlimit(runtests.memory_limit)
116
117 support.suppress_msvcrt_asserts(runtests.verbose >= 2)
118
119 support.use_resources = runtests.use_resources
120
121 timeout = runtests.timeout
122 if timeout is not None:
123 # For a slow buildbot worker, increase SHORT_TIMEOUT and LONG_TIMEOUT
124 support.LOOPBACK_TIMEOUT = max(support.LOOPBACK_TIMEOUT, timeout / 120)
125 # don't increase INTERNET_TIMEOUT
126 support.SHORT_TIMEOUT = max(support.SHORT_TIMEOUT, timeout / 40)
127 support.LONG_TIMEOUT = max(support.LONG_TIMEOUT, timeout / 4)
128
129 # If --timeout is short: reduce timeouts
130 support.LOOPBACK_TIMEOUT = min(support.LOOPBACK_TIMEOUT, timeout)
131 support.INTERNET_TIMEOUT = min(support.INTERNET_TIMEOUT, timeout)
132 support.SHORT_TIMEOUT = min(support.SHORT_TIMEOUT, timeout)
133 support.LONG_TIMEOUT = min(support.LONG_TIMEOUT, timeout)
134
135 if runtests.hunt_refleak:
136 # private attribute that mypy doesn't know about:
137 unittest.BaseTestSuite._cleanup = False # type: ignore[attr-defined]
138
139 if runtests.gc_threshold is not None:
140 gc.set_threshold(runtests.gc_threshold)
141
142 random.seed(runtests.random_seed)
143
144 # sys.stdout is redirected to a StringIO in single process mode on which
145 # color auto-detect fails as StringIO is not a TTY. If the original
146 # sys.stdout supports color pass that through with FORCE_COLOR so that when
147 # results are printed, such as with -W, they get color.
148 if can_colorize(file=sys.stdout):
149 os.environ['FORCE_COLOR'] = "1"

Callers 1

_runtestFunction · 0.85

Calls 3

can_colorizeFunction · 0.90
set_match_testsFunction · 0.85
seedMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…