mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-22 21:34:59 +00:00
cleaned up --no-autocommit test
This commit is contained in:
parent
2bb1c34bd5
commit
24e78229b2
1 changed files with 8 additions and 11 deletions
|
@ -2,7 +2,6 @@ import os
|
|||
import tempfile
|
||||
import unittest
|
||||
from unittest import TestCase
|
||||
from unittest.mock import MagicMock
|
||||
from aider.main import main
|
||||
import subprocess
|
||||
from prompt_toolkit.input import create_input
|
||||
|
@ -18,16 +17,6 @@ class TestMain(TestCase):
|
|||
main([], input=pipe_input, output=DummyOutput())
|
||||
pipe_input.close()
|
||||
|
||||
def test_main_with_no_auto_commits(self):
|
||||
with tempfile.TemporaryDirectory() as temp_dir:
|
||||
os.chdir(temp_dir)
|
||||
pipe_input = create_input(StringIO(""))
|
||||
with unittest.mock.patch("aider.main.Coder") as MockCoder:
|
||||
main(["--no-auto-commits"], input=pipe_input, output=DummyOutput())
|
||||
_, kwargs = MockCoder.call_args
|
||||
assert kwargs["auto_commits"] is False
|
||||
pipe_input.close()
|
||||
|
||||
def test_main_with_empty_dir_new_file(self):
|
||||
with tempfile.TemporaryDirectory() as temp_dir:
|
||||
os.chdir(temp_dir)
|
||||
|
@ -44,3 +33,11 @@ class TestMain(TestCase):
|
|||
main(["--yes", "foo.txt"], input=pipe_input, output=DummyOutput())
|
||||
pipe_input.close()
|
||||
self.assertTrue(os.path.exists("foo.txt"))
|
||||
|
||||
def test_main_with_no_auto_commits(self):
|
||||
with tempfile.TemporaryDirectory() as temp_dir:
|
||||
os.chdir(temp_dir)
|
||||
with unittest.mock.patch("aider.main.Coder") as MockCoder:
|
||||
main(["--no-auto-commits"])
|
||||
_, kwargs = MockCoder.call_args
|
||||
assert kwargs["auto_commits"] is False
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue