mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-01 18:25:00 +00:00
Merge pull request #378 from VariousForks/log_message_arg_patch_2023-11-27_unit_test
Fixes #374 - logging add_to_input_history if args.message is used. (and unit test)
This commit is contained in:
commit
93236e2e7e
2 changed files with 11 additions and 0 deletions
|
@ -560,6 +560,7 @@ def main(argv=None, input=None, output=None, force_git_root=None):
|
|||
io.tool_error(f"Git working dir: {git_root}")
|
||||
|
||||
if args.message:
|
||||
io.add_to_input_history(args.message)
|
||||
io.tool_output()
|
||||
coder.run(with_message=args.message)
|
||||
else:
|
||||
|
|
|
@ -196,3 +196,13 @@ class TestMain(TestCase):
|
|||
MockSend.side_effect = side_effect
|
||||
|
||||
main(["--yes", fname, "--encoding", "iso-8859-15"])
|
||||
@patch("aider.main.InputOutput")
|
||||
@patch("openai.ChatCompletion.create")
|
||||
def test_main_message_adds_to_input_history(self, mock_chat_completion, MockInputOutput):
|
||||
test_message = "test message"
|
||||
mock_io_instance = MockInputOutput.return_value
|
||||
mock_chat_completion.return_value = MagicMock(choices=[{"text": "mocked response"}])
|
||||
|
||||
main(["--message", test_message], input=DummyInput(), output=DummyOutput())
|
||||
|
||||
mock_io_instance.add_to_input_history.assert_called_once_with(test_message)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue