test: fix external editor test to use real temp file that exists
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user