mirror of https://github.com/python/cpython
[3.13] gh-119050: Add type hints to libregrtest/results.py (GH-119144) (#119156)
gh-119050: Add type hints to libregrtest/results.py (GH-119144)
Sort also 'omitted' in TestResults.display_result().
(cherry picked from commit 30b4e9f9c4
)
Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
parent
ec88e9f686
commit
91296146d5
|
@ -18,7 +18,7 @@ EXITCODE_INTERRUPTED = 130 # 128 + signal.SIGINT=2
|
|||
|
||||
|
||||
class TestResults:
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
self.bad: TestList = []
|
||||
self.good: TestList = []
|
||||
self.rerun_bad: TestList = []
|
||||
|
@ -38,22 +38,22 @@ class TestResults:
|
|||
# used by -T with -j
|
||||
self.covered_lines: set[Location] = set()
|
||||
|
||||
def is_all_good(self):
|
||||
def is_all_good(self) -> bool:
|
||||
return (not self.bad
|
||||
and not self.skipped
|
||||
and not self.interrupted
|
||||
and not self.worker_bug)
|
||||
|
||||
def get_executed(self):
|
||||
def get_executed(self) -> set[TestName]:
|
||||
return (set(self.good) | set(self.bad) | set(self.skipped)
|
||||
| set(self.resource_denied) | set(self.env_changed)
|
||||
| set(self.run_no_tests))
|
||||
|
||||
def no_tests_run(self):
|
||||
def no_tests_run(self) -> bool:
|
||||
return not any((self.good, self.bad, self.skipped, self.interrupted,
|
||||
self.env_changed))
|
||||
|
||||
def get_state(self, fail_env_changed):
|
||||
def get_state(self, fail_env_changed: bool) -> str:
|
||||
state = []
|
||||
if self.bad:
|
||||
state.append("FAILURE")
|
||||
|
@ -204,7 +204,7 @@ class TestResults:
|
|||
omitted = set(tests) - self.get_executed()
|
||||
|
||||
# less important
|
||||
all_tests.append((omitted, "test", "{} omitted:"))
|
||||
all_tests.append((sorted(omitted), "test", "{} omitted:"))
|
||||
if not quiet:
|
||||
all_tests.append((self.skipped, "test", "{} skipped:"))
|
||||
all_tests.append((self.resource_denied, "test", "{} skipped (resource denied):"))
|
||||
|
|
Loading…
Reference in New Issue