@@ -315,18 +315,20 @@ def regrtest_runner(result, test_func, ns) -> None:
315
315
if refleak :
316
316
result .state = State .REFLEAK
317
317
318
- if isinstance (test_result , TestStats ):
319
- stats = test_result
320
- elif isinstance (test_result , unittest .TestResult ):
321
- stats = TestStats .from_unittest (test_result )
322
- elif isinstance (test_result , doctest .TestResults ):
323
- stats = TestStats .from_doctest (test_result )
324
- elif test_result is None :
325
- print_warning (f"{ result .test_name } test runner returned None: { test_func } " )
326
- stats = None
327
- else :
328
- print_warning (f"Unknown test result type: { type (test_result )} " )
329
- stats = None
318
+ match test_result :
319
+ case TestStats ():
320
+ stats = test_result
321
+ case unittest .TestResult ():
322
+ stats = TestStats .from_unittest (test_result )
323
+ case doctest .TestResults ():
324
+ stats = TestStats .from_doctest (test_result )
325
+ case None :
326
+ print_warning (f"{ result .test_name } test runner returned None: { test_func } " )
327
+ stats = None
328
+ case _:
329
+ print_warning (f"Unknown test result type: { type (test_result )} " )
330
+ stats = None
331
+
330
332
result .stats = stats
331
333
332
334
@@ -442,7 +444,7 @@ def _runtest_env_changed_exc(result: TestResult, ns: Namespace,
442
444
result .state = State .PASSED
443
445
444
446
445
- def cleanup_test_droppings (test_name : str , verbose : int ):
447
+ def cleanup_test_droppings (test_name : str , verbose : int ) -> None :
446
448
# Try to clean up junk commonly left behind. While tests shouldn't leave
447
449
# any files or directories behind, when a test fails that can be tedious
448
450
# for it to arrange. The consequences can be especially nasty on Windows,
0 commit comments