mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-20 04:14:59 +00:00
test: add test for graceful exit when git command not found
This commit is contained in:
parent
7ab1cf5160
commit
81981e7e99
1 changed files with 11 additions and 0 deletions
|
@ -619,3 +619,14 @@ class TestMain(TestCase):
|
|||
return_coder=True,
|
||||
)
|
||||
self.assertTrue(coder.suggest_shell_commands)
|
||||
|
||||
@patch('git.Repo.init')
|
||||
def test_main_exit_with_git_command_not_found(self, mock_git_init):
|
||||
mock_git_init.side_effect = git.exc.GitCommandNotFound('git')
|
||||
|
||||
try:
|
||||
result = main(["--exit"], input=DummyInput(), output=DummyOutput())
|
||||
except Exception as e:
|
||||
self.fail(f"main() raised an unexpected exception: {e}")
|
||||
|
||||
self.assertIsNone(result, "main() should return None when called with --exit")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue