micropython/tests/extmod
Damien George 60f5b941e0 extmod/vfs_reader: Fix mp_reader_new_file to open file in "rb" mode.
mp_reader_new_file() is used to read in files for importing, either .py or
.mpy files, for the lexer and persistent code loader respectively.  In both
cases the file should be opened in raw bytes mode: the lexer handles
unicode characters itself, and .mpy files contain 8-bit bytes by nature.

Before this commit importing was working correctly because, although the
file was opened in text mode, all native filesystem implementations (POSIX,
FAT, LFS) would access the file in raw bytes mode via mp_stream_rw()
calling mp_stream_p_t.read().  So it was only an issue for non-native
filesystems, such as those implemented in Python.  For Python-based
filesystem implementations, a call to mp_stream_rw() would go via IOBase
and then to readinto() at the Python level, and readinto() is only defined
on files opened in raw bytes mode.

Signed-off-by: Damien George <damien@micropython.org>
2020-08-12 23:40:50 +10:00
..
btree1.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
btree1.py.exp
btree_error.py tests/extmod: Add btree test for errors raised by btree DB library. 2020-04-27 23:59:09 +10:00
btree_error.py.exp tests/extmod: Add btree test for errors raised by btree DB library. 2020-04-27 23:59:09 +10:00
btree_gc.py extmod/modbtree: Retain reference to underlying stream so it's not GC'd. 2020-05-02 16:08:04 +10:00
btree_gc.py.exp extmod/modbtree: Retain reference to underlying stream so it's not GC'd. 2020-05-02 16:08:04 +10:00
framebuf1.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
framebuf1.py.exp
framebuf2.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
framebuf2.py.exp
framebuf4.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
framebuf4.py.exp
framebuf8.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
framebuf8.py.exp
framebuf16.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
framebuf16.py.exp
framebuf_subclass.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
framebuf_subclass.py.exp extmod/modframebuf: Allow blit source to be a subclass of FrameBuffer. 2020-02-21 13:32:48 +11:00
machine1.py
machine1.py.exp
machine_pinbase.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
machine_pinbase.py.exp
machine_pulse.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
machine_pulse.py.exp
machine_signal.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
machine_signal.py.exp
machine_timer.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
machine_timer.py.exp tests/extmod: Add basic machine.Timer test. 2020-01-22 17:31:18 +11:00
ticks_diff.py tests/run-tests: Auto-skip extmod/ticks_diff, extmod/time_ms_us tests. 2020-02-11 10:56:49 +11:00
ticks_diff.py.exp
time_ms_us.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
time_ms_us.py.exp
uasyncio_await_return.py tests/extmod: Add uasyncio tests. 2020-03-26 01:25:45 +11:00
uasyncio_await_return.py.exp tests/extmod: Add uasyncio tests. 2020-03-26 01:25:45 +11:00
uasyncio_basic.py tests/extmod: Add uasyncio tests. 2020-03-26 01:25:45 +11:00
uasyncio_basic.py.exp tests/extmod: Add uasyncio tests. 2020-03-26 01:25:45 +11:00
uasyncio_basic2.py tests/extmod: Add uasyncio tests. 2020-03-26 01:25:45 +11:00
uasyncio_basic2.py.exp tests/extmod: Add uasyncio tests. 2020-03-26 01:25:45 +11:00
uasyncio_cancel_fair.py tests/extmod: Add uasyncio tests. 2020-03-26 01:25:45 +11:00
uasyncio_cancel_fair.py.exp tests/extmod: Add uasyncio tests. 2020-03-26 01:25:45 +11:00
uasyncio_cancel_fair2.py tests/extmod: Add uasyncio tests. 2020-03-26 01:25:45 +11:00
uasyncio_cancel_fair2.py.exp tests/extmod: Add uasyncio tests. 2020-03-26 01:25:45 +11:00
uasyncio_cancel_self.py tests/extmod: Add uasyncio tests. 2020-03-26 01:25:45 +11:00
uasyncio_cancel_self.py.exp extmod/uasyncio: Change cannot to can't in error message, and test exp. 2020-04-14 21:51:25 +10:00
uasyncio_cancel_task.py tests/extmod: Add uasyncio tests. 2020-03-26 01:25:45 +11:00
uasyncio_cancel_task.py.exp tests/extmod: Add uasyncio tests. 2020-03-26 01:25:45 +11:00
uasyncio_event.py tests/extmod: Add uasyncio tests. 2020-03-26 01:25:45 +11:00
uasyncio_event.py.exp tests/extmod: Add uasyncio tests. 2020-03-26 01:25:45 +11:00
uasyncio_event_fair.py tests/extmod: Add uasyncio tests. 2020-03-26 01:25:45 +11:00
uasyncio_event_fair.py.exp tests/extmod: Add uasyncio tests. 2020-03-26 01:25:45 +11:00
uasyncio_exception.py tests/extmod: Add uasyncio tests. 2020-03-26 01:25:45 +11:00
uasyncio_exception.py.exp tests/extmod: Add uasyncio tests. 2020-03-26 01:25:45 +11:00
uasyncio_fair.py tests/extmod: Add uasyncio tests. 2020-03-26 01:25:45 +11:00
uasyncio_fair.py.exp tests/extmod: Add uasyncio tests. 2020-03-26 01:25:45 +11:00
uasyncio_gather.py tests/extmod: Add uasyncio tests. 2020-03-26 01:25:45 +11:00
uasyncio_gather.py.exp tests/extmod: Add uasyncio tests. 2020-03-26 01:25:45 +11:00
uasyncio_get_event_loop.py tests/extmod: Add uasyncio tests. 2020-03-26 01:25:45 +11:00
uasyncio_heaplock.py tests/extmod: Add uasyncio tests. 2020-03-26 01:25:45 +11:00
uasyncio_heaplock.py.exp tests/extmod: Add uasyncio tests. 2020-03-26 01:25:45 +11:00
uasyncio_lock.py tests/extmod: Add uasyncio tests. 2020-03-26 01:25:45 +11:00
uasyncio_lock.py.exp tests/extmod: Add uasyncio tests. 2020-03-26 01:25:45 +11:00
uasyncio_lock_cancel.py tests/extmod: Add uasyncio tests. 2020-03-26 01:25:45 +11:00
uasyncio_lock_cancel.py.exp tests/extmod: Add uasyncio tests. 2020-03-26 01:25:45 +11:00
uasyncio_loop_stop.py extmod/uasyncio: Implement Loop.stop() to stop the event loop. 2020-04-02 00:14:18 +11:00
uasyncio_loop_stop.py.exp extmod/uasyncio: Implement Loop.stop() to stop the event loop. 2020-04-02 00:14:18 +11:00
uasyncio_micropython.py extmod/uasyncio: Add asyncio.wait_for_ms function. 2020-06-10 22:29:44 +10:00
uasyncio_micropython.py.exp extmod/uasyncio: Add asyncio.wait_for_ms function. 2020-06-10 22:29:44 +10:00
uasyncio_new_event_loop.py extmod/uasyncio: Add Loop.new_event_loop method. 2020-04-13 22:16:52 +10:00
uasyncio_new_event_loop.py.exp extmod/uasyncio: Add Loop.new_event_loop method. 2020-04-13 22:16:52 +10:00
uasyncio_set_exception_handler.py docs,tests: Add docs and test for uasyncio custom exc handler methods. 2020-04-04 10:47:48 +11:00
uasyncio_set_exception_handler.py.exp docs,tests: Add docs and test for uasyncio custom exc handler methods. 2020-04-04 10:47:48 +11:00
uasyncio_wait_for.py tests/extmod: Add uasyncio tests. 2020-03-26 01:25:45 +11:00
uasyncio_wait_for.py.exp tests/extmod: Add uasyncio tests. 2020-03-26 01:25:45 +11:00
uasyncio_wait_task.py tests/extmod: Add uasyncio tests. 2020-03-26 01:25:45 +11:00
uasyncio_wait_task.py.exp tests/extmod: Add uasyncio tests. 2020-03-26 01:25:45 +11:00
ubinascii_a2b_base64.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
ubinascii_b2a_base64.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
ubinascii_crc32.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
ubinascii_hexlify.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
ubinascii_micropython.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
ubinascii_micropython.py.exp
ubinascii_unhexlify.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
ucryptolib_aes128_cbc.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
ucryptolib_aes128_cbc.py.exp
ucryptolib_aes128_ctr.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
ucryptolib_aes128_ctr.py.exp extmod/moducryptolib: Add AES-CTR support. 2019-05-06 18:09:48 +10:00
ucryptolib_aes128_ecb.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
ucryptolib_aes128_ecb.py.exp
ucryptolib_aes128_ecb_enc.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
ucryptolib_aes128_ecb_enc.py.exp
ucryptolib_aes128_ecb_inpl.py
ucryptolib_aes128_ecb_inpl.py.exp
ucryptolib_aes128_ecb_into.py
ucryptolib_aes128_ecb_into.py.exp
ucryptolib_aes256_cbc.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
ucryptolib_aes256_cbc.py.exp
ucryptolib_aes256_ecb.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
ucryptolib_aes256_ecb.py.exp
uctypes_32bit_intbig.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
uctypes_32bit_intbig.py.exp
uctypes_array_assign_le.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
uctypes_array_assign_le.py.exp
uctypes_array_assign_native_le.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
uctypes_array_assign_native_le.py.exp
uctypes_array_assign_native_le_intbig.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
uctypes_array_assign_native_le_intbig.py.exp
uctypes_bytearray.py
uctypes_bytearray.py.exp
uctypes_byteat.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
uctypes_byteat.py.exp
uctypes_error.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
uctypes_error.py.exp
uctypes_le.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
uctypes_le.py.exp
uctypes_le_float.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
uctypes_le_float.py.exp
uctypes_native_float.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
uctypes_native_float.py.exp
uctypes_native_le.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
uctypes_native_le.py.exp
uctypes_print.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
uctypes_print.py.exp
uctypes_ptr_le.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
uctypes_ptr_le.py.exp
uctypes_ptr_native_le.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
uctypes_ptr_native_le.py.exp
uctypes_sizeof.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
uctypes_sizeof.py.exp
uctypes_sizeof_float.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
uctypes_sizeof_float.py.exp
uctypes_sizeof_layout.py
uctypes_sizeof_layout.py.exp
uctypes_sizeof_native.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
uctypes_sizeof_native.py.exp
uctypes_sizeof_od.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
uctypes_sizeof_od.py.exp
uhashlib_md5.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
uhashlib_sha1.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
uhashlib_sha256.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
uheapq1.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
ujson_dump.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
ujson_dump_iobase.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
ujson_dumps.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
ujson_dumps_extra.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
ujson_dumps_extra.py.exp
ujson_dumps_float.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
ujson_dumps_ordereddict.py py/objdict: Support ujson.dump() of OrderedDict objects. 2019-11-13 13:51:18 +11:00
ujson_load.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
ujson_loads.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
ujson_loads_bytes.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
ujson_loads_bytes.py.exp tests/extmod: Split json.loads of bytes/bytearray into separate test. 2019-08-22 15:45:13 +10:00
ujson_loads_float.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
urandom_basic.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
urandom_extra.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
urandom_extra_float.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
ure1.py extmod/ure: Use single function for match/search/sub. 2020-06-08 09:16:09 +02:00
ure_debug.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
ure_debug.py.exp
ure_error.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
ure_group.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
ure_groups.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
ure_namedclass.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
ure_span.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
ure_split.py
ure_split_empty.py
ure_split_empty.py.exp
ure_split_notimpl.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
ure_split_notimpl.py.exp
ure_stack_overflow.py
ure_stack_overflow.py.exp
ure_sub.py extmod/ure: Use single function for match/search/sub. 2020-06-08 09:16:09 +02:00
ure_sub_unmatched.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
ure_sub_unmatched.py.exp
uselect_poll_basic.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
uselect_poll_udp.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
usocket_udp_nonblock.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
ussl_basic.py extmod/modussl: Improve exception error messages. 2020-07-20 23:41:45 +10:00
ussl_basic.py.exp extmod/modussl: Improve exception error messages. 2020-07-20 23:41:45 +10:00
ussl_keycert.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
ussl_keycert.py.exp tests/extmod: Add test for ussl when passing in key/cert params. 2019-10-31 16:38:20 +11:00
utimeq1.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
utimeq1.py.exp
utimeq_stable.py
utimeq_stable.py.exp
uzlib_decompio.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
uzlib_decompio.py.exp
uzlib_decompio_gz.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
uzlib_decompio_gz.py.exp
uzlib_decompress.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
vfs_basic.py extmod/vfs: Retain previous working directory if chdir fails. 2020-05-29 23:05:01 +10:00
vfs_basic.py.exp extmod/vfs: Retain previous working directory if chdir fails. 2020-05-29 23:05:01 +10:00
vfs_blockdev.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
vfs_blockdev.py.exp tests/extmod: Add test for blockdev with standard and extended protocol. 2019-10-29 14:17:29 +11:00
vfs_fat_fileio1.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
vfs_fat_fileio1.py.exp tests/extmod: Split out VfsFat finaliser tests to separate test file. 2019-12-27 12:30:51 +11:00
vfs_fat_fileio2.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
vfs_fat_fileio2.py.exp
vfs_fat_finaliser.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
vfs_fat_finaliser.py.exp tests/extmod: Split out VfsFat finaliser tests to separate test file. 2019-12-27 12:30:51 +11:00
vfs_fat_more.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
vfs_fat_more.py.exp
vfs_fat_oldproto.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
vfs_fat_oldproto.py.exp
vfs_fat_ramdisk.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
vfs_fat_ramdisk.py.exp
vfs_fat_ramdisklarge.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
vfs_fat_ramdisklarge.py.exp
vfs_lfs.py extmod/vfs_lfsx: Fix rename to respect cur dir for new path. 2020-05-08 21:54:04 +10:00
vfs_lfs.py.exp extmod/vfs_lfsx: Fix rename to respect cur dir for new path. 2020-05-08 21:54:04 +10:00
vfs_lfs_corrupt.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
vfs_lfs_corrupt.py.exp tests/extmod: Add littlefs tests. 2019-10-29 14:17:29 +11:00
vfs_lfs_error.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
vfs_lfs_error.py.exp tests/extmod: Add littlefs tests. 2019-10-29 14:17:29 +11:00
vfs_lfs_file.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
vfs_lfs_file.py.exp tests/extmod: Add littlefs tests. 2019-10-29 14:17:29 +11:00
vfs_lfs_mount.py extmod/vfs_lfsx: Fix import_stat so it takes into account current dir. 2020-05-15 11:31:32 +10:00
vfs_lfs_mount.py.exp extmod/vfs_lfsx: Fix import_stat so it takes into account current dir. 2020-05-15 11:31:32 +10:00
vfs_userfs.py extmod/vfs_reader: Fix mp_reader_new_file to open file in "rb" mode. 2020-08-12 23:40:50 +10:00
vfs_userfs.py.exp extmod/vfs_reader: Fix mp_reader_new_file to open file in "rb" mode. 2020-08-12 23:40:50 +10:00
websocket_basic.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
websocket_basic.py.exp