mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-28 08:14:59 +00:00
refactor to use io.read_text
This commit is contained in:
parent
413ddb84df
commit
c8fb1ddaa7
4 changed files with 18 additions and 15 deletions
|
@ -3,6 +3,7 @@ import tempfile
|
|||
import unittest
|
||||
from unittest.mock import patch
|
||||
|
||||
from aider.io import InputOutput
|
||||
from aider.repomap import RepoMap
|
||||
|
||||
|
||||
|
@ -21,7 +22,8 @@ class TestRepoMap(unittest.TestCase):
|
|||
with open(os.path.join(temp_dir, file), "w") as f:
|
||||
f.write("")
|
||||
|
||||
repo_map = RepoMap(root=temp_dir)
|
||||
io = InputOutput()
|
||||
repo_map = RepoMap(root=temp_dir, io=io)
|
||||
other_files = [os.path.join(temp_dir, file) for file in test_files]
|
||||
result = repo_map.get_repo_map([], other_files)
|
||||
|
||||
|
@ -65,7 +67,8 @@ print(my_function(3, 4))
|
|||
with open(os.path.join(temp_dir, test_file3), "w") as f:
|
||||
f.write(file_content3)
|
||||
|
||||
repo_map = RepoMap(root=temp_dir)
|
||||
io = InputOutput()
|
||||
repo_map = RepoMap(root=temp_dir, io=io)
|
||||
other_files = [
|
||||
os.path.join(temp_dir, test_file1),
|
||||
os.path.join(temp_dir, test_file2),
|
||||
|
@ -83,7 +86,7 @@ print(my_function(3, 4))
|
|||
def test_check_for_ctags_failure(self):
|
||||
with patch("subprocess.run") as mock_run:
|
||||
mock_run.side_effect = Exception("ctags not found")
|
||||
repo_map = RepoMap()
|
||||
repo_map = RepoMap(io=InputOutput())
|
||||
self.assertFalse(repo_map.has_ctags)
|
||||
|
||||
def test_check_for_ctags_success(self):
|
||||
|
@ -100,7 +103,7 @@ print(my_function(3, 4))
|
|||
b' status = main()$/", "kind": "variable"}'
|
||||
),
|
||||
]
|
||||
repo_map = RepoMap()
|
||||
repo_map = RepoMap(io=InputOutput())
|
||||
self.assertTrue(repo_map.has_ctags)
|
||||
|
||||
def test_get_repo_map_without_ctags(self):
|
||||
|
@ -120,7 +123,7 @@ print(my_function(3, 4))
|
|||
with open(os.path.join(temp_dir, file), "w") as f:
|
||||
f.write("")
|
||||
|
||||
repo_map = RepoMap(root=temp_dir)
|
||||
repo_map = RepoMap(root=temp_dir, io=InputOutput())
|
||||
repo_map.has_ctags = False # force it off
|
||||
|
||||
other_files = [os.path.join(temp_dir, file) for file in test_files]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue