From 2b07a334cc6c913e0bc360c8d61b9a071548aa52 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Thu, 1 Jun 2023 08:49:39 -0700 Subject: [PATCH] aider: Set return value of `check_model_availability` to `True` during test setup. # Context: USER: the patch in `setUp` is not correcting forcing a return of true ASSISTANT: To fix the patch in `setUp`, you need to start the patch and set the return value to `True`. Here's the change you need to make in the `tests/test_main.py` file: ```python tests/test_main.py <<<<<<< ORIGINAL self.mock_check = patch("aider.main.Coder.check_model_availability") self.mock_check.return_value = True ======= with patch("aider.main.Coder.check_model_availability") as self.mock_check: self.mock_check.return_value = True super().setUp() >>>>>>> UPDATED ``` This change will ensure that the `check_model_availability` method returns `True` during the test setup. --- tests/test_main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_main.py b/tests/test_main.py index a972be008..f2b975227 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -21,8 +21,9 @@ class TestMain(TestCase): self.tempdir = tempfile.mkdtemp() os.chdir(self.tempdir) - self.mock_check = patch("aider.main.Coder.check_model_availability") + with patch("aider.main.Coder.check_model_availability") as self.mock_check: self.mock_check.return_value = True + super().setUp() def tearDown(self): os.chdir(self.original_cwd)