@@ -88,8 +88,10 @@ def run_codeflash_command(
8888 test_root = cwd / "tests" / (config .test_framework or "" )
8989
9090 command = build_command (cwd , config , test_root , config .benchmarks_root if config .benchmarks_root else None )
91+ env = os .environ .copy ()
92+ env ['PYTHONIOENCODING' ] = 'utf-8'
9193 process = subprocess .Popen (
92- command , stdout = subprocess .PIPE , stderr = subprocess .STDOUT , text = True , cwd = str (cwd ), env = os . environ . copy ()
94+ command , stdout = subprocess .PIPE , stderr = subprocess .STDOUT , text = True , cwd = str (cwd ), env = env , encoding = 'utf-8'
9395 )
9496
9597 output = []
@@ -122,7 +124,7 @@ def build_command(
122124) -> list [str ]:
123125 python_path = "../../../codeflash/main.py" if "code_directories" in str (cwd ) else "../codeflash/main.py"
124126
125- base_command = ["python " , python_path , "--file" , config .file_path , "--no-pr" ]
127+ base_command = ["uv" , "run" , "--no-project " , python_path , "--file" , config .file_path , "--no-pr" ]
126128
127129 if config .function_name :
128130 base_command .extend (["--function" , config .function_name ])
@@ -187,9 +189,11 @@ def validate_stdout_in_candidate(stdout: str, expected_in_stdout: list[str]) ->
187189def run_trace_test (cwd : pathlib .Path , config : TestConfig , expected_improvement_pct : int ) -> bool :
188190 test_root = cwd / "tests" / (config .test_framework or "" )
189191 clear_directory (test_root )
190- command = ["python" , "-m" , "codeflash.main" , "optimize" , "workload.py" ]
192+ command = ["uv" , "run" , "--no-project" , "-m" , "codeflash.main" , "optimize" , "workload.py" ]
193+ env = os .environ .copy ()
194+ env ['PYTHONIOENCODING' ] = 'utf-8'
191195 process = subprocess .Popen (
192- command , stdout = subprocess .PIPE , stderr = subprocess .STDOUT , text = True , cwd = str (cwd ), env = os . environ . copy ()
196+ command , stdout = subprocess .PIPE , stderr = subprocess .STDOUT , text = True , cwd = str (cwd ), env = env , encoding = 'utf-8'
193197 )
194198
195199 output = []
0 commit comments