diff options
| author | stijn | 2020-06-18 11:19:14 +0200 |
|---|---|---|
| committer | Damien George | 2020-09-04 00:10:24 +1000 |
| commit | 40ad8f1666b265dafc7844d765f45cfae4b6299f (patch) | |
| tree | d073a4b4f791f53d1a73c47d029bf2b49f041d5e /tests/io | |
| 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/io')
| -rw-r--r-- | tests/io/argv.py | 5 | ||||
| -rw-r--r-- | tests/io/builtin_print_file.py | 5 | ||||
| -rw-r--r-- | tests/io/file_stdio.py | 5 | ||||
| -rw-r--r-- | tests/io/resource_stream.py | 4 |
4 files changed, 14 insertions, 5 deletions
diff --git a/tests/io/argv.py b/tests/io/argv.py index 53254da11..834292504 100644 --- a/tests/io/argv.py +++ b/tests/io/argv.py @@ -1,3 +1,6 @@ -import sys +try: + import usys as sys +except ImportError: + import sys print(sys.argv) diff --git a/tests/io/builtin_print_file.py b/tests/io/builtin_print_file.py index 822356a6c..e5c20b64e 100644 --- a/tests/io/builtin_print_file.py +++ b/tests/io/builtin_print_file.py @@ -1,6 +1,9 @@ # test builtin print function, using file= argument -import sys +try: + import usys as sys +except ImportError: + import sys try: sys.stdout diff --git a/tests/io/file_stdio.py b/tests/io/file_stdio.py index cbdb07016..6c08f35d7 100644 --- a/tests/io/file_stdio.py +++ b/tests/io/file_stdio.py @@ -1,4 +1,7 @@ -import sys +try: + import usys as sys +except ImportError: + import sys print(sys.stdin.fileno()) print(sys.stdout.fileno()) diff --git a/tests/io/resource_stream.py b/tests/io/resource_stream.py index 5656205b6..b589ff99b 100644 --- a/tests/io/resource_stream.py +++ b/tests/io/resource_stream.py @@ -1,5 +1,5 @@ import uio -import sys +import usys try: uio.resource_stream @@ -11,5 +11,5 @@ buf = uio.resource_stream("data", "file2") print(buf.read()) # resource_stream(None, ...) look ups from current dir, hence sys.path[0] hack -buf = uio.resource_stream(None, sys.path[0] + "/data/file2") +buf = uio.resource_stream(None, usys.path[0] + "/data/file2") print(buf.read()) |
