tests/import: Improve builtinimport.c test coverage.

This commit is contained in:
Rami Ali 2017-01-16 15:45:55 +11:00 committed by Damien George
parent 8d01bd3a1c
commit 50e14ca619
4 changed files with 11 additions and 1 deletions

View File

@ -1,2 +1,2 @@
# 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

View File

@ -0,0 +1,2 @@
# import with no __init__.py files
import pkg8.mod

View File

@ -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')

1
tests/import/pkg8/mod.py Normal file
View File

@ -0,0 +1 @@
print('foo')