From 86cea0143486a1a062cbad94b0ed29f88de8155e Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Sun, 16 Jul 2023 09:05:18 -0300 Subject: [PATCH] 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 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. --- tests/test_repomap.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_repomap.py b/tests/test_repomap.py index b34593221..1ecc951b2 100644 --- a/tests/test_repomap.py +++ b/tests/test_repomap.py @@ -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):