From 27c149efe030b6fd24c0cc1475ea509da1a72821 Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 6 Feb 2017 13:19:52 +1100 Subject: stmhal: Add pyb.fault_debug() function, to control hard-fault behaviour. This new function controls what happens on a hard-fault: - debugging disabled: board will do a reset - debugging enabled: board will print registers and stack and flash LEDs The default is disabled, ie to do a reset. This is different to previous behaviour which flashed the LEDs and waited indefinitely. --- tests/pyb/pyb1.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tests/pyb') diff --git a/tests/pyb/pyb1.py b/tests/pyb/pyb1.py index 0087ec050..00adc8553 100644 --- a/tests/pyb/pyb1.py +++ b/tests/pyb/pyb1.py @@ -40,3 +40,6 @@ pyb.sync() print(len(pyb.unique_id())) pyb.wfi() + +pyb.fault_debug(True) +pyb.fault_debug(False) -- cgit v1.2.3 From d3bb3e38df3fcb2b980d37e06fde7eac9e689f6a Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 6 Feb 2017 13:48:01 +1100 Subject: tests/pyb: Adjust tests so they can run on PYB and PYBLITE. A few tests still fail on PYBLITE, and that's due to differences in the available peripheral block numbers on the different MCUs (eg I2C(2) exists on one, but it's I2C(3) on the other). --- tests/pyb/adc.py | 9 ++++++--- tests/pyb/can.py | 8 +++++++- tests/pyb/dac.py | 5 +++++ tests/pyb/extint.py | 2 +- tests/pyb/extint.py.exp | 6 +++--- tests/pyb/pin.py | 8 ++++---- tests/pyb/pin.py.exp | 12 ++++++------ tests/pyb/pyb1.py | 4 ---- tests/pyb/pyb1.py.exp | 1 - tests/pyb/pyb_f405.py | 11 +++++++++++ tests/pyb/pyb_f405.py.exp | 2 ++ tests/pyb/pyb_f411.py | 10 ++++++++++ tests/pyb/pyb_f411.py.exp | 1 + tests/pyb/rtc.py | 2 +- 14 files changed, 57 insertions(+), 24 deletions(-) create mode 100644 tests/pyb/pyb_f405.py create mode 100644 tests/pyb/pyb_f405.py.exp create mode 100644 tests/pyb/pyb_f411.py create mode 100644 tests/pyb/pyb_f411.py.exp (limited to 'tests/pyb') diff --git a/tests/pyb/adc.py b/tests/pyb/adc.py index 6508d7e24..362ca326d 100644 --- a/tests/pyb/adc.py +++ b/tests/pyb/adc.py @@ -9,9 +9,12 @@ print(adc) val = adc.read() assert val < 500 +# timer for read_timed +tim = pyb.Timer(5, freq=500) + # read into bytearray buf = bytearray(50) -adc.read_timed(buf, 500) +adc.read_timed(buf, tim) print(len(buf)) for i in buf: assert i < 500 @@ -19,12 +22,12 @@ for i in buf: # read into arrays with different element sizes import array ar = array.array('h', 25 * [0]) -adc.read_timed(ar, 500) +adc.read_timed(ar, tim) print(len(ar)) for i in buf: assert i < 500 ar = array.array('i', 30 * [0]) -adc.read_timed(ar, 500) +adc.read_timed(ar, tim) print(len(ar)) for i in buf: assert i < 500 diff --git a/tests/pyb/can.py b/tests/pyb/can.py index 594d1d509..617eb7ccc 100644 --- a/tests/pyb/can.py +++ b/tests/pyb/can.py @@ -1,4 +1,10 @@ -from pyb import CAN +try: + from pyb import CAN +except ImportError: + print('SKIP') + import sys + sys.exit() + import pyb # test we can correctly create by id or name diff --git a/tests/pyb/dac.py b/tests/pyb/dac.py index 884ec5829..942f30354 100644 --- a/tests/pyb/dac.py +++ b/tests/pyb/dac.py @@ -1,5 +1,10 @@ import pyb +if not hasattr(pyb, 'DAC'): + print('SKIP') + import sys + sys.exit() + dac = pyb.DAC(1) print(dac) dac.noise(100) diff --git a/tests/pyb/extint.py b/tests/pyb/extint.py index a8ba484b1..ae98ccd5a 100644 --- a/tests/pyb/extint.py +++ b/tests/pyb/extint.py @@ -1,7 +1,7 @@ import pyb # test basic functionality -ext = pyb.ExtInt('X1', pyb.ExtInt.IRQ_RISING, pyb.Pin.PULL_DOWN, lambda l:print('line:', l)) +ext = pyb.ExtInt('Y1', pyb.ExtInt.IRQ_RISING, pyb.Pin.PULL_DOWN, lambda l:print('line:', l)) ext.disable() ext.enable() print(ext.line()) diff --git a/tests/pyb/extint.py.exp b/tests/pyb/extint.py.exp index daed01c7f..1f9da9844 100644 --- a/tests/pyb/extint.py.exp +++ b/tests/pyb/extint.py.exp @@ -1,3 +1,3 @@ -0 -line: 0 -line: 0 +6 +line: 6 +line: 6 diff --git a/tests/pyb/pin.py b/tests/pyb/pin.py index b3eb87b60..9b3788343 100644 --- a/tests/pyb/pin.py +++ b/tests/pyb/pin.py @@ -1,14 +1,14 @@ from pyb import Pin -p = Pin('X1', Pin.IN) +p = Pin('Y1', Pin.IN) print(p) print(p.name()) print(p.pin()) print(p.port()) -p = Pin('X1', Pin.IN, Pin.PULL_UP) -p = Pin('X1', Pin.IN, pull=Pin.PULL_UP) -p = Pin('X1', mode=Pin.IN, pull=Pin.PULL_UP) +p = Pin('Y1', Pin.IN, Pin.PULL_UP) +p = Pin('Y1', Pin.IN, pull=Pin.PULL_UP) +p = Pin('Y1', mode=Pin.IN, pull=Pin.PULL_UP) print(p) print(p.value()) diff --git a/tests/pyb/pin.py.exp b/tests/pyb/pin.py.exp index 599374600..f2f7038fd 100644 --- a/tests/pyb/pin.py.exp +++ b/tests/pyb/pin.py.exp @@ -1,10 +1,10 @@ -Pin(Pin.cpu.A0, mode=Pin.IN) -A0 -0 -0 -Pin(Pin.cpu.A0, mode=Pin.IN, pull=Pin.PULL_UP) +Pin(Pin.cpu.C6, mode=Pin.IN) +C6 +6 +2 +Pin(Pin.cpu.C6, mode=Pin.IN, pull=Pin.PULL_UP) 1 -Pin(Pin.cpu.A0, mode=Pin.IN, pull=Pin.PULL_DOWN) +Pin(Pin.cpu.C6, mode=Pin.IN, pull=Pin.PULL_DOWN) 0 0 1 diff --git a/tests/pyb/pyb1.py b/tests/pyb/pyb1.py index 00adc8553..184acbdc4 100644 --- a/tests/pyb/pyb1.py +++ b/tests/pyb/pyb1.py @@ -27,14 +27,10 @@ print((pyb.millis() - start) // 5) # should print 3 pyb.disable_irq() pyb.enable_irq() -print(pyb.freq()) - print(pyb.have_cdc()) pyb.hid((0, 0, 0, 0)) # won't do anything -pyb.rng() - pyb.sync() print(len(pyb.unique_id())) diff --git a/tests/pyb/pyb1.py.exp b/tests/pyb/pyb1.py.exp index 84034d683..5816ea967 100644 --- a/tests/pyb/pyb1.py.exp +++ b/tests/pyb/pyb1.py.exp @@ -1,5 +1,4 @@ 3 3 -(168000000, 168000000, 42000000, 84000000) True 12 diff --git a/tests/pyb/pyb_f405.py b/tests/pyb/pyb_f405.py new file mode 100644 index 000000000..3c81fe109 --- /dev/null +++ b/tests/pyb/pyb_f405.py @@ -0,0 +1,11 @@ +# test pyb module on F405 MCUs + +import os, pyb + +if not 'STM32F405' in os.uname().machine: + print('SKIP') + import sys + sys.exit() + +print(pyb.freq()) +print(type(pyb.rng())) diff --git a/tests/pyb/pyb_f405.py.exp b/tests/pyb/pyb_f405.py.exp new file mode 100644 index 000000000..a90aa0268 --- /dev/null +++ b/tests/pyb/pyb_f405.py.exp @@ -0,0 +1,2 @@ +(168000000, 168000000, 42000000, 84000000) + diff --git a/tests/pyb/pyb_f411.py b/tests/pyb/pyb_f411.py new file mode 100644 index 000000000..328653965 --- /dev/null +++ b/tests/pyb/pyb_f411.py @@ -0,0 +1,10 @@ +# test pyb module on F411 MCUs + +import os, pyb + +if not 'STM32F411' in os.uname().machine: + print('SKIP') + import sys + sys.exit() + +print(pyb.freq()) diff --git a/tests/pyb/pyb_f411.py.exp b/tests/pyb/pyb_f411.py.exp new file mode 100644 index 000000000..79e0a1062 --- /dev/null +++ b/tests/pyb/pyb_f411.py.exp @@ -0,0 +1 @@ +(96000000, 96000000, 24000000, 48000000) diff --git a/tests/pyb/rtc.py b/tests/pyb/rtc.py index 300c95634..844526b4b 100644 --- a/tests/pyb/rtc.py +++ b/tests/pyb/rtc.py @@ -7,7 +7,7 @@ print(rtc) # make sure that 1 second passes correctly rtc.datetime((2014, 1, 1, 1, 0, 0, 0, 0)) -pyb.delay(1001) +pyb.delay(1002) print(rtc.datetime()[:7]) def set_and_print(datetime): -- cgit v1.2.3 From ca16c3821053e5bf2b87aeb10007f73f31dc1eac Mon Sep 17 00:00:00 2001 From: Ville Skyttä Date: Mon, 29 May 2017 10:08:14 +0300 Subject: various: Spelling fixes --- cc3200/README.md | 2 +- docs/library/btree.rst | 2 +- docs/library/machine.SD.rst | 2 +- docs/library/machine.UART.rst | 2 +- docs/library/uhashlib.rst | 4 ++-- docs/library/utime.rst | 4 ++-- docs/sphinx_selective_exclude/README.md | 2 +- docs/sphinx_selective_exclude/modindex_exclude.py | 2 +- esp8266/README.md | 2 +- esp8266/machine_rtc.c | 2 +- examples/conwaylife.py | 4 ++-- examples/embedding/Makefile.upylib | 2 +- examples/embedding/README.md | 2 +- extmod/modlwip.c | 4 ++-- extmod/modwebsocket.c | 2 +- lib/timeutils/timeutils.c | 2 +- lib/utils/stdout_helpers.c | 2 +- py/asmthumb.c | 2 +- py/builtinimport.c | 4 ++-- py/compile.c | 4 ++-- py/misc.h | 2 +- py/mkenv.mk | 2 +- py/mpconfig.h | 2 +- py/obj.c | 2 +- py/objstr.c | 4 ++-- py/py.mk | 2 +- py/ringbuf.h | 2 +- py/stream.c | 2 +- py/vm.c | 4 ++-- qemu-arm/README.md | 2 +- tests/basics/namedtuple1.py | 2 +- tests/basics/try_reraise2.py | 2 +- tests/pyb/can.py | 2 +- tests/thread/stress_aes.py | 2 +- tests/wipy/uart.py | 2 +- tools/insert-usb-ids.py | 2 +- tools/pyboard.py | 2 +- unix/Makefile | 2 +- unix/modsocket.c | 2 +- windows/windows_mphal.c | 2 +- zephyr/modutime.c | 2 +- 41 files changed, 49 insertions(+), 49 deletions(-) (limited to 'tests/pyb') diff --git a/cc3200/README.md b/cc3200/README.md index 753fd450a..53cad3ba0 100644 --- a/cc3200/README.md +++ b/cc3200/README.md @@ -138,7 +138,7 @@ If `WIPY_IP`, `WIPY_USER` or `WIPY_PWD` are omitted the default values (the ones ## Regarding old revisions of the CC3200-LAUNCHXL First silicon (pre-release) revisions of the CC3200 had issues with the ram blocks, and MicroPython cannot run -there. Make sure to use a **v4.1 (or higer) LAUNCHXL board** when trying this port, otherwise it won't work. +there. Make sure to use a **v4.1 (or higher) LAUNCHXL board** when trying this port, otherwise it won't work. ### Note regarding FileZilla diff --git a/docs/library/btree.rst b/docs/library/btree.rst index aebcbc160..bd7890586 100644 --- a/docs/library/btree.rst +++ b/docs/library/btree.rst @@ -69,7 +69,7 @@ Functions Open a database from a random-access `stream` (like an open file). All other parameters are optional and keyword-only, and allow to tweak advanced - paramters of the database operation (most users will not need them): + parameters of the database operation (most users will not need them): * `flags` - Currently unused. * `cachesize` - Suggested maximum memory cache size in bytes. For a diff --git a/docs/library/machine.SD.rst b/docs/library/machine.SD.rst index 0eb024602..608e95831 100644 --- a/docs/library/machine.SD.rst +++ b/docs/library/machine.SD.rst @@ -34,7 +34,7 @@ Methods .. method:: SD.init(id=0, pins=('GP10', 'GP11', 'GP15')) - Enable the SD card. In order to initalize the card, give it a 3-tuple: + Enable the SD card. In order to initialize the card, give it a 3-tuple: ``(clk_pin, cmd_pin, dat0_pin)``. .. method:: SD.deinit() diff --git a/docs/library/machine.UART.rst b/docs/library/machine.UART.rst index f9c8efef7..64ff28e1a 100644 --- a/docs/library/machine.UART.rst +++ b/docs/library/machine.UART.rst @@ -16,7 +16,7 @@ UART objects can be created and initialised using:: uart = UART(1, 9600) # init with given baudrate uart.init(9600, bits=8, parity=None, stop=1) # init with given parameters -Supported paramters differ on a board: +Supported parameters differ on a board: Pyboard: Bits can be 7, 8 or 9. Stop can be 1 or 2. With `parity=None`, only 8 and 9 bits are supported. With parity enabled, only 7 and 8 bits diff --git a/docs/library/uhashlib.rst b/docs/library/uhashlib.rst index cd0216dae..6b9a764ba 100644 --- a/docs/library/uhashlib.rst +++ b/docs/library/uhashlib.rst @@ -15,11 +15,11 @@ be implemented: * SHA1 - A previous generation algorithm. Not recommended for new usages, but SHA1 is a part of number of Internet standards and existing - applications, so boards targetting network connectivity and + applications, so boards targeting network connectivity and interoperatiability will try to provide this. * MD5 - A legacy algorithm, not considered cryptographically secure. Only - selected boards, targetting interoperatibility with legacy applications, + selected boards, targeting interoperatibility with legacy applications, will offer this. Constructors diff --git a/docs/library/utime.rst b/docs/library/utime.rst index 871f6c678..f3a067cde 100644 --- a/docs/library/utime.rst +++ b/docs/library/utime.rst @@ -146,8 +146,8 @@ Functions too distant inbetween, see below). The function returns **signed** value in the range [``-TICKS_PERIOD/2`` .. ``TICKS_PERIOD/2-1``] (that's a typical range definition for two's-complement signed binary integers). If the result is negative, it means that - ``ticks1`` occured earlier in time than ``ticks2``. Otherwise, it means that - ``ticks1`` occured after ``ticks2``. This holds ``only`` if ``ticks1`` and ``ticks2`` + ``ticks1`` occurred earlier in time than ``ticks2``. Otherwise, it means that + ``ticks1`` occurred after ``ticks2``. This holds ``only`` if ``ticks1`` and ``ticks2`` are apart from each other for no more than ``TICKS_PERIOD/2-1`` ticks. If that does not hold, incorrect result will be returned. Specifically, if two tick values are apart for ``TICKS_PERIOD/2-1`` ticks, that value will be returned by the function. diff --git a/docs/sphinx_selective_exclude/README.md b/docs/sphinx_selective_exclude/README.md index cc9725c21..dab140739 100644 --- a/docs/sphinx_selective_exclude/README.md +++ b/docs/sphinx_selective_exclude/README.md @@ -66,7 +66,7 @@ index for PDF, just the same as for HTML. search_auto_exclude ------------------- -Even if you exclude soem documents from toctree:: using only:: +Even if you exclude some documents from toctree:: using only:: directive, they will be indexed for full-text search, so user may find them and get confused. This plugin follows very simple idea that if you didn't include some documents in the toctree, then diff --git a/docs/sphinx_selective_exclude/modindex_exclude.py b/docs/sphinx_selective_exclude/modindex_exclude.py index 18b49cc80..bf8db795e 100644 --- a/docs/sphinx_selective_exclude/modindex_exclude.py +++ b/docs/sphinx_selective_exclude/modindex_exclude.py @@ -2,7 +2,7 @@ # This is a Sphinx documentation tool extension which allows to # exclude some Python modules from the generated indexes. Modules # are excluded both from "modindex" and "genindex" index tables -# (in the latter case, all members of a module are exlcuded). +# (in the latter case, all members of a module are excluded). # To control exclusion, set "modindex_exclude" variable in Sphinx # conf.py to the list of modules to exclude. Note: these should be # modules (as defined by py:module directive, not just raw filenames). diff --git a/esp8266/README.md b/esp8266/README.md index 897bb4737..d717d26fe 100644 --- a/esp8266/README.md +++ b/esp8266/README.md @@ -100,7 +100,7 @@ programming). __WiFi__ -Initally, the device configures itself as a WiFi access point (AP). +Initially, the device configures itself as a WiFi access point (AP). - ESSID: MicroPython-xxxxxx (x’s are replaced with part of the MAC address). - Password: micropythoN (note the upper-case N). - IP address of the board: 192.168.4.1. diff --git a/esp8266/machine_rtc.c b/esp8266/machine_rtc.c index 019b705ba..b17bcb261 100644 --- a/esp8266/machine_rtc.c +++ b/esp8266/machine_rtc.c @@ -93,7 +93,7 @@ void pyb_rtc_set_us_since_2000(uint64_t nowus) { int64_t delta = nowus - (((uint64_t)rtc_last_ticks * cal) >> 12); // As the calibration value jitters quite a bit, to make the - // clock at least somewhat practially usable, we need to store it + // clock at least somewhat practically usable, we need to store it system_rtc_mem_write(MEM_CAL_ADDR, &cal, sizeof(cal)); system_rtc_mem_write(MEM_DELTA_ADDR, &delta, sizeof(delta)); }; diff --git a/examples/conwaylife.py b/examples/conwaylife.py index f99796175..323f42e85 100644 --- a/examples/conwaylife.py +++ b/examples/conwaylife.py @@ -8,7 +8,7 @@ lcd.light(1) def conway_step(): for x in range(128): # loop over x coordinates for y in range(32): # loop over y coordinates - # count number of neigbours + # count number of neighbours num_neighbours = (lcd.get(x - 1, y - 1) + lcd.get(x, y - 1) + lcd.get(x + 1, y - 1) + @@ -25,7 +25,7 @@ def conway_step(): if self and not (2 <= num_neighbours <= 3): lcd.pixel(x, y, 0) # not enough, or too many neighbours: cell dies elif not self and num_neighbours == 3: - lcd.pixel(x, y, 1) # exactly 3 neigbours around an empty cell: cell is born + lcd.pixel(x, y, 1) # exactly 3 neighbours around an empty cell: cell is born # randomise the start def conway_rand(): diff --git a/examples/embedding/Makefile.upylib b/examples/embedding/Makefile.upylib index 873c0fd34..4663ad30a 100644 --- a/examples/embedding/Makefile.upylib +++ b/examples/embedding/Makefile.upylib @@ -170,7 +170,7 @@ SRC_QSTR_AUTO_DEPS += include $(MPTOP)/py/mkrules.mk # Value of configure's --host= option (required for cross-compilation). -# Deduce it from CROSS_COMPILE by default, but can be overriden. +# Deduce it from CROSS_COMPILE by default, but can be overridden. ifneq ($(CROSS_COMPILE),) CROSS_COMPILE_HOST = --host=$(patsubst %-,%,$(CROSS_COMPILE)) else diff --git a/examples/embedding/README.md b/examples/embedding/README.md index 989ce1fc8..804dfede6 100644 --- a/examples/embedding/README.md +++ b/examples/embedding/README.md @@ -18,7 +18,7 @@ Building the example is as simple as running: It's worth to trace what's happening behind the scenes though: 1. As a first step, a MicroPython library is built. This is handled by a -seperate makefile, Makefile.upylib. It is more or less complex, but the +separate makefile, Makefile.upylib. It is more or less complex, but the good news is that you won't need to change anything in it, just use it as is, the main Makefile shows how. What may require editing though is a MicroPython configuration file. MicroPython is highly configurable, so diff --git a/extmod/modlwip.c b/extmod/modlwip.c index c72849cf9..47669cb3a 100644 --- a/extmod/modlwip.c +++ b/extmod/modlwip.c @@ -373,7 +373,7 @@ STATIC err_t _lwip_tcp_recv(void *arg, struct tcp_pcb *tcpb, struct pbuf *p, err } /*******************************************************************************/ -// Functions for socket send/recieve operations. Socket send/recv and friends call +// Functions for socket send/receive operations. Socket send/recv and friends call // these to do the work. // Helper function for send/sendto to handle UDP packets. @@ -805,7 +805,7 @@ STATIC mp_obj_t lwip_socket_connect(mp_obj_t self_in, mp_obj_t addr_in) { mp_raise_OSError(MP_EINPROGRESS); } } - // Register our recieve callback. + // Register our receive callback. tcp_recv(socket->pcb.tcp, _lwip_tcp_recv); socket->state = STATE_CONNECTING; err = tcp_connect(socket->pcb.tcp, &dest, port, _lwip_tcp_connected); diff --git a/extmod/modwebsocket.c b/extmod/modwebsocket.c index 8200ea708..9e17d6a6d 100644 --- a/extmod/modwebsocket.c +++ b/extmod/modwebsocket.c @@ -132,7 +132,7 @@ STATIC mp_uint_t websocket_read(mp_obj_t self_in, void *buf, mp_uint_t size, int self->buf_pos = 0; self->to_recv = to_recv; - self->msg_sz = sz; // May be overriden by FRAME_OPT + self->msg_sz = sz; // May be overridden by FRAME_OPT if (to_recv != 0) { self->state = FRAME_OPT; } else { diff --git a/lib/timeutils/timeutils.c b/lib/timeutils/timeutils.c index 0af39a295..06915f25a 100644 --- a/lib/timeutils/timeutils.c +++ b/lib/timeutils/timeutils.c @@ -165,7 +165,7 @@ mp_uint_t timeutils_mktime(mp_uint_t year, mp_int_t month, mp_int_t mday, // // tm_tomorrow = list(time.localtime()) // tm_tomorrow[2] += 1 # Adds 1 to mday - // tomorrow = time.mktime(tm_tommorrow) + // tomorrow = time.mktime(tm_tomorrow) // // And not have to worry about all the weird overflows. // diff --git a/lib/utils/stdout_helpers.c b/lib/utils/stdout_helpers.c index 5f7a17d32..3de119757 100644 --- a/lib/utils/stdout_helpers.c +++ b/lib/utils/stdout_helpers.c @@ -9,7 +9,7 @@ * implementation below can be used. */ -// Send "cooked" string of given length, where every occurance of +// Send "cooked" string of given length, where every occurrence of // LF character is replaced with CR LF. void mp_hal_stdout_tx_strn_cooked(const char *str, size_t len) { while (len--) { diff --git a/py/asmthumb.c b/py/asmthumb.c index 749c1e405..7e92e4de4 100644 --- a/py/asmthumb.c +++ b/py/asmthumb.c @@ -52,7 +52,7 @@ void asm_thumb_end_pass(asm_thumb_t *as) { #if defined(MCU_SERIES_F7) if (as->base.pass == MP_ASM_PASS_EMIT) { - // flush D-cache, so the code emited is stored in memory + // flush D-cache, so the code emitted is stored in memory SCB_CleanDCache_by_Addr((uint32_t*)as->base.code_base, as->base.code_size); // invalidate I-cache SCB_InvalidateICache(); diff --git a/py/builtinimport.c b/py/builtinimport.c index d01ebbe73..6994fc48f 100644 --- a/py/builtinimport.c +++ b/py/builtinimport.c @@ -271,7 +271,7 @@ mp_obj_t mp_builtin___import__(size_t n_args, const mp_obj_t *args) { if (level != 0) { // What we want to do here is to take name of current module, // chop trailing components, and concatenate with passed-in - // module name, thus resolving relative import name into absolue. + // module name, thus resolving relative import name into absolute. // This even appears to be correct per // http://legacy.python.org/dev/peps/pep-0328/#relative-imports-and-name // "Relative imports use a module's __name__ attribute to determine that @@ -441,7 +441,7 @@ mp_obj_t mp_builtin___import__(size_t n_args, const mp_obj_t *args) { #if MICROPY_CPYTHON_COMPAT // Store module as "__main__" in the dictionary of loaded modules (returned by sys.modules). mp_obj_dict_store(MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_loaded_modules_dict)), MP_OBJ_NEW_QSTR(MP_QSTR___main__), module_obj); - // Store real name in "__main__" attribute. Choosen semi-randonly, to reuse existing qstr's. + // Store real name in "__main__" attribute. Chosen semi-randonly, to reuse existing qstr's. mp_obj_dict_store(MP_OBJ_FROM_PTR(o->globals), MP_OBJ_NEW_QSTR(MP_QSTR___main__), MP_OBJ_NEW_QSTR(mod_name)); #endif } diff --git a/py/compile.c b/py/compile.c index 8533e0528..3b6a264d6 100644 --- a/py/compile.c +++ b/py/compile.c @@ -939,7 +939,7 @@ STATIC void c_del_stmt(compiler_t *comp, mp_parse_node_t pn) { } } } else { - // some arbitrary statment that we can't delete (eg del 1) + // some arbitrary statement that we can't delete (eg del 1) goto cannot_delete; } @@ -1090,7 +1090,7 @@ STATIC void compile_import_name(compiler_t *comp, mp_parse_node_struct_t *pns) { STATIC void compile_import_from(compiler_t *comp, mp_parse_node_struct_t *pns) { mp_parse_node_t pn_import_source = pns->nodes[0]; - // extract the preceeding .'s (if any) for a relative import, to compute the import level + // extract the preceding .'s (if any) for a relative import, to compute the import level uint import_level = 0; do { mp_parse_node_t pn_rel; diff --git a/py/misc.h b/py/misc.h index 146b9a8e4..caa5945bf 100644 --- a/py/misc.h +++ b/py/misc.h @@ -197,7 +197,7 @@ int DEBUG_printf(const char *fmt, ...); extern mp_uint_t mp_verbose_flag; // This is useful for unicode handling. Some CPU archs has -// special instructions for efficient implentation of this +// special instructions for efficient implementation of this // function (e.g. CLZ on ARM). // NOTE: this function is unused at the moment #ifndef count_lead_ones diff --git a/py/mkenv.mk b/py/mkenv.mk index eb1e44fef..b167b2533 100644 --- a/py/mkenv.mk +++ b/py/mkenv.mk @@ -32,7 +32,7 @@ ifeq ($(BUILD_VERBOSE),0) $(info Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.) endif -# default settings; can be overriden in main Makefile +# default settings; can be overridden in main Makefile PY_SRC ?= $(TOP)/py BUILD ?= build diff --git a/py/mpconfig.h b/py/mpconfig.h index a61d431e5..78e346d73 100644 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -32,7 +32,7 @@ // mpconfigport.h is a file containing configuration settings for a // particular port. mpconfigport.h is actually a default name for -// such config, and it can be overriden using MP_CONFIGFILE preprocessor +// such config, and it can be overridden using MP_CONFIGFILE preprocessor // define (you can do that by passing CFLAGS_EXTRA='-DMP_CONFIGFILE=""' // argument to make when using standard MicroPython makefiles). // This is useful to have more than one config per port, for example, diff --git a/py/obj.c b/py/obj.c index 98ffa930b..493945a22 100644 --- a/py/obj.c +++ b/py/obj.c @@ -401,7 +401,7 @@ mp_obj_t mp_obj_id(mp_obj_t o_in) { return MP_OBJ_NEW_SMALL_INT(id); } else { // If that didn't work, well, let's return long int, just as - // a (big) positve value, so it will never clash with the range + // a (big) positive value, so it will never clash with the range // of small int returned in previous case. return mp_obj_new_int_from_uint((mp_uint_t)id); } diff --git a/py/objstr.c b/py/objstr.c index 70de0a693..a1e223572 100644 --- a/py/objstr.c +++ b/py/objstr.c @@ -798,7 +798,7 @@ STATIC mp_obj_t str_uni_strip(int type, size_t n_args, const mp_obj_t *args) { } assert(last_good_char_pos >= first_good_char_pos); - //+1 to accomodate the last character + //+1 to accommodate the last character size_t stripped_len = last_good_char_pos - first_good_char_pos + 1; if (stripped_len == orig_str_len) { // If nothing was stripped, don't bother to dup original string @@ -1811,7 +1811,7 @@ STATIC mp_obj_t str_islower(mp_obj_t self_in) { } #if MICROPY_CPYTHON_COMPAT -// These methods are superfluous in the presense of str() and bytes() +// These methods are superfluous in the presence of str() and bytes() // constructors. // TODO: should accept kwargs too STATIC mp_obj_t bytes_decode(size_t n_args, const mp_obj_t *args) { diff --git a/py/py.mk b/py/py.mk index 5ff1fd6a6..70891677d 100644 --- a/py/py.mk +++ b/py/py.mk @@ -25,7 +25,7 @@ ifeq ($(MICROPY_SSL_AXTLS),1) CFLAGS_MOD += -DMICROPY_SSL_AXTLS=1 -I../lib/axtls/ssl -I../lib/axtls/crypto -I../lib/axtls/config LDFLAGS_MOD += -Lbuild -laxtls else ifeq ($(MICROPY_SSL_MBEDTLS),1) -# Can be overriden by ports which have "builtin" mbedTLS +# Can be overridden by ports which have "builtin" mbedTLS MICROPY_SSL_MBEDTLS_INCLUDE ?= ../lib/mbedtls/include CFLAGS_MOD += -DMICROPY_SSL_MBEDTLS=1 -I$(MICROPY_SSL_MBEDTLS_INCLUDE) LDFLAGS_MOD += -L../lib/mbedtls/library -lmbedx509 -lmbedtls -lmbedcrypto diff --git a/py/ringbuf.h b/py/ringbuf.h index 5662594f7..5e108afad 100644 --- a/py/ringbuf.h +++ b/py/ringbuf.h @@ -33,7 +33,7 @@ typedef struct _ringbuf_t { uint16_t iput; } ringbuf_t; -// Static initalization: +// Static initialization: // byte buf_array[N]; // ringbuf_t buf = {buf_array, sizeof(buf_array)}; diff --git a/py/stream.c b/py/stream.c index c915110e0..d3fc767bb 100644 --- a/py/stream.c +++ b/py/stream.c @@ -51,7 +51,7 @@ STATIC mp_obj_t stream_readall(mp_obj_t self_in); #define STREAM_CONTENT_TYPE(stream) (((stream)->is_text) ? &mp_type_str : &mp_type_bytes) // Returns error condition in *errcode, if non-zero, return value is number of bytes written -// before error condition occured. If *errcode == 0, returns total bytes written (which will +// before error condition occurred. If *errcode == 0, returns total bytes written (which will // be equal to input size). mp_uint_t mp_stream_rw(mp_obj_t stream, void *buf_, mp_uint_t size, int *errcode, byte flags) { byte *buf = buf_; diff --git a/py/vm.c b/py/vm.c index 5094e3e45..ad3d9e29c 100644 --- a/py/vm.c +++ b/py/vm.c @@ -947,7 +947,7 @@ unwind_jump:; DECODE_UINT; // unum & 0xff == n_positional // (unum >> 8) & 0xff == n_keyword - // We have folowing stack layout here: + // We have following stack layout here: // fun arg0 arg1 ... kw0 val0 kw1 val1 ... seq dict <- TOS sp -= (unum & 0xff) + ((unum >> 7) & 0x1fe) + 2; #if MICROPY_STACKLESS @@ -1018,7 +1018,7 @@ unwind_jump:; DECODE_UINT; // unum & 0xff == n_positional // (unum >> 8) & 0xff == n_keyword - // We have folowing stack layout here: + // We have following stack layout here: // fun self arg0 arg1 ... kw0 val0 kw1 val1 ... seq dict <- TOS sp -= (unum & 0xff) + ((unum >> 7) & 0x1fe) + 3; #if MICROPY_STACKLESS diff --git a/qemu-arm/README.md b/qemu-arm/README.md index 329ae4d92..0cf93c7d5 100644 --- a/qemu-arm/README.md +++ b/qemu-arm/README.md @@ -4,7 +4,7 @@ provided by QEMU (http://qemu.org). The purposes of this port are to enable: 1. Continuous integration - - run tests agains architecture-specific parts of code base + - run tests against architecture-specific parts of code base 2. Experimentation - simulation & prototyping of anything that has architecture-specific code diff --git a/tests/basics/namedtuple1.py b/tests/basics/namedtuple1.py index 132dcf96b..70372f7ca 100644 --- a/tests/basics/namedtuple1.py +++ b/tests/basics/namedtuple1.py @@ -76,7 +76,7 @@ T4 = namedtuple("TupTuple", ("foo", "bar")) t = T4(1, 2) print(t.foo, t.bar) -# Try single string with comma field seperator +# Try single string with comma field separator # Not implemented so far #T2 = namedtuple("TupComma", "foo,bar") #t = T2(1, 2) diff --git a/tests/basics/try_reraise2.py b/tests/basics/try_reraise2.py index d9434397c..5648d2467 100644 --- a/tests/basics/try_reraise2.py +++ b/tests/basics/try_reraise2.py @@ -1,4 +1,4 @@ -# Reraise not the latest occured exception +# Reraise not the latest occurred exception def f(): try: raise ValueError("val", 3) diff --git a/tests/pyb/can.py b/tests/pyb/can.py index 617eb7ccc..7f2d070ec 100644 --- a/tests/pyb/can.py +++ b/tests/pyb/can.py @@ -158,7 +158,7 @@ print(can.recv(1)) del can -# Testing asyncronous send +# Testing asynchronous send can = CAN(1, CAN.LOOPBACK) can.setfilter(0, CAN.MASK16, 0, (0, 0, 0, 0)) diff --git a/tests/thread/stress_aes.py b/tests/thread/stress_aes.py index ecc963c92..df75e616c 100644 --- a/tests/thread/stress_aes.py +++ b/tests/thread/stress_aes.py @@ -8,7 +8,7 @@ # # The AES code comes first (code originates from a C version authored by D.P.George) # and then the test harness at the bottom. It can be tuned to be more/less -# agressive by changing the amount of data to encrypt, the number of loops and +# aggressive by changing the amount of data to encrypt, the number of loops and # the number of threads. # # MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd diff --git a/tests/wipy/uart.py b/tests/wipy/uart.py index a3a1c14e8..8e794015d 100644 --- a/tests/wipy/uart.py +++ b/tests/wipy/uart.py @@ -95,7 +95,7 @@ print(uart1.read() == None) print(uart1.write(b'123') == 3) print(uart0.read() == b'123') -# no pin assignemnt +# no pin assignment uart0 = UART(0, 1000000, pins=(None, None)) print(uart0.write(b'123456789') == 9) print(uart1.read() == None) diff --git a/tools/insert-usb-ids.py b/tools/insert-usb-ids.py index 420db34c5..cdccd3be9 100644 --- a/tools/insert-usb-ids.py +++ b/tools/insert-usb-ids.py @@ -1,4 +1,4 @@ -# Reads the USB VID and PID from the file specifed by sys.arg[1] and then +# Reads the USB VID and PID from the file specified by sys.argv[1] and then # inserts those values into the template file specified by sys.argv[2], # printing the result to stdout diff --git a/tools/pyboard.py b/tools/pyboard.py index 5eac030bd..921ffc52d 100755 --- a/tools/pyboard.py +++ b/tools/pyboard.py @@ -69,7 +69,7 @@ class TelnetToSerial: self.tn.write(bytes(password, 'ascii') + b"\r\n") if b'for more information.' in self.tn.read_until(b'Type "help()" for more information.', timeout=read_timeout): - # login succesful + # login successful from collections import deque self.fifo = deque() return diff --git a/unix/Makefile b/unix/Makefile index 837ddf2b7..006bce0ef 100644 --- a/unix/Makefile +++ b/unix/Makefile @@ -262,7 +262,7 @@ coverage_test: coverage gcov -o build-coverage/extmod ../extmod/*.c # Value of configure's --host= option (required for cross-compilation). -# Deduce it from CROSS_COMPILE by default, but can be overriden. +# Deduce it from CROSS_COMPILE by default, but can be overridden. ifneq ($(CROSS_COMPILE),) CROSS_COMPILE_HOST = --host=$(patsubst %-,%,$(CROSS_COMPILE)) else diff --git a/unix/modsocket.c b/unix/modsocket.c index 9ca04b88b..c7be6461e 100644 --- a/unix/modsocket.c +++ b/unix/modsocket.c @@ -58,7 +58,7 @@ from socket_more_funcs2 import * ------------------- I.e. this module should stay lean, and more functions (if needed) - should be add to seperate modules (C or Python level). + should be add to separate modules (C or Python level). */ #define MICROPY_SOCKET_EXTRA (0) diff --git a/windows/windows_mphal.c b/windows/windows_mphal.c index 1dd3105d8..a73140e54 100644 --- a/windows/windows_mphal.c +++ b/windows/windows_mphal.c @@ -72,7 +72,7 @@ void mp_hal_stdio_mode_orig(void) { // Previous versions of the mp_hal code would install a handler whenever Ctrl-C input is // allowed and remove the handler again when it is not. That is not necessary though (1), // and it might introduce problems (2) because console notifications are delivered to the -// application in a seperate thread. +// application in a separate thread. // (1) mp_hal_set_interrupt_char effectively enables/disables processing of Ctrl-C via the // ENABLE_PROCESSED_INPUT flag so in raw mode console_sighandler won't be called. // (2) if mp_hal_set_interrupt_char would remove the handler while Ctrl-C was issued earlier, diff --git a/zephyr/modutime.c b/zephyr/modutime.c index 378068bb3..0c268046a 100644 --- a/zephyr/modutime.c +++ b/zephyr/modutime.c @@ -36,7 +36,7 @@ #include "extmod/utime_mphal.h" STATIC mp_obj_t mod_time_time(void) { - /* The absense of FP support is deliberate. The Zephyr port uses + /* The absence of FP support is deliberate. The Zephyr port uses * single precision floats so the fraction component will start to * lose precision on devices with a long uptime. */ -- cgit v1.2.3 From 85d809d1f4e35a511e0a56b3411126e05a31c01b Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Sat, 10 Jun 2017 20:14:16 +0300 Subject: tests: Convert remaining "sys.exit()" to "raise SystemExit". --- tests/extmod/btree1.py | 3 +-- tests/extmod/framebuf1.py | 3 +-- tests/extmod/framebuf16.py | 3 +-- tests/extmod/framebuf4.py | 3 +-- tests/extmod/machine1.py | 3 +-- tests/extmod/machine_pinbase.py | 3 +-- tests/extmod/machine_pulse.py | 3 +-- tests/extmod/machine_signal.py | 3 +-- tests/extmod/time_ms_us.py | 3 +-- tests/extmod/ubinascii_a2b_base64.py | 3 +-- tests/extmod/ubinascii_b2a_base64.py | 3 +-- tests/extmod/ubinascii_crc32.py | 6 ++---- tests/extmod/ubinascii_hexlify.py | 3 +-- tests/extmod/ubinascii_micropython.py | 3 +-- tests/extmod/ubinascii_unhexlify.py | 3 +-- tests/extmod/uctypes_32bit_intbig.py | 3 +-- tests/extmod/uctypes_array_assign_le.py | 3 +-- tests/extmod/uctypes_array_assign_native_le.py | 4 ++-- tests/extmod/uctypes_array_assign_native_le_intbig.py | 4 ++-- tests/extmod/uctypes_bytearray.py | 3 +-- tests/extmod/uctypes_le.py | 3 +-- tests/extmod/uctypes_le_float.py | 3 +-- tests/extmod/uctypes_native_float.py | 3 +-- tests/extmod/uctypes_native_le.py | 4 ++-- tests/extmod/uctypes_print.py | 3 +-- tests/extmod/uctypes_ptr_le.py | 4 ++-- tests/extmod/uctypes_ptr_native_le.py | 4 ++-- tests/extmod/uctypes_sizeof.py | 3 +-- tests/extmod/uctypes_sizeof_native.py | 3 +-- tests/extmod/uhashlib_sha1.py | 5 ++--- tests/extmod/uhashlib_sha256.py | 3 +-- tests/extmod/uheapq1.py | 3 +-- tests/extmod/ujson_dumps.py | 3 +-- tests/extmod/ujson_dumps_extra.py | 3 +-- tests/extmod/ujson_dumps_float.py | 3 +-- tests/extmod/ujson_load.py | 3 +-- tests/extmod/ujson_loads.py | 3 +-- tests/extmod/ujson_loads_float.py | 3 +-- tests/extmod/urandom_basic.py | 3 +-- tests/extmod/urandom_extra.py | 6 ++---- tests/extmod/ure1.py | 3 +-- tests/extmod/ure_debug.py | 3 +-- tests/extmod/ure_error.py | 3 +-- tests/extmod/ure_group.py | 3 +-- tests/extmod/ure_namedclass.py | 3 +-- tests/extmod/ure_split.py | 3 +-- tests/extmod/ure_split_empty.py | 3 +-- tests/extmod/ure_split_notimpl.py | 3 +-- tests/extmod/ussl_basic.py | 3 +-- tests/extmod/utimeq1.py | 3 +-- tests/extmod/utimeq_stable.py | 3 +-- tests/extmod/uzlib_decompio.py | 3 +-- tests/extmod/uzlib_decompio_gz.py | 3 +-- tests/extmod/uzlib_decompress.py | 3 +-- tests/extmod/vfs_basic.py | 3 +-- tests/extmod/vfs_fat_fileio1.py | 7 +++---- tests/extmod/vfs_fat_fileio2.py | 7 +++---- tests/extmod/vfs_fat_more.py | 7 +++---- tests/extmod/vfs_fat_oldproto.py | 7 +++---- tests/extmod/vfs_fat_ramdisk.py | 7 +++---- tests/extmod/websocket_basic.py | 3 +-- tests/io/buffered_writer.py | 3 +-- tests/io/open_append.py | 3 +-- tests/io/open_plus.py | 3 +-- tests/io/resource_stream.py | 2 +- tests/io/write_ext.py | 3 +-- tests/jni/list.py | 3 +-- tests/jni/object.py | 3 +-- tests/jni/system_out.py | 3 +-- tests/micropython/heapalloc_bytesio.py | 3 +-- tests/micropython/heapalloc_iter.py | 3 +-- tests/micropython/heapalloc_traceback.py | 3 +-- tests/micropython/heapalloc_traceback.py.exp | 2 +- tests/micropython/kbd_intr.py | 3 +-- tests/micropython/schedule.py | 3 +-- tests/misc/non_compliant.py | 3 +-- tests/misc/print_exception.py | 2 +- tests/misc/recursive_data.py | 3 +-- tests/misc/recursive_iternext.py | 3 +-- tests/misc/sys_exc_info.py | 2 +- tests/pyb/can.py | 3 +-- tests/pyb/dac.py | 3 +-- tests/pyb/pyb_f405.py | 3 +-- tests/pyb/pyb_f411.py | 3 +-- tests/unix/extra_coverage.py | 3 +-- tests/unix/ffi_callback.py | 3 +-- tests/unix/ffi_float.py | 3 +-- tests/unix/ffi_float2.py | 5 ++--- 88 files changed, 107 insertions(+), 188 deletions(-) (limited to 'tests/pyb') diff --git a/tests/extmod/btree1.py b/tests/extmod/btree1.py index 2127554db..59638ef0a 100644 --- a/tests/extmod/btree1.py +++ b/tests/extmod/btree1.py @@ -4,8 +4,7 @@ try: import uerrno except ImportError: print("SKIP") - import sys - sys.exit() + raise SystemExit #f = open("_test.db", "w+b") f = uio.BytesIO() diff --git a/tests/extmod/framebuf1.py b/tests/extmod/framebuf1.py index 990b0b120..2c1366522 100644 --- a/tests/extmod/framebuf1.py +++ b/tests/extmod/framebuf1.py @@ -2,8 +2,7 @@ try: import framebuf except ImportError: print("SKIP") - import sys - sys.exit() + raise SystemExit w = 5 h = 16 diff --git a/tests/extmod/framebuf16.py b/tests/extmod/framebuf16.py index 3aa1d34de..fe81f7f93 100644 --- a/tests/extmod/framebuf16.py +++ b/tests/extmod/framebuf16.py @@ -2,8 +2,7 @@ try: import framebuf except ImportError: print("SKIP") - import sys - sys.exit() + raise SystemExit def printbuf(): print("--8<--") diff --git a/tests/extmod/framebuf4.py b/tests/extmod/framebuf4.py index 641f5bfc5..8358fa55b 100644 --- a/tests/extmod/framebuf4.py +++ b/tests/extmod/framebuf4.py @@ -2,8 +2,7 @@ try: import framebuf except ImportError: print("SKIP") - import sys - sys.exit() + raise SystemExit def printbuf(): print("--8<--") diff --git a/tests/extmod/machine1.py b/tests/extmod/machine1.py index e0c561168..6ff38cc05 100644 --- a/tests/extmod/machine1.py +++ b/tests/extmod/machine1.py @@ -8,8 +8,7 @@ try: machine.mem8 except: print("SKIP") - import sys - sys.exit() + raise SystemExit print(machine.mem8) diff --git a/tests/extmod/machine_pinbase.py b/tests/extmod/machine_pinbase.py index 5e82823ec..e91775504 100644 --- a/tests/extmod/machine_pinbase.py +++ b/tests/extmod/machine_pinbase.py @@ -6,8 +6,7 @@ try: machine.PinBase except AttributeError: print("SKIP") - import sys - sys.exit() + raise SystemExit class MyPin(machine.PinBase): diff --git a/tests/extmod/machine_pulse.py b/tests/extmod/machine_pulse.py index 6491b5409..d525974e0 100644 --- a/tests/extmod/machine_pulse.py +++ b/tests/extmod/machine_pulse.py @@ -7,8 +7,7 @@ try: machine.time_pulse_us except AttributeError: print("SKIP") - import sys - sys.exit() + raise SystemExit class ConstPin(machine.PinBase): diff --git a/tests/extmod/machine_signal.py b/tests/extmod/machine_signal.py index 96b8f43c7..53f4f5890 100644 --- a/tests/extmod/machine_signal.py +++ b/tests/extmod/machine_signal.py @@ -9,8 +9,7 @@ try: machine.Signal except AttributeError: print("SKIP") - import sys - sys.exit() + raise SystemExit class Pin(machine.PinBase): def __init__(self): diff --git a/tests/extmod/time_ms_us.py b/tests/extmod/time_ms_us.py index 2078f1bb5..31f07d31b 100644 --- a/tests/extmod/time_ms_us.py +++ b/tests/extmod/time_ms_us.py @@ -1,10 +1,9 @@ -import sys import utime try: utime.sleep_ms except AttributeError: print("SKIP") - sys.exit() + raise SystemExit utime.sleep_ms(1) utime.sleep_us(1) diff --git a/tests/extmod/ubinascii_a2b_base64.py b/tests/extmod/ubinascii_a2b_base64.py index 58eb0b50b..b35f26591 100644 --- a/tests/extmod/ubinascii_a2b_base64.py +++ b/tests/extmod/ubinascii_a2b_base64.py @@ -4,9 +4,8 @@ try: except ImportError: import binascii except ImportError: - import sys print("SKIP") - sys.exit() + raise SystemExit print(binascii.a2b_base64(b'')) print(binascii.a2b_base64(b'Zg==')) diff --git a/tests/extmod/ubinascii_b2a_base64.py b/tests/extmod/ubinascii_b2a_base64.py index 1c0c30311..f4bb69fe0 100644 --- a/tests/extmod/ubinascii_b2a_base64.py +++ b/tests/extmod/ubinascii_b2a_base64.py @@ -4,9 +4,8 @@ try: except ImportError: import binascii except ImportError: - import sys print("SKIP") - sys.exit() + raise SystemExit print(binascii.b2a_base64(b'')) print(binascii.b2a_base64(b'f')) diff --git a/tests/extmod/ubinascii_crc32.py b/tests/extmod/ubinascii_crc32.py index b82c44d6b..89664a9b3 100644 --- a/tests/extmod/ubinascii_crc32.py +++ b/tests/extmod/ubinascii_crc32.py @@ -4,16 +4,14 @@ try: except ImportError: import binascii except ImportError: - import sys print("SKIP") - sys.exit() + raise SystemExit try: binascii.crc32 except AttributeError: print("SKIP") - import sys - sys.exit() + raise SystemExit print(hex(binascii.crc32(b'The quick brown fox jumps over the lazy dog'))) print(hex(binascii.crc32(b'\x00' * 32))) diff --git a/tests/extmod/ubinascii_hexlify.py b/tests/extmod/ubinascii_hexlify.py index 5d70bda96..bc9928747 100644 --- a/tests/extmod/ubinascii_hexlify.py +++ b/tests/extmod/ubinascii_hexlify.py @@ -4,9 +4,8 @@ try: except ImportError: import binascii except ImportError: - import sys print("SKIP") - sys.exit() + raise SystemExit print(binascii.hexlify(b'\x00\x01\x02\x03\x04\x05\x06\x07')) print(binascii.hexlify(b'\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f')) diff --git a/tests/extmod/ubinascii_micropython.py b/tests/extmod/ubinascii_micropython.py index 96f566bd1..a4c00a2cb 100644 --- a/tests/extmod/ubinascii_micropython.py +++ b/tests/extmod/ubinascii_micropython.py @@ -4,9 +4,8 @@ try: except ImportError: import binascii except ImportError: - import sys print("SKIP") - sys.exit() + raise SystemExit # two arguments supported in uPy but not CPython a = binascii.hexlify(b'123', ':') diff --git a/tests/extmod/ubinascii_unhexlify.py b/tests/extmod/ubinascii_unhexlify.py index e669789ba..865abfe3a 100644 --- a/tests/extmod/ubinascii_unhexlify.py +++ b/tests/extmod/ubinascii_unhexlify.py @@ -4,9 +4,8 @@ try: except ImportError: import binascii except ImportError: - import sys print("SKIP") - sys.exit() + raise SystemExit print(binascii.unhexlify(b'0001020304050607')) print(binascii.unhexlify(b'08090a0b0c0d0e0f')) diff --git a/tests/extmod/uctypes_32bit_intbig.py b/tests/extmod/uctypes_32bit_intbig.py index a082dc370..6b4d3d76c 100644 --- a/tests/extmod/uctypes_32bit_intbig.py +++ b/tests/extmod/uctypes_32bit_intbig.py @@ -3,9 +3,8 @@ try: import uctypes except ImportError: - import sys print("SKIP") - sys.exit() + raise SystemExit buf = b"12345678abcd" struct = uctypes.struct( diff --git a/tests/extmod/uctypes_array_assign_le.py b/tests/extmod/uctypes_array_assign_le.py index bae467d09..6afa7e0a2 100644 --- a/tests/extmod/uctypes_array_assign_le.py +++ b/tests/extmod/uctypes_array_assign_le.py @@ -1,9 +1,8 @@ try: import uctypes except ImportError: - import sys print("SKIP") - sys.exit() + raise SystemExit desc = { # arr is array at offset 0, of UINT8 elements, array size is 2 diff --git a/tests/extmod/uctypes_array_assign_native_le.py b/tests/extmod/uctypes_array_assign_native_le.py index f0ecc0dad..a538bf9ad 100644 --- a/tests/extmod/uctypes_array_assign_native_le.py +++ b/tests/extmod/uctypes_array_assign_native_le.py @@ -3,11 +3,11 @@ try: import uctypes except ImportError: print("SKIP") - sys.exit() + raise SystemExit if sys.byteorder != "little": print("SKIP") - sys.exit() + raise SystemExit desc = { # arr is array at offset 0, of UINT8 elements, array size is 2 diff --git a/tests/extmod/uctypes_array_assign_native_le_intbig.py b/tests/extmod/uctypes_array_assign_native_le_intbig.py index f29a3b66e..84dfba0e2 100644 --- a/tests/extmod/uctypes_array_assign_native_le_intbig.py +++ b/tests/extmod/uctypes_array_assign_native_le_intbig.py @@ -3,11 +3,11 @@ try: import uctypes except ImportError: print("SKIP") - sys.exit() + raise SystemExit if sys.byteorder != "little": print("SKIP") - sys.exit() + raise SystemExit desc = { # arr is array at offset 0, of UINT8 elements, array size is 2 diff --git a/tests/extmod/uctypes_bytearray.py b/tests/extmod/uctypes_bytearray.py index bf7845ab2..61c7da271 100644 --- a/tests/extmod/uctypes_bytearray.py +++ b/tests/extmod/uctypes_bytearray.py @@ -1,9 +1,8 @@ try: import uctypes except ImportError: - import sys print("SKIP") - sys.exit() + raise SystemExit desc = { "arr": (uctypes.ARRAY | 0, uctypes.UINT8 | 2), diff --git a/tests/extmod/uctypes_le.py b/tests/extmod/uctypes_le.py index 829beda58..7df5ac090 100644 --- a/tests/extmod/uctypes_le.py +++ b/tests/extmod/uctypes_le.py @@ -1,9 +1,8 @@ try: import uctypes except ImportError: - import sys print("SKIP") - sys.exit() + raise SystemExit desc = { "s0": uctypes.UINT16 | 0, diff --git a/tests/extmod/uctypes_le_float.py b/tests/extmod/uctypes_le_float.py index a61305ba8..84ff2b84c 100644 --- a/tests/extmod/uctypes_le_float.py +++ b/tests/extmod/uctypes_le_float.py @@ -1,9 +1,8 @@ try: import uctypes except ImportError: - import sys print("SKIP") - sys.exit() + raise SystemExit desc = { "f32": uctypes.FLOAT32 | 0, diff --git a/tests/extmod/uctypes_native_float.py b/tests/extmod/uctypes_native_float.py index 80cb54383..acef47036 100644 --- a/tests/extmod/uctypes_native_float.py +++ b/tests/extmod/uctypes_native_float.py @@ -1,9 +1,8 @@ try: import uctypes except ImportError: - import sys print("SKIP") - sys.exit() + raise SystemExit desc = { "f32": uctypes.FLOAT32 | 0, diff --git a/tests/extmod/uctypes_native_le.py b/tests/extmod/uctypes_native_le.py index 5900224d4..8bba03b38 100644 --- a/tests/extmod/uctypes_native_le.py +++ b/tests/extmod/uctypes_native_le.py @@ -6,11 +6,11 @@ try: import uctypes except ImportError: print("SKIP") - sys.exit() + raise SystemExit if sys.byteorder != "little": print("SKIP") - sys.exit() + raise SystemExit desc = { diff --git a/tests/extmod/uctypes_print.py b/tests/extmod/uctypes_print.py index 76a009dc7..c310238e5 100644 --- a/tests/extmod/uctypes_print.py +++ b/tests/extmod/uctypes_print.py @@ -2,9 +2,8 @@ try: import uctypes except ImportError: - import sys print("SKIP") - sys.exit() + raise SystemExit # we use an address of "0" because we just want to print something deterministic # and don't actually need to set/get any values in the struct diff --git a/tests/extmod/uctypes_ptr_le.py b/tests/extmod/uctypes_ptr_le.py index e8a6243ce..056e45650 100644 --- a/tests/extmod/uctypes_ptr_le.py +++ b/tests/extmod/uctypes_ptr_le.py @@ -3,11 +3,11 @@ try: import uctypes except ImportError: print("SKIP") - sys.exit() + raise SystemExit if sys.byteorder != "little": print("SKIP") - sys.exit() + raise SystemExit desc = { "ptr": (uctypes.PTR | 0, uctypes.UINT8), diff --git a/tests/extmod/uctypes_ptr_native_le.py b/tests/extmod/uctypes_ptr_native_le.py index 9b016c04d..24508b1cb 100644 --- a/tests/extmod/uctypes_ptr_native_le.py +++ b/tests/extmod/uctypes_ptr_native_le.py @@ -3,11 +3,11 @@ try: import uctypes except ImportError: print("SKIP") - sys.exit() + raise SystemExit if sys.byteorder != "little": print("SKIP") - sys.exit() + raise SystemExit desc = { diff --git a/tests/extmod/uctypes_sizeof.py b/tests/extmod/uctypes_sizeof.py index 266cd0694..5a6adb437 100644 --- a/tests/extmod/uctypes_sizeof.py +++ b/tests/extmod/uctypes_sizeof.py @@ -1,9 +1,8 @@ try: import uctypes except ImportError: - import sys print("SKIP") - sys.exit() + raise SystemExit desc = { # arr is array at offset 0, of UINT8 elements, array size is 2 diff --git a/tests/extmod/uctypes_sizeof_native.py b/tests/extmod/uctypes_sizeof_native.py index f676c8c6d..32c740e77 100644 --- a/tests/extmod/uctypes_sizeof_native.py +++ b/tests/extmod/uctypes_sizeof_native.py @@ -1,9 +1,8 @@ try: import uctypes except ImportError: - import sys print("SKIP") - sys.exit() + raise SystemExit S1 = {} assert uctypes.sizeof(S1) == 0 diff --git a/tests/extmod/uhashlib_sha1.py b/tests/extmod/uhashlib_sha1.py index f12fc649a..4f7066899 100644 --- a/tests/extmod/uhashlib_sha1.py +++ b/tests/extmod/uhashlib_sha1.py @@ -1,4 +1,3 @@ -import sys try: import uhashlib as hashlib except ImportError: @@ -8,14 +7,14 @@ except ImportError: # This is neither uPy, nor cPy, so must be uPy with # uhashlib module disabled. print("SKIP") - sys.exit() + raise SystemExit try: hashlib.sha1 except AttributeError: # SHA1 is only available on some ports print("SKIP") - sys.exit() + raise SystemExit sha1 = hashlib.sha1(b'hello') sha1.update(b'world') diff --git a/tests/extmod/uhashlib_sha256.py b/tests/extmod/uhashlib_sha256.py index ff51f2ffa..3200e8f5c 100644 --- a/tests/extmod/uhashlib_sha256.py +++ b/tests/extmod/uhashlib_sha256.py @@ -1,4 +1,3 @@ -import sys try: import uhashlib as hashlib except ImportError: @@ -8,7 +7,7 @@ except ImportError: # This is neither uPy, nor cPy, so must be uPy with # uhashlib module disabled. print("SKIP") - sys.exit() + raise SystemExit h = hashlib.sha256() diff --git a/tests/extmod/uheapq1.py b/tests/extmod/uheapq1.py index 4b0e5de57..7c1fe4e1e 100644 --- a/tests/extmod/uheapq1.py +++ b/tests/extmod/uheapq1.py @@ -4,9 +4,8 @@ except: try: import heapq except ImportError: - import sys print("SKIP") - sys.exit() + raise SystemExit try: heapq.heappop([]) diff --git a/tests/extmod/ujson_dumps.py b/tests/extmod/ujson_dumps.py index 4a02f5170..d73271801 100644 --- a/tests/extmod/ujson_dumps.py +++ b/tests/extmod/ujson_dumps.py @@ -4,9 +4,8 @@ except ImportError: try: import json except ImportError: - import sys print("SKIP") - sys.exit() + raise SystemExit print(json.dumps(False)) print(json.dumps(True)) diff --git a/tests/extmod/ujson_dumps_extra.py b/tests/extmod/ujson_dumps_extra.py index a52e8224c..21a388c32 100644 --- a/tests/extmod/ujson_dumps_extra.py +++ b/tests/extmod/ujson_dumps_extra.py @@ -3,8 +3,7 @@ try: import ujson except ImportError: - import sys print("SKIP") - sys.exit() + raise SystemExit print(ujson.dumps(b'1234')) diff --git a/tests/extmod/ujson_dumps_float.py b/tests/extmod/ujson_dumps_float.py index d949ea6dd..e8cceb6f1 100644 --- a/tests/extmod/ujson_dumps_float.py +++ b/tests/extmod/ujson_dumps_float.py @@ -4,8 +4,7 @@ except ImportError: try: import json except ImportError: - import sys print("SKIP") - sys.exit() + raise SystemExit print(json.dumps(1.2)) diff --git a/tests/extmod/ujson_load.py b/tests/extmod/ujson_load.py index 901132a5f..9725ab2dd 100644 --- a/tests/extmod/ujson_load.py +++ b/tests/extmod/ujson_load.py @@ -6,9 +6,8 @@ except: from io import StringIO import json except ImportError: - import sys print("SKIP") - sys.exit() + raise SystemExit print(json.load(StringIO('null'))) print(json.load(StringIO('"abc\\u0064e"'))) diff --git a/tests/extmod/ujson_loads.py b/tests/extmod/ujson_loads.py index b2e18e3af..adba3c068 100644 --- a/tests/extmod/ujson_loads.py +++ b/tests/extmod/ujson_loads.py @@ -4,9 +4,8 @@ except ImportError: try: import json except ImportError: - import sys print("SKIP") - sys.exit() + raise SystemExit def my_print(o): if isinstance(o, dict): diff --git a/tests/extmod/ujson_loads_float.py b/tests/extmod/ujson_loads_float.py index b20a412ff..f1b8cc364 100644 --- a/tests/extmod/ujson_loads_float.py +++ b/tests/extmod/ujson_loads_float.py @@ -4,9 +4,8 @@ except ImportError: try: import json except ImportError: - import sys print("SKIP") - sys.exit() + raise SystemExit def my_print(o): print('%.3f' % o) diff --git a/tests/extmod/urandom_basic.py b/tests/extmod/urandom_basic.py index 885b8517f..57e6b26cb 100644 --- a/tests/extmod/urandom_basic.py +++ b/tests/extmod/urandom_basic.py @@ -4,9 +4,8 @@ except ImportError: try: import random except ImportError: - import sys print("SKIP") - sys.exit() + 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_extra.py b/tests/extmod/urandom_extra.py index 925dd0dbc..f5a34e168 100644 --- a/tests/extmod/urandom_extra.py +++ b/tests/extmod/urandom_extra.py @@ -4,16 +4,14 @@ except ImportError: try: import random except ImportError: - import sys print("SKIP") - sys.exit() + raise SystemExit try: random.randint except AttributeError: - import sys print('SKIP') - sys.exit() + raise SystemExit print('randrange') for i in range(50): diff --git a/tests/extmod/ure1.py b/tests/extmod/ure1.py index a867f1751..1f38b8087 100644 --- a/tests/extmod/ure1.py +++ b/tests/extmod/ure1.py @@ -4,9 +4,8 @@ except ImportError: try: import re except ImportError: - import sys print("SKIP") - sys.exit() + raise SystemExit r = re.compile(".+") m = r.match("abc") diff --git a/tests/extmod/ure_debug.py b/tests/extmod/ure_debug.py index 252df21e3..cfb264bb6 100644 --- a/tests/extmod/ure_debug.py +++ b/tests/extmod/ure_debug.py @@ -2,8 +2,7 @@ try: import ure except ImportError: - import sys print("SKIP") - sys.exit() + raise SystemExit ure.compile('^a|b[0-9]\w$', ure.DEBUG) diff --git a/tests/extmod/ure_error.py b/tests/extmod/ure_error.py index 3f16f9158..f52f735c7 100644 --- a/tests/extmod/ure_error.py +++ b/tests/extmod/ure_error.py @@ -6,9 +6,8 @@ except ImportError: try: import re except ImportError: - import sys print("SKIP") - sys.exit() + raise SystemExit def test_re(r): try: diff --git a/tests/extmod/ure_group.py b/tests/extmod/ure_group.py index 98aae2a73..4e39468c5 100644 --- a/tests/extmod/ure_group.py +++ b/tests/extmod/ure_group.py @@ -6,9 +6,8 @@ except ImportError: try: import re except ImportError: - import sys print("SKIP") - sys.exit() + raise SystemExit def print_groups(match): print('----') diff --git a/tests/extmod/ure_namedclass.py b/tests/extmod/ure_namedclass.py index e233f17c8..215d09613 100644 --- a/tests/extmod/ure_namedclass.py +++ b/tests/extmod/ure_namedclass.py @@ -6,9 +6,8 @@ except ImportError: try: import re except ImportError: - import sys print("SKIP") - sys.exit() + raise SystemExit def print_groups(match): print('----') diff --git a/tests/extmod/ure_split.py b/tests/extmod/ure_split.py index 1e411c27c..317ca9892 100644 --- a/tests/extmod/ure_split.py +++ b/tests/extmod/ure_split.py @@ -4,9 +4,8 @@ except ImportError: try: import re except ImportError: - import sys print("SKIP") - sys.exit() + raise SystemExit r = re.compile(" ") s = r.split("a b c foobar") diff --git a/tests/extmod/ure_split_empty.py b/tests/extmod/ure_split_empty.py index ad6334eba..76ce97ea6 100644 --- a/tests/extmod/ure_split_empty.py +++ b/tests/extmod/ure_split_empty.py @@ -7,9 +7,8 @@ try: import ure as re except ImportError: - import sys print("SKIP") - sys.exit() + raise SystemExit r = re.compile(" *") s = r.split("a b c foobar") diff --git a/tests/extmod/ure_split_notimpl.py b/tests/extmod/ure_split_notimpl.py index eca3ea512..da6e9652d 100644 --- a/tests/extmod/ure_split_notimpl.py +++ b/tests/extmod/ure_split_notimpl.py @@ -1,9 +1,8 @@ try: import ure as re except ImportError: - import sys print("SKIP") - sys.exit() + raise SystemExit r = re.compile('( )') try: diff --git a/tests/extmod/ussl_basic.py b/tests/extmod/ussl_basic.py index e9d435bca..9f8019a0b 100644 --- a/tests/extmod/ussl_basic.py +++ b/tests/extmod/ussl_basic.py @@ -5,8 +5,7 @@ try: import ussl as ssl except ImportError: print("SKIP") - import sys - sys.exit() + raise SystemExit # create in client mode try: diff --git a/tests/extmod/utimeq1.py b/tests/extmod/utimeq1.py index 68d69e25e..dc7f3b660 100644 --- a/tests/extmod/utimeq1.py +++ b/tests/extmod/utimeq1.py @@ -5,8 +5,7 @@ try: from utimeq import utimeq except ImportError: print("SKIP") - import sys - sys.exit() + raise SystemExit DEBUG = 0 diff --git a/tests/extmod/utimeq_stable.py b/tests/extmod/utimeq_stable.py index 9f6ba76d4..9fb522d51 100644 --- a/tests/extmod/utimeq_stable.py +++ b/tests/extmod/utimeq_stable.py @@ -2,8 +2,7 @@ try: from utimeq import utimeq except ImportError: print("SKIP") - import sys - sys.exit() + raise SystemExit h = utimeq(10) diff --git a/tests/extmod/uzlib_decompio.py b/tests/extmod/uzlib_decompio.py index 6f07c048c..112a82597 100644 --- a/tests/extmod/uzlib_decompio.py +++ b/tests/extmod/uzlib_decompio.py @@ -2,9 +2,8 @@ try: import uzlib as zlib import uio as io except ImportError: - import sys print("SKIP") - sys.exit() + raise SystemExit # Raw DEFLATE bitstream diff --git a/tests/extmod/uzlib_decompio_gz.py b/tests/extmod/uzlib_decompio_gz.py index 7572e9693..02087f763 100644 --- a/tests/extmod/uzlib_decompio_gz.py +++ b/tests/extmod/uzlib_decompio_gz.py @@ -2,9 +2,8 @@ try: import uzlib as zlib import uio as io except ImportError: - import sys print("SKIP") - sys.exit() + raise SystemExit # gzip bitstream diff --git a/tests/extmod/uzlib_decompress.py b/tests/extmod/uzlib_decompress.py index 10121ee7e..63247955c 100644 --- a/tests/extmod/uzlib_decompress.py +++ b/tests/extmod/uzlib_decompress.py @@ -4,9 +4,8 @@ except ImportError: try: import uzlib as zlib except ImportError: - import sys print("SKIP") - sys.exit() + raise SystemExit PATTERNS = [ # Packed results produced by CPy's zlib.compress() diff --git a/tests/extmod/vfs_basic.py b/tests/extmod/vfs_basic.py index fc016b8d5..995874824 100644 --- a/tests/extmod/vfs_basic.py +++ b/tests/extmod/vfs_basic.py @@ -9,8 +9,7 @@ try: uos.mount except (ImportError, AttributeError): print("SKIP") - import sys - sys.exit() + raise SystemExit class Filesystem: diff --git a/tests/extmod/vfs_fat_fileio1.py b/tests/extmod/vfs_fat_fileio1.py index 9036df7a5..d19df120b 100644 --- a/tests/extmod/vfs_fat_fileio1.py +++ b/tests/extmod/vfs_fat_fileio1.py @@ -1,4 +1,3 @@ -import sys try: import uerrno try: @@ -8,13 +7,13 @@ try: import uos except ImportError: print("SKIP") - sys.exit() + raise SystemExit try: uos.VfsFat except AttributeError: print("SKIP") - sys.exit() + raise SystemExit class RAMFS: @@ -46,7 +45,7 @@ try: bdev = RAMFS(50) except MemoryError: print("SKIP") - sys.exit() + raise SystemExit uos.VfsFat.mkfs(bdev) vfs = uos.VfsFat(bdev) diff --git a/tests/extmod/vfs_fat_fileio2.py b/tests/extmod/vfs_fat_fileio2.py index b2a0ba70f..b5adb75c9 100644 --- a/tests/extmod/vfs_fat_fileio2.py +++ b/tests/extmod/vfs_fat_fileio2.py @@ -1,4 +1,3 @@ -import sys try: import uerrno try: @@ -8,13 +7,13 @@ try: import uos except ImportError: print("SKIP") - sys.exit() + raise SystemExit try: uos.VfsFat except AttributeError: print("SKIP") - sys.exit() + raise SystemExit class RAMFS: @@ -46,7 +45,7 @@ try: bdev = RAMFS(50) except MemoryError: print("SKIP") - sys.exit() + raise SystemExit uos.VfsFat.mkfs(bdev) vfs = uos.VfsFat(bdev) diff --git a/tests/extmod/vfs_fat_more.py b/tests/extmod/vfs_fat_more.py index dacb21553..baec96787 100644 --- a/tests/extmod/vfs_fat_more.py +++ b/tests/extmod/vfs_fat_more.py @@ -1,4 +1,3 @@ -import sys import uerrno try: try: @@ -8,13 +7,13 @@ try: import uos except ImportError: print("SKIP") - sys.exit() + raise SystemExit try: uos.VfsFat except AttributeError: print("SKIP") - sys.exit() + raise SystemExit class RAMFS: @@ -47,7 +46,7 @@ try: bdev2 = RAMFS(50) except MemoryError: print("SKIP") - sys.exit() + raise SystemExit # first we umount any existing mount points the target may have try: diff --git a/tests/extmod/vfs_fat_oldproto.py b/tests/extmod/vfs_fat_oldproto.py index 3e66758c3..ef4f1da78 100644 --- a/tests/extmod/vfs_fat_oldproto.py +++ b/tests/extmod/vfs_fat_oldproto.py @@ -1,4 +1,3 @@ -import sys try: import uerrno try: @@ -7,13 +6,13 @@ try: import uos except ImportError: print("SKIP") - sys.exit() + raise SystemExit try: uos.VfsFat except AttributeError: print("SKIP") - sys.exit() + raise SystemExit class RAMFS_OLD: @@ -43,7 +42,7 @@ try: bdev = RAMFS_OLD(50) except MemoryError: print("SKIP") - sys.exit() + raise SystemExit uos.VfsFat.mkfs(bdev) vfs = uos.VfsFat(bdev) diff --git a/tests/extmod/vfs_fat_ramdisk.py b/tests/extmod/vfs_fat_ramdisk.py index fe72a8bef..801c69786 100644 --- a/tests/extmod/vfs_fat_ramdisk.py +++ b/tests/extmod/vfs_fat_ramdisk.py @@ -1,4 +1,3 @@ -import sys try: import uerrno try: @@ -7,13 +6,13 @@ try: import uos except ImportError: print("SKIP") - sys.exit() + raise SystemExit try: uos.VfsFat except AttributeError: print("SKIP") - sys.exit() + raise SystemExit class RAMFS: @@ -45,7 +44,7 @@ try: bdev = RAMFS(50) except MemoryError: print("SKIP") - sys.exit() + raise SystemExit uos.VfsFat.mkfs(bdev) diff --git a/tests/extmod/websocket_basic.py b/tests/extmod/websocket_basic.py index 770836c8e..9a80503a0 100644 --- a/tests/extmod/websocket_basic.py +++ b/tests/extmod/websocket_basic.py @@ -3,9 +3,8 @@ try: import uerrno import websocket except ImportError: - import sys print("SKIP") - sys.exit() + raise SystemExit # put raw data in the stream and do a websocket read def ws_read(msg, sz): diff --git a/tests/io/buffered_writer.py b/tests/io/buffered_writer.py index bb7b4e8db..c2cedb991 100644 --- a/tests/io/buffered_writer.py +++ b/tests/io/buffered_writer.py @@ -4,9 +4,8 @@ try: io.BytesIO io.BufferedWriter except AttributeError: - import sys print('SKIP') - sys.exit() + raise SystemExit bts = io.BytesIO() buf = io.BufferedWriter(bts, 8) diff --git a/tests/io/open_append.py b/tests/io/open_append.py index 2120b72f0..a696823bc 100644 --- a/tests/io/open_append.py +++ b/tests/io/open_append.py @@ -1,4 +1,3 @@ -import sys try: import uos as os except ImportError: @@ -6,7 +5,7 @@ except ImportError: if not hasattr(os, "unlink"): print("SKIP") - sys.exit() + raise SystemExit # cleanup in case testfile exists try: diff --git a/tests/io/open_plus.py b/tests/io/open_plus.py index 98598ee67..bba96fa2f 100644 --- a/tests/io/open_plus.py +++ b/tests/io/open_plus.py @@ -1,4 +1,3 @@ -import sys try: import uos as os except ImportError: @@ -6,7 +5,7 @@ except ImportError: if not hasattr(os, "unlink"): print("SKIP") - sys.exit() + raise SystemExit # cleanup in case testfile exists try: diff --git a/tests/io/resource_stream.py b/tests/io/resource_stream.py index 86975f118..37d985bf1 100644 --- a/tests/io/resource_stream.py +++ b/tests/io/resource_stream.py @@ -5,7 +5,7 @@ try: uio.resource_stream except AttributeError: print('SKIP') - sys.exit() + raise SystemExit buf = uio.resource_stream("data", "file2") print(buf.read()) diff --git a/tests/io/write_ext.py b/tests/io/write_ext.py index 19b616174..5a6eaa35c 100644 --- a/tests/io/write_ext.py +++ b/tests/io/write_ext.py @@ -5,9 +5,8 @@ import uio try: uio.BytesIO except AttributeError: - import sys print('SKIP') - sys.exit() + raise SystemExit buf = uio.BytesIO() diff --git a/tests/jni/list.py b/tests/jni/list.py index 6725abb5a..d58181d0b 100644 --- a/tests/jni/list.py +++ b/tests/jni/list.py @@ -1,10 +1,9 @@ -import sys import jni try: ArrayList = jni.cls("java/util/ArrayList") except: print("SKIP") - sys.exit() + raise SystemExit l = ArrayList() print(l) diff --git a/tests/jni/object.py b/tests/jni/object.py index 6cf936c4d..aa67615ec 100644 --- a/tests/jni/object.py +++ b/tests/jni/object.py @@ -1,10 +1,9 @@ -import sys import jni try: Integer = jni.cls("java/lang/Integer") except: print("SKIP") - sys.exit() + raise SystemExit # Create object i = Integer(42) diff --git a/tests/jni/system_out.py b/tests/jni/system_out.py index 7a1f18030..86c4b9e11 100644 --- a/tests/jni/system_out.py +++ b/tests/jni/system_out.py @@ -1,9 +1,8 @@ -import sys try: import jni System = jni.cls("java/lang/System") except: print("SKIP") - sys.exit() + raise SystemExit System.out.println("Hello, Java!") diff --git a/tests/micropython/heapalloc_bytesio.py b/tests/micropython/heapalloc_bytesio.py index 2a8d50abe..4aae2abf0 100644 --- a/tests/micropython/heapalloc_bytesio.py +++ b/tests/micropython/heapalloc_bytesio.py @@ -1,9 +1,8 @@ try: import uio except ImportError: - import sys print("SKIP") - sys.exit() + raise SystemExit import micropython diff --git a/tests/micropython/heapalloc_iter.py b/tests/micropython/heapalloc_iter.py index 45d3519e4..79461f999 100644 --- a/tests/micropython/heapalloc_iter.py +++ b/tests/micropython/heapalloc_iter.py @@ -2,9 +2,8 @@ try: import array except ImportError: - import sys print("SKIP") - sys.exit() + 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 b3795293f..f4212b6ce 100644 --- a/tests/micropython/heapalloc_traceback.py +++ b/tests/micropython/heapalloc_traceback.py @@ -5,9 +5,8 @@ import sys try: import uio except ImportError: - import sys print("SKIP") - sys.exit() + raise SystemExit # preallocate exception instance with some room for a traceback global_exc = StopIteration() diff --git a/tests/micropython/heapalloc_traceback.py.exp b/tests/micropython/heapalloc_traceback.py.exp index facd0af13..291bbd697 100644 --- a/tests/micropython/heapalloc_traceback.py.exp +++ b/tests/micropython/heapalloc_traceback.py.exp @@ -1,5 +1,5 @@ StopIteration Traceback (most recent call last): - File , line 23, in test + File , line 22, in test StopIteration: diff --git a/tests/micropython/kbd_intr.py b/tests/micropython/kbd_intr.py index a7ce7464b..879c9a229 100644 --- a/tests/micropython/kbd_intr.py +++ b/tests/micropython/kbd_intr.py @@ -6,8 +6,7 @@ try: micropython.kbd_intr except AttributeError: print('SKIP') - import sys - sys.exit() + raise SystemExit # just check we can actually call it micropython.kbd_intr(3) diff --git a/tests/micropython/schedule.py b/tests/micropython/schedule.py index 3d584eea4..74f90cb2d 100644 --- a/tests/micropython/schedule.py +++ b/tests/micropython/schedule.py @@ -6,8 +6,7 @@ try: micropython.schedule except AttributeError: print('SKIP') - import sys - sys.exit() + raise SystemExit # Basic test of scheduling a function. diff --git a/tests/misc/non_compliant.py b/tests/misc/non_compliant.py index 31074ab01..b4c90e9fc 100644 --- a/tests/misc/non_compliant.py +++ b/tests/misc/non_compliant.py @@ -4,9 +4,8 @@ try: import array import ustruct except ImportError: - import sys print("SKIP") - sys.exit() + raise SystemExit # when super can't find self try: diff --git a/tests/misc/print_exception.py b/tests/misc/print_exception.py index b833a7981..9ab8e728b 100644 --- a/tests/misc/print_exception.py +++ b/tests/misc/print_exception.py @@ -6,7 +6,7 @@ try: import io except ImportError: print("SKIP") - sys.exit() + raise SystemExit if hasattr(sys, 'print_exception'): print_exception = sys.print_exception diff --git a/tests/misc/recursive_data.py b/tests/misc/recursive_data.py index 383018945..3b7fa5095 100644 --- a/tests/misc/recursive_data.py +++ b/tests/misc/recursive_data.py @@ -2,9 +2,8 @@ try: import uio as io except ImportError: - import sys print("SKIP") - sys.exit() + raise SystemExit l = [1, 2, 3, None] l[-1] = l diff --git a/tests/misc/recursive_iternext.py b/tests/misc/recursive_iternext.py index d90f17716..edb5a843f 100644 --- a/tests/misc/recursive_iternext.py +++ b/tests/misc/recursive_iternext.py @@ -6,9 +6,8 @@ try: max zip except: - import sys print("SKIP") - sys.exit() + raise SystemExit # We need to pick an N that is large enough to hit the recursion # limit, but not too large that we run out of heap memory. diff --git a/tests/misc/sys_exc_info.py b/tests/misc/sys_exc_info.py index de5b82562..4bb2c61e8 100644 --- a/tests/misc/sys_exc_info.py +++ b/tests/misc/sys_exc_info.py @@ -3,7 +3,7 @@ try: sys.exc_info except: print("SKIP") - sys.exit() + raise SystemExit def f(): print(sys.exc_info()[0:2]) diff --git a/tests/pyb/can.py b/tests/pyb/can.py index 7f2d070ec..0fd8c8368 100644 --- a/tests/pyb/can.py +++ b/tests/pyb/can.py @@ -2,8 +2,7 @@ try: from pyb import CAN except ImportError: print('SKIP') - import sys - sys.exit() + raise SystemExit import pyb diff --git a/tests/pyb/dac.py b/tests/pyb/dac.py index 942f30354..6f03bbc64 100644 --- a/tests/pyb/dac.py +++ b/tests/pyb/dac.py @@ -2,8 +2,7 @@ import pyb if not hasattr(pyb, 'DAC'): print('SKIP') - import sys - sys.exit() + raise SystemExit dac = pyb.DAC(1) print(dac) diff --git a/tests/pyb/pyb_f405.py b/tests/pyb/pyb_f405.py index 3c81fe109..2f161ae09 100644 --- a/tests/pyb/pyb_f405.py +++ b/tests/pyb/pyb_f405.py @@ -4,8 +4,7 @@ import os, pyb if not 'STM32F405' in os.uname().machine: print('SKIP') - import sys - sys.exit() + raise SystemExit print(pyb.freq()) print(type(pyb.rng())) diff --git a/tests/pyb/pyb_f411.py b/tests/pyb/pyb_f411.py index 328653965..50de30282 100644 --- a/tests/pyb/pyb_f411.py +++ b/tests/pyb/pyb_f411.py @@ -4,7 +4,6 @@ import os, pyb if not 'STM32F411' in os.uname().machine: print('SKIP') - import sys - sys.exit() + raise SystemExit print(pyb.freq()) diff --git a/tests/unix/extra_coverage.py b/tests/unix/extra_coverage.py index 870e7d5f2..7a496aa87 100644 --- a/tests/unix/extra_coverage.py +++ b/tests/unix/extra_coverage.py @@ -2,8 +2,7 @@ try: extra_coverage except NameError: print("SKIP") - import sys - sys.exit() + raise SystemExit import uerrno import uio diff --git a/tests/unix/ffi_callback.py b/tests/unix/ffi_callback.py index 7f8af15b3..23b058bce 100644 --- a/tests/unix/ffi_callback.py +++ b/tests/unix/ffi_callback.py @@ -1,9 +1,8 @@ -import sys try: import ffi except ImportError: print("SKIP") - sys.exit() + raise SystemExit def ffi_open(names): diff --git a/tests/unix/ffi_float.py b/tests/unix/ffi_float.py index cc12fa7ad..c92a39bcd 100644 --- a/tests/unix/ffi_float.py +++ b/tests/unix/ffi_float.py @@ -1,10 +1,9 @@ # test ffi float support -import sys try: import ffi except ImportError: print("SKIP") - sys.exit() + raise SystemExit def ffi_open(names): diff --git a/tests/unix/ffi_float2.py b/tests/unix/ffi_float2.py index d635a2714..721eb4d19 100644 --- a/tests/unix/ffi_float2.py +++ b/tests/unix/ffi_float2.py @@ -1,10 +1,9 @@ # test ffi float support -import sys try: import ffi except ImportError: print("SKIP") - sys.exit() + raise SystemExit def ffi_open(names): @@ -25,7 +24,7 @@ try: tgammaf = libm.func('f', 'tgammaf', 'f') except OSError: print("SKIP") - sys.exit() + raise SystemExit for fun in (tgammaf,): for val in (0.5, 1, 1.0, 1.5, 4, 4.0): -- cgit v1.2.3