@@ -135,7 +135,7 @@ def from_str(cls, s: str):
135
135
@classmethod
136
136
def from_test_case (cls , test_file : Path , test : unittest .TestCase ):
137
137
test_id = test .id ()
138
- if type (test ).__name__ == '_ErrorHolder' :
138
+ if type (test ).__module__ == 'unittest.suite' and type ( test ). __name__ == '_ErrorHolder' :
139
139
if match := re .match (r'(\S+) \(([^)]+)\)' , test_id ):
140
140
action = match .group (1 )
141
141
class_name = match .group (2 )
@@ -641,10 +641,10 @@ def process_event(self, event):
641
641
self .last_test_id_for_blame = test_id
642
642
self .last_out_pos = event ['out_pos' ]
643
643
if test_id .test_name .endswith ('>' ):
644
- class_name = test_id .test_name [:test_id .test_name .find ('<' )]
644
+ class_name = test_id .test_name [:test_id .test_name .find ('<' )]. rstrip ( '.' )
645
645
specifier = TestSpecifier (test_id .test_file , class_name or None )
646
646
self .remaining_test_ids = [
647
- test for test in self .remaining_test_ids if not specifier .match (test_id )
647
+ test for test in self .remaining_test_ids if not specifier .match (test )
648
648
]
649
649
650
650
def get_status (self ):
@@ -966,6 +966,10 @@ def filter_tree(test_file: TestFile, test_suite: unittest.TestSuite, specifiers:
966
966
# When test loading fails, unittest just creates an instance of _FailedTest
967
967
if exception := getattr (test , '_exception' , None ):
968
968
raise exception
969
+ if type (test ).__module__ == 'unittest.loader' and type (test ).__name__ == 'ModuleSkipped' :
970
+ skipped_test , reason = test ().skipped [0 ]
971
+ log (f"Test module { skipped_test .id ().removeprefix ('unittest.loader.ModuleSkipped.' )} skipped: { reason } " )
972
+ return
969
973
if hasattr (test , '__iter__' ):
970
974
sub_collected = filter_tree (test_file , test , specifiers , tagged_ids )
971
975
if sub_collected :
0 commit comments