mirror of
https://github.com/micropython/micropython.git
synced 2025-12-16 09:50:15 +01:00
tests/import: Skip import tests where needed.
Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
try:
|
||||
import uos, utime
|
||||
except ImportError:
|
||||
print("SKIP")
|
||||
raise SystemExit
|
||||
|
||||
# Verify that sys is a builtin.
|
||||
import sys
|
||||
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
try:
|
||||
Exception.__class__
|
||||
except AttributeError:
|
||||
print("SKIP")
|
||||
raise SystemExit
|
||||
|
||||
import sys, pkg
|
||||
|
||||
# Modules we import are usually added to sys.modules.
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
if "__file__" not in globals():
|
||||
print("SKIP")
|
||||
raise SystemExit
|
||||
|
||||
import import1b
|
||||
|
||||
print(import1b.__file__)
|
||||
|
||||
@@ -13,4 +13,4 @@ pkg9.mod2()
|
||||
import pkg9.mod2
|
||||
|
||||
pkg9.mod1()
|
||||
print(pkg9.mod2.__name__, type(pkg9.mod2).__name__)
|
||||
print(pkg9.mod2.__name__, type(pkg9.mod2))
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
# test errors with import *
|
||||
|
||||
if not hasattr(object, "__init__"):
|
||||
# target doesn't have MICROPY_CPYTHON_COMPAT enabled, so doesn't check for "import *"
|
||||
print("SKIP")
|
||||
raise SystemExit
|
||||
|
||||
# 'import *' is not allowed in function scope
|
||||
try:
|
||||
exec("def foo(): from x import *")
|
||||
|
||||
Reference in New Issue
Block a user