@@ -437,6 +437,16 @@ def helper__makereport__setup(
437
437
return
438
438
439
439
440
+ # ------------------------------------------------------------------------
441
+ class ExitStatusNames :
442
+ FAILED = "FAILED"
443
+ PASSED = "PASSED"
444
+ XFAILED = "XFAILED"
445
+ NOT_XFAILED = "NOT XFAILED"
446
+ SKIPPED = "SKIPPED"
447
+ UNEXPECTED = "UNEXPECTED"
448
+
449
+
440
450
# ------------------------------------------------------------------------
441
451
def helper__makereport__call (
442
452
item : pytest .Function , call : pytest .CallInfo , outcome : T_PLUGGY_RESULT
@@ -486,28 +496,29 @@ def helper__makereport__call(
486
496
487
497
# --------
488
498
exitStatus = None
499
+ exitStatusInfo = None
489
500
if rep .outcome == "skipped" :
490
501
assert call .excinfo is not None # research
491
502
assert call .excinfo .value is not None # research
492
503
493
504
if type (call .excinfo .value ) == _pytest .outcomes .Skipped : # noqa: E721
494
505
assert not hasattr (rep , "wasxfail" )
495
506
496
- exitStatus = " SKIPPED"
507
+ exitStatus = ExitStatusNames . SKIPPED
497
508
reasonText = str (call .excinfo .value )
498
509
reasonMsgTempl = "SKIP REASON: {0}"
499
510
500
511
TEST_PROCESS_STATS .incrementSkippedTestCount ()
501
512
502
- elif type (call .excinfo .value ) == _pytest .outcomes .XFailed : # noqa: E721
503
- exitStatus = " XFAILED"
513
+ elif type (call .excinfo .value ) == _pytest .outcomes .XFailed : # noqa: E721 E501
514
+ exitStatus = ExitStatusNames . XFAILED
504
515
reasonText = str (call .excinfo .value )
505
516
reasonMsgTempl = "XFAIL REASON: {0}"
506
517
507
518
TEST_PROCESS_STATS .incrementXFailedTestCount (testID , item_error_msg_count )
508
519
509
520
else :
510
- exitStatus = " XFAILED"
521
+ exitStatus = ExitStatusNames . XFAILED
511
522
assert hasattr (rep , "wasxfail" )
512
523
assert rep .wasxfail is not None
513
524
assert type (rep .wasxfail ) == str # noqa: E721
@@ -544,7 +555,7 @@ def helper__makereport__call(
544
555
assert item_error_msg_count > 0
545
556
TEST_PROCESS_STATS .incrementFailedTestCount (testID , item_error_msg_count )
546
557
547
- exitStatus = " FAILED"
558
+ exitStatus = ExitStatusNames . FAILED
548
559
elif rep .outcome == "passed" :
549
560
assert call .excinfo is None
550
561
@@ -559,22 +570,31 @@ def helper__makereport__call(
559
570
warnMsg += " [" + rep .wasxfail + "]"
560
571
561
572
logging .info (warnMsg )
562
- exitStatus = "NOT XFAILED"
573
+ exitStatus = ExitStatusNames . NOT_XFAILED
563
574
else :
564
575
assert not hasattr (rep , "wasxfail" )
565
576
566
577
TEST_PROCESS_STATS .incrementPassedTestCount ()
567
- exitStatus = " PASSED"
578
+ exitStatus = ExitStatusNames . PASSED
568
579
else :
569
580
TEST_PROCESS_STATS .incrementUnexpectedTests ()
570
- exitStatus = "UNEXPECTED [{0}]" .format (rep .outcome )
581
+ exitStatus = ExitStatusNames .UNEXPECTED
582
+ exitStatusInfo = rep .outcome
571
583
# [2025-03-28] It may create a useless problem in new environment.
572
584
# assert False
573
585
574
586
# --------
575
587
if item_warning_msg_count > 0 :
576
588
TEST_PROCESS_STATS .incrementWarningTestCount (testID , item_warning_msg_count )
577
589
590
+ # --------
591
+ assert exitStatus is not None
592
+ assert type (exitStatus ) == str # noqa: E721
593
+
594
+ if exitStatus == ExitStatusNames .FAILED :
595
+ assert item_error_msg_count > 0
596
+ pass
597
+
578
598
# --------
579
599
assert type (TEST_PROCESS_STATS .cTotalDuration ) == datetime .timedelta # noqa: E721
580
600
assert type (testDurration ) == datetime .timedelta # noqa: E721
@@ -583,11 +603,17 @@ def helper__makereport__call(
583
603
584
604
assert testDurration <= TEST_PROCESS_STATS .cTotalDuration
585
605
606
+ # --------
607
+ exitStatusLineData = exitStatus
608
+
609
+ if exitStatusInfo is not None :
610
+ exitStatusLineData += " [{}]" .format (exitStatusInfo )
611
+
586
612
# --------
587
613
logging .info ("*" )
588
614
logging .info ("* DURATION : {0}" .format (timedelta_to_human_text (testDurration )))
589
615
logging .info ("*" )
590
- logging .info ("* EXIT STATUS : {0}" .format (exitStatus ))
616
+ logging .info ("* EXIT STATUS : {0}" .format (exitStatusLineData ))
591
617
logging .info ("* ERROR COUNT : {0}" .format (item_error_msg_count ))
592
618
logging .info ("* WARNING COUNT: {0}" .format (item_warning_msg_count ))
593
619
logging .info ("*" )
0 commit comments