@@ -197,7 +197,7 @@ def get_abs_module(ns: Namespace, test_name: str) -> str:
197
197
return 'test.' + test_name
198
198
199
199
200
- def _runtest_capture_output_timeout_junit (result : TestResult , ns : Namespace ):
200
+ def _runtest_capture_output_timeout_junit (result : TestResult , ns : Namespace ) -> None :
201
201
# Capture stdout and stderr, set faulthandler timeout,
202
202
# and create JUnit XML report.
203
203
@@ -301,7 +301,7 @@ def save_env(ns: Namespace, test_name: str):
301
301
return saved_test_environment (test_name , ns .verbose , ns .quiet , pgo = ns .pgo )
302
302
303
303
304
- def regrtest_runner (result , test_func , ns ):
304
+ def regrtest_runner (result , test_func , ns ) -> None :
305
305
# Run test_func(), collect statistics, and detect reference and memory
306
306
# leaks.
307
307
@@ -330,7 +330,7 @@ def regrtest_runner(result, test_func, ns):
330
330
result .stats = stats
331
331
332
332
333
- def _load_run_test (result : TestResult , ns : Namespace ) -> bool :
333
+ def _load_run_test (result : TestResult , ns : Namespace ) -> None :
334
334
# Load the test function, run the test function.
335
335
336
336
abstest = get_abs_module (ns , result .test_name )
@@ -375,7 +375,7 @@ def _load_run_test(result: TestResult, ns: Namespace) -> bool:
375
375
376
376
377
377
def _runtest_env_changed_exc (result : TestResult , ns : Namespace ,
378
- display_failure : bool = True ):
378
+ display_failure : bool = True ) -> None :
379
379
# Detect environment changes, handle exceptions.
380
380
381
381
# Reset the environment_altered flag to detect if a test altered
@@ -396,12 +396,12 @@ def _runtest_env_changed_exc(result: TestResult, ns: Namespace,
396
396
if not ns .quiet and not ns .pgo :
397
397
print (f"{ test_name } skipped -- { msg } " , flush = True )
398
398
result .state = State .RESOURCE_DENIED
399
- return result
399
+ return
400
400
except unittest .SkipTest as msg :
401
401
if not ns .quiet and not ns .pgo :
402
402
print (f"{ test_name } skipped -- { msg } " , flush = True )
403
403
result .state = State .SKIPPED
404
- return result
404
+ return
405
405
except support .TestFailedWithDetails as exc :
406
406
msg = f"test { test_name } failed"
407
407
if display_failure :
@@ -411,36 +411,35 @@ def _runtest_env_changed_exc(result: TestResult, ns: Namespace,
411
411
result .errors = exc .errors
412
412
result .failures = exc .failures
413
413
result .stats = exc .stats
414
- return result
414
+ return
415
415
except support .TestFailed as exc :
416
416
msg = f"test { test_name } failed"
417
417
if display_failure :
418
418
msg = f"{ msg } -- { exc } "
419
419
print (msg , file = sys .stderr , flush = True )
420
420
result .state = State .FAILED
421
421
result .stats = exc .stats
422
- return result
422
+ return
423
423
except support .TestDidNotRun :
424
424
result .state = State .DID_NOT_RUN
425
- return result
425
+ return
426
426
except KeyboardInterrupt :
427
427
print ()
428
428
result .state = State .INTERRUPTED
429
- return result
429
+ return
430
430
except :
431
431
if not ns .pgo :
432
432
msg = traceback .format_exc ()
433
433
print (f"test { test_name } crashed -- { msg } " ,
434
434
file = sys .stderr , flush = True )
435
435
result .state = State .UNCAUGHT_EXC
436
- return result
436
+ return
437
437
438
438
if support .environment_altered :
439
439
result .set_env_changed ()
440
440
# Don't override the state if it was already set (REFLEAK or ENV_CHANGED)
441
441
if result .state is None :
442
442
result .state = State .PASSED
443
- return result
444
443
445
444
446
445
def cleanup_test_droppings (test_name : str , verbose : int ):
0 commit comments