mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-21 21:04:59 +00:00
fix PermErr in test on windows
This commit is contained in:
parent
0f1af1d991
commit
09f79e5a42
1 changed files with 10 additions and 3 deletions
|
@ -1,6 +1,7 @@
|
||||||
import os
|
import os
|
||||||
import tempfile
|
import tempfile
|
||||||
import unittest
|
import unittest
|
||||||
|
from pathlib import Path
|
||||||
from unittest.mock import MagicMock, patch
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
import openai
|
import openai
|
||||||
|
@ -182,8 +183,14 @@ class TestCoder(unittest.TestCase):
|
||||||
|
|
||||||
def test_run_with_file_deletion(self):
|
def test_run_with_file_deletion(self):
|
||||||
# Create a few temporary files
|
# Create a few temporary files
|
||||||
_, file1 = tempfile.mkstemp()
|
|
||||||
_, file2 = tempfile.mkstemp()
|
tempdir = Path(tempfile.mkdtemp())
|
||||||
|
|
||||||
|
file1 = tempdir / "file1.txt"
|
||||||
|
file2 = tempdir / "file2.txt"
|
||||||
|
|
||||||
|
file1.touch()
|
||||||
|
file2.touch()
|
||||||
|
|
||||||
files = [file1, file2]
|
files = [file1, file2]
|
||||||
|
|
||||||
|
@ -202,7 +209,7 @@ class TestCoder(unittest.TestCase):
|
||||||
coder.run(with_message="hi")
|
coder.run(with_message="hi")
|
||||||
self.assertEqual(len(coder.abs_fnames), 2)
|
self.assertEqual(len(coder.abs_fnames), 2)
|
||||||
|
|
||||||
os.remove(file1)
|
file1.unlink()
|
||||||
|
|
||||||
# Call the run method again with a message
|
# Call the run method again with a message
|
||||||
coder.run(with_message="hi")
|
coder.run(with_message="hi")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue