diff --git a/ports/unix/coverage.c b/ports/unix/coverage.c index ab06c0fb39..6022ff2bff 100644 --- a/ports/unix/coverage.c +++ b/ports/unix/coverage.c @@ -356,19 +356,19 @@ STATIC mp_obj_t extra_coverage(void) { mp_printf(&mp_plat_print, "# repl\n"); const char *str; - size_t len = mp_repl_autocomplete("__n", 3, &mp_plat_print, &str); + size_t len = mp_repl_autocomplete("__n", 3, &mp_plat_print, &str); // expect "ame__" mp_printf(&mp_plat_print, "%.*s\n", (int)len, str); - len = mp_repl_autocomplete("i", 1, &mp_plat_print, &str); + len = mp_repl_autocomplete("im", 2, &mp_plat_print, &str); // expect "port" mp_printf(&mp_plat_print, "%.*s\n", (int)len, str); - mp_repl_autocomplete("import ", 7, &mp_plat_print, &str); - len = mp_repl_autocomplete("import ut", 9, &mp_plat_print, &str); + mp_repl_autocomplete("import ", 7, &mp_plat_print, &str); // expect the list of builtins + len = mp_repl_autocomplete("import ti", 9, &mp_plat_print, &str); // expect "me" mp_printf(&mp_plat_print, "%.*s\n", (int)len, str); - mp_repl_autocomplete("import time", 12, &mp_plat_print, &str); + mp_repl_autocomplete("import time", 11, &mp_plat_print, &str); // expect "time timeq" mp_store_global(MP_QSTR_sys, mp_import_name(MP_QSTR_sys, mp_const_none, MP_OBJ_NEW_SMALL_INT(0))); - mp_repl_autocomplete("sys.", 4, &mp_plat_print, &str); - len = mp_repl_autocomplete("sys.impl", 8, &mp_plat_print, &str); + mp_repl_autocomplete("sys.", 4, &mp_plat_print, &str); // expect dir(sys) + len = mp_repl_autocomplete("sys.impl", 8, &mp_plat_print, &str); // expect "ementation" mp_printf(&mp_plat_print, "%.*s\n", (int)len, str); } diff --git a/tests/basics/array1.py b/tests/basics/array1.py index f21ad4bd75..5c5d13a581 100644 --- a/tests/basics/array1.py +++ b/tests/basics/array1.py @@ -1,11 +1,8 @@ try: - import uarray as array + import array except ImportError: - try: - import array - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit a = array.array('B', [1, 2, 3]) print(a, len(a)) diff --git a/tests/basics/array_add.py b/tests/basics/array_add.py index 8335eb6b82..76ce59f761 100644 --- a/tests/basics/array_add.py +++ b/tests/basics/array_add.py @@ -1,12 +1,9 @@ # test array + array try: - import uarray as array + import array except ImportError: - try: - import array - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit a1 = array.array('I', [1]) a2 = array.array('I', [2]) diff --git a/tests/basics/array_construct.py b/tests/basics/array_construct.py index 4985244d13..2221de9906 100644 --- a/tests/basics/array_construct.py +++ b/tests/basics/array_construct.py @@ -1,13 +1,10 @@ # test construction of array.array from different objects try: - from uarray import array + from array import array except ImportError: - try: - from array import array - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit # tuple, list print(array('b', (1, 2))) diff --git a/tests/basics/array_construct2.py b/tests/basics/array_construct2.py index d1b1e9d158..c305b7f011 100644 --- a/tests/basics/array_construct2.py +++ b/tests/basics/array_construct2.py @@ -1,11 +1,8 @@ try: - from uarray import array + from array import array except ImportError: - try: - from array import array - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit # construct from something with unknown length (requires generators) print(array('i', (i for i in range(10)))) diff --git a/tests/basics/array_construct_endian.py b/tests/basics/array_construct_endian.py index 82a962fbe0..990d7b1ea0 100644 --- a/tests/basics/array_construct_endian.py +++ b/tests/basics/array_construct_endian.py @@ -1,13 +1,10 @@ # test construction of array.array from different objects try: - from uarray import array + from array import array except ImportError: - try: - from array import array - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit # raw copy from bytes, bytearray print(array('h', b'12')) diff --git a/tests/basics/array_intbig.py b/tests/basics/array_intbig.py index ba7f9ef985..5702a8ae63 100644 --- a/tests/basics/array_intbig.py +++ b/tests/basics/array_intbig.py @@ -1,13 +1,10 @@ # test array types QqLl that require big-ints try: - from uarray import array + from array import array except ImportError: - try: - from array import array - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit print(array('L', [0, 2**32-1])) print(array('l', [-2**31, 0, 2**31-1])) diff --git a/tests/basics/array_micropython.py b/tests/basics/array_micropython.py index 44dc1d83d8..771a7d709c 100644 --- a/tests/basics/array_micropython.py +++ b/tests/basics/array_micropython.py @@ -1,12 +1,9 @@ # test MicroPython-specific features of array.array try: - import uarray as array + import array except ImportError: - try: - import array - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit # arrays of objects a = array.array('O') diff --git a/tests/basics/async_await2.py b/tests/basics/async_await2.py index 56f77604ac..1e3164df93 100644 --- a/tests/basics/async_await2.py +++ b/tests/basics/async_await2.py @@ -1,9 +1,6 @@ # test await expression -try: - import usys as sys -except ImportError: - import sys +import sys if sys.implementation.name == 'micropython': # uPy allows normal generators to be awaitables coroutine = lambda f: f diff --git a/tests/basics/async_for2.py b/tests/basics/async_for2.py index 4af3be4c6d..aad23a3e5a 100644 --- a/tests/basics/async_for2.py +++ b/tests/basics/async_for2.py @@ -1,9 +1,6 @@ # test waiting within "async for" __anext__ function -try: - import usys as sys -except ImportError: - import sys +import sys if sys.implementation.name == 'micropython': # uPy allows normal generators to be awaitables coroutine = lambda f: f diff --git a/tests/basics/async_with2.py b/tests/basics/async_with2.py index 4dd1386240..44421ae917 100644 --- a/tests/basics/async_with2.py +++ b/tests/basics/async_with2.py @@ -1,9 +1,6 @@ # test waiting within async with enter/exit functions -try: - import usys as sys -except ImportError: - import sys +import sys if sys.implementation.name == 'micropython': # uPy allows normal generators to be awaitables coroutine = lambda f: f diff --git a/tests/basics/attrtuple1.py b/tests/basics/attrtuple1.py index 249c030bb4..78a0fbed1b 100644 --- a/tests/basics/attrtuple1.py +++ b/tests/basics/attrtuple1.py @@ -1,10 +1,7 @@ # test attrtuple # we can't test this type directly so we use sys.implementation object -try: - import usys as sys -except ImportError: - import sys +import sys t = sys.implementation # It can be just a normal tuple on small ports diff --git a/tests/basics/builtin_callable.py b/tests/basics/builtin_callable.py index c0a9d0c473..3ae49f004d 100644 --- a/tests/basics/builtin_callable.py +++ b/tests/basics/builtin_callable.py @@ -7,10 +7,7 @@ print(callable([])) print(callable("dfsd")) # modules should not be callabe -try: - import usys as sys -except ImportError: - import sys +import sys print(callable(sys)) # builtins should be callable diff --git a/tests/basics/builtin_dir.py b/tests/basics/builtin_dir.py index 1f2b498d77..1eecbd044b 100644 --- a/tests/basics/builtin_dir.py +++ b/tests/basics/builtin_dir.py @@ -4,10 +4,7 @@ print('__name__' in dir()) # dir of module -try: - import usys as sys -except ImportError: - import sys +import sys print('version' in dir(sys)) # dir of type diff --git a/tests/basics/bytearray_construct_array.py b/tests/basics/bytearray_construct_array.py index 52eaa7c6ef..bde5fa08bd 100644 --- a/tests/basics/bytearray_construct_array.py +++ b/tests/basics/bytearray_construct_array.py @@ -1,12 +1,9 @@ # test construction of bytearray from different objects try: - from uarray import array + from array import array except ImportError: - try: - from array import array - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit # arrays print(bytearray(array('b', [1, 2]))) diff --git a/tests/basics/bytearray_construct_endian.py b/tests/basics/bytearray_construct_endian.py index 332b43e686..0002f19c5f 100644 --- a/tests/basics/bytearray_construct_endian.py +++ b/tests/basics/bytearray_construct_endian.py @@ -1,12 +1,9 @@ # test construction of bytearray from different objects try: - from uarray import array + from array import array except ImportError: - try: - from array import array - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit # arrays print(bytearray(array('h', [1, 2]))) diff --git a/tests/basics/bytes_add_array.py b/tests/basics/bytes_add_array.py index c6382bed74..b17556d83c 100644 --- a/tests/basics/bytes_add_array.py +++ b/tests/basics/bytes_add_array.py @@ -1,12 +1,9 @@ # test bytes + other try: - import uarray as array + import array except ImportError: - try: - import array - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit # should be byteorder-neutral print(b"123" + array.array('h', [0x1515])) diff --git a/tests/basics/bytes_add_endian.py b/tests/basics/bytes_add_endian.py index 40b3de7d61..8cfffa7b6a 100644 --- a/tests/basics/bytes_add_endian.py +++ b/tests/basics/bytes_add_endian.py @@ -1,11 +1,8 @@ # test bytes + other try: - import uarray as array + import array except ImportError: - try: - import array - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit print(b"123" + array.array('i', [1])) diff --git a/tests/basics/bytes_compare_array.py b/tests/basics/bytes_compare_array.py index 6bad50b55a..ad378de70c 100644 --- a/tests/basics/bytes_compare_array.py +++ b/tests/basics/bytes_compare_array.py @@ -1,11 +1,8 @@ try: - import uarray as array + import array except ImportError: - try: - import array - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit print(array.array('b', [1, 2]) in b'\x01\x02\x03') # CPython gives False here diff --git a/tests/basics/bytes_construct_array.py b/tests/basics/bytes_construct_array.py index 7bdd8f10df..453eb59010 100644 --- a/tests/basics/bytes_construct_array.py +++ b/tests/basics/bytes_construct_array.py @@ -1,12 +1,9 @@ # test construction of bytes from different objects try: - from uarray import array + from array import array except ImportError: - try: - from array import array - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit # arrays print(bytes(array('b', [1, 2]))) diff --git a/tests/basics/bytes_construct_endian.py b/tests/basics/bytes_construct_endian.py index 294c5f23f5..cf1a9f408f 100644 --- a/tests/basics/bytes_construct_endian.py +++ b/tests/basics/bytes_construct_endian.py @@ -1,13 +1,10 @@ # test construction of bytes from different objects try: - from uarray import array + from array import array except ImportError: - try: - from array import array - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit # arrays print(bytes(array('h', [1, 2]))) diff --git a/tests/basics/class_ordereddict.py b/tests/basics/class_ordereddict.py index 4dd25eb6e1..03a211ddad 100644 --- a/tests/basics/class_ordereddict.py +++ b/tests/basics/class_ordereddict.py @@ -1,13 +1,10 @@ # test using an OrderedDict as the locals to construct a class try: - from ucollections import OrderedDict + from collections import OrderedDict except ImportError: - try: - from collections import OrderedDict - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit if not hasattr(int, "__dict__"): print("SKIP") diff --git a/tests/basics/class_store_class.py b/tests/basics/class_store_class.py index 797f88f852..8ee2f8db11 100644 --- a/tests/basics/class_store_class.py +++ b/tests/basics/class_store_class.py @@ -5,11 +5,8 @@ try: from collections import namedtuple except ImportError: - try: - from ucollections import namedtuple - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit _DefragResultBase = namedtuple('DefragResult', [ 'foo', 'bar' ]) diff --git a/tests/basics/deque1.py b/tests/basics/deque1.py index 19966fcb07..8b7874e2b1 100644 --- a/tests/basics/deque1.py +++ b/tests/basics/deque1.py @@ -1,8 +1,5 @@ try: - try: - from ucollections import deque - except ImportError: - from collections import deque + from collections import deque except ImportError: print("SKIP") raise SystemExit diff --git a/tests/basics/deque2.py b/tests/basics/deque2.py index 22d370e943..80fcd66785 100644 --- a/tests/basics/deque2.py +++ b/tests/basics/deque2.py @@ -1,10 +1,7 @@ # Tests for deques with "check overflow" flag and other extensions # wrt to CPython. try: - try: - from ucollections import deque - except ImportError: - from collections import deque + from collections import deque except ImportError: print("SKIP") raise SystemExit diff --git a/tests/basics/dict_fixed.py b/tests/basics/dict_fixed.py index 4261a06557..cfd3b71f57 100644 --- a/tests/basics/dict_fixed.py +++ b/tests/basics/dict_fixed.py @@ -1,48 +1,48 @@ # test that fixed dictionaries cannot be modified try: - import uerrno + import errno except ImportError: print("SKIP") raise SystemExit -# Save a copy of uerrno.errorcode, so we can check later +# Save a copy of errno.errorcode, so we can check later # that it hasn't been modified. -errorcode_copy = uerrno.errorcode.copy() +errorcode_copy = errno.errorcode.copy() try: - uerrno.errorcode.popitem() + errno.errorcode.popitem() except TypeError: print("TypeError") try: - uerrno.errorcode.pop(0) + errno.errorcode.pop(0) except TypeError: print("TypeError") try: - uerrno.errorcode.setdefault(0, 0) + errno.errorcode.setdefault(0, 0) except TypeError: print("TypeError") try: - uerrno.errorcode.update([(1, 2)]) + errno.errorcode.update([(1, 2)]) except TypeError: print("TypeError") try: - del uerrno.errorcode[1] + del errno.errorcode[1] except TypeError: print("TypeError") try: - uerrno.errorcode[1] = 'foo' + errno.errorcode[1] = 'foo' except TypeError: print("TypeError") try: - uerrno.errorcode.clear() + errno.errorcode.clear() except TypeError: print("TypeError") -assert uerrno.errorcode == errorcode_copy +assert errno.errorcode == errorcode_copy diff --git a/tests/basics/errno1.py b/tests/basics/errno1.py index d9a895a972..0773c926fd 100644 --- a/tests/basics/errno1.py +++ b/tests/basics/errno1.py @@ -1,25 +1,25 @@ -# test errno's and uerrno module +# test errno's and errno module try: - import uerrno + import errno except ImportError: print("SKIP") raise SystemExit # check that constants exist and are integers -print(type(uerrno.EIO)) +print(type(errno.EIO)) # check that errors are rendered in a nice way -msg = str(OSError(uerrno.EIO)) +msg = str(OSError(errno.EIO)) print(msg[:7], msg[-5:]) -msg = str(OSError(uerrno.EIO, "details")) +msg = str(OSError(errno.EIO, "details")) print(msg[:7], msg[-14:]) -msg = str(OSError(uerrno.EIO, "details", "more details")) +msg = str(OSError(errno.EIO, "details", "more details")) print(msg[:1], msg[-28:]) # check that unknown errno is still rendered print(str(OSError(9999))) # this tests a failed constant lookup in errno -errno = uerrno +errno = errno print(errno.__name__) diff --git a/tests/basics/errno1.py.exp b/tests/basics/errno1.py.exp index 58605b4767..7a9ffea8f7 100644 --- a/tests/basics/errno1.py.exp +++ b/tests/basics/errno1.py.exp @@ -3,4 +3,4 @@ [Errno ] EIO: details ( , 'details', 'more details') 9999 -uerrno +errno diff --git a/tests/basics/int_big1.py b/tests/basics/int_big1.py index ea48372b28..de2ba9fc4f 100644 --- a/tests/basics/int_big1.py +++ b/tests/basics/int_big1.py @@ -105,10 +105,7 @@ x = 4611686018427387904 # big x = -4611686018427387904 # big # sys.maxsize is a constant mpz, so test it's compatible with dynamic ones -try: - import usys as sys -except ImportError: - import sys +import sys print(sys.maxsize + 1 - 1 == sys.maxsize) # test extraction of big int value via mp_obj_get_int_maybe diff --git a/tests/basics/io_buffered_writer.py b/tests/basics/io_buffered_writer.py index 0e943cb0a9..5c065f158a 100644 --- a/tests/basics/io_buffered_writer.py +++ b/tests/basics/io_buffered_writer.py @@ -1,4 +1,4 @@ -import uio as io +import io try: io.BytesIO diff --git a/tests/basics/io_bytesio_cow.py b/tests/basics/io_bytesio_cow.py index 92654a0003..2edb7136a9 100644 --- a/tests/basics/io_bytesio_cow.py +++ b/tests/basics/io_bytesio_cow.py @@ -1,10 +1,6 @@ # Make sure that write operations on io.BytesIO don't # change original object it was constructed from. -try: - import uio as io -except ImportError: - import io - +import io b = b"foobar" a = io.BytesIO(b) diff --git a/tests/basics/io_bytesio_ext.py b/tests/basics/io_bytesio_ext.py index e454b2fd9f..4d4c60c136 100644 --- a/tests/basics/io_bytesio_ext.py +++ b/tests/basics/io_bytesio_ext.py @@ -1,9 +1,5 @@ # Extended stream operations on io.BytesIO -try: - import uio as io -except ImportError: - import io - +import io a = io.BytesIO(b"foobar") a.seek(10) print(a.read(10)) diff --git a/tests/basics/io_bytesio_ext2.py b/tests/basics/io_bytesio_ext2.py index 8f624fd58c..414ac90a3b 100644 --- a/tests/basics/io_bytesio_ext2.py +++ b/tests/basics/io_bytesio_ext2.py @@ -1,8 +1,4 @@ -try: - import uio as io -except ImportError: - import io - +import io a = io.BytesIO(b"foobar") try: a.seek(-10) diff --git a/tests/basics/io_iobase.py b/tests/basics/io_iobase.py index 6f554b00f0..d3824c177f 100644 --- a/tests/basics/io_iobase.py +++ b/tests/basics/io_iobase.py @@ -1,8 +1,4 @@ -try: - import uio as io -except: - import io - +import io try: io.IOBase except AttributeError: diff --git a/tests/basics/io_stringio1.py b/tests/basics/io_stringio1.py index 41089f22d5..7d355930f5 100644 --- a/tests/basics/io_stringio1.py +++ b/tests/basics/io_stringio1.py @@ -1,8 +1,4 @@ -try: - import uio as io -except ImportError: - import io - +import io a = io.StringIO() print('io.StringIO' in repr(a)) print(a.getvalue()) diff --git a/tests/basics/io_stringio_base.py b/tests/basics/io_stringio_base.py index dffc879074..0f65fb3fab 100644 --- a/tests/basics/io_stringio_base.py +++ b/tests/basics/io_stringio_base.py @@ -1,10 +1,7 @@ # Checks that an instance type inheriting from a native base that uses # MP_TYPE_FLAG_ITER_IS_STREAM will still have a getiter. -try: - import uio as io -except ImportError: - import io +import io a = io.StringIO() a.write("hello\nworld\nmicro\npython\n") diff --git a/tests/basics/io_stringio_with.py b/tests/basics/io_stringio_with.py index c35975445d..a3aa6ec84e 100644 --- a/tests/basics/io_stringio_with.py +++ b/tests/basics/io_stringio_with.py @@ -1,8 +1,4 @@ -try: - import uio as io -except ImportError: - import io - +import io # test __enter__/__exit__ with io.StringIO() as b: b.write("foo") diff --git a/tests/basics/io_write_ext.py b/tests/basics/io_write_ext.py index 5a6eaa35cf..695abccef4 100644 --- a/tests/basics/io_write_ext.py +++ b/tests/basics/io_write_ext.py @@ -1,14 +1,14 @@ # This tests extended (MicroPython-specific) form of write: # write(buf, len) and write(buf, offset, len) -import uio +import io try: - uio.BytesIO + io.BytesIO except AttributeError: print('SKIP') raise SystemExit -buf = uio.BytesIO() +buf = io.BytesIO() buf.write(b"foo", 2) print(buf.getvalue()) diff --git a/tests/basics/memoryview1.py b/tests/basics/memoryview1.py index 4c20c91f49..1ebfbc53b9 100644 --- a/tests/basics/memoryview1.py +++ b/tests/basics/memoryview1.py @@ -5,13 +5,10 @@ except: print("SKIP") raise SystemExit try: - import uarray as array + import array except ImportError: - try: - import array - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit # test reading from bytes b = b'1234' diff --git a/tests/basics/memoryview2.py b/tests/basics/memoryview2.py index eacc227c28..fa5514e072 100644 --- a/tests/basics/memoryview2.py +++ b/tests/basics/memoryview2.py @@ -5,13 +5,10 @@ except: print("SKIP") raise SystemExit try: - from uarray import array + from array import array except ImportError: - try: - from array import array - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit print(list(memoryview(b'\x7f\x80\x81\xff'))) print(list(memoryview(array('b', [0x7f, -0x80])))) diff --git a/tests/basics/memoryview_intbig.py b/tests/basics/memoryview_intbig.py index 4800a70cc2..72951d6eaa 100644 --- a/tests/basics/memoryview_intbig.py +++ b/tests/basics/memoryview_intbig.py @@ -5,13 +5,10 @@ except: print("SKIP") raise SystemExit try: - from uarray import array + from array import array except ImportError: - try: - from array import array - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit print(list(memoryview(array('i', [0x7f000000, -0x80000000])))) print(list(memoryview(array('I', [0x7f000000, 0x80000000, 0x81000000, 0xffffffff])))) diff --git a/tests/basics/memoryview_itemsize.py b/tests/basics/memoryview_itemsize.py index 64a8822b8b..5428a41785 100644 --- a/tests/basics/memoryview_itemsize.py +++ b/tests/basics/memoryview_itemsize.py @@ -4,13 +4,10 @@ except: print("SKIP") raise SystemExit try: - from uarray import array + from array import array except ImportError: - try: - from array import array - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit for code in ['b', 'h', 'i', 'q', 'f', 'd']: print(memoryview(array(code)).itemsize) diff --git a/tests/basics/memoryview_slice_assign.py b/tests/basics/memoryview_slice_assign.py index 74f6fae6f7..94f8073f0a 100644 --- a/tests/basics/memoryview_slice_assign.py +++ b/tests/basics/memoryview_slice_assign.py @@ -7,13 +7,10 @@ except (NameError, TypeError): raise SystemExit try: - import uarray as array + import array except ImportError: - try: - import array - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit # test slice assignment between memoryviews b1 = bytearray(b'1234') diff --git a/tests/basics/module2.py b/tests/basics/module2.py index 5923a27e08..a135601579 100644 --- a/tests/basics/module2.py +++ b/tests/basics/module2.py @@ -1,6 +1,6 @@ # uPy behaviour only: builtin modules are read-only -import usys +import sys try: - usys.x = 1 + sys.x = 1 except AttributeError: print("AttributeError") diff --git a/tests/basics/namedtuple1.py b/tests/basics/namedtuple1.py index e8247e4d6e..362c60583e 100644 --- a/tests/basics/namedtuple1.py +++ b/tests/basics/namedtuple1.py @@ -1,8 +1,5 @@ try: - try: - from ucollections import namedtuple - except ImportError: - from collections import namedtuple + from collections import namedtuple except ImportError: print("SKIP") raise SystemExit diff --git a/tests/basics/namedtuple_asdict.py b/tests/basics/namedtuple_asdict.py index 34c4e6f713..e85281bb73 100644 --- a/tests/basics/namedtuple_asdict.py +++ b/tests/basics/namedtuple_asdict.py @@ -1,8 +1,5 @@ try: - try: - from ucollections import namedtuple - except ImportError: - from collections import namedtuple + from collections import namedtuple except ImportError: print("SKIP") raise SystemExit diff --git a/tests/basics/ordereddict1.py b/tests/basics/ordereddict1.py index 270deab384..a6f305ff78 100644 --- a/tests/basics/ordereddict1.py +++ b/tests/basics/ordereddict1.py @@ -1,11 +1,8 @@ try: from collections import OrderedDict except ImportError: - try: - from ucollections import OrderedDict - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit d = OrderedDict([(10, 20), ("b", 100), (1, 2)]) print(len(d)) diff --git a/tests/basics/ordereddict_eq.py b/tests/basics/ordereddict_eq.py index c69daf8802..e103c867e2 100644 --- a/tests/basics/ordereddict_eq.py +++ b/tests/basics/ordereddict_eq.py @@ -1,11 +1,8 @@ try: from collections import OrderedDict except ImportError: - try: - from ucollections import OrderedDict - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit x = OrderedDict() y = OrderedDict() diff --git a/tests/basics/python34.py b/tests/basics/python34.py index 36e25e20dd..922234d22d 100644 --- a/tests/basics/python34.py +++ b/tests/basics/python34.py @@ -29,9 +29,9 @@ test_syntax("del ()") # can't delete empty tuple (in 3.6 we can) # from basics/sys1.py # uPy prints version 3.4 -import usys -print(usys.version[:3]) -print(usys.version_info[0], usys.version_info[1]) +import sys +print(sys.version[:3]) +print(sys.version_info[0], sys.version_info[1]) # from basics/exception1.py # in 3.7 no comma is printed if there is only 1 arg (in 3.4-3.6 one is printed) diff --git a/tests/basics/string_compare.py b/tests/basics/string_compare.py index f34879df25..6515809b36 100644 --- a/tests/basics/string_compare.py +++ b/tests/basics/string_compare.py @@ -51,10 +51,7 @@ print("1/" <= "1") # this tests an internal string that doesn't have a hash with a string # that does have a hash, but the lengths of the two strings are different -try: - import usys as sys -except ImportError: - import sys +import sys print(sys.version == 'a long string that has a hash') # this special string would have a hash of 0 but is incremented to 1 diff --git a/tests/basics/struct1.py b/tests/basics/struct1.py index c4960d2f80..a18655517b 100644 --- a/tests/basics/struct1.py +++ b/tests/basics/struct1.py @@ -1,11 +1,8 @@ try: - import ustruct as struct -except: - try: - import struct - except ImportError: - print("SKIP") - raise SystemExit + import struct +except ImportError: + print("SKIP") + raise SystemExit print(struct.calcsize(" 0) # Only test deque if we have it try: - from ucollections import deque + from collections import deque assert sys.getsizeof(deque((), 1)) > 0 except ImportError: pass diff --git a/tests/basics/sys_path.py b/tests/basics/sys_path.py index 6456e24019..576bd66c94 100644 --- a/tests/basics/sys_path.py +++ b/tests/basics/sys_path.py @@ -1,10 +1,6 @@ # test sys.path -try: - import usys as sys -except ImportError: - import sys - +import sys # check that this script was executed from a file of the same name if "__file__" not in globals() or "sys_path.py" not in __file__: print("SKIP") diff --git a/tests/basics/sys_tracebacklimit.py b/tests/basics/sys_tracebacklimit.py index 1ee638967f..3ae372b8d5 100644 --- a/tests/basics/sys_tracebacklimit.py +++ b/tests/basics/sys_tracebacklimit.py @@ -1,12 +1,8 @@ # test sys.tracebacklimit try: - try: - import usys as sys - import uio as io - except ImportError: - import sys - import io + import sys + import io except ImportError: print("SKIP") raise SystemExit diff --git a/tests/basics/sys_tracebacklimit.py.exp b/tests/basics/sys_tracebacklimit.py.exp index 3647280584..39c54523a0 100644 --- a/tests/basics/sys_tracebacklimit.py.exp +++ b/tests/basics/sys_tracebacklimit.py.exp @@ -1,35 +1,35 @@ Traceback (most recent call last): - File , line 62, in ftop - File , line 57, in f3 - File , line 53, in f2 - File , line 49, in f1 - File , line 45, in f0 + File , line 58, in ftop + File , line 53, in f3 + File , line 49, in f2 + File , line 45, in f1 + File , line 41, in f0 ValueError: value limit 4 Traceback (most recent call last): - File , line 62, in ftop - File , line 57, in f3 - File , line 53, in f2 - File , line 49, in f1 + File , line 58, in ftop + File , line 53, in f3 + File , line 49, in f2 + File , line 45, in f1 ValueError: value limit 3 Traceback (most recent call last): - File , line 62, in ftop - File , line 57, in f3 - File , line 53, in f2 + File , line 58, in ftop + File , line 53, in f3 + File , line 49, in f2 ValueError: value limit 2 Traceback (most recent call last): - File , line 62, in ftop - File , line 57, in f3 + File , line 58, in ftop + File , line 53, in f3 ValueError: value limit 1 Traceback (most recent call last): - File , line 62, in ftop + File , line 58, in ftop ValueError: value limit 0 diff --git a/tests/cmdline/repl_micropyinspect b/tests/cmdline/repl_micropyinspect index 0710f1a75b..8dfa8810ea 100644 --- a/tests/cmdline/repl_micropyinspect +++ b/tests/cmdline/repl_micropyinspect @@ -1,3 +1,3 @@ -import uos +import os -uos.putenv('MICROPYINSPECT', '1') +os.putenv('MICROPYINSPECT', '1') diff --git a/tests/cmdline/repl_sys_ps1_ps2.py b/tests/cmdline/repl_sys_ps1_ps2.py index 4f96057c49..cfefe804bf 100644 --- a/tests/cmdline/repl_sys_ps1_ps2.py +++ b/tests/cmdline/repl_sys_ps1_ps2.py @@ -1,6 +1,6 @@ # test changing ps1/ps2 -import usys -usys.ps1 = "PS1" -usys.ps2 = "PS2" +import sys +sys.ps1 = "PS1" +sys.ps2 = "PS2" (1 + 2) diff --git a/tests/cmdline/repl_sys_ps1_ps2.py.exp b/tests/cmdline/repl_sys_ps1_ps2.py.exp index e4a802d34d..9e82db5e31 100644 --- a/tests/cmdline/repl_sys_ps1_ps2.py.exp +++ b/tests/cmdline/repl_sys_ps1_ps2.py.exp @@ -1,9 +1,9 @@ MicroPython \.\+ version Use \.\+ >>> # test changing ps1/ps2 ->>> import usys ->>> usys.ps1 = "PS1" -PS1usys.ps2 = "PS2" +>>> import sys +>>> sys.ps1 = "PS1" +PS1sys.ps2 = "PS2" PS1(1 + PS22) 3 diff --git a/tests/esp32/partition_ota.py b/tests/esp32/partition_ota.py index 212fcf0338..65e2742ebb 100644 --- a/tests/esp32/partition_ota.py +++ b/tests/esp32/partition_ota.py @@ -22,10 +22,10 @@ def log(*args): # replace boot.py with the test code that will run on each reboot -import uos +import os try: - uos.rename("boot.py", "boot-orig.py") + os.rename("boot.py", "boot-orig.py") except: pass with open("boot.py", "w") as f: @@ -74,10 +74,10 @@ elif STEP == 3: elif STEP == 4: log("Confirming boot ok and DONE!") Partition.mark_app_valid_cancel_rollback() - import uos - uos.remove("step.py") - uos.remove("boot.py") - uos.rename("boot-orig.py", "boot.py") + import os + os.remove("step.py") + os.remove("boot.py") + os.rename("boot-orig.py", "boot.py") print("\\nSUCCESS!\\n\\x04\\x04") """ diff --git a/tests/esp32/resolve_on_connect.py b/tests/esp32/resolve_on_connect.py index 068757ab2a..e604ce9ca0 100644 --- a/tests/esp32/resolve_on_connect.py +++ b/tests/esp32/resolve_on_connect.py @@ -5,10 +5,7 @@ if sys.implementation.name == "micropython" and sys.platform != "esp32": print("SKIP") raise SystemExit -try: - import usocket as socket, sys -except: - import socket, sys +import socket, sys def test_bind_resolves_0_0_0_0(): diff --git a/tests/extmod/ubinascii_a2b_base64.py b/tests/extmod/binascii_a2b_base64.py similarity index 92% rename from tests/extmod/ubinascii_a2b_base64.py rename to tests/extmod/binascii_a2b_base64.py index 2630965e6a..fd1ff75e1f 100644 --- a/tests/extmod/ubinascii_a2b_base64.py +++ b/tests/extmod/binascii_a2b_base64.py @@ -1,8 +1,5 @@ try: - try: - import ubinascii as binascii - except ImportError: - import binascii + import binascii except ImportError: print("SKIP") raise SystemExit diff --git a/tests/extmod/ubinascii_b2a_base64.py b/tests/extmod/binascii_b2a_base64.py similarity index 88% rename from tests/extmod/ubinascii_b2a_base64.py rename to tests/extmod/binascii_b2a_base64.py index 3f92488969..306af94004 100644 --- a/tests/extmod/ubinascii_b2a_base64.py +++ b/tests/extmod/binascii_b2a_base64.py @@ -1,8 +1,5 @@ try: - try: - import ubinascii as binascii - except ImportError: - import binascii + import binascii except ImportError: print("SKIP") raise SystemExit diff --git a/tests/extmod/ubinascii_crc32.py b/tests/extmod/binascii_crc32.py similarity index 87% rename from tests/extmod/ubinascii_crc32.py rename to tests/extmod/binascii_crc32.py index 8f5f4d9ba5..0e4a5b58f3 100644 --- a/tests/extmod/ubinascii_crc32.py +++ b/tests/extmod/binascii_crc32.py @@ -1,8 +1,5 @@ try: - try: - import ubinascii as binascii - except ImportError: - import binascii + import binascii except ImportError: print("SKIP") raise SystemExit diff --git a/tests/extmod/ubinascii_hexlify.py b/tests/extmod/binascii_hexlify.py similarity index 80% rename from tests/extmod/ubinascii_hexlify.py rename to tests/extmod/binascii_hexlify.py index 3c266fb6cc..d06029aaba 100644 --- a/tests/extmod/ubinascii_hexlify.py +++ b/tests/extmod/binascii_hexlify.py @@ -1,8 +1,5 @@ try: - try: - import ubinascii as binascii - except ImportError: - import binascii + import binascii except ImportError: print("SKIP") raise SystemExit diff --git a/tests/extmod/ubinascii_unhexlify.py b/tests/extmod/binascii_unhexlify.py similarity index 81% rename from tests/extmod/ubinascii_unhexlify.py rename to tests/extmod/binascii_unhexlify.py index 2c3598ab98..bb663bc5b0 100644 --- a/tests/extmod/ubinascii_unhexlify.py +++ b/tests/extmod/binascii_unhexlify.py @@ -1,8 +1,5 @@ try: - try: - import ubinascii as binascii - except ImportError: - import binascii + import binascii except ImportError: print("SKIP") raise SystemExit diff --git a/tests/extmod/btree1.py b/tests/extmod/btree1.py index 876bce4f87..d142a370f4 100644 --- a/tests/extmod/btree1.py +++ b/tests/extmod/btree1.py @@ -1,13 +1,13 @@ try: import btree - import uio - import uerrno + import io + import errno except ImportError: print("SKIP") raise SystemExit # f = open("_test.db", "w+b") -f = uio.BytesIO() +f = io.BytesIO() db = btree.open(f, pagesize=512) mv = memoryview(b"bar1foo1") @@ -68,7 +68,7 @@ print(db.seq(1, b"qux")) try: db.seq(b"foo1") except OSError as e: - print(e.errno == uerrno.EINVAL) + print(e.errno == errno.EINVAL) print(list(db.keys())) print(list(db.values())) diff --git a/tests/extmod/btree_error.py b/tests/extmod/btree_error.py index b64769e884..2dd0d137a0 100644 --- a/tests/extmod/btree_error.py +++ b/tests/extmod/btree_error.py @@ -1,15 +1,15 @@ # Test that errno's propagate correctly through btree module. try: - import btree, uio, uerrno + import btree, io, errno - uio.IOBase + io.IOBase except (ImportError, AttributeError): print("SKIP") raise SystemExit -class Device(uio.IOBase): +class Device(io.IOBase): def __init__(self, read_ret=0, ioctl_ret=0): self.read_ret = read_ret self.ioctl_ret = ioctl_ret @@ -25,18 +25,24 @@ class Device(uio.IOBase): # Invalid pagesize; errno comes from btree library try: + import btree, io, errno + db = btree.open(Device(), pagesize=511) except OSError as er: - print("OSError", er.errno == uerrno.EINVAL) + print("OSError", er.errno == errno.EINVAL) # Valid pagesize, device returns error on read; errno comes from Device.readinto try: + import btree, io, errno + db = btree.open(Device(-1000), pagesize=512) except OSError as er: print(repr(er)) # Valid pagesize, device returns error on seek; errno comes from Device.ioctl try: + import btree, io, errno + db = btree.open(Device(0, -1001), pagesize=512) except OSError as er: print(repr(er)) diff --git a/tests/extmod/btree_gc.py b/tests/extmod/btree_gc.py index 1845aa0640..c5274eb489 100644 --- a/tests/extmod/btree_gc.py +++ b/tests/extmod/btree_gc.py @@ -1,7 +1,7 @@ # Test btree interaction with the garbage collector. try: - import btree, uio, gc + import btree, io, gc except ImportError: print("SKIP") raise SystemExit @@ -9,7 +9,7 @@ except ImportError: N = 80 # Create a BytesIO but don't keep a reference to it. -db = btree.open(uio.BytesIO(), pagesize=512) +db = btree.open(io.BytesIO(), pagesize=512) # Overwrite lots of the Python stack to make sure no reference to the BytesIO remains. x = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] diff --git a/tests/extmod/ucryptolib_aes128_cbc.py b/tests/extmod/cryptolib_aes128_cbc.py similarity index 90% rename from tests/extmod/ucryptolib_aes128_cbc.py rename to tests/extmod/cryptolib_aes128_cbc.py index d861d2c6bf..ef6d453685 100644 --- a/tests/extmod/ucryptolib_aes128_cbc.py +++ b/tests/extmod/cryptolib_aes128_cbc.py @@ -4,7 +4,7 @@ try: aes = AES.new except ImportError: try: - from ucryptolib import aes + from cryptolib import aes except ImportError: print("SKIP") raise SystemExit diff --git a/tests/extmod/ucryptolib_aes128_cbc.py.exp b/tests/extmod/cryptolib_aes128_cbc.py.exp similarity index 100% rename from tests/extmod/ucryptolib_aes128_cbc.py.exp rename to tests/extmod/cryptolib_aes128_cbc.py.exp diff --git a/tests/extmod/ucryptolib_aes128_ctr.py b/tests/extmod/cryptolib_aes128_ctr.py similarity index 94% rename from tests/extmod/ucryptolib_aes128_ctr.py rename to tests/extmod/cryptolib_aes128_ctr.py index 538d9606e9..b5066fb7b4 100644 --- a/tests/extmod/ucryptolib_aes128_ctr.py +++ b/tests/extmod/cryptolib_aes128_ctr.py @@ -1,5 +1,5 @@ try: - from ucryptolib import aes + from cryptolib import aes except ImportError: print("SKIP") raise SystemExit diff --git a/tests/extmod/ucryptolib_aes128_ctr.py.exp b/tests/extmod/cryptolib_aes128_ctr.py.exp similarity index 100% rename from tests/extmod/ucryptolib_aes128_ctr.py.exp rename to tests/extmod/cryptolib_aes128_ctr.py.exp diff --git a/tests/extmod/ucryptolib_aes128_ecb.py b/tests/extmod/cryptolib_aes128_ecb.py similarity index 89% rename from tests/extmod/ucryptolib_aes128_ecb.py rename to tests/extmod/cryptolib_aes128_ecb.py index 5c0e179986..d1e77d326d 100644 --- a/tests/extmod/ucryptolib_aes128_ecb.py +++ b/tests/extmod/cryptolib_aes128_ecb.py @@ -4,7 +4,7 @@ try: aes = AES.new except ImportError: try: - from ucryptolib import aes + from cryptolib import aes except ImportError: print("SKIP") raise SystemExit diff --git a/tests/extmod/ucryptolib_aes128_ecb.py.exp b/tests/extmod/cryptolib_aes128_ecb.py.exp similarity index 100% rename from tests/extmod/ucryptolib_aes128_ecb.py.exp rename to tests/extmod/cryptolib_aes128_ecb.py.exp diff --git a/tests/extmod/ucryptolib_aes128_ecb_enc.py b/tests/extmod/cryptolib_aes128_ecb_enc.py similarity index 91% rename from tests/extmod/ucryptolib_aes128_ecb_enc.py rename to tests/extmod/cryptolib_aes128_ecb_enc.py index 1d4484b0bc..1bc973e22d 100644 --- a/tests/extmod/ucryptolib_aes128_ecb_enc.py +++ b/tests/extmod/cryptolib_aes128_ecb_enc.py @@ -7,7 +7,7 @@ try: aes = AES.new except ImportError: try: - from ucryptolib import aes + from cryptolib import aes except ImportError: print("SKIP") raise SystemExit diff --git a/tests/extmod/ucryptolib_aes128_ecb_enc.py.exp b/tests/extmod/cryptolib_aes128_ecb_enc.py.exp similarity index 100% rename from tests/extmod/ucryptolib_aes128_ecb_enc.py.exp rename to tests/extmod/cryptolib_aes128_ecb_enc.py.exp diff --git a/tests/extmod/ucryptolib_aes128_ecb_inpl.py b/tests/extmod/cryptolib_aes128_ecb_inpl.py similarity index 90% rename from tests/extmod/ucryptolib_aes128_ecb_inpl.py rename to tests/extmod/cryptolib_aes128_ecb_inpl.py index 88ccb02daf..826f95ced8 100644 --- a/tests/extmod/ucryptolib_aes128_ecb_inpl.py +++ b/tests/extmod/cryptolib_aes128_ecb_inpl.py @@ -1,6 +1,6 @@ # Inplace operations (input and output buffer is the same) try: - from ucryptolib import aes + from cryptolib import aes except ImportError: print("SKIP") raise SystemExit diff --git a/tests/extmod/ucryptolib_aes128_ecb_inpl.py.exp b/tests/extmod/cryptolib_aes128_ecb_inpl.py.exp similarity index 100% rename from tests/extmod/ucryptolib_aes128_ecb_inpl.py.exp rename to tests/extmod/cryptolib_aes128_ecb_inpl.py.exp diff --git a/tests/extmod/ucryptolib_aes128_ecb_into.py b/tests/extmod/cryptolib_aes128_ecb_into.py similarity index 90% rename from tests/extmod/ucryptolib_aes128_ecb_into.py rename to tests/extmod/cryptolib_aes128_ecb_into.py index ff832d7ef3..f90dfcf272 100644 --- a/tests/extmod/ucryptolib_aes128_ecb_into.py +++ b/tests/extmod/cryptolib_aes128_ecb_into.py @@ -1,6 +1,6 @@ # Operations with pre-allocated output buffer try: - from ucryptolib import aes + from cryptolib import aes except ImportError: print("SKIP") raise SystemExit diff --git a/tests/extmod/ucryptolib_aes128_ecb_into.py.exp b/tests/extmod/cryptolib_aes128_ecb_into.py.exp similarity index 100% rename from tests/extmod/ucryptolib_aes128_ecb_into.py.exp rename to tests/extmod/cryptolib_aes128_ecb_into.py.exp diff --git a/tests/extmod/ucryptolib_aes256_cbc.py b/tests/extmod/cryptolib_aes256_cbc.py similarity index 90% rename from tests/extmod/ucryptolib_aes256_cbc.py rename to tests/extmod/cryptolib_aes256_cbc.py index c01846f199..91a9cd7609 100644 --- a/tests/extmod/ucryptolib_aes256_cbc.py +++ b/tests/extmod/cryptolib_aes256_cbc.py @@ -4,7 +4,7 @@ try: aes = AES.new except ImportError: try: - from ucryptolib import aes + from cryptolib import aes except ImportError: print("SKIP") raise SystemExit diff --git a/tests/extmod/ucryptolib_aes256_cbc.py.exp b/tests/extmod/cryptolib_aes256_cbc.py.exp similarity index 100% rename from tests/extmod/ucryptolib_aes256_cbc.py.exp rename to tests/extmod/cryptolib_aes256_cbc.py.exp diff --git a/tests/extmod/ucryptolib_aes256_ecb.py b/tests/extmod/cryptolib_aes256_ecb.py similarity index 89% rename from tests/extmod/ucryptolib_aes256_ecb.py rename to tests/extmod/cryptolib_aes256_ecb.py index 0760063c14..ed040bc15b 100644 --- a/tests/extmod/ucryptolib_aes256_ecb.py +++ b/tests/extmod/cryptolib_aes256_ecb.py @@ -4,7 +4,7 @@ try: aes = AES.new except ImportError: try: - from ucryptolib import aes + from cryptolib import aes except ImportError: print("SKIP") raise SystemExit diff --git a/tests/extmod/ucryptolib_aes256_ecb.py.exp b/tests/extmod/cryptolib_aes256_ecb.py.exp similarity index 100% rename from tests/extmod/ucryptolib_aes256_ecb.py.exp rename to tests/extmod/cryptolib_aes256_ecb.py.exp diff --git a/tests/extmod/framebuf16.py b/tests/extmod/framebuf16.py index cd7f5ec015..9f373c331e 100644 --- a/tests/extmod/framebuf16.py +++ b/tests/extmod/framebuf16.py @@ -1,11 +1,11 @@ try: - import framebuf, usys + import framebuf, sys except ImportError: print("SKIP") raise SystemExit # This test and its .exp file is based on a little-endian architecture. -if usys.byteorder != "little": +if sys.byteorder != "little": print("SKIP") raise SystemExit diff --git a/tests/extmod/framebuf_palette.py b/tests/extmod/framebuf_palette.py index f5b15fda73..ad1af2cf4c 100644 --- a/tests/extmod/framebuf_palette.py +++ b/tests/extmod/framebuf_palette.py @@ -1,6 +1,6 @@ # Test blit between different color spaces try: - import framebuf, usys + import framebuf, sys except ImportError: print("SKIP") raise SystemExit diff --git a/tests/extmod/framebuf_subclass.py b/tests/extmod/framebuf_subclass.py index 4cd9ea4eb5..162839e8bf 100644 --- a/tests/extmod/framebuf_subclass.py +++ b/tests/extmod/framebuf_subclass.py @@ -1,13 +1,13 @@ # test subclassing framebuf.FrameBuffer try: - import framebuf, usys + import framebuf, sys except ImportError: print("SKIP") raise SystemExit # This test and its .exp file is based on a little-endian architecture. -if usys.byteorder != "little": +if sys.byteorder != "little": print("SKIP") raise SystemExit diff --git a/tests/extmod/uhashlib_final.py b/tests/extmod/hashlib_final.py similarity index 92% rename from tests/extmod/uhashlib_final.py rename to tests/extmod/hashlib_final.py index f562cc1780..c8fdac9234 100644 --- a/tests/extmod/uhashlib_final.py +++ b/tests/extmod/hashlib_final.py @@ -1,12 +1,12 @@ try: - import uhashlib + import hashlib except ImportError: print("SKIP") raise SystemExit for algo_name in ("md5", "sha1", "sha256"): - algo = getattr(uhashlib, algo_name, None) + algo = getattr(hashlib, algo_name, None) if not algo: continue diff --git a/tests/extmod/uhashlib_final.py.exp b/tests/extmod/hashlib_final.py.exp similarity index 100% rename from tests/extmod/uhashlib_final.py.exp rename to tests/extmod/hashlib_final.py.exp diff --git a/tests/extmod/hashlib_md5.py b/tests/extmod/hashlib_md5.py new file mode 100644 index 0000000000..5f925fc97d --- /dev/null +++ b/tests/extmod/hashlib_md5.py @@ -0,0 +1,18 @@ +try: + import hashlib +except ImportError: + # This is neither uPy, nor cPy, so must be uPy with + # hashlib module disabled. + print("SKIP") + raise SystemExit + +try: + hashlib.md5 +except AttributeError: + # MD5 is only available on some ports + print("SKIP") + raise SystemExit + +md5 = hashlib.md5(b"hello") +md5.update(b"world") +print(md5.digest()) diff --git a/tests/extmod/hashlib_sha1.py b/tests/extmod/hashlib_sha1.py new file mode 100644 index 0000000000..af23033a59 --- /dev/null +++ b/tests/extmod/hashlib_sha1.py @@ -0,0 +1,18 @@ +try: + import hashlib +except ImportError: + # This is neither uPy, nor cPy, so must be uPy with + # hashlib module disabled. + print("SKIP") + raise SystemExit + +try: + hashlib.sha1 +except AttributeError: + # SHA1 is only available on some ports + print("SKIP") + raise SystemExit + +sha1 = hashlib.sha1(b"hello") +sha1.update(b"world") +print(sha1.digest()) diff --git a/tests/extmod/uhashlib_sha256.py b/tests/extmod/hashlib_sha256.py similarity index 72% rename from tests/extmod/uhashlib_sha256.py rename to tests/extmod/hashlib_sha256.py index 2e6df7df13..f0d07e1482 100644 --- a/tests/extmod/uhashlib_sha256.py +++ b/tests/extmod/hashlib_sha256.py @@ -1,13 +1,10 @@ try: - import uhashlib as hashlib + import hashlib except ImportError: - try: - import hashlib - except ImportError: - # This is neither uPy, nor cPy, so must be uPy with - # uhashlib module disabled. - print("SKIP") - raise SystemExit + # This is neither uPy, nor cPy, so must be uPy with + # hashlib module disabled. + print("SKIP") + raise SystemExit h = hashlib.sha256() diff --git a/tests/extmod/uheapq1.py b/tests/extmod/heapq1.py similarity index 78% rename from tests/extmod/uheapq1.py rename to tests/extmod/heapq1.py index a470bb6f71..efe208dac3 100644 --- a/tests/extmod/uheapq1.py +++ b/tests/extmod/heapq1.py @@ -1,11 +1,8 @@ try: - import uheapq as heapq -except: - try: - import heapq - except ImportError: - print("SKIP") - raise SystemExit + import heapq +except ImportError: + print("SKIP") + raise SystemExit try: heapq.heappop([]) diff --git a/tests/extmod/ujson_dump.py b/tests/extmod/json_dump.py similarity index 69% rename from tests/extmod/ujson_dump.py rename to tests/extmod/json_dump.py index feda8a47dd..897d33cc81 100644 --- a/tests/extmod/ujson_dump.py +++ b/tests/extmod/json_dump.py @@ -1,13 +1,9 @@ try: - from uio import StringIO - import ujson as json -except: - try: - from io import StringIO - import json - except ImportError: - print("SKIP") - raise SystemExit + from io import StringIO + import json +except ImportError: + print("SKIP") + raise SystemExit s = StringIO() json.dump(False, s) diff --git a/tests/extmod/ujson_dump_iobase.py b/tests/extmod/json_dump_iobase.py similarity index 71% rename from tests/extmod/ujson_dump_iobase.py rename to tests/extmod/json_dump_iobase.py index 7ecf23afb6..94d317b879 100644 --- a/tests/extmod/ujson_dump_iobase.py +++ b/tests/extmod/json_dump_iobase.py @@ -1,14 +1,10 @@ -# test ujson.dump in combination with uio.IOBase +# test json.dump in combination with io.IOBase try: - import uio as io - import ujson as json + import io, json except ImportError: - try: - import io, json - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit if not hasattr(io, "IOBase"): print("SKIP") diff --git a/tests/extmod/ujson_dump_separators.py b/tests/extmod/json_dump_separators.py similarity index 86% rename from tests/extmod/ujson_dump_separators.py rename to tests/extmod/json_dump_separators.py index e19b99a26d..4f8e56dceb 100644 --- a/tests/extmod/ujson_dump_separators.py +++ b/tests/extmod/json_dump_separators.py @@ -1,13 +1,9 @@ try: - from uio import StringIO - import ujson as json -except: - try: - from io import StringIO - import json - except ImportError: - print("SKIP") - raise SystemExit + from io import StringIO + import json +except ImportError: + print("SKIP") + raise SystemExit for sep in [ None, diff --git a/tests/extmod/ujson_dumps.py b/tests/extmod/json_dumps.py similarity index 83% rename from tests/extmod/ujson_dumps.py rename to tests/extmod/json_dumps.py index 251b268755..16f144e44f 100644 --- a/tests/extmod/ujson_dumps.py +++ b/tests/extmod/json_dumps.py @@ -1,11 +1,8 @@ try: - import ujson as json + import json except ImportError: - try: - import json - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit print(json.dumps(False)) print(json.dumps(True)) diff --git a/tests/extmod/json_dumps_extra.py b/tests/extmod/json_dumps_extra.py new file mode 100644 index 0000000000..9074416a99 --- /dev/null +++ b/tests/extmod/json_dumps_extra.py @@ -0,0 +1,9 @@ +# test uPy json behaviour that's not valid in CPy + +try: + import json +except ImportError: + print("SKIP") + raise SystemExit + +print(json.dumps(b"1234")) diff --git a/tests/extmod/ujson_dumps_extra.py.exp b/tests/extmod/json_dumps_extra.py.exp similarity index 100% rename from tests/extmod/ujson_dumps_extra.py.exp rename to tests/extmod/json_dumps_extra.py.exp diff --git a/tests/extmod/json_dumps_float.py b/tests/extmod/json_dumps_float.py new file mode 100644 index 0000000000..25fbc5c512 --- /dev/null +++ b/tests/extmod/json_dumps_float.py @@ -0,0 +1,8 @@ +try: + import json +except ImportError: + print("SKIP") + raise SystemExit + +print(json.dumps(1.2)) +print(json.dumps({1.5: "hi"})) diff --git a/tests/extmod/json_dumps_ordereddict.py b/tests/extmod/json_dumps_ordereddict.py new file mode 100644 index 0000000000..e1fa2a659c --- /dev/null +++ b/tests/extmod/json_dumps_ordereddict.py @@ -0,0 +1,8 @@ +try: + import json + from collections import OrderedDict +except ImportError: + print("SKIP") + raise SystemExit + +print(json.dumps(OrderedDict(((1, 2), (3, 4))))) diff --git a/tests/extmod/ujson_dumps_separators.py b/tests/extmod/json_dumps_separators.py similarity index 93% rename from tests/extmod/ujson_dumps_separators.py rename to tests/extmod/json_dumps_separators.py index efb541fe8b..a3a9ec308f 100644 --- a/tests/extmod/ujson_dumps_separators.py +++ b/tests/extmod/json_dumps_separators.py @@ -1,11 +1,8 @@ try: - import ujson as json + import json except ImportError: - try: - import json - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit for sep in [ None, diff --git a/tests/extmod/json_load.py b/tests/extmod/json_load.py new file mode 100644 index 0000000000..b2c7733282 --- /dev/null +++ b/tests/extmod/json_load.py @@ -0,0 +1,11 @@ +try: + from io import StringIO + import json +except ImportError: + print("SKIP") + raise SystemExit + +print(json.load(StringIO("null"))) +print(json.load(StringIO('"abc\\u0064e"'))) +print(json.load(StringIO("[false, true, 1, -2]"))) +print(json.load(StringIO('{"a":true}'))) diff --git a/tests/extmod/ujson_loads.py b/tests/extmod/json_loads.py similarity index 92% rename from tests/extmod/ujson_loads.py rename to tests/extmod/json_loads.py index 2de9cdcbc1..f9073c121e 100644 --- a/tests/extmod/ujson_loads.py +++ b/tests/extmod/json_loads.py @@ -1,11 +1,8 @@ try: - import ujson as json + import json except ImportError: - try: - import json - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit def my_print(o): diff --git a/tests/extmod/ujson_loads_bytes.py b/tests/extmod/json_loads_bytes.py similarity index 56% rename from tests/extmod/ujson_loads_bytes.py rename to tests/extmod/json_loads_bytes.py index 3ee87bbcd5..45cd0a35c5 100644 --- a/tests/extmod/ujson_loads_bytes.py +++ b/tests/extmod/json_loads_bytes.py @@ -1,13 +1,10 @@ # test loading from bytes and bytearray (introduced in Python 3.6) try: - import ujson as json + import json except ImportError: - try: - import json - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit print(json.loads(b"[1,2]")) print(json.loads(bytearray(b"[null]"))) diff --git a/tests/extmod/ujson_loads_bytes.py.exp b/tests/extmod/json_loads_bytes.py.exp similarity index 100% rename from tests/extmod/ujson_loads_bytes.py.exp rename to tests/extmod/json_loads_bytes.py.exp diff --git a/tests/extmod/ujson_loads_float.py b/tests/extmod/json_loads_float.py similarity index 65% rename from tests/extmod/ujson_loads_float.py rename to tests/extmod/json_loads_float.py index 842718f37d..2a8402dc6a 100644 --- a/tests/extmod/ujson_loads_float.py +++ b/tests/extmod/json_loads_float.py @@ -1,11 +1,8 @@ try: - import ujson as json + import json except ImportError: - try: - import json - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit def my_print(o): diff --git a/tests/extmod/machine1.py b/tests/extmod/machine1.py index 0c7f8122f4..90e6d17174 100644 --- a/tests/extmod/machine1.py +++ b/tests/extmod/machine1.py @@ -1,10 +1,8 @@ # test machine module try: - try: - import umachine as machine - except ImportError: - import machine + import machine + machine.mem8 except: print("SKIP") diff --git a/tests/extmod/machine_pinbase.py b/tests/extmod/machine_pinbase.py index 8bddd4bb70..4c467c2d26 100644 --- a/tests/extmod/machine_pinbase.py +++ b/tests/extmod/machine_pinbase.py @@ -1,8 +1,6 @@ try: - try: - import umachine as machine - except ImportError: - import machine + import machine + machine.PinBase except: print("SKIP") diff --git a/tests/extmod/machine_pulse.py b/tests/extmod/machine_pulse.py index 65d15fb351..c793134e19 100644 --- a/tests/extmod/machine_pulse.py +++ b/tests/extmod/machine_pulse.py @@ -1,8 +1,6 @@ try: - try: - import umachine as machine - except ImportError: - import machine + import machine + machine.PinBase machine.time_pulse_us except: diff --git a/tests/extmod/machine_signal.py b/tests/extmod/machine_signal.py index 1ffdb56436..2f6332748d 100644 --- a/tests/extmod/machine_signal.py +++ b/tests/extmod/machine_signal.py @@ -1,10 +1,8 @@ # test machine.Signal class try: - try: - import umachine as machine - except ImportError: - import machine + import machine + machine.PinBase machine.Signal except: diff --git a/tests/extmod/machine_timer.py b/tests/extmod/machine_timer.py index c9a47c4025..1be01d184d 100644 --- a/tests/extmod/machine_timer.py +++ b/tests/extmod/machine_timer.py @@ -1,7 +1,7 @@ # test machine.Timer try: - import utime, umachine as machine + import time, machine as machine machine.Timer except: @@ -29,10 +29,10 @@ t.deinit() # create one-shot timer with callback and wait for it to print (should be just once) t = machine.Timer(period=1, mode=machine.Timer.ONE_SHOT, callback=lambda t: print("one-shot")) -utime.sleep_ms(5) +time.sleep_ms(5) t.deinit() # create periodic timer with callback and wait for it to print t = machine.Timer(period=4, mode=machine.Timer.PERIODIC, callback=lambda t: print("periodic")) -utime.sleep_ms(14) +time.sleep_ms(14) t.deinit() diff --git a/tests/extmod/urandom_basic.py b/tests/extmod/random_basic.py similarity index 81% rename from tests/extmod/urandom_basic.py rename to tests/extmod/random_basic.py index f7f5a6d691..7cb992fede 100644 --- a/tests/extmod/urandom_basic.py +++ b/tests/extmod/random_basic.py @@ -1,11 +1,8 @@ try: - import urandom as random + import random except ImportError: - try: - import random - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit # check getrandbits returns a value within the bit range for b in (1, 2, 3, 4, 16, 32): diff --git a/tests/extmod/urandom_basic.py.exp b/tests/extmod/random_basic.py.exp similarity index 100% rename from tests/extmod/urandom_basic.py.exp rename to tests/extmod/random_basic.py.exp diff --git a/tests/extmod/urandom_extra.py b/tests/extmod/random_extra.py similarity index 89% rename from tests/extmod/urandom_extra.py rename to tests/extmod/random_extra.py index 78e17379dc..aa05053377 100644 --- a/tests/extmod/urandom_extra.py +++ b/tests/extmod/random_extra.py @@ -1,11 +1,8 @@ try: - import urandom as random + import random except ImportError: - try: - import random - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit try: random.randint diff --git a/tests/extmod/urandom_extra_float.py b/tests/extmod/random_extra_float.py similarity index 72% rename from tests/extmod/urandom_extra_float.py rename to tests/extmod/random_extra_float.py index 65918da136..3b37ed8dce 100644 --- a/tests/extmod/urandom_extra_float.py +++ b/tests/extmod/random_extra_float.py @@ -1,11 +1,8 @@ try: - import urandom as random + import random except ImportError: - try: - import random - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit try: random.randint diff --git a/tests/extmod/urandom_seed_default.py b/tests/extmod/random_seed_default.py similarity index 69% rename from tests/extmod/urandom_seed_default.py rename to tests/extmod/random_seed_default.py index a032b9362b..2fb16282ca 100644 --- a/tests/extmod/urandom_seed_default.py +++ b/tests/extmod/random_seed_default.py @@ -1,13 +1,10 @@ -# test urandom.seed() without any arguments +# test random.seed() without any arguments try: - import urandom as random + import random except ImportError: - try: - import random - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit try: random.seed() diff --git a/tests/extmod/ure1.py b/tests/extmod/re1.py similarity index 95% rename from tests/extmod/ure1.py rename to tests/extmod/re1.py index 2bdf2d0cfb..7e3839ae24 100644 --- a/tests/extmod/ure1.py +++ b/tests/extmod/re1.py @@ -1,11 +1,8 @@ try: - import ure as re + import re except ImportError: - try: - import re - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit r = re.compile(".+") m = r.match("abc") diff --git a/tests/extmod/ure_debug.py b/tests/extmod/re_debug.py similarity index 65% rename from tests/extmod/ure_debug.py rename to tests/extmod/re_debug.py index 7a07ede2d4..0f4c95551f 100644 --- a/tests/extmod/ure_debug.py +++ b/tests/extmod/re_debug.py @@ -1,10 +1,10 @@ # test printing debugging info when compiling try: - import ure + import re - ure.DEBUG + re.DEBUG except (ImportError, AttributeError): print("SKIP") raise SystemExit -ure.compile("^a|b[0-9]\w$", ure.DEBUG) +re.compile("^a|b[0-9]\w$", re.DEBUG) diff --git a/tests/extmod/ure_debug.py.exp b/tests/extmod/re_debug.py.exp similarity index 100% rename from tests/extmod/ure_debug.py.exp rename to tests/extmod/re_debug.py.exp diff --git a/tests/extmod/ure_error.py b/tests/extmod/re_error.py similarity index 73% rename from tests/extmod/ure_error.py rename to tests/extmod/re_error.py index 52a96b7c03..f61d091328 100644 --- a/tests/extmod/ure_error.py +++ b/tests/extmod/re_error.py @@ -1,13 +1,10 @@ # test errors in regex try: - import ure as re + import re except ImportError: - try: - import re - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit def test_re(r): diff --git a/tests/extmod/ure_group.py b/tests/extmod/re_group.py similarity index 81% rename from tests/extmod/ure_group.py rename to tests/extmod/re_group.py index 41425dd623..06c9ccfb2d 100644 --- a/tests/extmod/ure_group.py +++ b/tests/extmod/re_group.py @@ -1,13 +1,10 @@ # test groups, and nested groups try: - import ure as re + import re except ImportError: - try: - import re - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit def print_groups(match): diff --git a/tests/extmod/ure_groups.py b/tests/extmod/re_groups.py similarity index 81% rename from tests/extmod/ure_groups.py rename to tests/extmod/re_groups.py index 7da072a920..840a4b1af1 100644 --- a/tests/extmod/ure_groups.py +++ b/tests/extmod/re_groups.py @@ -1,13 +1,10 @@ # test match.groups() try: - import ure as re + import re except ImportError: - try: - import re - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit try: m = re.match(".", "a") diff --git a/tests/extmod/ure_limit.py b/tests/extmod/re_limit.py similarity index 88% rename from tests/extmod/ure_limit.py rename to tests/extmod/re_limit.py index 99c6a818e8..e0531afbdc 100644 --- a/tests/extmod/ure_limit.py +++ b/tests/extmod/re_limit.py @@ -1,7 +1,7 @@ -# Test overflow in ure.compile output code. +# Test overflow in re.compile output code. try: - import ure as re + import re except ImportError: print("SKIP") raise SystemExit diff --git a/tests/extmod/ure_limit.py.exp b/tests/extmod/re_limit.py.exp similarity index 100% rename from tests/extmod/ure_limit.py.exp rename to tests/extmod/re_limit.py.exp diff --git a/tests/extmod/ure_namedclass.py b/tests/extmod/re_namedclass.py similarity index 85% rename from tests/extmod/ure_namedclass.py rename to tests/extmod/re_namedclass.py index 4afc09dc0a..442172f4ab 100644 --- a/tests/extmod/ure_namedclass.py +++ b/tests/extmod/re_namedclass.py @@ -1,13 +1,10 @@ # test named char classes try: - import ure as re + import re except ImportError: - try: - import re - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit def print_groups(match): diff --git a/tests/extmod/ure_span.py b/tests/extmod/re_span.py similarity index 85% rename from tests/extmod/ure_span.py rename to tests/extmod/re_span.py index 03a3fef9f3..d00ef957a1 100644 --- a/tests/extmod/ure_span.py +++ b/tests/extmod/re_span.py @@ -1,13 +1,10 @@ # test match.span(), and nested spans try: - import ure as re + import re except ImportError: - try: - import re - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit try: m = re.match(".", "a") diff --git a/tests/extmod/ure_split.py b/tests/extmod/re_split.py similarity index 82% rename from tests/extmod/ure_split.py rename to tests/extmod/re_split.py index 7e6ef3990f..7769e1a121 100644 --- a/tests/extmod/ure_split.py +++ b/tests/extmod/re_split.py @@ -1,11 +1,8 @@ try: - import ure as re + import re except ImportError: - try: - import re - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit r = re.compile(" ") s = r.split("a b c foobar") diff --git a/tests/extmod/ure_split_empty.py b/tests/extmod/re_split_empty.py similarity index 95% rename from tests/extmod/ure_split_empty.py rename to tests/extmod/re_split_empty.py index 76ce97ea67..bc17aa8d78 100644 --- a/tests/extmod/ure_split_empty.py +++ b/tests/extmod/re_split_empty.py @@ -5,7 +5,7 @@ # splitting as soon as an empty match is found. try: - import ure as re + import re except ImportError: print("SKIP") raise SystemExit diff --git a/tests/extmod/ure_split_empty.py.exp b/tests/extmod/re_split_empty.py.exp similarity index 100% rename from tests/extmod/ure_split_empty.py.exp rename to tests/extmod/re_split_empty.py.exp diff --git a/tests/extmod/ure_split_notimpl.py b/tests/extmod/re_split_notimpl.py similarity index 89% rename from tests/extmod/ure_split_notimpl.py rename to tests/extmod/re_split_notimpl.py index 51bad791ef..7ddec9fa03 100644 --- a/tests/extmod/ure_split_notimpl.py +++ b/tests/extmod/re_split_notimpl.py @@ -1,5 +1,5 @@ try: - import ure as re + import re except ImportError: print("SKIP") raise SystemExit diff --git a/tests/extmod/ure_split_notimpl.py.exp b/tests/extmod/re_split_notimpl.py.exp similarity index 100% rename from tests/extmod/ure_split_notimpl.py.exp rename to tests/extmod/re_split_notimpl.py.exp diff --git a/tests/extmod/re_stack_overflow.py b/tests/extmod/re_stack_overflow.py new file mode 100644 index 0000000000..90fb8296b1 --- /dev/null +++ b/tests/extmod/re_stack_overflow.py @@ -0,0 +1,10 @@ +try: + import re +except ImportError: + print("SKIP") + raise SystemExit + +try: + re.match("(a*)*", "aaa") +except RuntimeError: + print("RuntimeError") diff --git a/tests/extmod/ure_stack_overflow.py.exp b/tests/extmod/re_stack_overflow.py.exp similarity index 100% rename from tests/extmod/ure_stack_overflow.py.exp rename to tests/extmod/re_stack_overflow.py.exp diff --git a/tests/extmod/ure_sub.py b/tests/extmod/re_sub.py similarity index 93% rename from tests/extmod/ure_sub.py rename to tests/extmod/re_sub.py index 806c389576..229c0e63ee 100644 --- a/tests/extmod/ure_sub.py +++ b/tests/extmod/re_sub.py @@ -1,11 +1,8 @@ try: - import ure as re + import re except ImportError: - try: - import re - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit try: re.sub diff --git a/tests/extmod/ure_sub_unmatched.py b/tests/extmod/re_sub_unmatched.py similarity index 71% rename from tests/extmod/ure_sub_unmatched.py rename to tests/extmod/re_sub_unmatched.py index d6312bfc2c..c238a7ed64 100644 --- a/tests/extmod/ure_sub_unmatched.py +++ b/tests/extmod/re_sub_unmatched.py @@ -1,13 +1,10 @@ # test re.sub with unmatched groups, behaviour changed in CPython 3.5 try: - import ure as re + import re except ImportError: - try: - import re - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit try: re.sub diff --git a/tests/extmod/ure_sub_unmatched.py.exp b/tests/extmod/re_sub_unmatched.py.exp similarity index 100% rename from tests/extmod/ure_sub_unmatched.py.exp rename to tests/extmod/re_sub_unmatched.py.exp diff --git a/tests/extmod/uselect_poll_basic.py b/tests/extmod/select_poll_basic.py similarity index 69% rename from tests/extmod/uselect_poll_basic.py rename to tests/extmod/select_poll_basic.py index 97fbd6fd15..b36e16f018 100644 --- a/tests/extmod/uselect_poll_basic.py +++ b/tests/extmod/select_poll_basic.py @@ -1,13 +1,10 @@ try: - import usocket as socket, uselect as select, uerrno as errno -except ImportError: - try: - import socket, select, errno + import socket, select, errno - select.poll # Raises AttributeError for CPython implementations without poll() - except (ImportError, AttributeError): - print("SKIP") - raise SystemExit + select.poll # Raises AttributeError for CPython implementations without poll() +except (ImportError, AttributeError): + print("SKIP") + raise SystemExit poller = select.poll() diff --git a/tests/extmod/uselect_poll_udp.py b/tests/extmod/select_poll_udp.py similarity index 66% rename from tests/extmod/uselect_poll_udp.py rename to tests/extmod/select_poll_udp.py index 2a56a122b5..336f987c12 100644 --- a/tests/extmod/uselect_poll_udp.py +++ b/tests/extmod/select_poll_udp.py @@ -1,15 +1,12 @@ # test select.poll on UDP sockets try: - import usocket as socket, uselect as select -except ImportError: - try: - import socket, select + import socket, select - select.poll # Raises AttributeError for CPython implementations without poll() - except (ImportError, AttributeError): - print("SKIP") - raise SystemExit + select.poll # Raises AttributeError for CPython implementations without poll() +except (ImportError, AttributeError): + print("SKIP") + raise SystemExit s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) diff --git a/tests/extmod/usocket_tcp_basic.py b/tests/extmod/socket_tcp_basic.py similarity index 60% rename from tests/extmod/usocket_tcp_basic.py rename to tests/extmod/socket_tcp_basic.py index c2fe8cd14c..ebd30f7862 100644 --- a/tests/extmod/usocket_tcp_basic.py +++ b/tests/extmod/socket_tcp_basic.py @@ -1,13 +1,10 @@ # Test basic, stand-alone TCP socket functionality try: - import usocket as socket, uerrno as errno + import socket, errno except ImportError: - try: - import socket, errno - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit # recv() on a fresh socket should raise ENOTCONN s = socket.socket() diff --git a/tests/extmod/usocket_udp_nonblock.py b/tests/extmod/socket_udp_nonblock.py similarity index 63% rename from tests/extmod/usocket_udp_nonblock.py rename to tests/extmod/socket_udp_nonblock.py index bc560de142..f7ce5f3444 100644 --- a/tests/extmod/usocket_udp_nonblock.py +++ b/tests/extmod/socket_udp_nonblock.py @@ -1,13 +1,10 @@ # test non-blocking UDP sockets try: - import usocket as socket, uerrno as errno + import socket, errno except ImportError: - try: - import socket, errno - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) diff --git a/tests/extmod/ussl_basic.py b/tests/extmod/ssl_basic.py similarity index 96% rename from tests/extmod/ussl_basic.py rename to tests/extmod/ssl_basic.py index dd3b6f0b91..d035798c98 100644 --- a/tests/extmod/ussl_basic.py +++ b/tests/extmod/ssl_basic.py @@ -1,8 +1,8 @@ # very basic test of ssl module, just to test the methods exist try: - import uio as io - import ussl as ssl + import io + import ssl except ImportError: print("SKIP") raise SystemExit diff --git a/tests/extmod/ussl_basic.py.exp b/tests/extmod/ssl_basic.py.exp similarity index 100% rename from tests/extmod/ussl_basic.py.exp rename to tests/extmod/ssl_basic.py.exp diff --git a/tests/extmod/ussl_keycert.py b/tests/extmod/ssl_keycert.py similarity index 94% rename from tests/extmod/ussl_keycert.py rename to tests/extmod/ssl_keycert.py index 87a40a1e55..53f064fdaf 100644 --- a/tests/extmod/ussl_keycert.py +++ b/tests/extmod/ssl_keycert.py @@ -1,8 +1,8 @@ -# Test ussl with key/cert passed in +# Test ssl with key/cert passed in try: - import uio as io - import ussl as ssl + import io + import ssl except ImportError: print("SKIP") raise SystemExit diff --git a/tests/extmod/ussl_keycert.py.exp b/tests/extmod/ssl_keycert.py.exp similarity index 100% rename from tests/extmod/ussl_keycert.py.exp rename to tests/extmod/ssl_keycert.py.exp diff --git a/tests/extmod/ussl_poll.py b/tests/extmod/ssl_poll.py similarity index 94% rename from tests/extmod/ussl_poll.py rename to tests/extmod/ssl_poll.py index 8080ec5112..347e5f7d37 100644 --- a/tests/extmod/ussl_poll.py +++ b/tests/extmod/ssl_poll.py @@ -1,8 +1,8 @@ try: - import uselect - import ussl + import select + import ssl import io - import ubinascii as binascii + import binascii except ImportError: print("SKIP") raise SystemExit @@ -121,9 +121,9 @@ client_io, server_io = _Pipe.new_pair() client_io.block_reads = True client_io.block_writes = True -client_sock = ussl.wrap_socket(client_io, do_handshake=False) +client_sock = ssl.wrap_socket(client_io, do_handshake=False) -server_sock = ussl.wrap_socket(server_io, key=key, cert=cert, server_side=True, do_handshake=False) +server_sock = ssl.wrap_socket(server_io, key=key, cert=cert, server_side=True, do_handshake=False) # Do a test read, at this point the TLS handshake wants to write, # so it returns None: @@ -175,7 +175,7 @@ assert server_sock.read(3) == b"bar" # Polling on a closed socket errors out: client_io, _ = _Pipe.new_pair() -client_sock = ussl.wrap_socket(client_io, do_handshake=False) +client_sock = ssl.wrap_socket(client_io, do_handshake=False) client_sock.close() assert_poll( client_sock, client_io, _MP_STREAM_POLL_RD, None, _MP_STREAM_POLL_NVAL @@ -184,7 +184,7 @@ assert_poll( # Errors propagates to poll: client_io, server_io = _Pipe.new_pair() -client_sock = ussl.wrap_socket(client_io, do_handshake=False) +client_sock = ssl.wrap_socket(client_io, do_handshake=False) # The server returns garbage: server_io.write(b"fooba") # Needs to be exactly 5 bytes diff --git a/tests/extmod/ussl_poll.py.exp b/tests/extmod/ssl_poll.py.exp similarity index 100% rename from tests/extmod/ussl_poll.py.exp rename to tests/extmod/ssl_poll.py.exp diff --git a/tests/extmod/ticks_add.py b/tests/extmod/ticks_add.py index 2f1ba6c810..4f465f3cfb 100644 --- a/tests/extmod/ticks_add.py +++ b/tests/extmod/ticks_add.py @@ -1,5 +1,5 @@ try: - from utime import ticks_diff, ticks_add + from time import ticks_diff, ticks_add except ImportError: print("SKIP") raise SystemExit diff --git a/tests/extmod/ticks_diff.py b/tests/extmod/ticks_diff.py index de45a557af..b2445f0d62 100644 --- a/tests/extmod/ticks_diff.py +++ b/tests/extmod/ticks_diff.py @@ -1,5 +1,5 @@ try: - from utime import ticks_diff, ticks_add + from time import ticks_diff, ticks_add except ImportError: print("SKIP") raise SystemExit diff --git a/tests/extmod/time_ms_us.py b/tests/extmod/time_ms_us.py index ac2ed8be27..e26c6e677a 100644 --- a/tests/extmod/time_ms_us.py +++ b/tests/extmod/time_ms_us.py @@ -1,23 +1,23 @@ try: - import utime + import time - utime.sleep_ms, utime.sleep_us, utime.ticks_diff, utime.ticks_ms, utime.ticks_us, utime.ticks_cpu + time.sleep_ms, time.sleep_us, time.ticks_diff, time.ticks_ms, time.ticks_us, time.ticks_cpu except (ImportError, AttributeError): print("SKIP") raise SystemExit -utime.sleep_ms(1) -utime.sleep_us(1) +time.sleep_ms(1) +time.sleep_us(1) -t0 = utime.ticks_ms() -t1 = utime.ticks_ms() -print(0 <= utime.ticks_diff(t1, t0) <= 1) +t0 = time.ticks_ms() +t1 = time.ticks_ms() +print(0 <= time.ticks_diff(t1, t0) <= 1) -t0 = utime.ticks_us() -t1 = utime.ticks_us() -print(0 <= utime.ticks_diff(t1, t0) <= 500) +t0 = time.ticks_us() +t1 = time.ticks_us() +print(0 <= time.ticks_diff(t1, t0) <= 500) # ticks_cpu may not be implemented, at least make sure it doesn't decrease -t0 = utime.ticks_cpu() -t1 = utime.ticks_cpu() -print(utime.ticks_diff(t1, t0) >= 0) +t0 = time.ticks_cpu() +t1 = time.ticks_cpu() +print(time.ticks_diff(t1, t0) >= 0) diff --git a/tests/extmod/utime_res.py b/tests/extmod/time_res.py similarity index 80% rename from tests/extmod/utime_res.py rename to tests/extmod/time_res.py index 4b62433483..548bef1f17 100644 --- a/tests/extmod/utime_res.py +++ b/tests/extmod/time_res.py @@ -1,18 +1,18 @@ -# test utime resolutions +# test time resolutions try: - import utime + import time except ImportError: print("SKIP") raise SystemExit def gmtime_time(): - return utime.gmtime(utime.time()) + return time.gmtime(time.time()) def localtime_time(): - return utime.localtime(utime.time()) + return time.localtime(time.time()) def test(): @@ -32,12 +32,12 @@ def test(): # call time functions results_map = {} - end_time = utime.ticks_ms() + TEST_TIME - while utime.ticks_diff(end_time, utime.ticks_ms()) > 0: - utime.sleep_ms(100) + end_time = time.ticks_ms() + TEST_TIME + while time.ticks_diff(end_time, time.ticks_ms()) > 0: + time.sleep_ms(100) for func_name, _ in EXPECTED_MAP: try: - time_func = getattr(utime, func_name, None) or globals()[func_name] + time_func = getattr(time, func_name, None) or globals()[func_name] now = time_func() # may raise AttributeError except (KeyError, AttributeError): continue diff --git a/tests/extmod/utime_res.py.exp b/tests/extmod/time_res.py.exp similarity index 100% rename from tests/extmod/utime_res.py.exp rename to tests/extmod/time_res.py.exp diff --git a/tests/extmod/utime_time_ns.py b/tests/extmod/time_time_ns.py similarity index 68% rename from tests/extmod/utime_time_ns.py rename to tests/extmod/time_time_ns.py index 0d13f839d4..3ef58e56a9 100644 --- a/tests/extmod/utime_time_ns.py +++ b/tests/extmod/time_time_ns.py @@ -1,18 +1,18 @@ -# test utime.time_ns() +# test time.time_ns() try: - import utime + import time - utime.sleep_us - utime.time_ns + time.sleep_us + time.time_ns except (ImportError, AttributeError): print("SKIP") raise SystemExit -t0 = utime.time_ns() -utime.sleep_us(5000) -t1 = utime.time_ns() +t0 = time.time_ns() +time.sleep_us(5000) +t1 = time.time_ns() # Check that time_ns increases. print(t0 < t1) diff --git a/tests/extmod/utime_time_ns.py.exp b/tests/extmod/time_time_ns.py.exp similarity index 100% rename from tests/extmod/utime_time_ns.py.exp rename to tests/extmod/time_time_ns.py.exp diff --git a/tests/extmod/utimeq1.py b/tests/extmod/timeq1.py similarity index 90% rename from tests/extmod/utimeq1.py rename to tests/extmod/timeq1.py index 688e5b834f..0778c87255 100644 --- a/tests/extmod/utimeq1.py +++ b/tests/extmod/timeq1.py @@ -1,8 +1,8 @@ -# Test for utimeq module which implements task queue with support for -# wraparound time (utime.ticks_ms() style). +# Test for timeq module which implements task queue with support for +# wraparound time (time.ticks_ms() style). try: - from utime import ticks_add, ticks_diff - from utimeq import utimeq + from time import ticks_add, ticks_diff + from timeq import timeq except ImportError: print("SKIP") raise SystemExit @@ -24,7 +24,7 @@ else: # Try not to crash on invalid data -h = utimeq(10) +h = timeq(10) try: h.push(1) assert False @@ -45,7 +45,7 @@ except TypeError: pass # pushing on full queue -h = utimeq(1) +h = timeq(1) h.push(1, 0, 0) try: h.push(2, 0, 0) @@ -68,7 +68,7 @@ assert h.peektime() == 1 # peektime with empty queue try: - utimeq(1).peektime() + timeq(1).peektime() assert False except IndexError: pass @@ -92,7 +92,7 @@ def add(h, v): dprint("-----") -h = utimeq(10) +h = timeq(10) add(h, 0) add(h, MAX) add(h, MAX - 1) @@ -107,7 +107,7 @@ for i in range(len(l) - 1): def edge_case(edge, offset): - h = utimeq(10) + h = timeq(10) add(h, ticks_add(0, offset)) add(h, ticks_add(edge, offset)) dprint(h) diff --git a/tests/extmod/utimeq1.py.exp b/tests/extmod/timeq1.py.exp similarity index 100% rename from tests/extmod/utimeq1.py.exp rename to tests/extmod/timeq1.py.exp diff --git a/tests/extmod/utimeq_stable.py b/tests/extmod/timeq_stable.py similarity index 90% rename from tests/extmod/utimeq_stable.py rename to tests/extmod/timeq_stable.py index 9fb522d514..b19ea1b3ad 100644 --- a/tests/extmod/utimeq_stable.py +++ b/tests/extmod/timeq_stable.py @@ -1,10 +1,10 @@ try: - from utimeq import utimeq + from timeq import timeq except ImportError: print("SKIP") raise SystemExit -h = utimeq(10) +h = timeq(10) # Check that for 2 same-key items, the queue is stable (pops items # in the same order they were pushed). Unfortunately, this no longer diff --git a/tests/extmod/utimeq_stable.py.exp b/tests/extmod/timeq_stable.py.exp similarity index 100% rename from tests/extmod/utimeq_stable.py.exp rename to tests/extmod/timeq_stable.py.exp diff --git a/tests/extmod/uasyncio_basic.py b/tests/extmod/uasyncio_basic.py index 20c0a82e47..3858e4fdd5 100644 --- a/tests/extmod/uasyncio_basic.py +++ b/tests/extmod/uasyncio_basic.py @@ -7,15 +7,12 @@ except ImportError: print("SKIP") raise SystemExit +import time -try: - import utime - - ticks = utime.ticks_ms - ticks_diff = utime.ticks_diff -except: - import time - +if hasattr(time, "ticks_ms"): + ticks = time.ticks_ms + ticks_diff = time.ticks_diff +else: ticks = lambda: int(time.time() * 1000) ticks_diff = lambda t1, t0: t1 - t0 diff --git a/tests/extmod/uasyncio_micropython.py b/tests/extmod/uasyncio_micropython.py index a6b65bb2a8..de1687ca8b 100644 --- a/tests/extmod/uasyncio_micropython.py +++ b/tests/extmod/uasyncio_micropython.py @@ -3,7 +3,7 @@ # - wait_for_ms try: - import utime, uasyncio + import time, uasyncio except ImportError: print("SKIP") raise SystemExit @@ -18,13 +18,13 @@ async def task(id, t): async def main(): # Simple sleep_ms - t0 = utime.ticks_ms() + t0 = time.ticks_ms() await uasyncio.sleep_ms(1) - print(utime.ticks_diff(utime.ticks_ms(), t0) < 100) + print(time.ticks_diff(time.ticks_ms(), t0) < 100) try: # Sleep 1ms beyond maximum allowed sleep value - await uasyncio.sleep_ms(utime.ticks_add(0, -1) // 2 + 1) + await uasyncio.sleep_ms(time.ticks_add(0, -1) // 2 + 1) except OverflowError: print("OverflowError") diff --git a/tests/extmod/uasyncio_threadsafeflag.py b/tests/extmod/uasyncio_threadsafeflag.py index a8a08d2e92..f97b138498 100644 --- a/tests/extmod/uasyncio_threadsafeflag.py +++ b/tests/extmod/uasyncio_threadsafeflag.py @@ -18,7 +18,7 @@ except AttributeError: try: # Unix port can't select/poll on user-defined types. - import uselect as select + import select poller = select.poll() poller.register(asyncio.ThreadSafeFlag()) diff --git a/tests/extmod/uasyncio_wait_task.py b/tests/extmod/uasyncio_wait_task.py index e19e29903c..1d70ddf720 100644 --- a/tests/extmod/uasyncio_wait_task.py +++ b/tests/extmod/uasyncio_wait_task.py @@ -10,14 +10,12 @@ except ImportError: raise SystemExit -try: - import utime - - ticks = utime.ticks_ms - ticks_diff = utime.ticks_diff -except: - import time +import time +if hasattr(time, "ticks_ms"): + ticks = time.ticks_ms + ticks_diff = time.ticks_diff +else: ticks = lambda: int(time.time() * 1000) ticks_diff = lambda t1, t0: t1 - t0 diff --git a/tests/extmod/uctypes_array_assign_native_le.py b/tests/extmod/uctypes_array_assign_native_le.py index 5bddfcdf2f..d4c27fc4b3 100644 --- a/tests/extmod/uctypes_array_assign_native_le.py +++ b/tests/extmod/uctypes_array_assign_native_le.py @@ -1,4 +1,4 @@ -import usys +import sys try: import uctypes @@ -6,7 +6,7 @@ except ImportError: print("SKIP") raise SystemExit -if usys.byteorder != "little": +if sys.byteorder != "little": print("SKIP") raise SystemExit diff --git a/tests/extmod/uctypes_array_assign_native_le_intbig.py b/tests/extmod/uctypes_array_assign_native_le_intbig.py index 42583b8afe..f33c63b4ef 100644 --- a/tests/extmod/uctypes_array_assign_native_le_intbig.py +++ b/tests/extmod/uctypes_array_assign_native_le_intbig.py @@ -1,4 +1,4 @@ -import usys +import sys try: import uctypes @@ -6,7 +6,7 @@ except ImportError: print("SKIP") raise SystemExit -if usys.byteorder != "little": +if sys.byteorder != "little": print("SKIP") raise SystemExit diff --git a/tests/extmod/uctypes_native_le.py b/tests/extmod/uctypes_native_le.py index 9889b98e9d..7958e5c22a 100644 --- a/tests/extmod/uctypes_native_le.py +++ b/tests/extmod/uctypes_native_le.py @@ -1,7 +1,7 @@ # This test is exactly like uctypes_le.py, but uses native structure layout. # Codepaths for packed vs native structures are different. This test only works # on little-endian machine (no matter if 32 or 64 bit). -import usys +import sys try: import uctypes @@ -9,7 +9,7 @@ except ImportError: print("SKIP") raise SystemExit -if usys.byteorder != "little": +if sys.byteorder != "little": print("SKIP") raise SystemExit diff --git a/tests/extmod/uctypes_ptr_le.py b/tests/extmod/uctypes_ptr_le.py index f475465ae8..5d8094ee48 100644 --- a/tests/extmod/uctypes_ptr_le.py +++ b/tests/extmod/uctypes_ptr_le.py @@ -1,4 +1,4 @@ -import usys +import sys try: import uctypes @@ -6,7 +6,7 @@ except ImportError: print("SKIP") raise SystemExit -if usys.byteorder != "little": +if sys.byteorder != "little": print("SKIP") raise SystemExit diff --git a/tests/extmod/uctypes_ptr_native_le.py b/tests/extmod/uctypes_ptr_native_le.py index ca2b316c54..8ca4d2c55c 100644 --- a/tests/extmod/uctypes_ptr_native_le.py +++ b/tests/extmod/uctypes_ptr_native_le.py @@ -1,4 +1,4 @@ -import usys +import sys try: import uctypes @@ -6,7 +6,7 @@ except ImportError: print("SKIP") raise SystemExit -if usys.byteorder != "little": +if sys.byteorder != "little": print("SKIP") raise SystemExit diff --git a/tests/extmod/uctypes_sizeof_od.py b/tests/extmod/uctypes_sizeof_od.py index 2f070095b5..375f05f5e2 100644 --- a/tests/extmod/uctypes_sizeof_od.py +++ b/tests/extmod/uctypes_sizeof_od.py @@ -1,5 +1,5 @@ try: - from ucollections import OrderedDict + from collections import OrderedDict import uctypes except ImportError: print("SKIP") diff --git a/tests/extmod/uhashlib_md5.py b/tests/extmod/uhashlib_md5.py deleted file mode 100644 index 07d5f31692..0000000000 --- a/tests/extmod/uhashlib_md5.py +++ /dev/null @@ -1,21 +0,0 @@ -try: - import uhashlib as hashlib -except ImportError: - try: - import hashlib - except ImportError: - # This is neither uPy, nor cPy, so must be uPy with - # uhashlib module disabled. - print("SKIP") - raise SystemExit - -try: - hashlib.md5 -except AttributeError: - # MD5 is only available on some ports - print("SKIP") - raise SystemExit - -md5 = hashlib.md5(b"hello") -md5.update(b"world") -print(md5.digest()) diff --git a/tests/extmod/uhashlib_sha1.py b/tests/extmod/uhashlib_sha1.py deleted file mode 100644 index a573121316..0000000000 --- a/tests/extmod/uhashlib_sha1.py +++ /dev/null @@ -1,21 +0,0 @@ -try: - import uhashlib as hashlib -except ImportError: - try: - import hashlib - except ImportError: - # This is neither uPy, nor cPy, so must be uPy with - # uhashlib module disabled. - print("SKIP") - raise SystemExit - -try: - hashlib.sha1 -except AttributeError: - # SHA1 is only available on some ports - print("SKIP") - raise SystemExit - -sha1 = hashlib.sha1(b"hello") -sha1.update(b"world") -print(sha1.digest()) diff --git a/tests/extmod/ujson_dumps_extra.py b/tests/extmod/ujson_dumps_extra.py deleted file mode 100644 index f2aa7f249f..0000000000 --- a/tests/extmod/ujson_dumps_extra.py +++ /dev/null @@ -1,9 +0,0 @@ -# test uPy ujson behaviour that's not valid in CPy - -try: - import ujson -except ImportError: - print("SKIP") - raise SystemExit - -print(ujson.dumps(b"1234")) diff --git a/tests/extmod/ujson_dumps_float.py b/tests/extmod/ujson_dumps_float.py deleted file mode 100644 index 25681d0c23..0000000000 --- a/tests/extmod/ujson_dumps_float.py +++ /dev/null @@ -1,11 +0,0 @@ -try: - import ujson as json -except ImportError: - try: - import json - except ImportError: - print("SKIP") - raise SystemExit - -print(json.dumps(1.2)) -print(json.dumps({1.5: "hi"})) diff --git a/tests/extmod/ujson_dumps_ordereddict.py b/tests/extmod/ujson_dumps_ordereddict.py deleted file mode 100644 index c6f4a8fcb7..0000000000 --- a/tests/extmod/ujson_dumps_ordereddict.py +++ /dev/null @@ -1,12 +0,0 @@ -try: - import ujson as json - from ucollections import OrderedDict -except ImportError: - try: - import json - from collections import OrderedDict - except ImportError: - print("SKIP") - raise SystemExit - -print(json.dumps(OrderedDict(((1, 2), (3, 4))))) diff --git a/tests/extmod/ujson_load.py b/tests/extmod/ujson_load.py deleted file mode 100644 index 7cec9246b8..0000000000 --- a/tests/extmod/ujson_load.py +++ /dev/null @@ -1,15 +0,0 @@ -try: - from uio import StringIO - import ujson as json -except: - try: - from io import StringIO - import json - except ImportError: - print("SKIP") - raise SystemExit - -print(json.load(StringIO("null"))) -print(json.load(StringIO('"abc\\u0064e"'))) -print(json.load(StringIO("[false, true, 1, -2]"))) -print(json.load(StringIO('{"a":true}'))) diff --git a/tests/extmod/ure_stack_overflow.py b/tests/extmod/ure_stack_overflow.py deleted file mode 100644 index d3ce0c5a7b..0000000000 --- a/tests/extmod/ure_stack_overflow.py +++ /dev/null @@ -1,13 +0,0 @@ -try: - import ure as re -except ImportError: - try: - import re - except ImportError: - print("SKIP") - raise SystemExit - -try: - re.match("(a*)*", "aaa") -except RuntimeError: - print("RuntimeError") diff --git a/tests/extmod/vfs_basic.py b/tests/extmod/vfs_basic.py index 9a9ef2ca61..028846406a 100644 --- a/tests/extmod/vfs_basic.py +++ b/tests/extmod/vfs_basic.py @@ -1,9 +1,9 @@ # test VFS functionality without any particular filesystem type try: - import uos + import os - uos.mount + os.mount except (ImportError, AttributeError): print("SKIP") raise SystemExit @@ -59,35 +59,35 @@ class Filesystem: # first we umount any existing mount points the target may have try: - uos.umount("/") + os.umount("/") except OSError: pass -for path in uos.listdir("/"): - uos.umount("/" + path) +for path in os.listdir("/"): + os.umount("/" + path) # stat root dir -print(uos.stat("/")) +print(os.stat("/")) # statvfs root dir; verify that f_namemax has a sensible size -print(uos.statvfs("/")[9] >= 32) +print(os.statvfs("/")[9] >= 32) # getcwd when in root dir -print(uos.getcwd()) +print(os.getcwd()) # test operations on the root directory with nothing mounted, they should all fail for func in ("chdir", "listdir", "mkdir", "remove", "rmdir", "stat"): for arg in ("x", "/x"): try: - getattr(uos, func)(arg) + getattr(os, func)(arg) except OSError: print(func, arg, "OSError") # basic mounting and listdir -uos.mount(Filesystem(1), "/test_mnt") -print(uos.listdir()) +os.mount(Filesystem(1), "/test_mnt") +print(os.listdir()) # ilistdir -i = uos.ilistdir() +i = os.ilistdir() print(next(i)) try: next(i) @@ -99,88 +99,88 @@ except StopIteration: print("StopIteration") # referencing the mount point in different ways -print(uos.listdir("test_mnt")) -print(uos.listdir("/test_mnt")) +print(os.listdir("test_mnt")) +print(os.listdir("/test_mnt")) # mounting another filesystem -uos.mount(Filesystem(2), "/test_mnt2", readonly=True) -print(uos.listdir()) -print(uos.listdir("/test_mnt2")) +os.mount(Filesystem(2), "/test_mnt2", readonly=True) +print(os.listdir()) +print(os.listdir("/test_mnt2")) # mounting over an existing mount point try: - uos.mount(Filesystem(3), "/test_mnt2") + os.mount(Filesystem(3), "/test_mnt2") except OSError: print("OSError") # mkdir of a mount point try: - uos.mkdir("/test_mnt") + os.mkdir("/test_mnt") except OSError: print("OSError") # rename across a filesystem try: - uos.rename("/test_mnt/a", "/test_mnt2/b") + os.rename("/test_mnt/a", "/test_mnt2/b") except OSError: print("OSError") # delegating to mounted filesystem -uos.chdir("test_mnt") -print(uos.listdir()) -print(uos.getcwd()) -uos.mkdir("test_dir") -uos.remove("test_file") -uos.rename("test_file", "test_file2") -uos.rmdir("test_dir") -print(uos.stat("test_file")) -print(uos.statvfs("/test_mnt")) +os.chdir("test_mnt") +print(os.listdir()) +print(os.getcwd()) +os.mkdir("test_dir") +os.remove("test_file") +os.rename("test_file", "test_file2") +os.rmdir("test_dir") +print(os.stat("test_file")) +print(os.statvfs("/test_mnt")) open("test_file") open("test_file", "wb") # umount -uos.umount("/test_mnt") -uos.umount("/test_mnt2") +os.umount("/test_mnt") +os.umount("/test_mnt2") # umount a non-existent mount point try: - uos.umount("/test_mnt") + os.umount("/test_mnt") except OSError: print("OSError") # root dir -uos.mount(Filesystem(3), "/") -print(uos.stat("/")) -print(uos.statvfs("/")) -print(uos.listdir()) +os.mount(Filesystem(3), "/") +print(os.stat("/")) +print(os.statvfs("/")) +print(os.listdir()) open("test") -uos.mount(Filesystem(4), "/mnt") -print(uos.listdir()) -print(uos.listdir("/mnt")) -uos.chdir("/mnt") -print(uos.listdir()) +os.mount(Filesystem(4), "/mnt") +print(os.listdir()) +print(os.listdir("/mnt")) +os.chdir("/mnt") +print(os.listdir()) # chdir to a subdir within root-mounted vfs, and then listdir -uos.chdir("/subdir") -print(uos.listdir()) -uos.chdir("/") +os.chdir("/subdir") +print(os.listdir()) +os.chdir("/") -uos.umount("/") -print(uos.listdir("/")) -uos.umount("/mnt") +os.umount("/") +print(os.listdir("/")) +os.umount("/mnt") # chdir to a non-existent mount point (current directory should remain unchanged) try: - uos.chdir("/foo") + os.chdir("/foo") except OSError: print("OSError") -print(uos.getcwd()) +print(os.getcwd()) # chdir to a non-existent subdirectory in a mounted filesystem -uos.mount(Filesystem(5, 1), "/mnt") +os.mount(Filesystem(5, 1), "/mnt") try: - uos.chdir("/mnt/subdir") + os.chdir("/mnt/subdir") except OSError: print("OSError") -print(uos.getcwd()) +print(os.getcwd()) diff --git a/tests/extmod/vfs_blockdev.py b/tests/extmod/vfs_blockdev.py index e24169ba93..f4c84ea921 100644 --- a/tests/extmod/vfs_blockdev.py +++ b/tests/extmod/vfs_blockdev.py @@ -1,10 +1,10 @@ # Test for behaviour of combined standard and extended block device try: - import uos + import os - uos.VfsFat - uos.VfsLfs2 + os.VfsFat + os.VfsLfs2 except (ImportError, AttributeError): print("SKIP") raise SystemExit @@ -65,10 +65,12 @@ def test(bdev, vfs_class): try: + import os + bdev = RAMBlockDevice(50) except MemoryError: print("SKIP") raise SystemExit -test(bdev, uos.VfsFat) -test(bdev, uos.VfsLfs2) +test(bdev, os.VfsFat) +test(bdev, os.VfsLfs2) diff --git a/tests/extmod/vfs_fat_fileio1.py b/tests/extmod/vfs_fat_fileio1.py index 55f399ff2e..f4db5ac8dd 100644 --- a/tests/extmod/vfs_fat_fileio1.py +++ b/tests/extmod/vfs_fat_fileio1.py @@ -1,12 +1,12 @@ try: - import uerrno - import uos + import errno + import os except ImportError: print("SKIP") raise SystemExit try: - uos.VfsFat + os.VfsFat except AttributeError: print("SKIP") raise SystemExit @@ -38,14 +38,14 @@ class RAMFS: try: bdev = RAMFS(50) - uos.VfsFat.mkfs(bdev) + os.VfsFat.mkfs(bdev) except MemoryError: print("SKIP") raise SystemExit -vfs = uos.VfsFat(bdev) -uos.mount(vfs, "/ramdisk") -uos.chdir("/ramdisk") +vfs = os.VfsFat(bdev) +os.mount(vfs, "/ramdisk") +os.chdir("/ramdisk") # file IO f = open("foo_file.txt", "w") @@ -57,22 +57,22 @@ f.close() # allowed try: f.write("world!") except OSError as e: - print(e.errno == uerrno.EINVAL) + print(e.errno == errno.EINVAL) try: f.read() except OSError as e: - print(e.errno == uerrno.EINVAL) + print(e.errno == errno.EINVAL) try: f.flush() except OSError as e: - print(e.errno == uerrno.EINVAL) + print(e.errno == errno.EINVAL) try: open("foo_file.txt", "x") except OSError as e: - print(e.errno == uerrno.EEXIST) + print(e.errno == errno.EEXIST) with open("foo_file.txt", "a") as f: f.write("world!") @@ -104,7 +104,7 @@ vfs.mkdir("foo_dir") try: vfs.rmdir("foo_file.txt") except OSError as e: - print(e.errno == 20) # uerrno.ENOTDIR + print(e.errno == 20) # errno.ENOTDIR vfs.remove("foo_file.txt") print(list(vfs.ilistdir())) diff --git a/tests/extmod/vfs_fat_fileio2.py b/tests/extmod/vfs_fat_fileio2.py index 9429f115f6..353b997e5c 100644 --- a/tests/extmod/vfs_fat_fileio2.py +++ b/tests/extmod/vfs_fat_fileio2.py @@ -1,12 +1,12 @@ try: - import uerrno - import uos + import errno + import os except ImportError: print("SKIP") raise SystemExit try: - uos.VfsFat + os.VfsFat except AttributeError: print("SKIP") raise SystemExit @@ -38,34 +38,34 @@ class RAMFS: try: bdev = RAMFS(50) - uos.VfsFat.mkfs(bdev) + os.VfsFat.mkfs(bdev) except MemoryError: print("SKIP") raise SystemExit -vfs = uos.VfsFat(bdev) -uos.mount(vfs, "/ramdisk") -uos.chdir("/ramdisk") +vfs = os.VfsFat(bdev) +os.mount(vfs, "/ramdisk") +os.chdir("/ramdisk") try: vfs.mkdir("foo_dir") except OSError as e: - print(e.errno == uerrno.EEXIST) + print(e.errno == errno.EEXIST) try: vfs.remove("foo_dir") except OSError as e: - print(e.errno == uerrno.EISDIR) + print(e.errno == errno.EISDIR) try: vfs.remove("no_file.txt") except OSError as e: - print(e.errno == uerrno.ENOENT) + print(e.errno == errno.ENOENT) try: vfs.rename("foo_dir", "/null/file") except OSError as e: - print(e.errno == uerrno.ENOENT) + print(e.errno == errno.ENOENT) # file in dir with open("foo_dir/file-in-dir.txt", "w+t") as f: @@ -81,7 +81,7 @@ with open("foo_dir/sub_file.txt", "w") as f: try: vfs.rmdir("foo_dir") except OSError as e: - print(e.errno == uerrno.EACCES) + print(e.errno == errno.EACCES) # trim full path vfs.rename("foo_dir/file-in-dir.txt", "foo_dir/file.txt") @@ -110,5 +110,5 @@ try: f = open("large_file.txt", "wb") f.write(bytearray(bsize * free)) except OSError as e: - print("ENOSPC:", e.errno == 28) # uerrno.ENOSPC + print("ENOSPC:", e.errno == 28) # errno.ENOSPC f.close() diff --git a/tests/extmod/vfs_fat_finaliser.py b/tests/extmod/vfs_fat_finaliser.py index b38e640c73..b6c7dffb82 100644 --- a/tests/extmod/vfs_fat_finaliser.py +++ b/tests/extmod/vfs_fat_finaliser.py @@ -1,9 +1,9 @@ # Test VfsFat class and its finaliser try: - import uerrno, uos + import errno, os - uos.VfsFat + os.VfsFat except (ImportError, AttributeError): print("SKIP") raise SystemExit @@ -31,14 +31,16 @@ class RAMBlockDevice: # Create block device, and skip test if not enough RAM try: + import errno, os + bdev = RAMBlockDevice(50) except MemoryError: print("SKIP") raise SystemExit # Format block device and create VFS object -uos.VfsFat.mkfs(bdev) -vfs = uos.VfsFat(bdev) +os.VfsFat.mkfs(bdev) +vfs = os.VfsFat(bdev) # Here we test that opening a file with the heap locked fails correctly. This # is a special case because file objects use a finaliser and allocating with a @@ -48,6 +50,8 @@ import micropython micropython.heap_lock() try: + import errno, os + vfs.open("x", "r") except MemoryError: print("MemoryError") diff --git a/tests/extmod/vfs_fat_ilistdir_del.py b/tests/extmod/vfs_fat_ilistdir_del.py index ccdacc57c2..055836ad71 100644 --- a/tests/extmod/vfs_fat_ilistdir_del.py +++ b/tests/extmod/vfs_fat_ilistdir_del.py @@ -2,9 +2,9 @@ import gc try: - import uos + import os - uos.VfsFat + os.VfsFat except (ImportError, AttributeError): print("SKIP") raise SystemExit @@ -77,4 +77,4 @@ except MemoryError: print("SKIP") raise SystemExit -test(bdev, uos.VfsFat) +test(bdev, os.VfsFat) diff --git a/tests/extmod/vfs_fat_more.py b/tests/extmod/vfs_fat_more.py index 981c2524a6..7074221a32 100644 --- a/tests/extmod/vfs_fat_more.py +++ b/tests/extmod/vfs_fat_more.py @@ -1,11 +1,11 @@ try: - import uos + import os except ImportError: print("SKIP") raise SystemExit try: - uos.VfsFat + os.VfsFat except AttributeError: print("SKIP") raise SystemExit @@ -44,76 +44,76 @@ except MemoryError: # first we umount any existing mount points the target may have try: - uos.umount("/") + os.umount("/") except OSError: pass -for path in uos.listdir("/"): - uos.umount("/" + path) +for path in os.listdir("/"): + os.umount("/" + path) -uos.VfsFat.mkfs(bdev) -uos.mount(bdev, "/") +os.VfsFat.mkfs(bdev) +os.mount(bdev, "/") -print(uos.getcwd()) +print(os.getcwd()) f = open("test.txt", "w") f.write("hello") f.close() -print(uos.listdir()) -print(uos.listdir("/")) -print(uos.stat("")[:-3]) -print(uos.stat("/")[:-3]) -print(uos.stat("test.txt")[:-3]) -print(uos.stat("/test.txt")[:-3]) +print(os.listdir()) +print(os.listdir("/")) +print(os.stat("")[:-3]) +print(os.stat("/")[:-3]) +print(os.stat("test.txt")[:-3]) +print(os.stat("/test.txt")[:-3]) f = open("/test.txt") print(f.read()) f.close() -uos.rename("test.txt", "test2.txt") -print(uos.listdir()) -uos.rename("test2.txt", "/test3.txt") -print(uos.listdir()) -uos.rename("/test3.txt", "test4.txt") -print(uos.listdir()) -uos.rename("/test4.txt", "/test5.txt") -print(uos.listdir()) +os.rename("test.txt", "test2.txt") +print(os.listdir()) +os.rename("test2.txt", "/test3.txt") +print(os.listdir()) +os.rename("/test3.txt", "test4.txt") +print(os.listdir()) +os.rename("/test4.txt", "/test5.txt") +print(os.listdir()) -uos.mkdir("dir") -print(uos.listdir()) -uos.mkdir("/dir2") -print(uos.listdir()) -uos.mkdir("dir/subdir") -print(uos.listdir("dir")) +os.mkdir("dir") +print(os.listdir()) +os.mkdir("/dir2") +print(os.listdir()) +os.mkdir("dir/subdir") +print(os.listdir("dir")) for exist in ("", "/", "dir", "/dir", "dir/subdir"): try: - uos.mkdir(exist) + os.mkdir(exist) except OSError as er: print("mkdir OSError", er.errno == 17) # EEXIST -uos.chdir("/") -print(uos.stat("test5.txt")[:-3]) +os.chdir("/") +print(os.stat("test5.txt")[:-3]) -uos.VfsFat.mkfs(bdev2) -uos.mount(bdev2, "/sys") -print(uos.listdir()) -print(uos.listdir("sys")) -print(uos.listdir("/sys")) +os.VfsFat.mkfs(bdev2) +os.mount(bdev2, "/sys") +print(os.listdir()) +print(os.listdir("sys")) +print(os.listdir("/sys")) -uos.rmdir("dir2") -uos.remove("test5.txt") -print(uos.listdir()) +os.rmdir("dir2") +os.remove("test5.txt") +print(os.listdir()) -uos.umount("/") -print(uos.getcwd()) -print(uos.listdir()) -print(uos.listdir("sys")) +os.umount("/") +print(os.getcwd()) +print(os.listdir()) +print(os.listdir("sys")) # test importing a file from a mounted FS -import usys +import sys -usys.path.clear() -usys.path.append("/sys") +sys.path.clear() +sys.path.append("/sys") with open("sys/test_module.py", "w") as f: f.write('print("test_module!")') import test_module diff --git a/tests/extmod/vfs_fat_mtime.py b/tests/extmod/vfs_fat_mtime.py index d8fd66b75f..1ceb611364 100644 --- a/tests/extmod/vfs_fat_mtime.py +++ b/tests/extmod/vfs_fat_mtime.py @@ -1,11 +1,11 @@ # Test for VfsFat using a RAM device, mtime feature try: - import utime, uos + import time, os - utime.time - utime.sleep - uos.VfsFat + time.time + time.sleep + os.VfsFat except (ImportError, AttributeError): print("SKIP") raise SystemExit @@ -44,11 +44,11 @@ def test(bdev, vfs_class): vfs = vfs_class(bdev) # Create an empty file, should have a timestamp. - current_time = int(utime.time()) + current_time = int(time.time()) vfs.open("test1", "wt").close() # Wait 2 seconds so mtime will increase (FAT has 2 second resolution). - utime.sleep(2) + time.sleep(2) # Create another empty file, should have a timestamp. vfs.open("test2", "wt").close() @@ -71,4 +71,4 @@ def test(bdev, vfs_class): bdev = RAMBlockDevice(50) -test(bdev, uos.VfsFat) +test(bdev, os.VfsFat) diff --git a/tests/extmod/vfs_fat_oldproto.py b/tests/extmod/vfs_fat_oldproto.py index b1556ba2c0..f5336ba916 100644 --- a/tests/extmod/vfs_fat_oldproto.py +++ b/tests/extmod/vfs_fat_oldproto.py @@ -1,12 +1,12 @@ try: - import uerrno - import uos + import errno + import os except ImportError: print("SKIP") raise SystemExit try: - uos.VfsFat + os.VfsFat except AttributeError: print("SKIP") raise SystemExit @@ -41,9 +41,9 @@ except MemoryError: print("SKIP") raise SystemExit -uos.VfsFat.mkfs(bdev) -vfs = uos.VfsFat(bdev) -uos.mount(vfs, "/ramdisk") +os.VfsFat.mkfs(bdev) +vfs = os.VfsFat(bdev) +os.mount(vfs, "/ramdisk") # file io with vfs.open("file.txt", "w") as f: diff --git a/tests/extmod/vfs_fat_ramdisk.py b/tests/extmod/vfs_fat_ramdisk.py index 01235bc266..1693359d49 100644 --- a/tests/extmod/vfs_fat_ramdisk.py +++ b/tests/extmod/vfs_fat_ramdisk.py @@ -1,12 +1,12 @@ try: - import uerrno - import uos + import errno + import os except ImportError: print("SKIP") raise SystemExit try: - uos.VfsFat + os.VfsFat except AttributeError: print("SKIP") raise SystemExit @@ -38,7 +38,7 @@ class RAMFS: try: bdev = RAMFS(50) - uos.VfsFat.mkfs(bdev) + os.VfsFat.mkfs(bdev) except MemoryError: print("SKIP") raise SystemExit @@ -46,8 +46,8 @@ except MemoryError: print(b"FOO_FILETXT" not in bdev.data) print(b"hello!" not in bdev.data) -vfs = uos.VfsFat(bdev) -uos.mount(vfs, "/ramdisk") +vfs = os.VfsFat(bdev) +os.mount(vfs, "/ramdisk") print("statvfs:", vfs.statvfs("/ramdisk")) print("getcwd:", vfs.getcwd()) @@ -55,7 +55,7 @@ print("getcwd:", vfs.getcwd()) try: vfs.stat("no_file.txt") except OSError as e: - print(e.errno == uerrno.ENOENT) + print(e.errno == errno.ENOENT) with vfs.open("foo_file.txt", "w") as f: f.write("hello!") @@ -78,18 +78,18 @@ with vfs.open("sub_file.txt", "w") as f: try: vfs.chdir("sub_file.txt") except OSError as e: - print(e.errno == uerrno.ENOENT) + print(e.errno == errno.ENOENT) vfs.chdir("..") print("getcwd:", vfs.getcwd()) -uos.umount(vfs) +os.umount(vfs) -vfs = uos.VfsFat(bdev) +vfs = os.VfsFat(bdev) print(list(vfs.ilistdir(b""))) # list a non-existent directory try: vfs.ilistdir(b"no_exist") except OSError as e: - print("ENOENT:", e.errno == uerrno.ENOENT) + print("ENOENT:", e.errno == errno.ENOENT) diff --git a/tests/extmod/vfs_fat_ramdisklarge.py b/tests/extmod/vfs_fat_ramdisklarge.py index 649a53db14..40cba9ee43 100644 --- a/tests/extmod/vfs_fat_ramdisklarge.py +++ b/tests/extmod/vfs_fat_ramdisklarge.py @@ -1,13 +1,13 @@ # test making a FAT filesystem on a very large block device try: - import uos + import os except ImportError: print("SKIP") raise SystemExit try: - uos.VfsFat + os.VfsFat except AttributeError: print("SKIP") raise SystemExit @@ -46,13 +46,13 @@ class RAMBDevSparse: try: bdev = RAMBDevSparse(4 * 1024 * 1024 * 1024 // RAMBDevSparse.SEC_SIZE) - uos.VfsFat.mkfs(bdev) + os.VfsFat.mkfs(bdev) except MemoryError: print("SKIP") raise SystemExit -vfs = uos.VfsFat(bdev) -uos.mount(vfs, "/ramdisk") +vfs = os.VfsFat(bdev) +os.mount(vfs, "/ramdisk") print("statvfs:", vfs.statvfs("/ramdisk")) @@ -66,4 +66,4 @@ f = open("/ramdisk/test.txt") print(f.read()) f.close() -uos.umount(vfs) +os.umount(vfs) diff --git a/tests/extmod/vfs_lfs.py b/tests/extmod/vfs_lfs.py index 8e56400df3..83377653b2 100644 --- a/tests/extmod/vfs_lfs.py +++ b/tests/extmod/vfs_lfs.py @@ -1,10 +1,10 @@ # Test for VfsLittle using a RAM device try: - import uos + import os - uos.VfsLfs1 - uos.VfsLfs2 + os.VfsLfs1 + os.VfsLfs2 except (ImportError, AttributeError): print("SKIP") raise SystemExit @@ -150,5 +150,5 @@ def test(bdev, vfs_class): bdev = RAMBlockDevice(30) -test(bdev, uos.VfsLfs1) -test(bdev, uos.VfsLfs2) +test(bdev, os.VfsLfs1) +test(bdev, os.VfsLfs2) diff --git a/tests/extmod/vfs_lfs_corrupt.py b/tests/extmod/vfs_lfs_corrupt.py index 330458709a..c49dcad92b 100644 --- a/tests/extmod/vfs_lfs_corrupt.py +++ b/tests/extmod/vfs_lfs_corrupt.py @@ -1,10 +1,10 @@ # Test for VfsLittle using a RAM device, testing error handling from corrupt block device try: - import uos + import os - uos.VfsLfs1 - uos.VfsLfs2 + os.VfsLfs1 + os.VfsLfs2 except (ImportError, AttributeError): print("SKIP") raise SystemExit @@ -108,5 +108,5 @@ def test(bdev, vfs_class): bdev = RAMBlockDevice(30) -test(bdev, uos.VfsLfs1) -test(bdev, uos.VfsLfs2) +test(bdev, os.VfsLfs1) +test(bdev, os.VfsLfs2) diff --git a/tests/extmod/vfs_lfs_error.py b/tests/extmod/vfs_lfs_error.py index 717284ea01..32b76b2821 100644 --- a/tests/extmod/vfs_lfs_error.py +++ b/tests/extmod/vfs_lfs_error.py @@ -1,10 +1,10 @@ # Test for VfsLittle using a RAM device, testing error handling try: - import uos + import os - uos.VfsLfs1 - uos.VfsLfs2 + os.VfsLfs1 + os.VfsLfs2 except (ImportError, AttributeError): print("SKIP") raise SystemExit @@ -117,5 +117,5 @@ def test(bdev, vfs_class): bdev = RAMBlockDevice(30) -test(bdev, uos.VfsLfs1) -test(bdev, uos.VfsLfs2) +test(bdev, os.VfsLfs1) +test(bdev, os.VfsLfs2) diff --git a/tests/extmod/vfs_lfs_file.py b/tests/extmod/vfs_lfs_file.py index 774cca2964..b4a3e6b223 100644 --- a/tests/extmod/vfs_lfs_file.py +++ b/tests/extmod/vfs_lfs_file.py @@ -1,10 +1,10 @@ # Test for VfsLittle using a RAM device, file IO try: - import uos + import os - uos.VfsLfs1 - uos.VfsLfs2 + os.VfsLfs1 + os.VfsLfs2 except (ImportError, AttributeError): print("SKIP") raise SystemExit @@ -117,5 +117,5 @@ def test(bdev, vfs_class): bdev = RAMBlockDevice(30) -test(bdev, uos.VfsLfs1) -test(bdev, uos.VfsLfs2) +test(bdev, os.VfsLfs1) +test(bdev, os.VfsLfs2) diff --git a/tests/extmod/vfs_lfs_ilistdir_del.py b/tests/extmod/vfs_lfs_ilistdir_del.py index 073576986d..ff66717147 100644 --- a/tests/extmod/vfs_lfs_ilistdir_del.py +++ b/tests/extmod/vfs_lfs_ilistdir_del.py @@ -2,9 +2,9 @@ import gc try: - import uos + import os - uos.VfsLfs2 + os.VfsLfs2 except (ImportError, AttributeError): print("SKIP") raise SystemExit @@ -72,4 +72,4 @@ def test(bdev, vfs_class): bdev = RAMBlockDevice(30) -test(bdev, uos.VfsLfs2) +test(bdev, os.VfsLfs2) diff --git a/tests/extmod/vfs_lfs_mount.py b/tests/extmod/vfs_lfs_mount.py index bea8a2723a..4ebd9ac623 100644 --- a/tests/extmod/vfs_lfs_mount.py +++ b/tests/extmod/vfs_lfs_mount.py @@ -1,10 +1,10 @@ # Test for VfsLittle using a RAM device, with mount/umount try: - import uos + import os - uos.VfsLfs1 - uos.VfsLfs2 + os.VfsLfs1 + os.VfsLfs2 except (ImportError, AttributeError): print("SKIP") raise SystemExit @@ -42,7 +42,7 @@ def test(vfs_class): # mount bdev unformatted try: - uos.mount(bdev, "/lfs") + os.mount(bdev, "/lfs") except Exception as er: print(repr(er)) @@ -53,7 +53,7 @@ def test(vfs_class): vfs = vfs_class(bdev) # mount - uos.mount(vfs, "/lfs") + os.mount(vfs, "/lfs") # import with open("/lfs/lfsmod.py", "w") as f: @@ -61,23 +61,23 @@ def test(vfs_class): import lfsmod # import package - uos.mkdir("/lfs/lfspkg") + os.mkdir("/lfs/lfspkg") with open("/lfs/lfspkg/__init__.py", "w") as f: f.write('print("package")\n') import lfspkg # chdir and import module from current directory (needs "" in sys.path) - uos.mkdir("/lfs/subdir") - uos.chdir("/lfs/subdir") - uos.rename("/lfs/lfsmod.py", "/lfs/subdir/lfsmod2.py") + os.mkdir("/lfs/subdir") + os.chdir("/lfs/subdir") + os.rename("/lfs/lfsmod.py", "/lfs/subdir/lfsmod2.py") import lfsmod2 # umount - uos.umount("/lfs") + os.umount("/lfs") # mount read-only vfs = vfs_class(bdev) - uos.mount(vfs, "/lfs", readonly=True) + os.mount(vfs, "/lfs", readonly=True) # test reading works with open("/lfs/subdir/lfsmod2.py") as f: @@ -90,25 +90,25 @@ def test(vfs_class): print(repr(er)) # umount - uos.umount("/lfs") + os.umount("/lfs") # mount bdev again - uos.mount(bdev, "/lfs") + os.mount(bdev, "/lfs") # umount - uos.umount("/lfs") + os.umount("/lfs") # clear imported modules - usys.modules.clear() + sys.modules.clear() # initialise path -import usys +import sys -usys.path.clear() -usys.path.append("/lfs") -usys.path.append("") +sys.path.clear() +sys.path.append("/lfs") +sys.path.append("") # run tests -test(uos.VfsLfs1) -test(uos.VfsLfs2) +test(os.VfsLfs1) +test(os.VfsLfs2) diff --git a/tests/extmod/vfs_lfs_mtime.py b/tests/extmod/vfs_lfs_mtime.py index a67e48dd80..ade02fa144 100644 --- a/tests/extmod/vfs_lfs_mtime.py +++ b/tests/extmod/vfs_lfs_mtime.py @@ -1,11 +1,11 @@ # Test for VfsLfs using a RAM device, mtime feature try: - import utime, uos + import time, os - utime.time - utime.sleep - uos.VfsLfs2 + time.time + time.sleep + os.VfsLfs2 except (ImportError, AttributeError): print("SKIP") raise SystemExit @@ -47,11 +47,11 @@ def test(bdev, vfs_class): vfs = vfs_class(bdev, mtime=True) # Create an empty file, should have a timestamp. - current_time = int(utime.time()) + current_time = int(time.time()) vfs.open("test1", "wt").close() # Wait 1 second so mtime will increase by at least 1. - utime.sleep(1) + time.sleep(1) # Create another empty file, should have a timestamp. vfs.open("test2", "wt").close() @@ -68,7 +68,7 @@ def test(bdev, vfs_class): print(stat1[8] < stat2[8]) # Wait 1 second so mtime will increase by at least 1. - utime.sleep(1) + time.sleep(1) # Open test1 for reading and ensure mtime did not change. vfs.open("test1", "rt").close() @@ -107,4 +107,4 @@ except MemoryError: print("SKIP") raise SystemExit -test(bdev, uos.VfsLfs2) +test(bdev, os.VfsLfs2) diff --git a/tests/extmod/vfs_lfs_superblock.py b/tests/extmod/vfs_lfs_superblock.py index 1ac5675554..b8a8ec60b9 100644 --- a/tests/extmod/vfs_lfs_superblock.py +++ b/tests/extmod/vfs_lfs_superblock.py @@ -1,9 +1,9 @@ # Test for VfsLfs using a RAM device, when the first superblock does not exist try: - import uos + import os - uos.VfsLfs2 + os.VfsLfs2 except (ImportError, AttributeError): print("SKIP") raise SystemExit @@ -36,12 +36,12 @@ lfs2_data = b"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x bdev = RAMBlockDevice(64, lfs2_data) # Create the VFS explicitly, no auto-detection is needed for this. -vfs = uos.VfsLfs2(bdev) +vfs = os.VfsLfs2(bdev) print(list(vfs.ilistdir())) # Mount the block device directly; this relies on auto-detection. -uos.mount(bdev, "/userfs") -print(uos.listdir("/userfs")) +os.mount(bdev, "/userfs") +print(os.listdir("/userfs")) # Clean up. -uos.umount("/userfs") +os.umount("/userfs") diff --git a/tests/extmod/vfs_posix.py b/tests/extmod/vfs_posix.py index 3c23140065..05dc0f537e 100644 --- a/tests/extmod/vfs_posix.py +++ b/tests/extmod/vfs_posix.py @@ -2,9 +2,9 @@ try: import gc - import uos + import os - uos.VfsPosix + os.VfsPosix except (ImportError, AttributeError): print("SKIP") raise SystemExit @@ -13,27 +13,29 @@ except (ImportError, AttributeError): # Skip the test if it does exist. temp_dir = "micropy_test_dir" try: - uos.stat(temp_dir) + import os + + os.stat(temp_dir) print("SKIP") raise SystemExit except OSError: pass # getcwd and chdir -curdir = uos.getcwd() -uos.chdir("/") -print(uos.getcwd()) -uos.chdir(curdir) -print(uos.getcwd() == curdir) +curdir = os.getcwd() +os.chdir("/") +print(os.getcwd()) +os.chdir(curdir) +print(os.getcwd() == curdir) # stat -print(type(uos.stat("/"))) +print(type(os.stat("/"))) # listdir and ilistdir -print(type(uos.listdir("/"))) +print(type(os.listdir("/"))) # mkdir -uos.mkdir(temp_dir) +os.mkdir(temp_dir) # file create f = open(temp_dir + "/test", "w") @@ -78,14 +80,14 @@ with open(nextfd, "w") as f: print("next_file_no <= base_file_no", next_file_no <= base_file_no) for n in names + [basefd, nextfd]: - uos.remove(n) + os.remove(n) # rename -uos.rename(temp_dir + "/test", temp_dir + "/test2") -print(uos.listdir(temp_dir)) +os.rename(temp_dir + "/test", temp_dir + "/test2") +print(os.listdir(temp_dir)) # construct new VfsPosix with path argument -vfs = uos.VfsPosix(temp_dir) +vfs = os.VfsPosix(temp_dir) print(list(i[0] for i in vfs.ilistdir("."))) # stat, statvfs (statvfs may not exist) @@ -98,21 +100,25 @@ print(type(list(vfs.ilistdir("."))[0][0])) print(type(list(vfs.ilistdir(b"."))[0][0])) # remove -uos.remove(temp_dir + "/test2") -print(uos.listdir(temp_dir)) +os.remove(temp_dir + "/test2") +print(os.listdir(temp_dir)) # remove with error try: - uos.remove(temp_dir + "/test2") + import os + + os.remove(temp_dir + "/test2") except OSError: print("remove OSError") # rmdir -uos.rmdir(temp_dir) -print(temp_dir in uos.listdir()) +os.rmdir(temp_dir) +print(temp_dir in os.listdir()) # rmdir with error try: - uos.rmdir(temp_dir) + import os + + os.rmdir(temp_dir) except OSError: print("rmdir OSError") diff --git a/tests/extmod/vfs_userfs.py b/tests/extmod/vfs_userfs.py index 570b833534..518373c70a 100644 --- a/tests/extmod/vfs_userfs.py +++ b/tests/extmod/vfs_userfs.py @@ -1,21 +1,21 @@ # test VFS functionality with a user-defined filesystem -# also tests parts of uio.IOBase implementation +# also tests parts of io.IOBase implementation -import usys +import sys try: - import uio + import io - uio.IOBase - import uos + io.IOBase + import os - uos.mount + os.mount except (ImportError, AttributeError): print("SKIP") raise SystemExit -class UserFile(uio.IOBase): +class UserFile(io.IOBase): def __init__(self, mode, data): assert isinstance(data, bytes) self.is_text = mode.find("b") == -1 @@ -69,16 +69,16 @@ user_files = { "/usermod1.py": b"print('in usermod1')\nimport usermod2", "/usermod2.py": b"print('in usermod2')", } -uos.mount(UserFS(user_files), "/userfs") +os.mount(UserFS(user_files), "/userfs") # open and read a file f = open("/userfs/data.txt") print(f.read()) # import files from the user filesystem -usys.path.append("/userfs") +sys.path.append("/userfs") import usermod1 # unmount and undo path addition -uos.umount("/userfs") -usys.path.pop() +os.umount("/userfs") +sys.path.pop() diff --git a/tests/extmod/websocket_basic.py b/tests/extmod/websocket_basic.py index dabdb76be1..133457784f 100644 --- a/tests/extmod/websocket_basic.py +++ b/tests/extmod/websocket_basic.py @@ -1,7 +1,7 @@ try: - import uio - import uerrno - import uwebsocket + import io + import errno + import websocket except ImportError: print("SKIP") raise SystemExit @@ -9,14 +9,14 @@ except ImportError: # put raw data in the stream and do a websocket read def ws_read(msg, sz): - ws = uwebsocket.websocket(uio.BytesIO(msg)) + ws = websocket.websocket(io.BytesIO(msg)) return ws.read(sz) # do a websocket write and then return the raw data from the stream def ws_write(msg, sz): - s = uio.BytesIO() - ws = uwebsocket.websocket(s) + s = io.BytesIO() + ws = websocket.websocket(s) ws.write(msg) s.seek(0) return s.read(sz) @@ -38,8 +38,8 @@ print(ws_write(b"pong" * 32, 132)) print(ws_read(b"\x81\x84maskmask", 4)) # close control frame -s = uio.BytesIO(b"\x88\x00") # FRAME_CLOSE -ws = uwebsocket.websocket(s) +s = io.BytesIO(b"\x88\x00") # FRAME_CLOSE +ws = websocket.websocket(s) print(ws.read(1)) s.seek(2) print(s.read(4)) @@ -49,15 +49,15 @@ print(ws_read(b"\x89\x00\x81\x04ping", 4)) # FRAME_PING print(ws_read(b"\x8a\x00\x81\x04pong", 4)) # FRAME_PONG # close method -ws = uwebsocket.websocket(uio.BytesIO()) +ws = websocket.websocket(io.BytesIO()) ws.close() # ioctl -ws = uwebsocket.websocket(uio.BytesIO()) +ws = websocket.websocket(io.BytesIO()) print(ws.ioctl(8)) # GET_DATA_OPTS print(ws.ioctl(9, 2)) # SET_DATA_OPTS print(ws.ioctl(9)) try: ws.ioctl(-1) except OSError as e: - print("ioctl: EINVAL:", e.errno == uerrno.EINVAL) + print("ioctl: EINVAL:", e.errno == errno.EINVAL) diff --git a/tests/extmod/uzlib_decompio.py b/tests/extmod/zlib_decompio.py similarity index 93% rename from tests/extmod/uzlib_decompio.py rename to tests/extmod/zlib_decompio.py index fae901aad0..9abbad43c6 100644 --- a/tests/extmod/uzlib_decompio.py +++ b/tests/extmod/zlib_decompio.py @@ -1,6 +1,6 @@ try: - import uzlib as zlib - import uio as io + import zlib + import io except ImportError: print("SKIP") raise SystemExit diff --git a/tests/extmod/uzlib_decompio.py.exp b/tests/extmod/zlib_decompio.py.exp similarity index 100% rename from tests/extmod/uzlib_decompio.py.exp rename to tests/extmod/zlib_decompio.py.exp diff --git a/tests/extmod/uzlib_decompio_gz.py b/tests/extmod/zlib_decompio_gz.py similarity index 97% rename from tests/extmod/uzlib_decompio_gz.py rename to tests/extmod/zlib_decompio_gz.py index 1bc8ba885b..1407459304 100644 --- a/tests/extmod/uzlib_decompio_gz.py +++ b/tests/extmod/zlib_decompio_gz.py @@ -1,6 +1,6 @@ try: - import uzlib as zlib - import uio as io + import zlib + import io except ImportError: print("SKIP") raise SystemExit diff --git a/tests/extmod/uzlib_decompio_gz.py.exp b/tests/extmod/zlib_decompio_gz.py.exp similarity index 100% rename from tests/extmod/uzlib_decompio_gz.py.exp rename to tests/extmod/zlib_decompio_gz.py.exp diff --git a/tests/extmod/uzlib_decompress.py b/tests/extmod/zlib_decompress.py similarity index 94% rename from tests/extmod/uzlib_decompress.py rename to tests/extmod/zlib_decompress.py index 8d4a9640b4..b72ee96ea8 100644 --- a/tests/extmod/uzlib_decompress.py +++ b/tests/extmod/zlib_decompress.py @@ -1,11 +1,8 @@ try: import zlib except ImportError: - try: - import uzlib as zlib - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit PATTERNS = [ # Packed results produced by CPy's zlib.compress() diff --git a/tests/feature_check/byteorder.py b/tests/feature_check/byteorder.py index 509bd8b1b5..c82a41a24b 100644 --- a/tests/feature_check/byteorder.py +++ b/tests/feature_check/byteorder.py @@ -1,6 +1,3 @@ -try: - import usys as sys -except ImportError: - import sys +import sys print(sys.byteorder) diff --git a/tests/feature_check/uio_module.py b/tests/feature_check/io_module.py similarity index 56% rename from tests/feature_check/uio_module.py rename to tests/feature_check/io_module.py index bad8d7c95b..9094e60531 100644 --- a/tests/feature_check/uio_module.py +++ b/tests/feature_check/io_module.py @@ -1,6 +1,6 @@ try: - import uio + import io - print("uio") + print("io") except ImportError: print("no") diff --git a/tests/feature_check/uio_module.py.exp b/tests/feature_check/io_module.py.exp similarity index 100% rename from tests/feature_check/uio_module.py.exp rename to tests/feature_check/io_module.py.exp diff --git a/tests/float/array_construct.py b/tests/float/array_construct.py index f6a3a9dc9d..6b5c996312 100644 --- a/tests/float/array_construct.py +++ b/tests/float/array_construct.py @@ -1,13 +1,10 @@ # test construction of array from array with float type try: - from uarray import array + from array import array except ImportError: - try: - from array import array - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit print(array("f", array("h", [1, 2]))) print(array("d", array("f", [1, 2]))) diff --git a/tests/float/bytearray_construct_endian.py b/tests/float/bytearray_construct_endian.py index 47f2b793c0..a971d706e2 100644 --- a/tests/float/bytearray_construct_endian.py +++ b/tests/float/bytearray_construct_endian.py @@ -1,12 +1,9 @@ # test construction of bytearray from array with float type try: - from uarray import array + from array import array except ImportError: - try: - from array import array - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit print(bytearray(array("f", [1, 2.5]))) diff --git a/tests/float/bytes_construct_endian.py b/tests/float/bytes_construct_endian.py index 4e15acc8bc..4dbcf390ea 100644 --- a/tests/float/bytes_construct_endian.py +++ b/tests/float/bytes_construct_endian.py @@ -1,12 +1,9 @@ # test construction of bytes from array with float type try: - from uarray import array + from array import array except ImportError: - try: - from array import array - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit print(bytes(array("f", [1, 2.5]))) diff --git a/tests/float/float2int_doubleprec_intbig.py b/tests/float/float2int_doubleprec_intbig.py index adc76d4aeb..402966cace 100644 --- a/tests/float/float2int_doubleprec_intbig.py +++ b/tests/float/float2int_doubleprec_intbig.py @@ -1,11 +1,7 @@ # check cases converting float to int, requiring double precision float -try: - import ustruct as struct - import usys as sys -except: - import struct - import sys +import struct +import sys maxsize_bits = 0 maxsize = sys.maxsize diff --git a/tests/float/float2int_fp30_intbig.py b/tests/float/float2int_fp30_intbig.py index 4e3c1fa217..1b22fe9646 100644 --- a/tests/float/float2int_fp30_intbig.py +++ b/tests/float/float2int_fp30_intbig.py @@ -1,11 +1,7 @@ # check cases converting float to int, relying only on single precision float -try: - import ustruct as struct - import usys as sys -except: - import struct - import sys +import struct +import sys maxsize_bits = 0 maxsize = sys.maxsize diff --git a/tests/float/float2int_intbig.py b/tests/float/float2int_intbig.py index 739f98f804..d047f247f2 100644 --- a/tests/float/float2int_intbig.py +++ b/tests/float/float2int_intbig.py @@ -1,11 +1,7 @@ # check cases converting float to int, relying only on single precision float -try: - import ustruct as struct - import usys as sys -except: - import struct - import sys +import struct +import sys maxsize_bits = 0 maxsize = sys.maxsize diff --git a/tests/float/float_array.py b/tests/float/float_array.py index 219b6b86ae..3d128da838 100644 --- a/tests/float/float_array.py +++ b/tests/float/float_array.py @@ -1,11 +1,8 @@ try: - from uarray import array + from array import array except ImportError: - try: - from array import array - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit def test(a): diff --git a/tests/float/float_struct.py b/tests/float/float_struct.py index 18893af0e0..47fe405018 100644 --- a/tests/float/float_struct.py +++ b/tests/float/float_struct.py @@ -1,9 +1,6 @@ # test struct package with floats try: - try: - import ustruct as struct - except: - import struct + import struct except ImportError: print("SKIP") raise SystemExit diff --git a/tests/import/builtin_ext.py b/tests/import/builtin_ext.py index dd8f95cbc1..87465f1d59 100644 --- a/tests/import/builtin_ext.py +++ b/tests/import/builtin_ext.py @@ -1,3 +1,4 @@ +# Verify that sys is a builtin. import sys print(sys, hasattr(sys, "__file__")) @@ -7,6 +8,8 @@ sys.path.append("ext") # All three should only get builtins, despite sys.py, usys.py, and # micropython.py being in the path. +# usys isn't extensible, but has a special-cased alias for backwards +# compatibility. import micropython print(micropython, hasattr(micropython, "__file__")) @@ -31,6 +34,7 @@ print(time, hasattr(time, "__file__"), time.sleep, time.extra) import uos print(uos, hasattr(uos, "__file__"), hasattr(uos, "extra")) + import utime print(utime, hasattr(utime, "__file__"), hasattr(utime, "extra")) diff --git a/tests/import/builtin_ext.py.exp b/tests/import/builtin_ext.py.exp index 08496e14b7..e09af2843a 100644 --- a/tests/import/builtin_ext.py.exp +++ b/tests/import/builtin_ext.py.exp @@ -6,5 +6,5 @@ os from filesystem True / 1 time from filesystem True 1 - False False - False False + False False + False False diff --git a/tests/import/ext/time.py b/tests/import/ext/time.py index 6f2d4a42c0..6b460b4235 100644 --- a/tests/import/ext/time.py +++ b/tests/import/ext/time.py @@ -4,11 +4,11 @@ print("time from filesystem") # import. import sys -_path = sys.path[:] -sys.path.clear() +_path = sys.path +sys.path = () from time import * -sys.path.extend(_path) +sys.path = _path del _path extra = 1 diff --git a/tests/inlineasm/asmfpldrstr.py b/tests/inlineasm/asmfpldrstr.py index 96cd0c23eb..c65f8a798b 100644 --- a/tests/inlineasm/asmfpldrstr.py +++ b/tests/inlineasm/asmfpldrstr.py @@ -1,4 +1,4 @@ -import uarray as array +import array @micropython.asm_thumb # test vldr, vstr diff --git a/tests/inlineasm/asmsum.py b/tests/inlineasm/asmsum.py index 208709a25f..51613ef6ac 100644 --- a/tests/inlineasm/asmsum.py +++ b/tests/inlineasm/asmsum.py @@ -46,7 +46,7 @@ def asm_sum_bytes(r0, r1): mov(r0, r2) -import uarray as array +import array b = array.array("l", (100, 200, 300, 400)) n = asm_sum_words(len(b), b) diff --git a/tests/internal_bench/var-8-namedtuple-1st.py b/tests/internal_bench/var-8-namedtuple-1st.py index 1a6daa6cdd..e3a2fa19cd 100644 --- a/tests/internal_bench/var-8-namedtuple-1st.py +++ b/tests/internal_bench/var-8-namedtuple-1st.py @@ -1,5 +1,5 @@ import bench -from ucollections import namedtuple +from collections import namedtuple T = namedtuple("Tup", ["num", "bar"]) diff --git a/tests/internal_bench/var-8.1-namedtuple-5th.py b/tests/internal_bench/var-8.1-namedtuple-5th.py index 568ece8067..3e52121746 100644 --- a/tests/internal_bench/var-8.1-namedtuple-5th.py +++ b/tests/internal_bench/var-8.1-namedtuple-5th.py @@ -1,5 +1,5 @@ import bench -from ucollections import namedtuple +from collections import namedtuple T = namedtuple("Tup", ["foo1", "foo2", "foo3", "foo4", "num"]) diff --git a/tests/io/argv.py b/tests/io/argv.py index 834292504d..53254da119 100644 --- a/tests/io/argv.py +++ b/tests/io/argv.py @@ -1,6 +1,3 @@ -try: - import usys as sys -except ImportError: - import sys +import sys print(sys.argv) diff --git a/tests/io/builtin_print_file.py b/tests/io/builtin_print_file.py index e5c20b64e4..822356a6cc 100644 --- a/tests/io/builtin_print_file.py +++ b/tests/io/builtin_print_file.py @@ -1,9 +1,6 @@ # test builtin print function, using file= argument -try: - import usys as sys -except ImportError: - import sys +import sys try: sys.stdout diff --git a/tests/io/file_stdio.py b/tests/io/file_stdio.py index 6c08f35d78..cbdb070163 100644 --- a/tests/io/file_stdio.py +++ b/tests/io/file_stdio.py @@ -1,7 +1,4 @@ -try: - import usys as sys -except ImportError: - import sys +import sys print(sys.stdin.fileno()) print(sys.stdout.fileno()) diff --git a/tests/io/open_append.py b/tests/io/open_append.py index 49cdd094b3..80a9422d81 100644 --- a/tests/io/open_append.py +++ b/tests/io/open_append.py @@ -1,7 +1,4 @@ -try: - import uos as os -except ImportError: - import os +import os if not hasattr(os, "remove"): print("SKIP") diff --git a/tests/io/open_plus.py b/tests/io/open_plus.py index 3cb2330eed..5199861a4e 100644 --- a/tests/io/open_plus.py +++ b/tests/io/open_plus.py @@ -1,7 +1,4 @@ -try: - import uos as os -except ImportError: - import os +import os if not hasattr(os, "remove"): print("SKIP") diff --git a/tests/micropython/builtin_execfile.py b/tests/micropython/builtin_execfile.py index 8a8ce79f78..5a26ccf0ad 100644 --- a/tests/micropython/builtin_execfile.py +++ b/tests/micropython/builtin_execfile.py @@ -1,17 +1,17 @@ # Test builtin execfile function using VFS. try: - import uio, uos + import io, os execfile - uio.IOBase - uos.mount + io.IOBase + os.mount except (ImportError, NameError, AttributeError): print("SKIP") raise SystemExit -class File(uio.IOBase): +class File(io.IOBase): def __init__(self, data): self.data = data self.off = 0 @@ -44,21 +44,25 @@ class Filesystem: # First umount any existing mount points the target may have. try: - uos.umount("/") + import io, os + + os.umount("/") except OSError: pass -for path in uos.listdir("/"): - uos.umount("/" + path) +for path in os.listdir("/"): + os.umount("/" + path) # Create and mount the VFS object. files = { "/test.py": "print(123)", } fs = Filesystem(files) -uos.mount(fs, "/test_mnt") +os.mount(fs, "/test_mnt") # Test execfile with a file that doesn't exist. try: + import io, os + execfile("/test_mnt/noexist.py") except OSError: print("OSError") @@ -67,4 +71,4 @@ except OSError: execfile("/test_mnt/test.py") # Unmount the VFS object. -uos.umount(fs) +os.umount(fs) diff --git a/tests/micropython/emg_exc.py b/tests/micropython/emg_exc.py index b8df94b071..9a09956c86 100644 --- a/tests/micropython/emg_exc.py +++ b/tests/micropython/emg_exc.py @@ -1,10 +1,10 @@ # test that emergency exceptions work import micropython -import usys +import sys try: - import uio + import io except ImportError: print("SKIP") raise SystemExit @@ -25,8 +25,8 @@ def f(): micropython.heap_unlock() # print the exception - buf = uio.StringIO() - usys.print_exception(exc, buf) + buf = io.StringIO() + sys.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_bytesio.py b/tests/micropython/heapalloc_bytesio.py index 4aae2abf06..0ac8c92555 100644 --- a/tests/micropython/heapalloc_bytesio.py +++ b/tests/micropython/heapalloc_bytesio.py @@ -1,5 +1,5 @@ try: - import uio + import io except ImportError: print("SKIP") raise SystemExit @@ -7,7 +7,7 @@ except ImportError: import micropython data = b"1234" * 16 -buf = uio.BytesIO(64) +buf = io.BytesIO(64) micropython.heap_lock() diff --git a/tests/micropython/heapalloc_bytesio2.py b/tests/micropython/heapalloc_bytesio2.py index 3b9f141270..05c384a516 100644 --- a/tests/micropython/heapalloc_bytesio2.py +++ b/tests/micropython/heapalloc_bytesio2.py @@ -1,7 +1,7 @@ # Creating BytesIO from immutable object should not immediately # copy its content. try: - import uio + import io import micropython micropython.mem_total @@ -14,7 +14,7 @@ data = b"1234" * 256 before = micropython.mem_total() -buf = uio.BytesIO(data) +buf = io.BytesIO(data) after = micropython.mem_total() diff --git a/tests/micropython/heapalloc_iter.py b/tests/micropython/heapalloc_iter.py index 18f5322ee1..bd1ba4db79 100644 --- a/tests/micropython/heapalloc_iter.py +++ b/tests/micropython/heapalloc_iter.py @@ -5,13 +5,10 @@ except NameError: print("SKIP") raise SystemExit try: - import uarray as array + import array except ImportError: - try: - import array - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit try: from micropython import heap_lock, heap_unlock diff --git a/tests/micropython/heapalloc_traceback.py b/tests/micropython/heapalloc_traceback.py index 09a2ad2c14..4c5f99afee 100644 --- a/tests/micropython/heapalloc_traceback.py +++ b/tests/micropython/heapalloc_traceback.py @@ -1,10 +1,10 @@ # test that we can generate a traceback without allocating import micropython -import usys +import sys try: - import uio + import io except ImportError: print("SKIP") raise SystemExit @@ -32,8 +32,8 @@ def test(): test() # print the exception that was raised -buf = uio.StringIO() -usys.print_exception(global_exc, buf) +buf = io.StringIO() +sys.print_exception(global_exc, buf) for l in buf.getvalue().split("\n"): # uPy on pyboard prints 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 b02312a7a8..36db102e9d 100644 --- a/tests/micropython/import_mpy_invalid.py +++ b/tests/micropython/import_mpy_invalid.py @@ -1,16 +1,16 @@ # test importing of invalid .mpy files try: - import usys, uio, uos + import sys, io, os - uio.IOBase - uos.mount + io.IOBase + os.mount except (ImportError, AttributeError): print("SKIP") raise SystemExit -class UserFile(uio.IOBase): +class UserFile(io.IOBase): def __init__(self, data): self.data = memoryview(data) self.pos = 0 @@ -52,8 +52,8 @@ user_files = { } # create and mount a user filesystem -uos.mount(UserFS(user_files), "/userfs") -usys.path.append("/userfs") +os.mount(UserFS(user_files), "/userfs") +sys.path.append("/userfs") # import .mpy files from the user filesystem for i in range(len(user_files)): @@ -64,5 +64,5 @@ for i in range(len(user_files)): print(mod, "ValueError", er) # unmount and undo path addition -uos.umount("/userfs") -usys.path.pop() +os.umount("/userfs") +sys.path.pop() diff --git a/tests/micropython/import_mpy_native.py b/tests/micropython/import_mpy_native.py index 73e20694cc..da20746b22 100644 --- a/tests/micropython/import_mpy_native.py +++ b/tests/micropython/import_mpy_native.py @@ -1,23 +1,23 @@ # test importing of .mpy files with native code try: - import usys, uio, uos + import sys, io, os - usys.implementation._mpy - uio.IOBase - uos.mount + sys.implementation._mpy + io.IOBase + os.mount except (ImportError, AttributeError): print("SKIP") raise SystemExit -mpy_arch = usys.implementation._mpy >> 8 +mpy_arch = sys.implementation._mpy >> 8 if mpy_arch >> 2 == 0: # This system does not support .mpy files containing native code print("SKIP") raise SystemExit -class UserFile(uio.IOBase): +class UserFile(io.IOBase): def __init__(self, data): self.data = memoryview(data) self.pos = 0 @@ -110,8 +110,8 @@ user_files = { # fmt: on # create and mount a user filesystem -uos.mount(UserFS(user_files), "/userfs") -usys.path.append("/userfs") +os.mount(UserFS(user_files), "/userfs") +sys.path.append("/userfs") # import .mpy files from the user filesystem for i in range(len(user_files)): @@ -123,5 +123,5 @@ for i in range(len(user_files)): print(mod, "ValueError", er) # unmount and undo path addition -uos.umount("/userfs") -usys.path.pop() +os.umount("/userfs") +sys.path.pop() diff --git a/tests/micropython/import_mpy_native_gc.py b/tests/micropython/import_mpy_native_gc.py index e18720fb31..5a3855dc7d 100644 --- a/tests/micropython/import_mpy_native_gc.py +++ b/tests/micropython/import_mpy_native_gc.py @@ -1,17 +1,17 @@ # Test that native code loaded from a .mpy file is retained after a GC. try: - import gc, sys, uio, uos + import gc, sys, io, os sys.implementation._mpy - uio.IOBase - uos.mount + io.IOBase + os.mount except (ImportError, AttributeError): print("SKIP") raise SystemExit -class UserFile(uio.IOBase): +class UserFile(io.IOBase): def __init__(self, data): self.data = memoryview(data) self.pos = 0 @@ -68,7 +68,7 @@ if sys_implementation_mpy not in features0_file_contents: user_files = {"/features0.mpy": features0_file_contents[sys_implementation_mpy]} # Create and mount a user filesystem. -uos.mount(UserFS(user_files), "/userfs") +os.mount(UserFS(user_files), "/userfs") sys.path.append("/userfs") # Import the native function. @@ -89,5 +89,5 @@ for i in range(1000): print(factorial(10)) # Unmount and undo path addition. -uos.umount("/userfs") +os.umount("/userfs") sys.path.pop() diff --git a/tests/micropython/opt_level_lineno.py b/tests/micropython/opt_level_lineno.py index 1cbf2fb1a8..d8253e54b4 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 usys\n usys.print_exception(er)") +exec("try:\n xyz\nexcept NameError as er:\n import sys\n sys.print_exception(er)") diff --git a/tests/micropython/viper_misc_intbig.py b/tests/micropython/viper_misc_intbig.py index ac09f57857..91673f2c10 100644 --- a/tests/micropython/viper_misc_intbig.py +++ b/tests/micropython/viper_misc_intbig.py @@ -7,6 +7,6 @@ def viper_uint() -> uint: return uint(-1) -import usys +import sys -print(viper_uint() == (usys.maxsize << 1 | 1)) +print(viper_uint() == (sys.maxsize << 1 | 1)) diff --git a/tests/misc/non_compliant.py b/tests/misc/non_compliant.py index cc63185b5d..da90f90ac3 100644 --- a/tests/misc/non_compliant.py +++ b/tests/misc/non_compliant.py @@ -1,8 +1,8 @@ # tests for things that are not implemented, or have non-compliant behaviour try: - import uarray as array - import ustruct + import array + import struct except ImportError: print("SKIP") raise SystemExit @@ -106,10 +106,10 @@ except NotImplementedError: print("NotImplementedError") # struct pack with too many args, not checked by uPy -print(ustruct.pack("bb", 1, 2, 3)) +print(struct.pack("bb", 1, 2, 3)) # struct pack with too few args, not checked by uPy -print(ustruct.pack("bb", 1)) +print(struct.pack("bb", 1)) # array slice assignment with unsupported RHS try: diff --git a/tests/misc/print_exception.py b/tests/misc/print_exception.py index 06f4023349..1d196d6ab1 100644 --- a/tests/misc/print_exception.py +++ b/tests/misc/print_exception.py @@ -1,10 +1,6 @@ try: - try: - import uio as io - import usys as sys - except ImportError: - import io - import sys + import io + import sys except ImportError: print("SKIP") raise SystemExit diff --git a/tests/misc/sys_atexit.py b/tests/misc/sys_atexit.py index 141b24cc9f..e9c5693f97 100644 --- a/tests/misc/sys_atexit.py +++ b/tests/misc/sys_atexit.py @@ -1,9 +1,9 @@ # test sys.atexit() function -import usys +import sys try: - usys.atexit + sys.atexit except AttributeError: print("SKIP") raise SystemExit @@ -15,7 +15,7 @@ def do_at_exit(): print("done at exit:", some_var) -usys.atexit(do_at_exit) +sys.atexit(do_at_exit) some_var = "ok" print("done before exit") diff --git a/tests/misc/sys_exc_info.py b/tests/misc/sys_exc_info.py index 3a8c4a6c8d..d7e8a2d943 100644 --- a/tests/misc/sys_exc_info.py +++ b/tests/misc/sys_exc_info.py @@ -1,7 +1,4 @@ -try: - import usys as sys -except ImportError: - import sys +import sys try: sys.exc_info diff --git a/tests/multi_net/ssl_cert_rsa.py b/tests/multi_net/ssl_cert_rsa.py index 7c718ee40a..872855edba 100644 --- a/tests/multi_net/ssl_cert_rsa.py +++ b/tests/multi_net/ssl_cert_rsa.py @@ -2,7 +2,7 @@ # This test won't run under CPython because CPython doesn't have key/cert try: - import ubinascii as binascii, usocket as socket, ussl as ssl + import binascii, socket, ssl except ImportError: print("SKIP") raise SystemExit diff --git a/tests/multi_net/ssl_data.py b/tests/multi_net/ssl_data.py index aef85b83ab..a21c8c6589 100644 --- a/tests/multi_net/ssl_data.py +++ b/tests/multi_net/ssl_data.py @@ -2,7 +2,7 @@ # This test won't run under CPython because it requires key/cert try: - import ubinascii as binascii, usocket as socket, ussl as ssl + import binascii, socket, ssl except ImportError: print("SKIP") raise SystemExit diff --git a/tests/multi_net/uasyncio_tcp_readinto.py b/tests/multi_net/uasyncio_tcp_readinto.py index 631997652a..647c06b8aa 100644 --- a/tests/multi_net/uasyncio_tcp_readinto.py +++ b/tests/multi_net/uasyncio_tcp_readinto.py @@ -10,13 +10,10 @@ except ImportError: raise SystemExit try: - import uarray as array + import array except ImportError: - try: - import array - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit PORT = 8000 diff --git a/tests/net_hosted/accept_nonblock.py b/tests/net_hosted/accept_nonblock.py index d17e287498..30d2033e65 100644 --- a/tests/net_hosted/accept_nonblock.py +++ b/tests/net_hosted/accept_nonblock.py @@ -1,9 +1,6 @@ # test that socket.accept() on a non-blocking socket raises EAGAIN -try: - import usocket as socket -except: - import socket +import socket s = socket.socket() s.bind(socket.getaddrinfo("127.0.0.1", 8123)[0][-1]) diff --git a/tests/net_hosted/accept_timeout.py b/tests/net_hosted/accept_timeout.py index 734fe217ca..865d2aad26 100644 --- a/tests/net_hosted/accept_timeout.py +++ b/tests/net_hosted/accept_timeout.py @@ -1,9 +1,6 @@ # test that socket.accept() on a socket with timeout raises ETIMEDOUT -try: - import uerrno as errno, usocket as socket -except: - import errno, socket +import errno, socket try: socket.socket.settimeout diff --git a/tests/net_hosted/connect_nonblock.py b/tests/net_hosted/connect_nonblock.py index 4b8055c161..781f1a4ee2 100644 --- a/tests/net_hosted/connect_nonblock.py +++ b/tests/net_hosted/connect_nonblock.py @@ -1,10 +1,6 @@ # test that socket.connect() on a non-blocking socket raises EINPROGRESS -try: - import usocket as socket - import uerrno as errno -except: - import socket, errno +import socket, errno def test(peer_addr): diff --git a/tests/net_hosted/connect_nonblock_xfer.py b/tests/net_hosted/connect_nonblock_xfer.py index 1a0b242276..e669a5766c 100644 --- a/tests/net_hosted/connect_nonblock_xfer.py +++ b/tests/net_hosted/connect_nonblock_xfer.py @@ -1,11 +1,8 @@ # test that socket.connect() on a non-blocking socket raises EINPROGRESS # and that an immediate write/send/read/recv does the right thing -try: - import sys, time - import uerrno as errno, usocket as socket, ussl as ssl -except: - import socket, errno, ssl +import sys, time, socket, errno, ssl + isMP = sys.implementation.name == "micropython" diff --git a/tests/net_hosted/connect_poll.py b/tests/net_hosted/connect_poll.py index b2739e36e9..a3232bd334 100644 --- a/tests/net_hosted/connect_poll.py +++ b/tests/net_hosted/connect_poll.py @@ -1,9 +1,6 @@ # test that socket.connect() has correct polling behaviour before, during and after -try: - import usocket as socket, uselect as select -except: - import socket, select +import socket, select def test(peer_addr): diff --git a/tests/net_hosted/ssl_getpeercert.py b/tests/net_hosted/ssl_getpeercert.py index dee5fcfd89..0df895a654 100644 --- a/tests/net_hosted/ssl_getpeercert.py +++ b/tests/net_hosted/ssl_getpeercert.py @@ -1,11 +1,7 @@ # test ssl.getpeercert() method -try: - import usocket as socket - import ussl as ssl -except: - import socket - import ssl +import socket +import ssl def test(peer_addr): diff --git a/tests/net_inet/getaddrinfo.py b/tests/net_inet/getaddrinfo.py index 765723ae73..e26060ad21 100644 --- a/tests/net_inet/getaddrinfo.py +++ b/tests/net_inet/getaddrinfo.py @@ -1,7 +1,4 @@ -try: - import usocket as socket, sys -except: - import socket, sys +import socket, sys def test_non_existent(): diff --git a/tests/net_inet/ssl_cert.py b/tests/net_inet/ssl_cert.py index d2d437e381..d6e0aec889 100644 --- a/tests/net_inet/ssl_cert.py +++ b/tests/net_inet/ssl_cert.py @@ -1,6 +1,6 @@ -import ubinascii as binascii -import usocket as socket -import ussl as ssl +import binascii +import socket +import ssl # This certificate was obtained from micropython.org using openssl: diff --git a/tests/net_inet/ssl_errors.py b/tests/net_inet/ssl_errors.py index ece1f6e253..65f3637e9e 100644 --- a/tests/net_inet/ssl_errors.py +++ b/tests/net_inet/ssl_errors.py @@ -1,12 +1,7 @@ # test that socket.connect() on a non-blocking socket raises EINPROGRESS # and that an immediate write/send/read/recv does the right thing -import sys - -try: - import uerrno as errno, usocket as socket, ussl as ssl -except: - import errno, socket, ssl +import sys, errno, socket, ssl def test(addr, hostname, block=True): diff --git a/tests/net_inet/test_tls_nonblock.py b/tests/net_inet/test_tls_nonblock.py index b4f2ef4ed2..6378280a71 100644 --- a/tests/net_inet/test_tls_nonblock.py +++ b/tests/net_inet/test_tls_nonblock.py @@ -1,7 +1,4 @@ -try: - import usocket as socket, ussl as ssl, uerrno as errno, sys -except: - import socket, ssl, errno, sys, time, select +import socket, ssl, errno, sys, time, select def test_one(site, opts): diff --git a/tests/net_inet/test_tls_sites.py b/tests/net_inet/test_tls_sites.py index fabe4b43c9..f9a3dc86d2 100644 --- a/tests/net_inet/test_tls_sites.py +++ b/tests/net_inet/test_tls_sites.py @@ -1,21 +1,16 @@ -try: - import usocket as _socket -except: - import _socket -try: - import ussl as ssl -except: - import ssl +import socket +import ssl - # CPython only supports server_hostname with SSLContext +# CPython only supports server_hostname with SSLContext +if hasattr(ssl, "SSLContext"): ssl = ssl.SSLContext() def test_one(site, opts): - ai = _socket.getaddrinfo(site, 443) + ai = socket.getaddrinfo(site, 443) addr = ai[0][-1] - s = _socket.socket() + s = socket.socket() try: s.connect(addr) diff --git a/tests/net_inet/tls_num_errors.py b/tests/net_inet/tls_num_errors.py index dd7f714e6e..34aa2bb455 100644 --- a/tests/net_inet/tls_num_errors.py +++ b/tests/net_inet/tls_num_errors.py @@ -1,9 +1,7 @@ # test that modtls produces a numerical error message when out of heap -try: - import usocket as socket, ussl as ssl, sys -except: - import socket, ssl, sys +import socket, ssl, sys + try: from micropython import alloc_emergency_exception_buf, heap_lock, heap_unlock except: diff --git a/tests/net_inet/tls_text_errors.py b/tests/net_inet/tls_text_errors.py index 9e8ccfaf9e..498593bba2 100644 --- a/tests/net_inet/tls_text_errors.py +++ b/tests/net_inet/tls_text_errors.py @@ -1,9 +1,6 @@ # test that modtls produces a text error message -try: - import usocket as socket, ussl as ssl, sys -except: - import socket, ssl, sys +import socket, ssl, sys def test(addr): diff --git a/tests/perf_bench/benchrun.py b/tests/perf_bench/benchrun.py index ed43297d15..4029c8ac8a 100644 --- a/tests/perf_bench/benchrun.py +++ b/tests/perf_bench/benchrun.py @@ -1,10 +1,10 @@ def bm_run(N, M): try: - from utime import ticks_us, ticks_diff + from time import ticks_us, ticks_diff except ImportError: - import time + from time import perf_counter - ticks_us = lambda: int(time.perf_counter() * 1000000) + ticks_us = lambda: int(perf_counter() * 1000000) ticks_diff = lambda a, b: a - b # Pick sensible parameters given N, M diff --git a/tests/perf_bench/bm_hexiom.py b/tests/perf_bench/bm_hexiom.py index 84eda9a909..e36fc234cd 100644 --- a/tests/perf_bench/bm_hexiom.py +++ b/tests/perf_bench/bm_hexiom.py @@ -632,10 +632,7 @@ bm_params = { def bm_setup(params): - try: - import uio as io - except ImportError: - import io + import io loops, level, order, strategy = params diff --git a/tests/perf_bench/core_import_mpy_multi.py b/tests/perf_bench/core_import_mpy_multi.py index 99c4721d29..ce68306678 100644 --- a/tests/perf_bench/core_import_mpy_multi.py +++ b/tests/perf_bench/core_import_mpy_multi.py @@ -1,8 +1,8 @@ # Test performance of importing an .mpy file many times. -import usys, uio, uos +import sys, io, os -if not (hasattr(uio, "IOBase") and hasattr(uos, "mount")): +if not (hasattr(io, "IOBase") and hasattr(os, "mount")): print("SKIP") raise SystemExit @@ -26,7 +26,7 @@ result = 123 file_data = b'M\x06\x00\x1f\x14\x03\x0etest.py\x00\x0f\x02A\x00\x02f\x00\x0cresult\x00/-5#\x82I\x81{\x81w\x82/\x81\x05\x81\x17Iom\x82\x13\x06arg\x00\x05\x1cthis will be a string object\x00\x06\x1bthis will be a bytes object\x00\n\x07\x05\x0bconst tuple\x00\x01\x02\x03\x07\x011\x07\x012\x07\x013\x81\\\x10\n\x01\x89\x07d`T2\x00\x10\x024\x02\x16\x022\x01\x16\x03"\x80{\x16\x04Qc\x02\x81d\x00\x08\x02(DD\x11\x05\x16\x06\x10\x02\x16\x072\x00\x16\x082\x01\x16\t2\x02\x16\nQc\x03`\x1a\x08\x08\x12\x13@\xb1\xb0\x18\x13Qc@\t\x08\t\x12` Qc@\t\x08\n\x12``Qc\x82@ \x0e\x03\x80\x08+)##\x12\x0b\x12\x0c\x12\r\x12\x0e*\x04Y\x12\x0f\x12\x10\x12\x11*\x03Y#\x00\xc0#\x01\xc0#\x02\xc0Qc' -class File(uio.IOBase): +class File(io.IOBase): def __init__(self): self.off = 0 @@ -57,14 +57,14 @@ class FS: def mount(): - uos.mount(FS(), "/__remote") - uos.chdir("/__remote") + os.mount(FS(), "/__remote") + os.chdir("/__remote") def test(r): global result for _ in r: - usys.modules.clear() + sys.modules.clear() module = __import__("__injected") result = module.result diff --git a/tests/perf_bench/core_import_mpy_single.py b/tests/perf_bench/core_import_mpy_single.py index af3f4a29b2..1b411fc3fb 100644 --- a/tests/perf_bench/core_import_mpy_single.py +++ b/tests/perf_bench/core_import_mpy_single.py @@ -2,9 +2,9 @@ # The first import of a module will intern strings that don't already exist, and # this test should be representative of what happens in a real application. -import uio, uos +import io, os -if not (hasattr(uio, "IOBase") and hasattr(uos, "mount")): +if not (hasattr(io, "IOBase") and hasattr(os, "mount")): print("SKIP") raise SystemExit @@ -81,7 +81,7 @@ result = 123 file_data = b"M\x06\x00\x1f\x81=\x1e\x0etest.py\x00\x0f\x04A0\x00\x04A1\x00\x04f0\x00\x04f1\x00\x0cresult\x00/-5\x04a0\x00\x04a1\x00\x04a2\x00\x04a3\x00\x13\x15\x17\x19\x1b\x1d\x1f!#%')+1379;=?ACEGIKMOQSUWY[]_acegikmoqsuwy{}\x7f\x81\x01\x81\x03\x81\x05\x81\x07\x81\t\x81\x0b\x81\r\x81\x0f\x81\x11\x81\x13\x81\x15\x81\x17\x81\x19\x81\x1b\x81\x1d\x81\x1f\x81!\x81#\x81%\x81'\x81)\x81+\x81-\x81/\x811\x813\x815\x817\x819\x81;\x81=\x81?\x81A\x81C\x81E\x81G\x81I\x81K\x81M\x81O\x81Q\x81S\x81U\x81W\x81Y\x81[\x81]\x81_\x81a\x81c\x81e\x81g\x81i\x81k\x81m\x81o\x81q\x81s\x81u\x81w\x81y\x81{\x81}\x81\x7f\x82\x01\x82\x03\x82\x05\x82\x07\x82\t\x82\x0b\x82\r\x82\x0f\x82\x11\x82\x13\x82\x15\x82\x17\x82\x19\x82\x1b\x82\x1d\x82\x1f\x82!\x82#\x82%\x82'\x82)\x82+\x82-\x82/\x821\x823\x825\x827\x829\x82;\x82=\x82?\x82A\x82E\x82G\x82I\x82K\nname0\x00\nname1\x00\nname2\x00\nname3\x00\nname4\x00\nname5\x00\nname6\x00\nname7\x00\nname8\x00\nname9\x00$quite_a_long_name0\x00$quite_a_long_name1\x00$quite_a_long_name2\x00$quite_a_long_name3\x00$quite_a_long_name4\x00$quite_a_long_name5\x00$quite_a_long_name6\x00$quite_a_long_name7\x00$quite_a_long_name8\x00$quite_a_long_name9\x00&quite_a_long_name10\x00&quite_a_long_name11\x00\x05\x1ethis will be a string object 0\x00\x05\x1ethis will be a string object 1\x00\x05\x1ethis will be a string object 2\x00\x05\x1ethis will be a string object 3\x00\x05\x1ethis will be a string object 4\x00\x05\x1ethis will be a string object 5\x00\x05\x1ethis will be a string object 6\x00\x05\x1ethis will be a string object 7\x00\x05\x1ethis will be a string object 8\x00\x05\x1ethis will be a string object 9\x00\x06\x1dthis will be a bytes object 0\x00\x06\x1dthis will be a bytes object 1\x00\x06\x1dthis will be a bytes object 2\x00\x06\x1dthis will be a bytes object 3\x00\x06\x1dthis will be a bytes object 4\x00\x06\x1dthis will be a bytes object 5\x00\x06\x1dthis will be a bytes object 6\x00\x06\x1dthis will be a bytes object 7\x00\x06\x1dthis will be a bytes object 8\x00\x06\x1dthis will be a bytes object 9\x00\n\x07\x05\rconst tuple 0\x00\x01\x02\x03\x07\x011\x07\x012\x07\x013\n\x07\x05\rconst tuple 1\x00\x01\x02\x03\x07\x011\x07\x012\x07\x013\n\x07\x05\rconst tuple 2\x00\x01\x02\x03\x07\x011\x07\x012\x07\x013\n\x07\x05\rconst tuple 3\x00\x01\x02\x03\x07\x011\x07\x012\x07\x013\n\x07\x05\rconst tuple 4\x00\x01\x02\x03\x07\x011\x07\x012\x07\x013\n\x07\x05\rconst tuple 5\x00\x01\x02\x03\x07\x011\x07\x012\x07\x013\n\x07\x05\rconst tuple 6\x00\x01\x02\x03\x07\x011\x07\x012\x07\x013\n\x07\x05\rconst tuple 7\x00\x01\x02\x03\x07\x011\x07\x012\x07\x013\n\x07\x05\rconst tuple 8\x00\x01\x02\x03\x07\x011\x07\x012\x07\x013\n\x07\x05\rconst tuple 9\x00\x01\x02\x03\x07\x011\x07\x012\x07\x013\x82d\x10\x12\x01i@i@\x84\x18\x84\x1fT2\x00\x10\x024\x02\x16\x02T2\x01\x10\x034\x02\x16\x032\x02\x16\x042\x03\x16\x05\"\x80{\x16\x06Qc\x04\x82\x0c\x00\n\x02($$$\x11\x07\x16\x08\x10\x02\x16\t2\x00\x16\n2\x01\x16\x0b2\x02\x16\x0c2\x03\x16\rQc\x04@\t\x08\n\x81\x0b Qc@\t\x08\x0b\x81\x0b@Qc@\t\x08\x0c\x81\x0b`QcH\t\n\r\x81\x0b` Qc\x82\x14\x00\x0c\x03h`$$$\x11\x07\x16\x08\x10\x03\x16\t2\x00\x16\n2\x01\x16\x0b2\x02\x16\x0c2\x03\x16\rQc\x04H\t\n\n\x81\x0b``QcH\t\n\x0b\x81\x0b\x80\x07QcH\t\n\x0c\x81\x0b\x80\x08QcH\t\n\r\x81\x0b\x80\tQc\xa08P:\x04\x80\x0b13///---997799<\x1f%\x1f\"\x1f%)\x1f\"//\x12\x0e\x12\x0f\x12\x10\x12\x11\x12\x12\x12\x13\x12\x14*\x07Y\x12\x15\x12\x16\x12\x17\x12\x18\x12\x19\x12\x1a\x12\x08\x12\x07*\x08Y\x12\x1b\x12\x1c\x12\t\x12\x1d\x12\x1e\x12\x1f*\x06Y\x12 \x12!\x12\"\x12#\x12$\x12%*\x06Y\x12&\x12'\x12(\x12)\x12*\x12+*\x06Y\x12,\x12-\x12.\x12/\x120*\x05Y\x121\x122\x123\x124\x125*\x05Y\x126\x127\x128\x129\x12:*\x05Y\x12;\x12<\x12=\x12>\x12?\x12@\x12A\x12B\x12C\x12D\x12E*\x0bY\x12F\x12G\x12H\x12I\x12J\x12K\x12L\x12M\x12N\x12O\x12P*\x0bY\x12Q\x12R\x12S\x12T\x12U\x12V\x12W\x12X\x12Y\x12Z*\nY\x12[\x12\\\x12]\x12^\x12_\x12`\x12a\x12b\x12c\x12d*\nY\x12e\x12f\x12g\x12h\x12i\x12j\x12k\x12l\x12m\x12n\x12o*\x0bY\x12p\x12q\x12r\x12s\x12t\x12u\x12v\x12w\x12x\x12y\x12z*\x0bY\x12{\x12|\x12}\x12~\x12\x7f\x12\x81\x00\x12\x81\x01\x12\x81\x02\x12\x81\x03\x12\x81\x04*\nY\x12\x81\x05\x12\x81\x06\x12\x81\x07\x12\x81\x08\x12\x81\t\x12\x81\n\x12\x81\x0b\x12\x81\x0c\x12\x81\r\x12\x81\x0e\x12\x81\x0f*\x0bY\x12\x81\x10\x12\x81\x11\x12\x81\x12\x12\x81\x13\x12\x81\x14\x12\x81\x15\x12\x81\x16\x12\x81\x17\x12\x81\x18\x12\x81\x19*\nY\x12\x81\x1a\x12\x81\x1b\x12\x81\x1c\x12\x81\x1d\x12\x81\x1e\x12\x81\x1f\x12\x81 \x12\x81!\x12\x81\"\x12\x81#\x12\x81$*\x0bY\x12\x81%\x12\x81&*\x02Y\x12\x81'\x12\x81(\x12\x81)\x12\x81*\x12\x81+\x12\x81,\x12\x81-\x12\x81.\x12\x81/\x12\x810*\nY\x12\x811\x12\x812\x12\x813\x12\x814*\x04Y\x12\x815\x12\x816\x12\x817\x12\x818*\x04Y\x12\x819\x12\x81:\x12\x81;\x12\x81<*\x04YQc\x87p\x08@\x05\x80###############################\x00\xc0#\x01\xc0#\x02\xc0#\x03\xc0#\x04\xc0#\x05\xc0#\x06\xc0#\x07\xc0#\x08\xc0#\t\xc0#\n\xc0#\x0b\xc0#\x0c\xc0#\r\xc0#\x0e\xc0#\x0f\xc0#\x10\xc0#\x11\xc0#\x12\xc0#\x13\xc0#\x14\xc0#\x15\xc0#\x16\xc0#\x17\xc0#\x18\xc0#\x19\xc0#\x1a\xc0#\x1b\xc0#\x1c\xc0#\x1d\xc0Qc" -class File(uio.IOBase): +class File(io.IOBase): def __init__(self): self.off = 0 @@ -112,8 +112,8 @@ class FS: def mount(): - uos.mount(FS(), "/__remote") - uos.chdir("/__remote") + os.mount(FS(), "/__remote") + os.chdir("/__remote") def test(): diff --git a/tests/renesas-ra/freq.py b/tests/renesas-ra/freq.py index 6ce1871f8c..97fe946b72 100644 --- a/tests/renesas-ra/freq.py +++ b/tests/renesas-ra/freq.py @@ -20,7 +20,7 @@ import os try: import machine -except: +except ImportError: print("machine module is not found") raise SystemExit diff --git a/tests/run-natmodtests.py b/tests/run-natmodtests.py index 16bb469222..9fe970a6d0 100755 --- a/tests/run-natmodtests.py +++ b/tests/run-natmodtests.py @@ -22,16 +22,16 @@ NATMOD_EXAMPLE_DIR = "../examples/natmod/" TEST_MAPPINGS = { "btree": "btree/btree_$(ARCH).mpy", "framebuf": "framebuf/framebuf_$(ARCH).mpy", - "uheapq": "uheapq/uheapq_$(ARCH).mpy", - "urandom": "urandom/urandom_$(ARCH).mpy", - "ure": "ure/ure_$(ARCH).mpy", - "uzlib": "uzlib/uzlib_$(ARCH).mpy", + "heapq": "heapq/heapq_$(ARCH).mpy", + "random": "random/random_$(ARCH).mpy", + "re": "re/re_$(ARCH).mpy", + "zlib": "zlib/zlib_$(ARCH).mpy", } # Code to allow a target MicroPython to import an .mpy from RAM injected_import_hook_code = """\ -import usys, uos, uio -class __File(uio.IOBase): +import sys, os, io +class __File(io.IOBase): def __init__(self): self.off = 0 def ioctl(self, request, arg): @@ -52,9 +52,9 @@ class __FS: raise OSError(-2) # ENOENT def open(self, path, mode): return __File() -uos.mount(__FS(), '/__remote') -uos.chdir('/__remote') -usys.modules['{}'] = __import__('__injected') +os.mount(__FS(), '/__remote') +os.chdir('/__remote') +sys.modules['{}'] = __import__('__injected') """ diff --git a/tests/run-tests-exp.py b/tests/run-tests-exp.py index 21b6645336..bbb057f4ce 100644 --- a/tests/run-tests-exp.py +++ b/tests/run-tests-exp.py @@ -5,8 +5,8 @@ # This script is intended to be run by the same interpreter executable # which is to be tested, so should use minimal language functionality. # -import usys as sys -import uos as os +import sys +import os tests = ["basics", "micropython", "float", "import", "io", " misc", "unicode", "extmod", "unix"] diff --git a/tests/run-tests.py b/tests/run-tests.py index 498db8b404..4964ff49fd 100755 --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -56,8 +56,8 @@ os.environ["PYTHONIOENCODING"] = "utf-8" # Code to allow a target MicroPython to import an .mpy from RAM injected_import_hook_code = """\ -import usys, uos, uio -class __File(uio.IOBase): +import sys, os, io +class __File(io.IOBase): def __init__(self): self.off = 0 def ioctl(self, request, arg): @@ -80,8 +80,8 @@ class __FS: raise OSError(-2) # ENOENT def open(self, path, mode): return __File() -uos.mount(__FS(), '/__vfstest') -uos.chdir('/__vfstest') +os.mount(__FS(), '/__vfstest') +os.chdir('/__vfstest') __import__('__injected_test') """ @@ -455,9 +455,9 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1): if output == b"TypeError\n": skip_revops = True - # Check if uio module exists, and skip such tests if it doesn't - output = run_feature_check(pyb, args, base_path, "uio_module.py") - if output != b"uio\n": + # Check if io module exists, and skip such tests if it doesn't + output = run_feature_check(pyb, args, base_path, "io_module.py") + if output != b"io\n": skip_io_module = True # Check if fstring feature is enabled, and skip such tests if it doesn't @@ -512,9 +512,9 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1): skip_tests.add("extmod/uctypes_le_float.py") skip_tests.add("extmod/uctypes_native_float.py") skip_tests.add("extmod/uctypes_sizeof_float.py") - skip_tests.add("extmod/ujson_dumps_float.py") - skip_tests.add("extmod/ujson_loads_float.py") - skip_tests.add("extmod/urandom_extra_float.py") + skip_tests.add("extmod/json_dumps_float.py") + skip_tests.add("extmod/json_loads_float.py") + skip_tests.add("extmod/random_extra_float.py") skip_tests.add("misc/rge_sm.py") if upy_float_precision < 32: skip_tests.add( @@ -544,7 +544,7 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1): if not has_coverage: skip_tests.add("cmdline/cmd_parsetree.py") skip_tests.add("cmdline/repl_sys_ps1_ps2.py") - skip_tests.add("extmod/ussl_poll.py") + skip_tests.add("extmod/ssl_poll.py") # Some tests shouldn't be run on a PC if args.target == "unix": @@ -568,9 +568,9 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1): } ) # requires uctypes skip_tests.add("extmod/zlibd_decompress.py") # requires zlib - skip_tests.add("extmod/uheapq1.py") # uheapq not supported by WiPy - skip_tests.add("extmod/urandom_basic.py") # requires urandom - skip_tests.add("extmod/urandom_extra.py") # requires urandom + skip_tests.add("extmod/heapq1.py") # heapq not supported by WiPy + skip_tests.add("extmod/random_basic.py") # requires random + skip_tests.add("extmod/random_extra.py") # requires random elif args.target == "esp8266": skip_tests.add("misc/rge_sm.py") # too large elif args.target == "minimal": @@ -582,7 +582,7 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1): skip_tests.add("micropython/opt_level.py") # don't assume line numbers are stored elif args.target == "nrf": skip_tests.add("basics/memoryview1.py") # no item assignment for memoryview - skip_tests.add("extmod/urandom_basic.py") # unimplemented: urandom.seed + skip_tests.add("extmod/random_basic.py") # unimplemented: random.seed skip_tests.add("micropython/opt_level.py") # no support for line numbers skip_tests.add("misc/non_compliant.py") # no item assignment for bytearray for t in tests: @@ -590,7 +590,7 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1): skip_tests.add(t) elif args.target == "renesas-ra": skip_tests.add( - "extmod/utime_time_ns.py" + "extmod/time_time_ns.py" ) # RA fsp rtc function doesn't support nano sec info elif args.target == "qemu-arm": skip_tests.add("misc/print_exception.py") # requires sys stdfiles diff --git a/tests/stress/recursive_data.py b/tests/stress/recursive_data.py index 3b7fa50952..6e01319ed3 100644 --- a/tests/stress/recursive_data.py +++ b/tests/stress/recursive_data.py @@ -1,6 +1,6 @@ # This tests that printing recursive data structure doesn't lead to segfault. try: - import uio as io + import io except ImportError: print("SKIP") raise SystemExit diff --git a/tests/thread/stress_aes.py b/tests/thread/stress_aes.py index aaf9f576dd..b25da855ae 100644 --- a/tests/thread/stress_aes.py +++ b/tests/thread/stress_aes.py @@ -216,10 +216,7 @@ class AES: ################################################################## # test code -try: - import utime as time -except ImportError: - import time +import time import _thread diff --git a/tests/thread/stress_create.py b/tests/thread/stress_create.py index 877424cdf5..98f272f5cd 100644 --- a/tests/thread/stress_create.py +++ b/tests/thread/stress_create.py @@ -1,13 +1,12 @@ # stress test for creating many threads -try: - import utime - - sleep_ms = utime.sleep_ms -except ImportError: - import time +import time +if hasattr(time, "sleep_ms"): + sleep_ms = time.sleep_ms +else: sleep_ms = lambda t: time.sleep(t / 1000) + import _thread diff --git a/tests/thread/stress_heap.py b/tests/thread/stress_heap.py index 2ad91ae147..dec65c7ce0 100644 --- a/tests/thread/stress_heap.py +++ b/tests/thread/stress_heap.py @@ -3,10 +3,7 @@ # # MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -try: - import utime as time -except ImportError: - import time +import time import _thread diff --git a/tests/thread/stress_schedule.py b/tests/thread/stress_schedule.py index 8be7f2d737..40191e6620 100644 --- a/tests/thread/stress_schedule.py +++ b/tests/thread/stress_schedule.py @@ -2,7 +2,7 @@ # while dealing with concurrent access from multiple threads. import _thread -import utime +import time import micropython import gc @@ -32,15 +32,15 @@ def thread(): micropython.schedule(task, None) except RuntimeError: # Queue full, back off. - utime.sleep_ms(10) + time.sleep_ms(10) for i in range(8): _thread.start_new_thread(thread, ()) # Wait up to 10 seconds for 10000 tasks to be scheduled. -t = utime.ticks_ms() -while n < _NUM_TASKS and utime.ticks_diff(utime.ticks_ms(), t) < _TIMEOUT_MS: +t = time.ticks_ms() +while n < _NUM_TASKS and time.ticks_diff(time.ticks_ms(), t) < _TIMEOUT_MS: pass if n < _NUM_TASKS: diff --git a/tests/thread/thread_exc2.py b/tests/thread/thread_exc2.py index 2863e1dec1..6f77bdbffa 100644 --- a/tests/thread/thread_exc2.py +++ b/tests/thread/thread_exc2.py @@ -1,5 +1,5 @@ # test raising exception within thread which is not caught -import utime +import time import _thread @@ -8,5 +8,5 @@ def thread_entry(): _thread.start_new_thread(thread_entry, ()) -utime.sleep(1) +time.sleep(1) print("done") diff --git a/tests/thread/thread_exit1.py b/tests/thread/thread_exit1.py index 186a9be340..e34ca827ca 100644 --- a/tests/thread/thread_exit1.py +++ b/tests/thread/thread_exit1.py @@ -2,10 +2,7 @@ # # MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -try: - import utime as time -except ImportError: - import time +import time import _thread diff --git a/tests/thread/thread_exit2.py b/tests/thread/thread_exit2.py index 5be7945db2..630b664758 100644 --- a/tests/thread/thread_exit2.py +++ b/tests/thread/thread_exit2.py @@ -2,10 +2,7 @@ # # MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -try: - import utime as time -except ImportError: - import time +import time import _thread diff --git a/tests/thread/thread_lock2.py b/tests/thread/thread_lock2.py index b842f69c93..96b3a6af80 100644 --- a/tests/thread/thread_lock2.py +++ b/tests/thread/thread_lock2.py @@ -2,10 +2,7 @@ # # MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -try: - import utime as time -except ImportError: - import time +import time import _thread lock = _thread.allocate_lock() diff --git a/tests/thread/thread_lock4.py b/tests/thread/thread_lock4.py index bbf9043996..97c3dc5380 100644 --- a/tests/thread/thread_lock4.py +++ b/tests/thread/thread_lock4.py @@ -2,10 +2,7 @@ # # MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -try: - import utime as time -except ImportError: - import time +import time import _thread diff --git a/tests/thread/thread_qstr1.py b/tests/thread/thread_qstr1.py index 14f5b6be66..f184d2a58e 100644 --- a/tests/thread/thread_qstr1.py +++ b/tests/thread/thread_qstr1.py @@ -2,10 +2,7 @@ # # MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -try: - import utime as time -except ImportError: - import time +import time import _thread diff --git a/tests/thread/thread_sleep1.py b/tests/thread/thread_sleep1.py index 18fa4e05a1..add9b02f15 100644 --- a/tests/thread/thread_sleep1.py +++ b/tests/thread/thread_sleep1.py @@ -2,13 +2,11 @@ # # MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -try: - import utime - - sleep_ms = utime.sleep_ms -except ImportError: - import time +import time +if hasattr(time, "sleep_ms"): + sleep_ms = time.sleep_ms +else: sleep_ms = lambda t: time.sleep(t / 1000) import _thread diff --git a/tests/thread/thread_stacksize1.py b/tests/thread/thread_stacksize1.py index cf46b73b77..140d165cb3 100644 --- a/tests/thread/thread_stacksize1.py +++ b/tests/thread/thread_stacksize1.py @@ -1,10 +1,8 @@ # test setting the thread stack size # # MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -try: - import usys as sys -except ImportError: - import sys + +import sys import _thread # different implementations have different minimum sizes diff --git a/tests/thread/thread_start1.py b/tests/thread/thread_start1.py index 7274633245..ea8c4f0002 100644 --- a/tests/thread/thread_start1.py +++ b/tests/thread/thread_start1.py @@ -2,10 +2,7 @@ # # MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -try: - import utime as time -except ImportError: - import time +import time import _thread diff --git a/tests/thread/thread_start2.py b/tests/thread/thread_start2.py index d68ea94329..f8239a779a 100644 --- a/tests/thread/thread_start2.py +++ b/tests/thread/thread_start2.py @@ -2,10 +2,7 @@ # # MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd -try: - import utime as time -except ImportError: - import time +import time import _thread diff --git a/tests/unicode/unicode_ure.py b/tests/unicode/unicode_ure.py index 5a5dc60054..c268b9e6fe 100644 --- a/tests/unicode/unicode_ure.py +++ b/tests/unicode/unicode_ure.py @@ -1,13 +1,10 @@ # test match.span() for unicode strings try: - import ure as re + import re except ImportError: - try: - import re - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit try: m = re.match(".", "a") diff --git a/tests/unix/extra_coverage.py b/tests/unix/extra_coverage.py index 3c12b26923..0ea8f7886b 100644 --- a/tests/unix/extra_coverage.py +++ b/tests/unix/extra_coverage.py @@ -4,8 +4,8 @@ except NameError: print("SKIP") raise SystemExit -import uerrno -import uio +import errno +import io data = extra_coverage() @@ -18,7 +18,7 @@ print(hash(str(data[1], "utf8"))) # test streams stream = data[2] # has set_error and set_buf. Write always returns error -stream.set_error(uerrno.EAGAIN) # non-blocking error +stream.set_error(errno.EAGAIN) # non-blocking error print(stream.read()) # read all encounters non-blocking error print(stream.read(1)) # read 1 byte encounters non-blocking error print(stream.readline()) # readline encounters non-blocking error @@ -42,8 +42,8 @@ stream2 = data[3] # is textio print(stream2.read(1)) # read 1 byte encounters non-blocking error with textio stream # test BufferedWriter with stream errors -stream.set_error(uerrno.EAGAIN) -buf = uio.BufferedWriter(stream, 8) +stream.set_error(errno.EAGAIN) +buf = io.BufferedWriter(stream, 8) print(buf.write(bytearray(16))) # function defined in C++ code diff --git a/tests/unix/extra_coverage.py.exp b/tests/unix/extra_coverage.py.exp index 7ea2599c91..6ec8eaaa04 100644 --- a/tests/unix/extra_coverage.py.exp +++ b/tests/unix/extra_coverage.py.exp @@ -48,21 +48,21 @@ RuntimeError: RuntimeError: # repl ame__ -mport +port builtins micropython _thread _uasyncio -btree cexample cmath cppexample -example_package ffi framebuf -gc math termios uarray -ubinascii ucollections ucryptolib uctypes -uerrno uhashlib uheapq uio -ujson umachine uos urandom -ure uselect usocket ussl -ustruct usys utime utimeq -uwebsocket uzlib -ime +array binascii btree cexample +cmath collections cppexample cryptolib +errno example_package ffi +framebuf gc hashlib heapq +io json machine math +os random re select +socket ssl struct sys +termios time timeq uctypes +websocket zlib +me -utime utimeq +time timeq argv atexit byteorder exc_info executable exit getsizeof implementation diff --git a/tests/unix/ffi_types.py b/tests/unix/ffi_types.py index fd94c509d0..06e9b89d3f 100644 --- a/tests/unix/ffi_types.py +++ b/tests/unix/ffi_types.py @@ -1,7 +1,7 @@ # test 8/16/32/64 bit signed/unsigned integer arguments and return types for ffi functions # requires ffi_lib.c to be compiled as: $(CC) -shared -o ffi_lib.so ffi_lib.c -import uos, usys +import os, sys try: import ffi @@ -9,9 +9,9 @@ except ImportError: print("SKIP") raise SystemExit -ffi_lib_filename = "./" + usys.argv[0].rsplit("/", 1)[0] + "/ffi_lib.so" +ffi_lib_filename = "./" + sys.argv[0].rsplit("/", 1)[0] + "/ffi_lib.so" try: - uos.stat(ffi_lib_filename) + os.stat(ffi_lib_filename) except OSError: print("SKIP") raise SystemExit diff --git a/tests/unix/time.py b/tests/unix/time_mktime_localtime.py similarity index 96% rename from tests/unix/time.py rename to tests/unix/time_mktime_localtime.py index 55a4b18aae..d1c03c103d 100644 --- a/tests/unix/time.py +++ b/tests/unix/time_mktime_localtime.py @@ -1,7 +1,4 @@ -try: - import utime as time -except ImportError: - import time +import time DAYS_PER_MONTH = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] diff --git a/tests/wipy/wlan/machine.py.exp b/tests/wipy/wlan/machine.py.exp index cc5b3f61da..303a0633a6 100644 --- a/tests/wipy/wlan/machine.py.exp +++ b/tests/wipy/wlan/machine.py.exp @@ -1,4 +1,4 @@ - + True True Active diff --git a/tools/ci.sh b/tools/ci.sh index 21acc17535..a010adcbce 100755 --- a/tools/ci.sh +++ b/tools/ci.sh @@ -630,8 +630,8 @@ function ci_unix_macos_build { function ci_unix_macos_run_tests { # Issues with macOS tests: # - import_pkg7 has a problem with relative imports - # - urandom_basic has a problem with getrandbits(0) - (cd tests && MICROPY_MICROPYTHON=../ports/unix/build-standard/micropython ./run-tests.py --exclude 'import_pkg7.py' --exclude 'urandom_basic.py') + # - random_basic has a problem with getrandbits(0) + (cd tests && MICROPY_MICROPYTHON=../ports/unix/build-standard/micropython ./run-tests.py --exclude 'import_pkg7.py' --exclude 'random_basic.py') } function ci_unix_qemu_mips_setup { diff --git a/tools/tinytest-codegen.py b/tools/tinytest-codegen.py index feda75f283..d6e87ac6ce 100755 --- a/tools/tinytest-codegen.py +++ b/tools/tinytest-codegen.py @@ -65,11 +65,11 @@ exclude_tests = ( "basics/bytes_compare3.py", "extmod/ticks_diff.py", "extmod/time_ms_us.py", - "extmod/uheapq_timeq.py", + "extmod/heapq_timeq.py", # unicode char issue - "extmod/ujson_loads.py", + "extmod/json_loads.py", # doesn't output to python stdout - "extmod/ure_debug.py", + "extmod/re_debug.py", "extmod/vfs_basic.py", "extmod/vfs_fat_ramdisk.py", "extmod/vfs_fat_fileio.py",