test: fix external editor test to use real temp file that exists

This commit is contained in:
2026-05-07 21:21:05 -04:00
parent 6a615a2d20
commit a6c569fb69
3 changed files with 37 additions and 33 deletions
+11 -3
View File
@@ -61,8 +61,14 @@ def test_vscode_launches_with_diff_view(live_gui):
print(f"\n=== VSCODE LAUNCH TEST ===")
print(f"VSCode before:\n{before if before.strip() else 'not running'}")
sample_patch = """--- a/test.py
+++ b/test.py
with tempfile.NamedTemporaryFile(mode='w', suffix='.py', delete=False, encoding='utf-8') as f:
f.write('HELLO_WORLD = "original"\n')
f.write('def main():\n')
f.write(' pass\n')
test_file = f.name
sample_patch = f"""--- a/{Path(test_file).name}
+++ b/{Path(test_file).name}
@@ -1,2 +1,3 @@
HELLO_WORLD = "original"
-HELLO_WORLD = "modified"
@@ -73,7 +79,7 @@ def test_vscode_launches_with_diff_view(live_gui):
client.push_event("show_patch_modal", {
"patch_text": sample_patch,
"file_paths": ["test.py"]
"file_paths": [test_file]
})
time.sleep(2)
@@ -99,6 +105,8 @@ def test_vscode_launches_with_diff_view(live_gui):
client.push_event("hide_patch_modal", {})
time.sleep(1)
os.unlink(test_file)
@pytest.mark.integration
@pytest.mark.timeout(30)