test: Update tests for git integration

This commit is contained in:
Paul Gauthier 2025-05-13 13:44:23 -07:00 committed by Paul Gauthier (aider)
parent 6aa05ab11c
commit 756372809e
2 changed files with 2 additions and 17 deletions

View file

@ -836,7 +836,7 @@ two
def test_skip_gitignored_files_on_init(self): def test_skip_gitignored_files_on_init(self):
with GitTemporaryDirectory() as tmpdir: with GitTemporaryDirectory() as tmpdir:
repo_path = Path(tmpdir) repo_path = Path(".")
repo = git.Repo.init(repo_path) repo = git.Repo.init(repo_path)
ignored_file = repo_path / "ignored_by_git.txt" ignored_file = repo_path / "ignored_by_git.txt"
@ -856,7 +856,7 @@ two
fnames_to_add = [str(ignored_file), str(regular_file)] fnames_to_add = [str(ignored_file), str(regular_file)]
coder = Coder.create(self.GPT35, None, mock_io, fnames=fnames_to_add, repo=repo) coder = Coder.create(self.GPT35, None, mock_io, fnames=fnames_to_add)
self.assertNotIn(str(ignored_file.resolve()), coder.abs_fnames) self.assertNotIn(str(ignored_file.resolve()), coder.abs_fnames)
self.assertIn(str(regular_file.resolve()), coder.abs_fnames) self.assertIn(str(regular_file.resolve()), coder.abs_fnames)

View file

@ -1363,18 +1363,3 @@ class TestMain(TestCase):
) )
for call in mock_io_instance.tool_warning.call_args_list: for call in mock_io_instance.tool_warning.call_args_list:
self.assertNotIn("Cost estimates may be inaccurate", call[0][0]) self.assertNotIn("Cost estimates may be inaccurate", call[0][0])
def test_argv_file_respects_git(self):
with GitTemporaryDirectory():
fname = Path("not_in_git.txt")
fname.touch()
with open(".gitignore", "w+") as f:
f.write("not_in_git.txt")
coder = main(
argv=["--file", "not_in_git.txt"],
input=DummyInput(),
output=DummyOutput(),
return_coder=True,
)
self.assertNotIn("not_in_git.txt", str(coder.abs_fnames))
self.assertFalse(coder.allowed_to_edit("not_in_git.txt"))