mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
[3.13] gh-109413: Enable strict_optional for libregrtest/main.py (GH-126394) (#126802)
(cherry picked from commit 12ca7e622f)
This commit is contained in:
parent
64846f14d8
commit
effedb5ff0
4 changed files with 22 additions and 9 deletions
|
|
@ -123,7 +123,7 @@ def __init__(self, ns: Namespace, _add_python_opts: bool = False):
|
|||
self.python_cmd = None
|
||||
self.coverage: bool = ns.trace
|
||||
self.coverage_dir: StrPath | None = ns.coverdir
|
||||
self.tmp_dir: StrPath | None = ns.tempdir
|
||||
self._tmp_dir: StrPath | None = ns.tempdir
|
||||
|
||||
# Randomize
|
||||
self.randomize: bool = ns.randomize
|
||||
|
|
@ -159,6 +159,8 @@ def log(self, line=''):
|
|||
self.logger.log(line)
|
||||
|
||||
def find_tests(self, tests: TestList | None = None) -> tuple[TestTuple, TestList | None]:
|
||||
if tests is None:
|
||||
tests = []
|
||||
if self.single_test_run:
|
||||
self.next_single_filename = os.path.join(self.tmp_dir, 'pynexttest')
|
||||
try:
|
||||
|
|
@ -453,7 +455,12 @@ def finalize_tests(self, coverage: trace.CoverageResults | None) -> None:
|
|||
if self.junit_filename:
|
||||
self.results.write_junit(self.junit_filename)
|
||||
|
||||
def display_summary(self):
|
||||
def display_summary(self) -> None:
|
||||
if self.first_runtests is None:
|
||||
raise ValueError(
|
||||
"Should never call `display_summary()` before calling `_run_test()`"
|
||||
)
|
||||
|
||||
duration = time.perf_counter() - self.logger.start_time
|
||||
filtered = bool(self.match_tests)
|
||||
|
||||
|
|
@ -711,7 +718,15 @@ def _init(self):
|
|||
|
||||
strip_py_suffix(self.cmdline_args)
|
||||
|
||||
self.tmp_dir = get_temp_dir(self.tmp_dir)
|
||||
self._tmp_dir = get_temp_dir(self._tmp_dir)
|
||||
|
||||
@property
|
||||
def tmp_dir(self) -> StrPath:
|
||||
if self._tmp_dir is None:
|
||||
raise ValueError(
|
||||
"Should never use `.tmp_dir` before calling `.main()`"
|
||||
)
|
||||
return self._tmp_dir
|
||||
|
||||
def main(self, tests: TestList | None = None):
|
||||
if self.want_add_python_opts:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue