diff options
-rw-r--r-- | tests/import/builtin_ext.py | 6 | ||||
-rw-r--r-- | tests/import/import_broken.py | 6 | ||||
-rw-r--r-- | tests/import/import_file.py | 4 | ||||
-rw-r--r-- | tests/import/import_pkg9.py | 2 | ||||
-rw-r--r-- | tests/import/import_star_error.py | 5 |
5 files changed, 22 insertions, 1 deletions
diff --git a/tests/import/builtin_ext.py b/tests/import/builtin_ext.py index 87465f1d5..aecbbb263 100644 --- a/tests/import/builtin_ext.py +++ b/tests/import/builtin_ext.py @@ -1,3 +1,9 @@ +try: + import uos, utime +except ImportError: + print("SKIP") + raise SystemExit + # Verify that sys is a builtin. import sys diff --git a/tests/import/import_broken.py b/tests/import/import_broken.py index 3c7cf4a49..440922157 100644 --- a/tests/import/import_broken.py +++ b/tests/import/import_broken.py @@ -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. diff --git a/tests/import/import_file.py b/tests/import/import_file.py index 90ec4e41e..4cf307641 100644 --- a/tests/import/import_file.py +++ b/tests/import/import_file.py @@ -1,3 +1,7 @@ +if "__file__" not in globals(): + print("SKIP") + raise SystemExit + import import1b print(import1b.__file__) diff --git a/tests/import/import_pkg9.py b/tests/import/import_pkg9.py index 4de028494..c2e0b618b 100644 --- a/tests/import/import_pkg9.py +++ b/tests/import/import_pkg9.py @@ -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)) diff --git a/tests/import/import_star_error.py b/tests/import/import_star_error.py index 9e1757b6e..73d9c863d 100644 --- a/tests/import/import_star_error.py +++ b/tests/import/import_star_error.py @@ -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 *") |