From 309c19d39b8d7556ef60d8a7545978ba8f77ecfe Mon Sep 17 00:00:00 2001 From: Jim Mussared Date: Tue, 28 Apr 2020 13:43:07 +1000 Subject: [PATCH] tests/cpydiff: Add cpydiff test for __all__ used in imported package. --- tests/cpydiff/core_import_all.py | 9 +++++++++ tests/cpydiff/modules3/__init__.py | 1 + tests/cpydiff/modules3/foo.py | 2 ++ 3 files changed, 12 insertions(+) create mode 100644 tests/cpydiff/core_import_all.py create mode 100644 tests/cpydiff/modules3/__init__.py create mode 100644 tests/cpydiff/modules3/foo.py diff --git a/tests/cpydiff/core_import_all.py b/tests/cpydiff/core_import_all.py new file mode 100644 index 0000000000..5adf9ae3eb --- /dev/null +++ b/tests/cpydiff/core_import_all.py @@ -0,0 +1,9 @@ +""" +categories: Core,import +description: __all__ is unsupported in __init__.py in MicroPython. +cause: Not implemented. +workaround: Manually import the sub-modules directly in __init__.py using ``from . import foo, bar``. +""" +from modules3 import * + +foo.hello() diff --git a/tests/cpydiff/modules3/__init__.py b/tests/cpydiff/modules3/__init__.py new file mode 100644 index 0000000000..27a2bf2ad9 --- /dev/null +++ b/tests/cpydiff/modules3/__init__.py @@ -0,0 +1 @@ +__all__ = ["foo"] diff --git a/tests/cpydiff/modules3/foo.py b/tests/cpydiff/modules3/foo.py new file mode 100644 index 0000000000..dd9b9d4ddd --- /dev/null +++ b/tests/cpydiff/modules3/foo.py @@ -0,0 +1,2 @@ +def hello(): + print("hello")