diff options
author | stijn <stijn@ignitron.net> | 2020-06-18 11:19:14 +0200 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2020-09-04 00:10:24 +1000 |
commit | 40ad8f1666b265dafc7844d765f45cfae4b6299f (patch) | |
tree | d073a4b4f791f53d1a73c47d029bf2b49f041d5e /tests/micropython | |
parent | b0932fcf2e2f9a81abf7737ed4b2573bd9ad4a49 (diff) |
all: Rename "sys" module to "usys".
This is consistent with the other 'micro' modules and allows implementing
additional features in Python via e.g. micropython-lib's sys.
Note this is a breaking change (not backwards compatible) for ports which
do not enable weak links, as "import sys" must now be replaced with
"import usys".
Diffstat (limited to 'tests/micropython')
-rw-r--r-- | tests/micropython/emg_exc.py | 4 | ||||
-rw-r--r-- | tests/micropython/heapalloc_traceback.py | 4 | ||||
-rw-r--r-- | tests/micropython/import_mpy_invalid.py | 6 | ||||
-rw-r--r-- | tests/micropython/import_mpy_native_x64.py | 8 | ||||
-rw-r--r-- | tests/micropython/opt_level_lineno.py | 2 | ||||
-rw-r--r-- | tests/micropython/viper_misc_intbig.py | 4 |
6 files changed, 14 insertions, 14 deletions
diff --git a/tests/micropython/emg_exc.py b/tests/micropython/emg_exc.py index bca4d2d9f..b8df94b07 100644 --- a/tests/micropython/emg_exc.py +++ b/tests/micropython/emg_exc.py @@ -1,7 +1,7 @@ # test that emergency exceptions work import micropython -import sys +import usys try: import uio @@ -26,7 +26,7 @@ def f(): # print the exception buf = uio.StringIO() - sys.print_exception(exc, buf) + usys.print_exception(exc, buf) for l in buf.getvalue().split("\n"): if l.startswith(" File "): print(l.split('"')[2]) diff --git a/tests/micropython/heapalloc_traceback.py b/tests/micropython/heapalloc_traceback.py index eabd09388..09a2ad2c1 100644 --- a/tests/micropython/heapalloc_traceback.py +++ b/tests/micropython/heapalloc_traceback.py @@ -1,7 +1,7 @@ # test that we can generate a traceback without allocating import micropython -import sys +import usys try: import uio @@ -33,7 +33,7 @@ test() # print the exception that was raised buf = uio.StringIO() -sys.print_exception(global_exc, buf) +usys.print_exception(global_exc, buf) for l in buf.getvalue().split("\n"): # uPy on pyboard prints <stdin> as file, so remove filename. if l.startswith(" File "): diff --git a/tests/micropython/import_mpy_invalid.py b/tests/micropython/import_mpy_invalid.py index 00973fe3f..02fd4b125 100644 --- a/tests/micropython/import_mpy_invalid.py +++ b/tests/micropython/import_mpy_invalid.py @@ -1,7 +1,7 @@ # test importing of invalid .mpy files try: - import sys, uio, uos + import usys, uio, uos uio.IOBase uos.mount @@ -54,7 +54,7 @@ user_files = { # create and mount a user filesystem uos.mount(UserFS(user_files), "/userfs") -sys.path.append("/userfs") +usys.path.append("/userfs") # import .mpy files from the user filesystem for i in range(len(user_files)): @@ -66,4 +66,4 @@ for i in range(len(user_files)): # unmount and undo path addition uos.umount("/userfs") -sys.path.pop() +usys.path.pop() diff --git a/tests/micropython/import_mpy_native_x64.py b/tests/micropython/import_mpy_native_x64.py index d0de507d4..3e7b2058e 100644 --- a/tests/micropython/import_mpy_native_x64.py +++ b/tests/micropython/import_mpy_native_x64.py @@ -1,7 +1,7 @@ # test importing of .mpy files with native code (x64 only) try: - import sys, uio, uos + import usys, uio, uos uio.IOBase uos.mount @@ -9,7 +9,7 @@ except (ImportError, AttributeError): print("SKIP") raise SystemExit -if not (sys.platform == "linux" and sys.maxsize > 2 ** 32): +if not (usys.platform == "linux" and usys.maxsize > 2 ** 32): print("SKIP") raise SystemExit @@ -101,7 +101,7 @@ user_files = { # create and mount a user filesystem uos.mount(UserFS(user_files), "/userfs") -sys.path.append("/userfs") +usys.path.append("/userfs") # import .mpy files from the user filesystem for i in range(len(user_files)): @@ -114,4 +114,4 @@ for i in range(len(user_files)): # unmount and undo path addition uos.umount("/userfs") -sys.path.pop() +usys.path.pop() diff --git a/tests/micropython/opt_level_lineno.py b/tests/micropython/opt_level_lineno.py index d8253e54b..1cbf2fb1a 100644 --- a/tests/micropython/opt_level_lineno.py +++ b/tests/micropython/opt_level_lineno.py @@ -3,4 +3,4 @@ import micropython as micropython # check that level 3 doesn't store line numbers # the expected output is that any line is printed as "line 1" micropython.opt_level(3) -exec("try:\n xyz\nexcept NameError as er:\n import sys\n sys.print_exception(er)") +exec("try:\n xyz\nexcept NameError as er:\n import usys\n usys.print_exception(er)") diff --git a/tests/micropython/viper_misc_intbig.py b/tests/micropython/viper_misc_intbig.py index 055c08d8e..eda873ca6 100644 --- a/tests/micropython/viper_misc_intbig.py +++ b/tests/micropython/viper_misc_intbig.py @@ -6,6 +6,6 @@ def viper_uint() -> uint: return uint(-1) -import sys +import usys -print(viper_uint() == (sys.maxsize << 1 | 1)) +print(viper_uint() == (usys.maxsize << 1 | 1)) |