mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 17:55:01 +00:00
![]() # Aider chat conversation: USER: the real `get_commit_message` is being called in `test_main_with_empty_git_dir_new_file` ASSISTANT: To prevent the real `get_commit_message` from being called during the test `test_main_with_empty_git_dir_new_file`, we can use the `unittest.mock.patch` decorator to replace it with a mock function. Here's how to do it: ```python tests/test_main.py <<<<<<< ORIGINAL def test_main_with_empty_git_dir_new_file(self): make_repo() main(["--yes", "foo.txt"], input=DummyInput(), output=DummyOutput()) self.assertTrue(os.path.exists("foo.txt")) ======= @patch("aider.repo.AiderRepo.get_commit_message", return_value="mock commit message") def test_main_with_empty_git_dir_new_file(self, _): make_repo() main(["--yes", "foo.txt"], input=DummyInput(), output=DummyOutput()) self.assertTrue(os.path.exists("foo.txt")) >>>>>>> UPDATED ``` This change will replace the `get_commit_message` method with a mock that always returns "mock commit message" during the execution of `test_main_with_empty_git_dir_new_file`. |
||
---|---|---|
.. | ||
__init__.py | ||
test_coder.py | ||
test_commands.py | ||
test_editblock.py | ||
test_io.py | ||
test_main.py | ||
test_models.py | ||
test_repo.py | ||
test_repomap.py | ||
test_sendchat.py | ||
test_wholefile.py | ||
utils.py |