|
12 | 12 | from codeflash.api.aiservice import AiServiceClient, LocalAiServiceClient
|
13 | 13 | from codeflash.cli_cmds.console import console, logger, progress_bar
|
14 | 14 | from codeflash.code_utils import env_utils
|
| 15 | +from codeflash.code_utils.code_utils import cleanup_paths |
15 | 16 | from codeflash.code_utils.env_utils import get_pr_number
|
16 | 17 | from codeflash.either import is_successful
|
17 | 18 | from codeflash.models.models import ValidCode
|
@@ -251,6 +252,7 @@ def run(self) -> None:
|
251 | 252 | if self.args.no_draft and is_pr_draft():
|
252 | 253 | logger.warning("PR is in draft mode, skipping optimization")
|
253 | 254 | return
|
| 255 | + cleanup_paths(Optimizer.find_leftover_instrumented_test_files(self.test_cfg.tests_root)) |
254 | 256 |
|
255 | 257 | function_optimizer = None
|
256 | 258 | file_to_funcs_to_optimize, num_optimizable_functions = self.get_optimizable_functions()
|
@@ -344,13 +346,9 @@ def find_leftover_instrumented_test_files(test_root: Path) -> list[Path]:
|
344 | 346 | return [file for file in test_root.rglob("test_*.py") if pattern.match(file.name)]
|
345 | 347 |
|
346 | 348 | def cleanup_temporary_paths(self) -> None:
|
347 |
| - from codeflash.code_utils.code_utils import cleanup_paths |
348 |
| - |
349 | 349 | if self.current_function_optimizer:
|
350 | 350 | self.current_function_optimizer.cleanup_generated_files()
|
351 | 351 |
|
352 |
| - cleanup_paths(Optimizer.find_leftover_instrumented_test_files(self.test_cfg.tests_root)) |
353 |
| - |
354 | 352 | cleanup_paths([self.test_cfg.concolic_test_root_dir, self.replay_tests_dir])
|
355 | 353 |
|
356 | 354 |
|
|
0 commit comments