@@ -627,42 +627,45 @@ def process_test_files(
627627
628628 if not definition or definition [0 ].type != "function" :
629629 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 ),
630+ try :
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 ),
663+ )
663664 )
664- )
665- num_discovered_tests += 1
665+ num_discovered_tests += 1
666+ except Exception as e :
667+ logger .debug (str (e ))
668+ continue
666669
667670 progress .advance (task_id )
668671
0 commit comments