@@ -109,8 +109,8 @@ class TEST_PROCESS_STATS:
109
109
cUnexpectedTests :int = 0
110
110
cAchtungTests :int = 0
111
111
112
- FailedTests = list [str ]()
113
- XFailedTests = list [str ]()
112
+ FailedTests = list [str , int ]()
113
+ XFailedTests = list [str , int ]()
114
114
NotXFailedTests = list [str ]()
115
115
AchtungTests = list [str ]()
116
116
@@ -132,19 +132,23 @@ def incrementPassedTestCount() -> None:
132
132
__class__ .cPassedTests += 1
133
133
134
134
# --------------------------------------------------------------------
135
- def incrementFailedTestCount (testID :str )-> None :
135
+ def incrementFailedTestCount (testID :str , errCount : int )-> None :
136
136
assert type (testID )== str # noqa: E721
137
+ assert type (errCount )== int # noqa: E721
138
+ assert errCount >= 0
137
139
assert type (__class__ .FailedTests )== list # noqa: E721
138
140
139
- __class__ .FailedTests .append (testID )# raise?
141
+ __class__ .FailedTests .append (( testID , errCount ) )# raise?
140
142
__class__ .cFailedTests += 1
141
143
142
144
# --------------------------------------------------------------------
143
- def incrementXFailedTestCount (testID :str )-> None :
145
+ def incrementXFailedTestCount (testID :str , errCount : int )-> None :
144
146
assert type (testID )== str # noqa: E721
147
+ assert type (errCount )== int # noqa: E721
148
+ assert errCount >= 0
145
149
assert type (__class__ .XFailedTests )== list # noqa: E721
146
150
147
- __class__ .XFailedTests .append (testID )# raise?
151
+ __class__ .XFailedTests .append (( testID , errCount ) )# raise?
148
152
__class__ .cXFailedTests += 1
149
153
150
154
# --------------------------------------------------------------------
@@ -329,26 +333,25 @@ def helper__makereport__call(
329
333
if type (call .excinfo .value )== _pytest .outcomes .Skipped :# noqa: E721
330
334
assert not hasattr (rep ,"wasxfail" )
331
335
332
- TEST_PROCESS_STATS .incrementSkippedTestCount ()
333
-
334
336
exitStatus = "SKIPPED"
335
337
reasonText = str (call .excinfo .value )
336
338
reasonMsgTempl = "SKIP REASON: {0}"
337
339
338
- elif type (call .excinfo .value )== _pytest .outcomes .XFailed :# noqa: E721
339
- TEST_PROCESS_STATS .incrementXFailedTestCount (testID )
340
+ TEST_PROCESS_STATS .incrementSkippedTestCount ()
340
341
342
+ elif type (call .excinfo .value )== _pytest .outcomes .XFailed :# noqa: E721
341
343
exitStatus = "XFAILED"
342
344
reasonText = str (call .excinfo .value )
343
345
reasonMsgTempl = "XFAIL REASON: {0}"
346
+
347
+ TEST_PROCESS_STATS .incrementXFailedTestCount (testID ,item_error_msg_count )
348
+
344
349
else :
345
350
exitStatus = "XFAILED"
346
351
assert hasattr (rep ,"wasxfail" )
347
352
assert rep .wasxfail is not None
348
353
assert type (rep .wasxfail )== str # noqa: E721
349
354
350
- TEST_PROCESS_STATS .incrementXFailedTestCount (testID )
351
-
352
355
reasonText = rep .wasxfail
353
356
reasonMsgTempl = "XFAIL REASON: {0}"
354
357
@@ -358,6 +361,8 @@ def helper__makereport__call(
358
361
logging .error (call .excinfo .value )
359
362
item_error_msg_count += 1
360
363
364
+ TEST_PROCESS_STATS .incrementXFailedTestCount (testID ,item_error_msg_count )
365
+
361
366
assert type (reasonText )== str # noqa: E721
362
367
363
368
if reasonText != "" :
@@ -369,15 +374,15 @@ def helper__makereport__call(
369
374
assert call .excinfo is not None
370
375
assert call .excinfo .value is not None
371
376
372
- TEST_PROCESS_STATS .incrementFailedTestCount (testID )
373
-
374
377
if type (call .excinfo .value )== SIGNAL_EXCEPTION :# noqa: E721
375
378
assert item_error_msg_count > 0
376
379
pass
377
380
else :
378
381
logging .error (call .excinfo .value )
379
382
item_error_msg_count += 1
380
383
384
+ TEST_PROCESS_STATS .incrementFailedTestCount (testID ,item_error_msg_count )
385
+
381
386
exitStatus = "FAILED"
382
387
elif rep .outcome == "passed" :
383
388
assert call .excinfo is None
@@ -676,11 +681,42 @@ def helper__print_test_list(tests: list[str]) -> None:
676
681
677
682
nTest = 0
678
683
679
- while nTest < len ( tests ) :
680
- testID = tests [ nTest ]
681
- assert type ( testID ) == str # noqa: E721
684
+ for t in tests :
685
+ assert type ( t ) == str # noqa: E721
686
+ assert t != ""
682
687
nTest += 1
683
- logging .info (templateLine .format (nTest ,testID ))
688
+ logging .info (templateLine .format (nTest ,t ))
689
+
690
+
691
+ # ------------------------------------------------------------------------
692
+ def helper__print_test_list2 (tests :list [str ,int ])-> None :
693
+ assert type (tests )== list # noqa: E721
694
+
695
+ assert helper__calc_W (9 )== 1
696
+ assert helper__calc_W (10 )== 2
697
+ assert helper__calc_W (11 )== 2
698
+ assert helper__calc_W (99 )== 2
699
+ assert helper__calc_W (100 )== 3
700
+ assert helper__calc_W (101 )== 3
701
+ assert helper__calc_W (999 )== 3
702
+ assert helper__calc_W (1000 )== 4
703
+ assert helper__calc_W (1001 )== 4
704
+
705
+ W = helper__calc_W (len (tests ))
706
+
707
+ templateLine = "{0:0" + str (W )+ "d}. {1} ({2})"
708
+
709
+ nTest = 0
710
+
711
+ for t in tests :
712
+ assert type (t )== tuple # noqa: E721
713
+ assert len (t )== 2
714
+ assert type (t [0 ])== str # noqa: E721
715
+ assert type (t [1 ])== int # noqa: E721
716
+ assert t [0 ]!= ""
717
+ assert t [1 ]>= 0
718
+ nTest += 1
719
+ logging .info (templateLine .format (nTest ,t [0 ],t [1 ]))
684
720
685
721
686
722
# /////////////////////////////////////////////////////////////////////////////
@@ -714,20 +750,36 @@ def LOCAL__print_test_list(header: str, test_count: int, test_list: list[str]):
714
750
helper__print_test_list (test_list )
715
751
logging .info ("" )
716
752
753
+ def LOCAL__print_test_list2 (
754
+ header :str ,test_count :int ,test_list :list [str ,int ]
755
+ ):
756
+ assert type (header )== str # noqa: E721
757
+ assert type (test_count )== int # noqa: E721
758
+ assert type (test_list )== list # noqa: E721
759
+ assert header != ""
760
+ assert test_count >= 0
761
+ assert len (test_list )== test_count
762
+
763
+ LOCAL__print_line1_with_header (header )
764
+ logging .info ("" )
765
+ if len (test_list )> 0 :
766
+ helper__print_test_list2 (test_list )
767
+ logging .info ("" )
768
+
717
769
# fmt: off
718
770
LOCAL__print_test_list (
719
771
"ACHTUNG TESTS" ,
720
772
TEST_PROCESS_STATS .cAchtungTests ,
721
773
TEST_PROCESS_STATS .AchtungTests ,
722
774
)
723
775
724
- LOCAL__print_test_list (
776
+ LOCAL__print_test_list2 (
725
777
"FAILED TESTS" ,
726
778
TEST_PROCESS_STATS .cFailedTests ,
727
779
TEST_PROCESS_STATS .FailedTests
728
780
)
729
781
730
- LOCAL__print_test_list (
782
+ LOCAL__print_test_list2 (
731
783
"XFAILED TESTS" ,
732
784
TEST_PROCESS_STATS .cXFailedTests ,
733
785
TEST_PROCESS_STATS .XFailedTests ,