@@ -624,45 +624,47 @@ def process_test_files(
624
624
except Exception as e :
625
625
logger .debug (str (e ))
626
626
continue
627
-
628
- if not definition or definition [0 ].type != "function" :
629
- continue
630
-
631
- definition_obj = definition [ 0 ]
632
- definition_path = str ( definition_obj . module_path )
633
-
634
- project_root_str = str ( project_root_path )
635
- if (
636
- definition_path . startswith ( project_root_str + os . sep )
637
- and definition_obj .module_name != name . module_name
638
- and definition_obj . full_name is not None
639
- ):
640
- # Pre-compute common values outside the inner loop
641
- module_prefix = definition_obj .module_name + "."
642
- full_name_without_module_prefix = definition_obj .full_name . replace ( module_prefix , "" , 1 )
643
- qualified_name_with_modules_from_root = f" { module_name_from_file_path ( definition_obj . module_path , project_root_path ) } . { full_name_without_module_prefix } "
644
-
645
- for test_func in test_functions_by_name [ scope ] :
646
- if test_func . parameters is not None :
647
- if test_framework == "pytest" :
648
- scope_test_function = f" { test_func . function_name } [ { test_func . parameters } ]"
649
- else : # unittest
650
- scope_test_function = f" { test_func . function_name } _ { test_func . parameters } "
651
- else :
652
- scope_test_function = test_func . function_name
653
-
654
- function_to_test_map [ qualified_name_with_modules_from_root ]. add (
655
- FunctionCalledInTest (
656
- tests_in_file = TestsInFile (
657
- test_file = test_file ,
658
- test_class = test_func . test_class ,
659
- test_function = scope_test_function ,
660
- test_type = test_func . test_type ,
661
- ),
662
- position = CodePosition ( line_no = name . line , col_no = name . column ),
627
+ try :
628
+ if not definition or definition [0 ].type != "function" :
629
+ continue
630
+ definition_obj = definition [ 0 ]
631
+ definition_path = str ( definition_obj . module_path )
632
+
633
+ project_root_str = str ( project_root_path )
634
+ if (
635
+ definition_path . startswith ( project_root_str + os . sep )
636
+ and definition_obj . module_name != name . module_name
637
+ and definition_obj .full_name is not None
638
+ ):
639
+ # Pre-compute common values outside the inner loop
640
+ module_prefix = definition_obj . module_name + "."
641
+ full_name_without_module_prefix = definition_obj .full_name . replace ( module_prefix , "" , 1 )
642
+ qualified_name_with_modules_from_root = f" { module_name_from_file_path ( definition_obj .module_path , project_root_path ) } . { full_name_without_module_prefix } "
643
+
644
+ for test_func in test_functions_by_name [ scope ]:
645
+ if test_func . parameters is not None :
646
+ if test_framework == "pytest" :
647
+ scope_test_function = f" { test_func . function_name } [ { test_func . parameters } ]"
648
+ else : # unittest
649
+ scope_test_function = f" { test_func . function_name } _ { test_func . parameters } "
650
+ else :
651
+ scope_test_function = test_func . function_name
652
+
653
+ function_to_test_map [ qualified_name_with_modules_from_root ]. add (
654
+ FunctionCalledInTest (
655
+ tests_in_file = TestsInFile (
656
+ test_file = test_file ,
657
+ test_class = test_func . test_class ,
658
+ test_function = scope_test_function ,
659
+ test_type = test_func . test_type ,
660
+ ) ,
661
+ position = CodePosition ( line_no = name . line , col_no = name . column ),
662
+ )
663
663
)
664
- )
665
- num_discovered_tests += 1
664
+ num_discovered_tests += 1
665
+ except Exception as e :
666
+ logger .debug (str (e ))
667
+ continue
666
668
667
669
progress .advance (task_id )
668
670
0 commit comments