MCPcopy
hub / github.com/Aider-AI/aider / test_cmd_add_from_subdir

Method test_cmd_add_from_subdir

tests/basic/test_commands.py:389–421  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

387 self.assertIn("bar.txt", console_output)
388
389 def test_cmd_add_from_subdir(self):
390 repo = git.Repo.init()
391 repo.config_writer().set_value("user", "name", "Test User").release()
392 repo.config_writer().set_value("user", "email", "testuser@example.com").release()
393
394 # Create three empty files and add them to the git repository
395 filenames = ["one.py", Path("subdir") / "two.py", Path("anotherdir") / "three.py"]
396 for filename in filenames:
397 file_path = Path(filename)
398 file_path.parent.mkdir(parents=True, exist_ok=True)
399 file_path.touch()
400 repo.git.add(str(file_path))
401 repo.git.commit("-m", "added")
402
403 filenames = [str(Path(fn).resolve()) for fn in filenames]
404
405 ###
406
407 os.chdir("subdir")
408
409 io = InputOutput(pretty=False, fancy_input=False, yes=True)
410 coder = Coder.create(self.GPT35, None, io)
411 commands = Commands(io, coder)
412
413 # this should get added
414 commands.cmd_add(str(Path("anotherdir") / "three.py"))
415
416 # this should add one.py
417 commands.cmd_add("*.py")
418
419 self.assertIn(filenames[0], coder.abs_fnames)
420 self.assertNotIn(filenames[1], coder.abs_fnames)
421 self.assertIn(filenames[2], coder.abs_fnames)
422
423 def test_cmd_add_from_subdir_again(self):
424 with GitTemporaryDirectory():

Callers

nothing calls this directly

Calls 6

cmd_addMethod · 0.95
InputOutputClass · 0.90
CommandsClass · 0.90
commitMethod · 0.80
createMethod · 0.80
initMethod · 0.45

Tested by

no test coverage detected