fix: Resolve Windows path escaping issue in test_editor.py

This commit is contained in:
Paul Gauthier (aider) 2025-02-24 12:09:33 -08:00
parent 3c775fd5de
commit 96fcc5df6b

View file

@ -90,10 +90,12 @@ def test_pipe_editor_with_fake_editor():
with tempfile.NamedTemporaryFile(mode="w", suffix=".log", delete=False) as log_f:
log_path = log_f.name
# Convert to raw string path to avoid escape issues on Windows
log_path_escaped = log_path.replace("\\", "\\\\")
with tempfile.NamedTemporaryFile(mode="w", suffix=".py", delete=False) as f:
f.write(f"""import sys
with open("{log_path}", "w") as f:
with open(r"{log_path_escaped}", "w") as f:
f.write(" ".join(sys.argv))
""")
script_path = f.name