@@ -1079,13 +1079,9 @@ def test_other():
10791079 mock_function .function_name = "target_function"
10801080 mock_function .parents = [] # No parent classes
10811081
1082- filtered_tests = discover_unit_tests (test_config , functions_to_optimize = [mock_function ])
1083- # The import filter is designed for high recall, so it may include both functions
1084- # because both test files import from the same module (mycode) that contains target_function
1085- assert len (filtered_tests ) >= 1 # Should find at least target_function
1082+ filtered_tests = discover_unit_tests (test_config , file_to_funcs_to_optimize = {code_file : [mock_function ]})
1083+ assert len (filtered_tests ) >= 1
10861084 assert "mycode.target_function" in filtered_tests
1087- # In a perfect world we'd filter out other_function, but conservative filtering
1088- # is acceptable for performance optimization purposes
10891085
10901086
10911087def test_analyze_imports_conditional_import ():
@@ -1225,8 +1221,8 @@ def test_unrelated():
12251221 mock_function .qualified_name_with_modules_from_root .return_value = "target_module.target_function"
12261222 mock_function .function_name = "target_function"
12271223 mock_function .parents = [] # No parent classes
1228-
1229- filtered_tests = discover_unit_tests (test_config , functions_to_optimize = [mock_function ])
1224+
1225+ filtered_tests = discover_unit_tests (test_config , file_to_funcs_to_optimize = { target_file : [mock_function ]} )
12301226 # Should filter out the unrelated test since it imports from a different module
12311227 assert len (filtered_tests ) == 1
12321228 assert "target_module.target_function" in filtered_tests
0 commit comments