mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 16:54:59 +00:00
wip
This commit is contained in:
parent
99693fe614
commit
a5414473d9
1 changed files with 6 additions and 9 deletions
|
@ -13,26 +13,23 @@ from aider.main import main
|
||||||
|
|
||||||
|
|
||||||
class TestMain(TestCase):
|
class TestMain(TestCase):
|
||||||
from unittest.mock import MagicMock
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
os.environ["OPENAI_API_KEY"] = "deadbeef"
|
os.environ["OPENAI_API_KEY"] = "deadbeef"
|
||||||
self.original_cwd = os.getcwd()
|
self.original_cwd = os.getcwd()
|
||||||
self.tempdir = tempfile.mkdtemp()
|
self.tempdir = tempfile.mkdtemp()
|
||||||
os.chdir(self.tempdir)
|
os.chdir(self.tempdir)
|
||||||
|
|
||||||
self.mock_check = MagicMock(return_value=True)
|
|
||||||
with patch("aider.main.Coder.check_model_availability", new=self.mock_check):
|
|
||||||
super().setUp()
|
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
os.chdir(self.original_cwd)
|
os.chdir(self.original_cwd)
|
||||||
shutil.rmtree(self.tempdir)
|
shutil.rmtree(self.tempdir)
|
||||||
|
|
||||||
def test_main_with_empty_dir_no_files_on_command(self):
|
def test_main_with_empty_dir_no_files_on_command(self):
|
||||||
pipe_input = create_input(StringIO(""))
|
with patch("aider.main.Coder.check_model_availability") as mock_check:
|
||||||
main([], input=pipe_input, output=DummyOutput())
|
mock_check.return_value = True
|
||||||
pipe_input.close()
|
|
||||||
|
pipe_input = create_input(StringIO(""))
|
||||||
|
main([], input=pipe_input, output=DummyOutput())
|
||||||
|
pipe_input.close()
|
||||||
|
|
||||||
def test_main_with_empty_dir_new_file(self):
|
def test_main_with_empty_dir_new_file(self):
|
||||||
pipe_input = create_input(StringIO(""))
|
pipe_input = create_input(StringIO(""))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue