mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
gh-109162: Refactor libregrtest.RunTests (#109177)
* Rename dash_R() runtest_refleak(). The function now gets huntrleaks and quiet arguments, instead of 'ns' argument. * Add attributes to Regrtest and RunTests: * verbose * quiet * huntrleaks * test_dir * Add HuntRefleak class.
This commit is contained in:
parent
b4131a13cb
commit
e21c89f984
5 changed files with 88 additions and 60 deletions
|
|
@ -18,7 +18,7 @@ from test.libregrtest.utils import (setup_unraisable_hook,
|
|||
UNICODE_GUARD_ENV = "PYTHONREGRTEST_UNICODE_GUARD"
|
||||
|
||||
|
||||
def setup_test_dir(testdir):
|
||||
def setup_test_dir(testdir: str | None) -> None:
|
||||
if testdir:
|
||||
# Prepend test directory to sys.path, so runtest() will be able
|
||||
# to locate tests
|
||||
|
|
@ -68,7 +68,7 @@ def setup_tests(runtests, ns):
|
|||
if getattr(module, '__file__', None):
|
||||
module.__file__ = os.path.abspath(module.__file__)
|
||||
|
||||
if ns.huntrleaks:
|
||||
if runtests.hunt_refleak:
|
||||
unittest.BaseTestSuite._cleanup = False
|
||||
|
||||
if ns.memlimit is not None:
|
||||
|
|
@ -77,7 +77,7 @@ def setup_tests(runtests, ns):
|
|||
if ns.threshold is not None:
|
||||
gc.set_threshold(ns.threshold)
|
||||
|
||||
support.suppress_msvcrt_asserts(ns.verbose and ns.verbose >= 2)
|
||||
support.suppress_msvcrt_asserts(runtests.verbose and runtests.verbose >= 2)
|
||||
|
||||
support.use_resources = ns.use_resources
|
||||
|
||||
|
|
@ -102,7 +102,7 @@ def setup_tests(runtests, ns):
|
|||
support.SHORT_TIMEOUT = min(support.SHORT_TIMEOUT, timeout)
|
||||
support.LONG_TIMEOUT = min(support.LONG_TIMEOUT, timeout)
|
||||
|
||||
if ns.xmlpath:
|
||||
if runtests.junit_filename:
|
||||
from test.support.testresult import RegressionTestResult
|
||||
RegressionTestResult.USE_XML = True
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue