Merge pull request #1684 from davidhalter/relative-import

Relative imports should work even if they are not within the project
This commit is contained in:
Dave Halter authored and GitHub committed 2020-12-22 23:18:46 +01:00
commit b89f9445c2
3 files changed
+61 -3

No files matched your search

+4 -2
View File
@@ -1,9 +1,11 @@
import pytest
from ..helpers import test_dir
def test_import_references(Script):
s = Script("from .. import foo", path="foo.py")
assert [usage.line for usage in s.get_references(line=1, column=18)] == [1]
s = Script("from .. import foo", path=test_dir.joinpath("foo.py"))
assert [usage.line for usage in s.get_references()] == [1]
def test_exclude_builtin_modules(Script):