@@ -211,7 +211,7 @@ def optimize_function(self) -> Result[BestOptimization, str]:
211211 key : self .function_to_tests .get (key , []) + function_to_concolic_tests .get (key , [])
212212 for key in set (self .function_to_tests ) | set (function_to_concolic_tests )
213213 }
214- instrumented_unittests_created_for_function = self .instrument_existing_tests ()
214+ instrumented_unittests_created_for_function = self .instrument_existing_tests (function_to_all_tests )
215215
216216 # Get a dict of file_path_to_classes of fto and helpers_of_fto
217217 file_path_to_helper_classes = defaultdict (set )
@@ -623,19 +623,19 @@ def cleanup_leftover_test_return_values() -> None:
623623 get_run_tmp_file (Path ("test_return_values_0.bin" )).unlink (missing_ok = True )
624624 get_run_tmp_file (Path ("test_return_values_0.sqlite" )).unlink (missing_ok = True )
625625
626- def instrument_existing_tests (self ) -> set [Path ]:
626+ def instrument_existing_tests (self , function_to_all_tests : dict [ str , list [ FunctionCalledInTest ]] ) -> set [Path ]:
627627 existing_test_files_count = 0
628628 replay_test_files_count = 0
629629 concolic_coverage_test_files_count = 0
630630 unique_instrumented_test_files = set ()
631631
632632 func_qualname = self .function_to_optimize .qualified_name_with_modules_from_root (self .project_root )
633- if func_qualname not in self . function_to_tests :
633+ if func_qualname not in function_to_all_tests :
634634 logger .info (f"Did not find any pre-existing tests for '{ func_qualname } ', will only use generated tests." )
635635 console .rule ()
636636 else :
637637 test_file_invocation_positions = defaultdict (list [FunctionCalledInTest ])
638- for tests_in_file in self . function_to_tests .get (func_qualname ):
638+ for tests_in_file in function_to_all_tests .get (func_qualname ):
639639 test_file_invocation_positions [
640640 (tests_in_file .tests_in_file .test_file , tests_in_file .tests_in_file .test_type )
641641 ].append (tests_in_file )
0 commit comments