8000 [3.13] gh-119050: Add type hints to libregrtest/results.py (GH-119144) by miss-islington · Pull Request #119156 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

[3.13] gh-119050: Add type hints to libregrtest/results.py (GH-119144) #119156

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
gh-119050: Add type hints to libregrtest/results.py (GH-119144)
Sort also 'omitted' in TestResults.display_result().
(cherry picked from commit 30b4e9f)

Co-authored-by: Victor Stinner <vstinner@python.org>
  • Loading branch information
vstinner authored and miss-islington committed May 18, 2024
commit a4d2fb4d65bb0985f9c63d4bc87e1b7ea7a647a2
12 changes: 6 additions & 6 deletions Lib/test/libregrtest/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@


class TestResults:
def __init__(self):
def __init__(self) -> None:
self.bad: TestList = []
self.good: TestList = []
self.rerun_bad: TestList = []
Expand All @@ -38,22 +38,22 @@ def __init__(self):
# 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")
Expand Down Expand Up @@ -204,7 +204,7 @@ def display_result(self, tests: TestTuple, quiet: bool, print_slowest: bool):
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):"))
Expand Down
Loading
0