circuitpython/tests/import
Yoctopuce dev 66c0148022 py/runtime: Add support for using __all__ in star import.
When the symbol `__all__` is defined in a module, `mp_import_all()` should
import all listed symbols into the global environment, rather than relying
on the underscore-is-private default.  This is the standard in CPython.

Each item is loaded in the same way as if it would be an explicit import
statement, and will invoke the module's `__getattr__` function if needed.
This provides a straightforward solution for fixing star import of modules
using a dynamic loader, such as `extmod/asyncio` (see issue #7266).

This improvement has been enabled at BASIC_FEATURES level, to avoid
impacting devices with limited ressources, for which star import is of
little use anyway.

Additionally, detailled reporting of errors during `__all__` import has
been implemented to match CPython, but this is only enabled when
ERROR_REPORTING is set to MICROPY_ERROR_REPORTING_DETAILED.

Signed-off-by: Yoctopuce dev <dev@yoctopuce.com>
2025-06-23 16:05:12 +10:00
..
broken py/builtinimport: Remove partially-loaded modules from sys.modules. 2023-06-05 23:21:52 +10:00
circular py/builtinimport: Remove partially-loaded modules from sys.modules. 2023-06-05 23:21:52 +10:00
ext all: Fix "reuse" and "overridden" spelling mistakes. 2024-01-05 15:08:33 +11:00
pkg tests: Split out those tests requiring float and import. 2014-04-17 16:21:43 +01:00
pkg2 tests: Split out those tests requiring float and import. 2014-04-17 16:21:43 +01:00
pkg3 tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
pkg6 tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
pkg7 py/builtinimport: Change relative import's ValueError to ImportError. 2021-05-30 19:35:03 +10:00
pkg8 tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
pkg9 tests/import/import_pkg9.py: Add test for subpackage attribute. 2023-06-01 16:21:37 +10:00
pkgstar_all_array py/runtime: Add support for using __all__ in star import. 2025-06-23 16:05:12 +10:00
pkgstar_all_inval py/runtime: Add support for using __all__ in star import. 2025-06-23 16:05:12 +10:00
pkgstar_all_miss py/runtime: Add support for using __all__ in star import. 2025-06-23 16:05:12 +10:00
pkgstar_all_tuple py/runtime: Add support for using __all__ in star import. 2025-06-23 16:05:12 +10:00
pkgstar_default py/runtime: Add support for using __all__ in star import. 2025-06-23 16:05:12 +10:00
builtin_ext.py tests: Replace umodule with module everywhere. 2023-06-08 17:54:24 +10:00
builtin_ext.py.exp tests: Replace umodule with module everywhere. 2023-06-08 17:54:24 +10:00
builtin_import.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
gen_context.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
gen_context2.py tests: Move gen_context to import tests, because it relies on import. 2014-04-17 23:21:52 +01:00
import1a.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
import1b.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
import2a.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
import3a.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
import_broken.py py/builtinimport: Remove partially-loaded modules from sys.modules. 2023-06-05 23:21:52 +10:00
import_circular.py py/builtinimport: Remove partially-loaded modules from sys.modules. 2023-06-05 23:21:52 +10:00
import_file.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
import_long_dyn.py tests/import_long_dyn: Test for "import *" of a long dynamic name. 2018-11-01 13:33:16 +11:00
import_long_dyn2.py tests/import_long_dyn: Test for "import *" of a long dynamic name. 2018-11-01 13:33:16 +11:00
import_override.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
import_override.py.exp tests: Add .exp files for basics/parser and import/import_override. 2019-12-13 14:20:47 +11:00
import_pkg1.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
import_pkg2.py tests: Rename test scripts, changing - to _ for consistency. 2014-07-05 06:14:29 +01:00
import_pkg3.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
import_pkg4.py tests: Rename test scripts, changing - to _ for consistency. 2014-07-05 06:14:29 +01:00
import_pkg5.py tests: Rename test scripts, changing - to _ for consistency. 2014-07-05 06:14:29 +01:00
import_pkg6.py tests: Add another testcase for relative imports. 2015-02-16 12:11:41 +02:00
import_pkg7.py tests/import: Improve builtinimport.c test coverage. 2017-01-16 15:59:33 +11:00
import_pkg7.py.exp py/builtinimport: Change relative import's ValueError to ImportError. 2021-05-30 19:35:03 +10:00
import_pkg8.py tests/import: Improve builtinimport.c test coverage. 2017-01-16 15:59:33 +11:00
import_pkg9.py tests/import/import_pkg9.py: Add test for subpackage attribute. 2023-06-01 16:21:37 +10:00
import_star.py py/runtime: Add support for using __all__ in star import. 2025-06-23 16:05:12 +10:00
import_star_error.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
module_dict.py py/objmodule: Add support for __dict__. 2022-09-19 23:22:46 +10:00
module_getattr.py top: Update Python formatting to black "2023 stable style". 2023-02-02 12:51:03 +11:00
module_getattr.py.exp tests/import: Add .exp file for module_getattr.py to not require Py 3.7. 2018-10-23 11:56:58 +11:00
rel_import_inv.py tests: Add test for relative import without package context. 2015-06-27 00:40:22 +03:00
try_module.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00