diff --git a/tests/test_main.py b/tests/test_main.py index 491d75f51..097063208 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -18,18 +18,19 @@ class TestMain(TestCase): self.original_cwd = os.getcwd() self.tempdir = tempfile.mkdtemp() os.chdir(self.tempdir) + self.patcher = patch("aider.main.Coder.check_model_availability") + self.mock_check = self.patcher.start() + self.mock_check.return_value = True def tearDown(self): os.chdir(self.original_cwd) shutil.rmtree(self.tempdir) + self.patcher.stop() def test_main_with_empty_dir_no_files_on_command(self): - with patch("aider.main.Coder.check_model_availability") as mock_check: - mock_check.return_value = True - - pipe_input = create_input(StringIO("")) - main([], input=pipe_input, output=DummyOutput()) - 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): pipe_input = create_input(StringIO(""))