Skip to content
Merged
Show file tree
Hide file tree
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
26 changes: 23 additions & 3 deletions Lib/test/libregrtest/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@

from .runtests import RunTests
from .result import State, TestResult, TestStats, Location
from .skipped import expected_to_be_skipped
from .utils import (
StrPath, TestName, TestTuple, TestList, FilterDict,
printlist, count, format_duration)
printlist, count, format_duration, cleanup_test_name)

if TYPE_CHECKING:
from xml.etree.ElementTree import Element
Expand Down Expand Up @@ -100,7 +101,7 @@ def get_exitcode(self, fail_env_changed: bool, fail_rerun: bool) -> int:
return exitcode

def accumulate_result(self, result: TestResult, runtests: RunTests) -> None:
test_name = result.test_name
test_name = cleanup_test_name(result.test_name)
rerun = runtests.rerun
fail_env_changed = runtests.fail_env_changed

Expand Down Expand Up @@ -207,7 +208,19 @@ def write_junit(self, filename: StrPath) -> None:
for s in ET.tostringlist(root):
f.write(s)

def split_expected_skip(self, tests):
skipped = []
expected = []
for name in tests:
if expected_to_be_skipped(name):
expected.append(name)
else:
skipped.append(name)
return (skipped, expected)

def display_result(self, tests: TestTuple, quiet: bool, print_slowest: bool) -> None:
tests = tuple(cleanup_test_name(name) for name in tests)

ansi = get_colors()
green = ansi.GREEN
red = ansi.BOLD_RED
Expand All @@ -224,13 +237,20 @@ def display_result(self, tests: TestTuple, quiet: bool, print_slowest: bool) ->
all_tests = []
omitted = set(tests) - self.get_executed()

# Filter tests expected to be skipped
skipped, expected_skip = self.split_expected_skip(self.skipped)
if expected_skip:
print()
count_text = count(len(expected_skip), "test")
print(f"{count_text} expected to be skipped (not listed)")

# less important
all_tests.append(
(sorted(omitted), "test", f"{yellow}{{}} omitted:{reset}")
)
if not quiet:
all_tests.append(
(self.skipped, "test", f"{yellow}{{}} skipped:{reset}")
(skipped, "test", f"{yellow}{{}} skipped:{reset}")
)
all_tests.append(
(
Expand Down
Loading
Loading