Skip to content
Snippets Groups Projects
Commit 50e14ca6 authored by Rami Ali's avatar Rami Ali Committed by Damien George
Browse files

tests/import: Improve builtinimport.c test coverage.

parent 8d01bd3a
No related branches found
No related tags found
No related merge requests found
# This tests ... relative imports as used in pkg7
# This tests ... relative imports as used in pkg7 and imports beyond package root
import pkg7.subpkg1.subpkg2.mod3
# import with no __init__.py files
import pkg8.mod
......@@ -2,3 +2,10 @@ from ... import mod1
from ...mod2 import bar
print(mod1.foo)
print(bar)
# when attempting relative import beyond top-level package uPy raises ImportError
# whereas CPython raises a ValueError
try:
from .... import mod1
except (ImportError, ValueError):
print('Error')
print('foo')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment