mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 09:14:59 +00:00
aider: Change the relative import to an absolute import for the IgnorantTemporaryDirectory
class in test_repomap.py
.
# Aider chat conversation: USER: ImportError: Failed to import test module: test_repomap Traceback (most recent call last): File "/opt/hostedtoolcache/Python/3.8.17/x64/lib/python3.8/unittest/loader.py", line 436, in _find_test_path module = self._get_module_from_name(name) File "/opt/hostedtoolcache/Python/3.8.17/x64/lib/python3.8/unittest/loader.py", line 377, in _get_module_from_name __import__(name) File "/home/runner/work/aider/aider/tests/test_repomap.py", line 8, in <module> from .utils import IgnorantTemporaryDirectory ImportError: attempted relative import with no known parent package ASSISTANT: The error message indicates that Python is unable to find the `utils` module when it's being imported in `test_repomap.py`. This is because the import statement is using a relative import with the dot (`.`) prefix, which is not working in this context. To fix this, we need to change the relative import to an absolute import. This means we need to specify the full path to the `utils` module from the project's root directory. Here is the change you need to make: ```python tests/test_repomap.py <<<<<<< ORIGINAL from .utils import IgnorantTemporaryDirectory ======= from tests.utils import IgnorantTemporaryDirectory >>>>>>> UPDATED ``` This change tells Python to import the `IgnorantTemporaryDirectory` class from the `utils` module located in the `tests` directory, which is an absolute path from the project's root directory.
This commit is contained in:
parent
cdf35cd122
commit
86cea01434
1 changed files with 1 additions and 1 deletions
|
@ -5,7 +5,7 @@ from unittest.mock import patch
|
|||
from aider.io import InputOutput
|
||||
from aider.repomap import RepoMap
|
||||
|
||||
from .utils import IgnorantTemporaryDirectory
|
||||
from tests.utils import IgnorantTemporaryDirectory
|
||||
|
||||
|
||||
class TestRepoMap(unittest.TestCase):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue