Added a test case to fail if git posix paths are not turned into windows paths

This commit is contained in:
Paul Gauthier 2023-07-05 16:53:43 -07:00
parent b3d624b7cd
commit c6696e7245
2 changed files with 20 additions and 9 deletions

View file

@ -2,6 +2,7 @@ import os
import shutil
import subprocess
import tempfile
from pathlib import Path
from unittest import TestCase
from unittest.mock import patch
@ -37,9 +38,25 @@ class TestMain(TestCase):
subprocess.run(["git", "init"])
subprocess.run(["git", "config", "user.email", "dummy@example.com"])
subprocess.run(["git", "config", "user.name", "Dummy User"])
main(["--verbose", "--yes", "foo.txt"], input=DummyInput(), output=DummyOutput())
main(["--yes", "foo.txt"], input=DummyInput(), output=DummyOutput())
self.assertTrue(os.path.exists("foo.txt"))
def test_main_with_empty_git_dir_new_subdir_file(self):
subprocess.run(["git", "init"])
subprocess.run(["git", "config", "user.email", "dummy@example.com"])
subprocess.run(["git", "config", "user.name", "Dummy User"])
subdir = Path("subdir")
subdir.mkdir()
fname = subdir / "foo.txt"
fname.touch()
subprocess.run(["git", "add", str(subdir)])
subprocess.run(["git", "commit", "-m", "added"])
# This will throw a git error on windows if get_tracked_files doesn't
# properly convert git/posix/paths to git\posix\paths.
# Because aider will try and `git add` a file that's already in the repo.
main(["--yes", "--verbose", str(fname)], input=DummyInput(), output=DummyOutput())
def test_main_args(self):
with patch("aider.main.Coder.create") as MockCoder:
main(["--no-auto-commits"], input=DummyInput())