mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 16:54:59 +00:00
simplify with make_repo
This commit is contained in:
parent
108abe4a49
commit
7096f7287c
1 changed files with 4 additions and 6 deletions
|
@ -12,7 +12,8 @@ from prompt_toolkit.output import DummyOutput
|
||||||
|
|
||||||
from aider.dump import dump # noqa: F401
|
from aider.dump import dump # noqa: F401
|
||||||
from aider.io import InputOutput
|
from aider.io import InputOutput
|
||||||
from aider.main import main
|
from aider.main import main, setup_git
|
||||||
|
from tests.utils import make_repo
|
||||||
|
|
||||||
|
|
||||||
class TestMain(TestCase):
|
class TestMain(TestCase):
|
||||||
|
@ -38,18 +39,16 @@ class TestMain(TestCase):
|
||||||
self.assertTrue(os.path.exists("foo.txt"))
|
self.assertTrue(os.path.exists("foo.txt"))
|
||||||
|
|
||||||
def test_main_with_empty_git_dir_new_file(self):
|
def test_main_with_empty_git_dir_new_file(self):
|
||||||
from tests.utils import make_repo
|
|
||||||
make_repo()
|
make_repo()
|
||||||
main(["--yes", "foo.txt"], input=DummyInput(), output=DummyOutput())
|
main(["--yes", "foo.txt"], input=DummyInput(), output=DummyOutput())
|
||||||
self.assertTrue(os.path.exists("foo.txt"))
|
self.assertTrue(os.path.exists("foo.txt"))
|
||||||
|
|
||||||
def test_main_with_git_config_yml(self):
|
def test_main_with_git_config_yml(self):
|
||||||
from tests.utils import make_repo
|
|
||||||
make_repo()
|
make_repo()
|
||||||
|
|
||||||
Path(".aider.conf.yml").write_text("no-auto-commits: true\n")
|
Path(".aider.conf.yml").write_text("no-auto-commits: true\n")
|
||||||
with patch("aider.main.Coder.create") as MockCoder:
|
with patch("aider.main.Coder.create") as MockCoder:
|
||||||
main([], input=DummyInput(), output=DummyOutput())
|
main(["--yes"], input=DummyInput(), output=DummyOutput())
|
||||||
_, kwargs = MockCoder.call_args
|
_, kwargs = MockCoder.call_args
|
||||||
assert kwargs["auto_commits"] is False
|
assert kwargs["auto_commits"] is False
|
||||||
|
|
||||||
|
@ -60,7 +59,6 @@ class TestMain(TestCase):
|
||||||
assert kwargs["auto_commits"] is True
|
assert kwargs["auto_commits"] is True
|
||||||
|
|
||||||
def test_main_with_empty_git_dir_new_subdir_file(self):
|
def test_main_with_empty_git_dir_new_subdir_file(self):
|
||||||
from tests.utils import make_repo
|
|
||||||
make_repo()
|
make_repo()
|
||||||
subdir = Path("subdir")
|
subdir = Path("subdir")
|
||||||
subdir.mkdir()
|
subdir.mkdir()
|
||||||
|
@ -75,7 +73,7 @@ class TestMain(TestCase):
|
||||||
main(["--yes", str(fname)], input=DummyInput(), output=DummyOutput())
|
main(["--yes", str(fname)], input=DummyInput(), output=DummyOutput())
|
||||||
|
|
||||||
def test_setup_git(self):
|
def test_setup_git(self):
|
||||||
io = InputOutput(pretty=False, yes=True)
|
# io = InputOutput(pretty=False, yes=True)
|
||||||
with patch("aider.main.git.Repo.init") as MockRepoInit:
|
with patch("aider.main.git.Repo.init") as MockRepoInit:
|
||||||
MockRepoInit.return_value = git.Repo(self.tempdir)
|
MockRepoInit.return_value = git.Repo(self.tempdir)
|
||||||
git_root = setup_git(None, self.io)
|
git_root = setup_git(None, self.io)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue