Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: dfdcb5550d381774989d4af002654b8602ceeb46
https://github.com/WebKit/WebKit/commit/dfdcb5550d381774989d4af002654b8602ceeb46
Author: Sam Sneddon <[email protected]>
Date: 2026-09-25 (Fri, 25 Sep 2026)
Changed paths:
M Tools/Scripts/webkitpy/test/printer.py
M Tools/Scripts/webkitpy/test/printer_unittest.py
M Tools/Scripts/webkitpy/test/runner.py
M Tools/Scripts/webkitpy/test/runner_unittest.py
Log Message:
-----------
Fix test-webkitpy support for unittest.TestCase.subTest
https://bugs.webkit.org/show_bug.cgi?id=325306
rdar://188418374
Reviewed by Jonathan Bedard.
Using unittest.TestCase.subTest() in a webkitpy test crashes test-webkitpy
instead of reporting the subtest failures. _Worker.handle() asserts that the
number of failures, errors, skips, expected failures, unexpected successes
and successes it collects equals testsRun, but subTest() can append multiple
entries to result.failures (or result.errors) for a single test method
without incrementing testsRun, so the assertion fails.
Printer.print_finished_test()
also assumed at most one failure or error per test and only ever displayed
the first one.
Drop the custom TestResult subclass (and the assertion, which no longer
holds) in favor of the stdlib unittest.TestResult, and format every entry in
result.failures/result.errors rather than just the first. Have
Printer.print_finished_test() iterate over all of a test's failure/error
messages, and count num_failures/num_errors by how many entries were
reported rather than incrementing by one per test.
* Tools/Scripts/webkitpy/test/printer.py:
(Printer.print_finished_test):
* Tools/Scripts/webkitpy/test/printer_unittest.py:
(PrinterTest.test_failed_with_expected_failures_list):
(PrinterTest):
(PrinterTest.test_single_failure_is_printed_and_counted):
(PrinterTest.test_multiple_subtest_failures_are_all_printed_and_counted):
(PrinterTest.test_multiple_errors_are_all_printed_and_counted):
* Tools/Scripts/webkitpy/test/runner.py:
(_Worker.handle):
(TestResult): Deleted.
(TestResult.__init__): Deleted.
(TestResult.addSuccess): Deleted.
* Tools/Scripts/webkitpy/test/runner_unittest.py:
(_Test_Runner):
(_Test_Runner._test_all_subtests_pass):
(_Test_Runner._test_one_subtest_fails):
(_Test_Runner._test_two_subtests_fail):
(_Test_Runner._test_plain_failure):
(StubLoader):
(StubLoader.loadTestsFromName):
(RunnerTest.test_run_expected_failures):
(RunnerTest):
(RunnerTest._run):
(RunnerTest.test_one_failing_subtest_does_not_crash_the_runner):
(RunnerTest.test_two_failing_subtests_do_not_crash_the_runner):
(RunnerTest.test_all_passing_subtests_do_not_crash_the_runner):
(RunnerTest.test_failing_subtest_failure_message_identifies_the_subtest):
(RunnerTest.test_plain_failure_message_still_includes_the_traceback):
Canonical link: https://commits.webkit.org/321933@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications