Skip to content

Commit a1d5381

Browse files
committed
add E2E test on windows too
1 parent 02662c6 commit a1d5381

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

.github/workflows/windows-unit-tests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ jobs:
1010
windows-unit-tests:
1111
continue-on-error: true
1212
runs-on: windows-latest
13+
env:
14+
PYTHONIOENCODING: utf-8
1315
steps:
1416
- uses: actions/checkout@v4
1517
with:

tests/scripts/end_to_end_test_utilities.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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]) ->
187189
def 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

Comments
 (0)