Skip to content

Commit 30d9cb4

Browse files
Update function_optimizer.py
1 parent b775a84 commit 30d9cb4

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

codeflash/optimization/function_optimizer.py

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -319,20 +319,12 @@ def optimize_function(self) -> Result[BestOptimization, str]:
319319
original_helper_code,
320320
self.function_to_optimize.file_path,
321321
)
322-
for generated_test_path in generated_test_paths:
323-
generated_test_path.unlink(missing_ok=True)
324-
for generated_perf_test_path in generated_perf_test_paths:
325-
generated_perf_test_path.unlink(missing_ok=True)
326-
for test_paths in instrumented_unittests_created_for_function:
327-
test_paths.unlink(missing_ok=True)
328-
for fn in function_to_concolic_tests:
329-
for test in function_to_concolic_tests[fn]:
330-
if not test.tests_in_file.test_file.parent.exists():
331-
logger.warning(
332-
f"Concolic test directory {test.tests_in_file.test_file.parent} does not exist so could not be deleted."
333-
)
334-
shutil.rmtree(test.tests_in_file.test_file.parent, ignore_errors=True)
335-
break # need to delete only one test directory
322+
323+
# lista filepath
324+
filespaths = generated_test_paths + generated_perf_test_paths
325+
# remove all test files
326+
cleanup_paths(filespaths)
327+
336328

337329
if not best_optimization:
338330
return Failure(f"No best optimizations found for function {self.function_to_optimize.qualified_name}")

0 commit comments

Comments
 (0)