Skip to content

Commit

Permalink
added test for #310
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-gauthier committed Nov 2, 2023
1 parent b507ea0 commit 6556265
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,3 +413,22 @@ def test_cmd_add_quoted_filename(self):
commands.cmd_add(f'"{fname}"')

self.assertIn(str(fname.resolve()), coder.abs_fnames)

def test_cmd_add_no_autocommit(self):
with GitTemporaryDirectory():
io = InputOutput(pretty=False, yes=True)
from aider.coders import Coder

coder = Coder.create(models.GPT35, None, io, auto_commits=False)
commands = Commands(io, coder)

commands.cmd_add("foo.txt")

# Check if both files have been created in the temporary directory
self.assertTrue(os.path.exists("foo.txt"))

repo = git.Repo()

# Assert that foo.txt has been `git add` but not `git commit`
added_files = repo.git.diff("--cached", "--name-only").split()
self.assertIn("foo.txt", added_files)

0 comments on commit 6556265

Please sign in to comment.