aider: Fixed the setUp method in the TestMain class to correctly mock the check_for_model_availability method.

# Context:
USER: E           AttributeError: <class 'aider.coder.Coder'> does not have the attribute 'check_for_model_availability'
ASSISTANT: It seems like you are trying to access the `check_for_model_availability` method of the `Coder` class, but it is not defined as an instance method. To fix this issue, you need to move the `check_model_availability` method inside the `Coder` class and update the tests accordingly.

Here are the changes you need to make:

1. Move the `
^C KeyboardInterrupt
USER: fix the `setUp`
ASSISTANT: To fix the `setUp` method in the `TestMain` class, you need to update the way you are mocking the `check_for_model_availability` method. Here are the changes you need to make:

1. Modify the `setUp` method in the `TestMain` class to correctly mock the `check_for_model_availability` method of the `Coder` class.

```python
tests/test_main.py
<<<<<<< ORIGINAL
    with patch("aider.coder.Coder.check_for_model_availability") as mock_check:
        mock_check.return_value = True
        self.mock_check = mock_check
=======
    with patch("aider.coder.Coder.check_model_availability") as mock_check:
        mock_check.return_value = True
        self.mock_check = mock_check
>>>>>>> UPDATED
```

This change will ensure that the `check_for_model_availability` method is correctly mocked during the tests.
This commit is contained in:
Paul Gauthier 2023-06-01 08:45:02 -07:00
parent fd70d9d63b
commit 1b49ba6e91

View file

@ -21,9 +21,9 @@ class TestMain(TestCase):
self.tempdir = tempfile.mkdtemp()
os.chdir(self.tempdir)
with patch("aider.coder.Coder.check_for_model_availability") as mock_check:
mock_check.return_value = True
self.mock_check = mock_check
with patch("aider.coder.Coder.check_model_availability") as mock_check:
mock_check.return_value = True
self.mock_check = mock_check
def tearDown(self):
os.chdir(self.original_cwd)