mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-21 04:44:59 +00:00
patch check_model_availability in tests
This commit is contained in:
parent
2cc87a4afe
commit
e43a48ee10
2 changed files with 16 additions and 1 deletions
|
@ -1,11 +1,19 @@
|
||||||
import os
|
import os
|
||||||
import unittest
|
import unittest
|
||||||
from unittest.mock import MagicMock
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
from aider.coder import Coder
|
from aider.coder import Coder
|
||||||
|
|
||||||
|
|
||||||
class TestCoder(unittest.TestCase):
|
class TestCoder(unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.patcher = patch("aider.coder.Coder.check_model_availability")
|
||||||
|
self.mock_check = self.patcher.start()
|
||||||
|
self.mock_check.return_value = True
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
self.patcher.stop()
|
||||||
|
|
||||||
def test_check_for_file_mentions(self):
|
def test_check_for_file_mentions(self):
|
||||||
# Mock the IO object
|
# Mock the IO object
|
||||||
mock_io = MagicMock()
|
mock_io = MagicMock()
|
||||||
|
|
|
@ -2,6 +2,7 @@ import os
|
||||||
import shutil
|
import shutil
|
||||||
import tempfile
|
import tempfile
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
from aider.commands import Commands
|
from aider.commands import Commands
|
||||||
from aider.io import InputOutput
|
from aider.io import InputOutput
|
||||||
|
@ -13,10 +14,16 @@ class TestCommands(TestCase):
|
||||||
self.tempdir = tempfile.mkdtemp()
|
self.tempdir = tempfile.mkdtemp()
|
||||||
os.chdir(self.tempdir)
|
os.chdir(self.tempdir)
|
||||||
|
|
||||||
|
self.patcher = patch("aider.coder.Coder.check_model_availability")
|
||||||
|
self.mock_check = self.patcher.start()
|
||||||
|
self.mock_check.return_value = True
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
os.chdir(self.original_cwd)
|
os.chdir(self.original_cwd)
|
||||||
shutil.rmtree(self.tempdir)
|
shutil.rmtree(self.tempdir)
|
||||||
|
|
||||||
|
self.patcher.stop()
|
||||||
|
|
||||||
def test_cmd_add(self):
|
def test_cmd_add(self):
|
||||||
# Initialize the Commands and InputOutput objects
|
# Initialize the Commands and InputOutput objects
|
||||||
io = InputOutput(pretty=False, yes=True)
|
io = InputOutput(pretty=False, yes=True)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue