@@ -382,7 +382,9 @@ def set_status_running(self) -> None:
382
382
383
383
def finalize_from_phase_outcome (
384
384
self ,
385
- phase_execution_outcome : phase_executor .PhaseExecutionOutcome ) -> None :
385
+ phase_execution_outcome : phase_executor .PhaseExecutionOutcome ,
386
+ phase_name : str ,
387
+ ) -> None :
386
388
"""Finalize due to the given phase outcome."""
387
389
if self ._is_aborted ():
388
390
return
@@ -400,39 +402,49 @@ def finalize_from_phase_outcome(
400
402
self .test_record .add_outcome_details (code , description )
401
403
if self ._outcome_is_failure_exception (phase_execution_outcome ):
402
404
self .state_logger .error (
403
- 'Outcome will be FAIL since exception was of type %s' ,
404
- phase_execution_outcome .phase_result .exc_val )
405
+ f'Outcome of { phase_name } will be FAIL since exception was of type'
406
+ ' {phase_execution_outcome.phase_result.exc_val}'
407
+ )
405
408
self ._finalize (test_record .Outcome .FAIL )
406
409
else :
407
410
self .state_logger .critical (
408
- 'Finishing test execution early due to an exception raised during '
409
- 'phase execution; outcome ERROR.' )
411
+ f'Finishing test execution of { phase_name } early due to an '
412
+ 'exception raised during phase execution; outcome ERROR.'
413
+ )
410
414
# Enable CLI printing of the full traceback with the -v flag.
411
415
if isinstance (result , phase_executor .ExceptionInfo ):
412
416
self .state_logger .critical (
413
- 'Traceback:%s%s%s%s' ,
417
+ 'Traceback:%s%s%s%s\n in executing %s ' ,
414
418
os .linesep ,
415
419
phase_execution_outcome .phase_result .get_traceback_string (),
416
420
os .linesep ,
417
421
description ,
422
+ phase_name ,
418
423
)
419
424
else :
420
425
self .state_logger .critical (
421
- 'Description:%s' ,
422
- description ,
426
+ f'Description:{ description } , PhaseName:{ phase_name } '
423
427
)
424
428
self ._finalize (test_record .Outcome .ERROR )
425
429
elif phase_execution_outcome .is_timeout :
426
- self .state_logger .error ('Finishing test execution early due to '
427
- 'phase timeout, outcome TIMEOUT.' )
428
- self .test_record .add_outcome_details ('TIMEOUT' ,
429
- 'A phase hit its timeout.' )
430
+ self .state_logger .error (
431
+ 'Finishing test execution early due to '
432
+ f'phase { phase_name } experiencing timeout, '
433
+ 'outcome TIMEOUT.'
434
+ )
435
+ self .test_record .add_outcome_details (
436
+ 'TIMEOUT' , f'Phase { phase_name } hit its timeout.'
437
+ )
430
438
self ._finalize (test_record .Outcome .TIMEOUT )
431
439
elif phase_execution_outcome .phase_result == openhtf .PhaseResult .STOP :
432
- self .state_logger .error ('Finishing test execution early due to '
433
- 'PhaseResult.STOP, outcome FAIL.' )
434
- self .test_record .add_outcome_details ('STOP' ,
435
- 'A phase stopped the test run.' )
440
+ self .state_logger .error (
441
+ 'Finishing test execution early due to '
442
+ f'{ phase_name } causing PhaseResult.STOP, '
443
+ 'outcome FAIL.'
444
+ )
445
+ self .test_record .add_outcome_details (
446
+ 'STOP' , f'Phase { phase_name } stopped the test run.'
447
+ )
436
448
self ._finalize (test_record .Outcome .FAIL )
437
449
438
450
def finalize_normally (self ) -> None :
0 commit comments