mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-25 14:55:00 +00:00
feat: use IgnorantTemporaryDirectory and create actual repo1 subdirectory in test_setup_git_home_existing_repo
This commit is contained in:
parent
fc77570b38
commit
b8a52c2bef
1 changed files with 12 additions and 9 deletions
|
@ -621,19 +621,22 @@ class TestMain(TestCase):
|
||||||
self.assertTrue(coder.suggest_shell_commands)
|
self.assertTrue(coder.suggest_shell_commands)
|
||||||
|
|
||||||
@patch("aider.main.InputOutput")
|
@patch("aider.main.InputOutput")
|
||||||
@patch("aider.main.Path")
|
def test_setup_git_home_existing_repo(self, mock_io):
|
||||||
def test_setup_git_home_existing_repo(self, mock_path, mock_io):
|
|
||||||
mock_io_instance = mock_io.return_value
|
mock_io_instance = mock_io.return_value
|
||||||
mock_io_instance.prompt_ask.return_value = "1"
|
mock_io_instance.prompt_ask.return_value = "1"
|
||||||
mock_path.home.return_value.glob.return_value = [Path("/home/user/repo1/.git")]
|
|
||||||
|
|
||||||
result = setup_git_home(mock_io_instance)
|
with IgnorantTemporaryDirectory() as temp_home:
|
||||||
|
with patch("aider.main.Path.home", return_value=Path(temp_home)):
|
||||||
|
# Create actual repo1 subdirectory with .git folder
|
||||||
|
Path(temp_home, "repo1", ".git").mkdir(parents=True)
|
||||||
|
|
||||||
self.assertEqual(result, Path("/home/user/repo1"))
|
result = setup_git_home(mock_io_instance)
|
||||||
mock_io_instance.tool_output.assert_called_with(
|
|
||||||
"Found git repositories in your home directory:"
|
self.assertEqual(result, Path(temp_home) / "repo1")
|
||||||
)
|
mock_io_instance.tool_output.assert_any_call(
|
||||||
mock_io_instance.prompt_ask.assert_called()
|
"Found git repositories in your home directory:"
|
||||||
|
)
|
||||||
|
mock_io_instance.prompt_ask.assert_called()
|
||||||
|
|
||||||
@patch("aider.main.InputOutput")
|
@patch("aider.main.InputOutput")
|
||||||
@patch("aider.main.make_new_repo")
|
@patch("aider.main.make_new_repo")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue