mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-23 13:54:59 +00:00
Make the tests run on windows; added test for files with quotes
This commit is contained in:
parent
68c26a60ef
commit
cccd0d1ebe
1 changed files with 14 additions and 5 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
import os
|
||||||
import tempfile
|
import tempfile
|
||||||
import unittest
|
import unittest
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
@ -367,12 +368,20 @@ class TestCoder(unittest.TestCase):
|
||||||
repo = git.Repo.init(tempdir)
|
repo = git.Repo.init(tempdir)
|
||||||
|
|
||||||
# Create three empty files and add them to the git repository
|
# Create three empty files and add them to the git repository
|
||||||
filenames = ["README.md", "doc/fänny_dirname/README.md", "doc/systemüberblick.md"]
|
filenames = ["README.md", "fänny.md", "systemüberblick.md", 'file"with"quotes.txt']
|
||||||
|
created_files = []
|
||||||
for filename in filenames:
|
for filename in filenames:
|
||||||
file_path = tempdir / filename
|
file_path = tempdir / filename
|
||||||
file_path.parent.mkdir(parents=True, exist_ok=True)
|
try:
|
||||||
file_path.touch()
|
file_path.touch()
|
||||||
repo.git.add(str(file_path))
|
repo.git.add(str(file_path))
|
||||||
|
created_files.append(filename)
|
||||||
|
except OSError:
|
||||||
|
# windows won't allow files with quotes, that's ok
|
||||||
|
self.assertIn('"', filename)
|
||||||
|
self.assertEqual(os.name, "nt")
|
||||||
|
|
||||||
|
self.assertTrue(len(created_files) >= 3)
|
||||||
|
|
||||||
repo.git.commit("-m", "added")
|
repo.git.commit("-m", "added")
|
||||||
|
|
||||||
|
@ -386,7 +395,7 @@ class TestCoder(unittest.TestCase):
|
||||||
)
|
)
|
||||||
|
|
||||||
# Assert that coder.get_tracked_files() returns the three filenames
|
# Assert that coder.get_tracked_files() returns the three filenames
|
||||||
self.assertEqual(set(coder.get_tracked_files()), set(filenames))
|
self.assertEqual(set(coder.get_tracked_files()), set(created_files))
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue