@@ -195,7 +195,7 @@ def test_sort(self):
195195 ).replace ('"' , "'" )
196196
197197
198- def test_perfinjector_only_replay_test () -> None :
198+ def test_perfinjector_only_replay_test (tmp_dir ) -> None :
199199 code = """import dill as pickle
200200import pytest
201201from codeflash.tracing.replay_test import get_next_arg_and_return
@@ -274,7 +274,7 @@ def test_prepare_image_for_yolo():
274274 assert compare_results(return_val_1, ret)
275275 codeflash_con.close()
276276"""
277- with tempfile . NamedTemporaryFile ( mode = "w" ) as f :
277+ with ( tmp_dir / "test_return_values.py" ). open ( "w" ) as f :
278278 f .write (code )
279279 f .flush ()
280280 func = FunctionToOptimize (function_name = "prepare_image_for_yolo" , parents = [], file_path = Path ("module.py" ))
@@ -287,7 +287,7 @@ def test_prepare_image_for_yolo():
287287 os .chdir (original_cwd )
288288 assert success
289289 assert new_test .replace ('"' , "'" ) == expected .format (
290- module_path = Path (f .name ).name , tmp_dir_path = get_run_tmp_file (Path ("test_return_values" ))
290+ module_path = Path (f .name ).stem , tmp_dir_path = get_run_tmp_file (Path ("test_return_values" )). as_posix ( )
291291 ).replace ('"' , "'" )
292292
293293
@@ -394,7 +394,7 @@ def test_sort():
394394 assert new_test is not None
395395 assert new_test .replace ('"' , "'" ) == expected .format (
396396 module_path = "code_to_optimize.tests.pytest.test_perfinjector_bubble_sort_results_temp" ,
397- tmp_dir_path = get_run_tmp_file (Path ("test_return_values" )),
397+ tmp_dir_path = get_run_tmp_file (Path ("test_return_values" )). as_posix () ,
398398 ).replace ('"' , "'" )
399399
400400 success , new_perf_test = inject_profiling_into_existing_test (
0 commit comments