aider/tests
Paul Gauthier c4a07f1f84 aider: The real get_commit_message is being replaced with a mock function in the test_main_with_empty_git_dir_new_file test.
# 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`.
2023-07-21 15:59:13 -03:00
..
__init__.py aider: Added empty __init__.py file to tests directory to fix ModuleNotFoundError when running tests. 2023-05-11 17:12:42 -07:00
test_coder.py Merge branch 'main' into refactor-repo 2023-07-21 15:46:31 -03:00
test_commands.py restore test_cmd_tokens 2023-07-17 16:01:37 -03:00
test_editblock.py added test_replace_part_with_missing_varied_leading_whitespace 2023-07-18 15:13:14 -03:00
test_io.py Fix test 2023-07-10 15:33:46 -07:00
test_main.py aider: The real get_commit_message is being replaced with a mock function in the test_main_with_empty_git_dir_new_file test. 2023-07-21 15:59:13 -03:00
test_models.py More Model test cases 2023-06-21 14:13:34 -07:00
test_repo.py Refactor coder.get_tracked_files to coder.repo.get_tracked_files in test_coder.py and add test_get_commit_message_no_strip_unmatched_quotes in test_repo.py. 2023-07-21 14:36:26 -03:00
test_repomap.py aider: Change the relative import to an absolute import for the IgnorantTemporaryDirectory class in test_repomap.py. 2023-07-16 09:05:18 -03:00
test_sendchat.py move tests to test_sendchat.py 2023-07-21 14:17:14 -03:00
test_wholefile.py updated tests 2023-07-11 15:17:00 -07:00
utils.py refac make_repo 2023-07-16 12:25:18 -03:00