From 4c4f586e2c798a28ea441fd3ddd409806672138f Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 19 Jan 2017 23:37:44 +1100 Subject: tests/extmod/framebuf1: Add test for no-op fill_rect. --- tests/extmod/framebuf1.py | 1 + 1 file changed, 1 insertion(+) (limited to 'tests/extmod/framebuf1.py') diff --git a/tests/extmod/framebuf1.py b/tests/extmod/framebuf1.py index cdc7e5b18..47dd98d7e 100644 --- a/tests/extmod/framebuf1.py +++ b/tests/extmod/framebuf1.py @@ -50,6 +50,7 @@ print('rect', buf) #fill rect fbuf.fill(0) +fbuf.fill_rect(0, 0, 0, 3, 1) # zero width, no-operation fbuf.fill_rect(1, 1, 3, 3, 1) print('fill_rect', buf) -- cgit v1.2.3 From fd99690f1859a46aee690355170ad13eed9f0122 Mon Sep 17 00:00:00 2001 From: Oleg Korsak Date: Sun, 1 Jan 2017 04:24:56 +0200 Subject: extmod/modframebuf: Add GS4_HMSB format. --- extmod/modframebuf.c | 59 +++++++++++++++++++++++++++++++++++++++++++++-- tests/extmod/framebuf1.py | 2 +- 2 files changed, 58 insertions(+), 3 deletions(-) (limited to 'tests/extmod/framebuf1.py') diff --git a/extmod/modframebuf.c b/extmod/modframebuf.c index e2441f194..792a3a7fa 100644 --- a/extmod/modframebuf.c +++ b/extmod/modframebuf.c @@ -97,13 +97,66 @@ STATIC void rgb565_fill_rect(const mp_obj_framebuf_t *fb, int x, int y, int w, i } } +// Functions for GS4_HMSB format + +STATIC void gs4_hmsb_setpixel(const mp_obj_framebuf_t *fb, int x, int y, uint32_t col) { + uint8_t *pixel = &((uint8_t*)fb->buf)[(x + y * fb->stride) >> 1]; + + if (x % 2) { + *pixel = ((uint8_t)col & 0x0f) | (*pixel & 0xf0); + } else { + *pixel = ((uint8_t)col << 4) | (*pixel & 0x0f); + } +} + +STATIC uint32_t gs4_hmsb_getpixel(const mp_obj_framebuf_t *fb, int x, int y) { + if (x % 2) { + return ((uint8_t*)fb->buf)[(x + y * fb->stride) >> 1] & 0x0f; + } + + return ((uint8_t*)fb->buf)[(x + y * fb->stride) >> 1] >> 4; +} + +STATIC void gs4_hmsb_fill_rect(const mp_obj_framebuf_t *fb, int x, int y, int w, int h, uint32_t col) { + col &= 0x0f; + uint8_t *pixel_pair = &((uint8_t*)fb->buf)[(x + y * fb->stride) >> 1]; + uint8_t col_shifted_left = col << 4; + uint8_t colored_pixel_pair = col_shifted_left | col; + int pixel_count_till_next_line = (fb->stride - w) >> 1; + bool odd_x = (x % 2 == 1); + + while (h--) { + int ww = w; + + if (odd_x && ww > 0) { + *pixel_pair = (*pixel_pair & 0xf0) | col; + pixel_pair++; + ww--; + } + + memset(pixel_pair, colored_pixel_pair, ww >> 1); + pixel_pair += ww >> 1; + + if (ww % 2) { + *pixel_pair = col_shifted_left | (*pixel_pair & 0x0f); + if (!odd_x) { + pixel_pair++; + } + } + + pixel_pair += pixel_count_till_next_line; + } +} + // constants for formats -#define FRAMEBUF_MVLSB (0) -#define FRAMEBUF_RGB565 (1) +#define FRAMEBUF_MVLSB (0) +#define FRAMEBUF_RGB565 (1) +#define FRAMEBUF_GS4_HMSB (2) STATIC mp_framebuf_p_t formats[] = { [FRAMEBUF_MVLSB] = {mvlsb_setpixel, mvlsb_getpixel, mvlsb_fill_rect}, [FRAMEBUF_RGB565] = {rgb565_setpixel, rgb565_getpixel, rgb565_fill_rect}, + [FRAMEBUF_GS4_HMSB] = {gs4_hmsb_setpixel, gs4_hmsb_getpixel, gs4_hmsb_fill_rect}, }; static inline void setpixel(const mp_obj_framebuf_t *fb, int x, int y, uint32_t color) { @@ -152,6 +205,7 @@ STATIC mp_obj_t framebuf_make_new(const mp_obj_type_t *type, size_t n_args, size switch (o->format) { case FRAMEBUF_MVLSB: case FRAMEBUF_RGB565: + case FRAMEBUF_GS4_HMSB: break; default: nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError, @@ -490,6 +544,7 @@ STATIC const mp_rom_map_elem_t framebuf_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_FrameBuffer1), MP_ROM_PTR(&legacy_framebuffer1_obj) }, { MP_ROM_QSTR(MP_QSTR_MVLSB), MP_OBJ_NEW_SMALL_INT(FRAMEBUF_MVLSB) }, { MP_ROM_QSTR(MP_QSTR_RGB565), MP_OBJ_NEW_SMALL_INT(FRAMEBUF_RGB565) }, + { MP_ROM_QSTR(MP_QSTR_GS4_HMSB), MP_OBJ_NEW_SMALL_INT(FRAMEBUF_GS4_HMSB) }, }; STATIC MP_DEFINE_CONST_DICT(framebuf_module_globals, framebuf_module_globals_table); diff --git a/tests/extmod/framebuf1.py b/tests/extmod/framebuf1.py index 47dd98d7e..9fed33809 100644 --- a/tests/extmod/framebuf1.py +++ b/tests/extmod/framebuf1.py @@ -91,7 +91,7 @@ print(buf) # test invalid constructor try: - fbuf = framebuf.FrameBuffer(buf, w, h, 2, framebuf.MVLSB) + fbuf = framebuf.FrameBuffer(buf, w, h, 3, framebuf.MVLSB) except ValueError: print("ValueError") -- cgit v1.2.3 From bf51200bc10858552f3cc6989afe0fe51b57a4f2 Mon Sep 17 00:00:00 2001 From: Damien George Date: Wed, 25 Jan 2017 23:23:50 +1100 Subject: tests/extmod/framebuf1: Fix test for framebuf invalid constructor. --- tests/extmod/framebuf1.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests/extmod/framebuf1.py') diff --git a/tests/extmod/framebuf1.py b/tests/extmod/framebuf1.py index 9fed33809..c204e63aa 100644 --- a/tests/extmod/framebuf1.py +++ b/tests/extmod/framebuf1.py @@ -89,11 +89,11 @@ print(buf) fbuf.text(str(chr(31)), 0, 0) print(buf) -# test invalid constructor +# test invalid constructor, and stride argument try: - fbuf = framebuf.FrameBuffer(buf, w, h, 3, framebuf.MVLSB) + fbuf = framebuf.FrameBuffer(buf, w, h, -1, w) except ValueError: - print("ValueError") + print("ValueError") # test legacy constructor fbuf = framebuf.FrameBuffer1(buf, w, h) -- cgit v1.2.3 From 231cfc84a7cae31f93208c334fc33b08278040eb Mon Sep 17 00:00:00 2001 From: Peter Hinch Date: Mon, 6 Feb 2017 10:59:44 +0000 Subject: extmod/modframebuf: Add support for monochrome horizontal format. MHLSB and MHMSB formats are added to the framebuf module, which have 8 adjacent horizontal pixels represented in a single byte. --- extmod/modframebuf.c | 48 ++++++++++-- tests/extmod/framebuf1.py | 171 ++++++++++++++++++++++-------------------- tests/extmod/framebuf1.py.exp | 46 ++++++++++++ 3 files changed, 179 insertions(+), 86 deletions(-) (limited to 'tests/extmod/framebuf1.py') diff --git a/extmod/modframebuf.c b/extmod/modframebuf.c index 792a3a7fa..33985dd00 100644 --- a/extmod/modframebuf.c +++ b/extmod/modframebuf.c @@ -53,6 +53,41 @@ typedef struct _mp_framebuf_p_t { fill_rect_t fill_rect; } mp_framebuf_p_t; +// constants for formats +#define FRAMEBUF_MVLSB (0) +#define FRAMEBUF_RGB565 (1) +#define FRAMEBUF_GS4_HMSB (2) +#define FRAMEBUF_MHLSB (3) +#define FRAMEBUF_MHMSB (4) + +// Functions for MHLSB and MHMSB + +STATIC void mono_horiz_setpixel(const mp_obj_framebuf_t *fb, int x, int y, uint32_t color) { + size_t index = (x + y * fb->stride) >> 3; + int offset = fb->format == FRAMEBUF_MHMSB ? x & 0x07 : 7 - (x & 0x07); + ((uint8_t*)fb->buf)[index] = (((uint8_t*)fb->buf)[index] & ~(0x01 << offset)) | ((color != 0) << offset); +} + +STATIC uint32_t mono_horiz_getpixel(const mp_obj_framebuf_t *fb, int x, int y) { + size_t index = (x + y * fb->stride) >> 3; + int offset = fb->format == FRAMEBUF_MHMSB ? x & 0x07 : 7 - (x & 0x07); + return (((uint8_t*)fb->buf)[index] >> (offset)) & 0x01; +} + +STATIC void mono_horiz_fill_rect(const mp_obj_framebuf_t *fb, int x, int y, int w, int h, uint32_t col) { + int reverse = fb->format == FRAMEBUF_MHMSB; + int advance = fb->stride >> 3; + while (w--) { + uint8_t *b = &((uint8_t*)fb->buf)[(x >> 3) + y * advance]; + int offset = reverse ? x & 7 : 7 - (x & 7); + for (int hh = h; hh; --hh) { + *b = (*b & ~(0x01 << offset)) | ((col != 0) << offset); + b += advance; + } + ++x; + } +} + // Functions for MVLSB format STATIC void mvlsb_setpixel(const mp_obj_framebuf_t *fb, int x, int y, uint32_t color) { @@ -148,15 +183,12 @@ STATIC void gs4_hmsb_fill_rect(const mp_obj_framebuf_t *fb, int x, int y, int w, } } -// constants for formats -#define FRAMEBUF_MVLSB (0) -#define FRAMEBUF_RGB565 (1) -#define FRAMEBUF_GS4_HMSB (2) - STATIC mp_framebuf_p_t formats[] = { [FRAMEBUF_MVLSB] = {mvlsb_setpixel, mvlsb_getpixel, mvlsb_fill_rect}, [FRAMEBUF_RGB565] = {rgb565_setpixel, rgb565_getpixel, rgb565_fill_rect}, [FRAMEBUF_GS4_HMSB] = {gs4_hmsb_setpixel, gs4_hmsb_getpixel, gs4_hmsb_fill_rect}, + [FRAMEBUF_MHLSB] = {mono_horiz_setpixel, mono_horiz_getpixel, mono_horiz_fill_rect}, + [FRAMEBUF_MHMSB] = {mono_horiz_setpixel, mono_horiz_getpixel, mono_horiz_fill_rect}, }; static inline void setpixel(const mp_obj_framebuf_t *fb, int x, int y, uint32_t color) { @@ -207,6 +239,10 @@ STATIC mp_obj_t framebuf_make_new(const mp_obj_type_t *type, size_t n_args, size case FRAMEBUF_RGB565: case FRAMEBUF_GS4_HMSB: break; + case FRAMEBUF_MHLSB: + case FRAMEBUF_MHMSB: + o->stride = (o->stride + 7) & ~7; + break; default: nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError, "invalid format")); @@ -545,6 +581,8 @@ STATIC const mp_rom_map_elem_t framebuf_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_MVLSB), MP_OBJ_NEW_SMALL_INT(FRAMEBUF_MVLSB) }, { MP_ROM_QSTR(MP_QSTR_RGB565), MP_OBJ_NEW_SMALL_INT(FRAMEBUF_RGB565) }, { MP_ROM_QSTR(MP_QSTR_GS4_HMSB), MP_OBJ_NEW_SMALL_INT(FRAMEBUF_GS4_HMSB) }, + { MP_ROM_QSTR(MP_QSTR_MHLSB), MP_OBJ_NEW_SMALL_INT(FRAMEBUF_MHLSB) }, + { MP_ROM_QSTR(MP_QSTR_MHMSB), MP_OBJ_NEW_SMALL_INT(FRAMEBUF_MHMSB) }, }; STATIC MP_DEFINE_CONST_DICT(framebuf_module_globals, framebuf_module_globals_table); diff --git a/tests/extmod/framebuf1.py b/tests/extmod/framebuf1.py index c204e63aa..0a8e1ae55 100644 --- a/tests/extmod/framebuf1.py +++ b/tests/extmod/framebuf1.py @@ -7,87 +7,96 @@ except ImportError: w = 5 h = 16 -buf = bytearray(w * h // 8) -fbuf = framebuf.FrameBuffer(buf, w, h, framebuf.MVLSB) - -# access as buffer -print(memoryview(fbuf)[0]) - -# fill -fbuf.fill(1) -print(buf) -fbuf.fill(0) -print(buf) - -# put pixel -fbuf.pixel(0, 0, 1) -fbuf.pixel(4, 0, 1) -fbuf.pixel(0, 15, 1) -fbuf.pixel(4, 15, 1) -print(buf) - -# clear pixel -fbuf.pixel(4, 15, 0) -print(buf) - -# get pixel -print(fbuf.pixel(0, 0), fbuf.pixel(1, 1)) - -# hline -fbuf.fill(0) -fbuf.hline(0, 1, w, 1) -print('hline', buf) - -# vline -fbuf.fill(0) -fbuf.vline(1, 0, h, 1) -print('vline', buf) - -# rect -fbuf.fill(0) -fbuf.rect(1, 1, 3, 3, 1) -print('rect', buf) - -#fill rect -fbuf.fill(0) -fbuf.fill_rect(0, 0, 0, 3, 1) # zero width, no-operation -fbuf.fill_rect(1, 1, 3, 3, 1) -print('fill_rect', buf) - -# line -fbuf.fill(0) -fbuf.line(1, 1, 3, 3, 1) -print('line', buf) - -# line steep negative gradient -fbuf.fill(0) -fbuf.line(3, 3, 2, 1, 1) -print('line', buf) - -# scroll -fbuf.fill(0) -fbuf.pixel(2, 7, 1) -fbuf.scroll(0, 1) -print(buf) -fbuf.scroll(0, -2) -print(buf) -fbuf.scroll(1, 0) -print(buf) -fbuf.scroll(-1, 0) -print(buf) -fbuf.scroll(2, 2) -print(buf) - -# print text -fbuf.fill(0) -fbuf.text("hello", 0, 0, 1) -print(buf) -fbuf.text("hello", 0, 0, 0) # clear -print(buf) - -# char out of font range set to chr(127) -fbuf.text(str(chr(31)), 0, 0) -print(buf) +size = w * h // 8 +buf = bytearray(size) +maps = {framebuf.MVLSB : 'MVLSB', + framebuf.MHLSB : 'MHLSB', + framebuf.MHMSB : 'MHMSB'} + +for mapping in maps.keys(): + for x in range(size): + buf[x] = 0 + fbuf = framebuf.FrameBuffer(buf, w, h, mapping) + print(maps[mapping]) + # access as buffer + print(memoryview(fbuf)[0]) + + # fill + fbuf.fill(1) + print(buf) + fbuf.fill(0) + print(buf) + + # put pixel + fbuf.pixel(0, 0, 1) + fbuf.pixel(4, 0, 1) + fbuf.pixel(0, 15, 1) + fbuf.pixel(4, 15, 1) + print(buf) + + # clear pixel + fbuf.pixel(4, 15, 0) + print(buf) + + # get pixel + print(fbuf.pixel(0, 0), fbuf.pixel(1, 1)) + + # hline + fbuf.fill(0) + fbuf.hline(0, 1, w, 1) + print('hline', buf) + + # vline + fbuf.fill(0) + fbuf.vline(1, 0, h, 1) + print('vline', buf) + + # rect + fbuf.fill(0) + fbuf.rect(1, 1, 3, 3, 1) + print('rect', buf) + + #fill rect + fbuf.fill(0) + fbuf.fill_rect(0, 0, 0, 3, 1) # zero width, no-operation + fbuf.fill_rect(1, 1, 3, 3, 1) + print('fill_rect', buf) + + # line + fbuf.fill(0) + fbuf.line(1, 1, 3, 3, 1) + print('line', buf) + + # line steep negative gradient + fbuf.fill(0) + fbuf.line(3, 3, 2, 1, 1) + print('line', buf) + + # scroll + fbuf.fill(0) + fbuf.pixel(2, 7, 1) + fbuf.scroll(0, 1) + print(buf) + fbuf.scroll(0, -2) + print(buf) + fbuf.scroll(1, 0) + print(buf) + fbuf.scroll(-1, 0) + print(buf) + fbuf.scroll(2, 2) + print(buf) + + # print text + fbuf.fill(0) + fbuf.text("hello", 0, 0, 1) + print(buf) + fbuf.text("hello", 0, 0, 0) # clear + print(buf) + + # char out of font range set to chr(127) + fbuf.text(str(chr(31)), 0, 0) + print(buf) + print() # test invalid constructor, and stride argument try: diff --git a/tests/extmod/framebuf1.py.exp b/tests/extmod/framebuf1.py.exp index 83d775d3c..736ad7a45 100644 --- a/tests/extmod/framebuf1.py.exp +++ b/tests/extmod/framebuf1.py.exp @@ -1,3 +1,4 @@ +MVLSB 0 bytearray(b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff') bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') @@ -18,4 +19,49 @@ bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01') bytearray(b'\x00\x7f\x7f\x04\x04\x00\x00\x00\x00\x00') bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') bytearray(b'\xaaU\xaaU\xaa\x00\x00\x00\x00\x00') + +MHLSB +0 +bytearray(b'\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8') +bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +bytearray(b'\x88\x00\x00\x00\x00\x00\x00\x00\x00\x00') +bytearray(b'\x88\x00\x00\x00\x00\x00\x00\x00\x00\x00') +1 0 +hline bytearray(b'\x00\xf8\x00\x00\x00\x00\x00\x00\x00\x00') +vline bytearray(b'@@@@@@@@@@') +rect bytearray(b'\x00pPp\x00\x00\x00\x00\x00\x00') +fill_rect bytearray(b'\x00ppp\x00\x00\x00\x00\x00\x00') +line bytearray(b'\x00@ \x10\x00\x00\x00\x00\x00\x00') +line bytearray(b'\x00 \x10\x00\x00\x00\x00\x00\x00') +bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00 \x00') +bytearray(b'\x00\x00\x00\x00\x00\x00 \x00\x00\x00') +bytearray(b'\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00') +bytearray(b'\x00\x00\x00\x00\x00\x00 \x00\x00\x00') +bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00') +bytearray(b'``x````\x00\x00\x00') +bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +bytearray(b'P\xa8P\xa8P\xa8P\xa8\x00\x00') + +MHMSB +0 +bytearray(b'\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f') +bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +bytearray(b'\x11\x00\x00\x00\x00\x00\x00\x00\x00\x00') +bytearray(b'\x11\x00\x00\x00\x00\x00\x00\x00\x00\x00') +1 0 +hline bytearray(b'\x00\x1f\x00\x00\x00\x00\x00\x00\x00\x00') +vline bytearray(b'\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02') +rect bytearray(b'\x00\x0e\n\x0e\x00\x00\x00\x00\x00\x00') +fill_rect bytearray(b'\x00\x0e\x0e\x0e\x00\x00\x00\x00\x00\x00') +line bytearray(b'\x00\x02\x04\x08\x00\x00\x00\x00\x00\x00') +line bytearray(b'\x00\x04\x04\x08\x00\x00\x00\x00\x00\x00') +bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00') +bytearray(b'\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00') +bytearray(b'\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00') +bytearray(b'\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00') +bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00') +bytearray(b'\x06\x06\x1e\x06\x06\x06\x06\x00\x00\x00') +bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +bytearray(b'\n\x15\n\x15\n\x15\n\x15\x00\x00') + ValueError -- cgit v1.2.3 From 468c6f9da147d6e752e437a32211e317a116b6df Mon Sep 17 00:00:00 2001 From: Peter Hinch Date: Sat, 1 Apr 2017 07:00:09 +0100 Subject: extmod/modframebuf: Make monochrome bitmap formats start with MONO_. MONO_xxx is much easier to read if you're not familiar with the code. MVLSB is deprecated but kept for backwards compatibility, for the time being. This patch also updates the associated docs and tests. --- docs/library/framebuf.rst | 25 ++++++++++++++++++++++++- extmod/modframebuf.c | 5 +++-- tests/extmod/framebuf1.py | 7 ++++--- tests/extmod/framebuf1.py.exp | 7 ++++--- 4 files changed, 35 insertions(+), 9 deletions(-) (limited to 'tests/extmod/framebuf1.py') diff --git a/docs/library/framebuf.rst b/docs/library/framebuf.rst index 91fc362fd..61f0635f3 100644 --- a/docs/library/framebuf.rst +++ b/docs/library/framebuf.rst @@ -116,9 +116,32 @@ Other methods Constants --------- -.. data:: framebuf.MVLSB +.. data:: framebuf.MONO_VLSB Monochrome (1-bit) color format + This defines a mapping where the bits in a byte are vertically mapped with + bit 0 being nearest the top of the screen. Consequently each byte occupies + 8 vertical pixels. Subsequent bytes appear at successive horizontal + locations until the rightmost edge is reached. Further bytes are rendered + at locations starting at the leftmost edge, 8 pixels lower. + +.. data:: framebuf.MONO_HLSB + + Monochrome (1-bit) color format + This defines a mapping where the bits in a byte are horizontally mapped. + Each byte occupies 8 horizontal pixels with bit 0 being the leftmost. + Subsequent bytes appear at successive horizontal locations until the + rightmost edge is reached. Further bytes are rendered on the next row, one + pixel lower. + +.. data:: framebuf.MONO_HMSB + + Monochrome (1-bit) color format + This defines a mapping where the bits in a byte are horizontally mapped. + Each byte occupies 8 horizontal pixels with bit 7 being the leftmost. + Subsequent bytes appear at successive horizontal locations until the + rightmost edge is reached. Further bytes are rendered on the next row, one + pixel lower. .. data:: framebuf.RGB565 diff --git a/extmod/modframebuf.c b/extmod/modframebuf.c index 33985dd00..b8e84fe1c 100644 --- a/extmod/modframebuf.c +++ b/extmod/modframebuf.c @@ -579,10 +579,11 @@ STATIC const mp_rom_map_elem_t framebuf_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_FrameBuffer), MP_ROM_PTR(&mp_type_framebuf) }, { MP_ROM_QSTR(MP_QSTR_FrameBuffer1), MP_ROM_PTR(&legacy_framebuffer1_obj) }, { MP_ROM_QSTR(MP_QSTR_MVLSB), MP_OBJ_NEW_SMALL_INT(FRAMEBUF_MVLSB) }, + { MP_ROM_QSTR(MP_QSTR_MONO_VLSB), MP_OBJ_NEW_SMALL_INT(FRAMEBUF_MVLSB) }, { MP_ROM_QSTR(MP_QSTR_RGB565), MP_OBJ_NEW_SMALL_INT(FRAMEBUF_RGB565) }, { MP_ROM_QSTR(MP_QSTR_GS4_HMSB), MP_OBJ_NEW_SMALL_INT(FRAMEBUF_GS4_HMSB) }, - { MP_ROM_QSTR(MP_QSTR_MHLSB), MP_OBJ_NEW_SMALL_INT(FRAMEBUF_MHLSB) }, - { MP_ROM_QSTR(MP_QSTR_MHMSB), MP_OBJ_NEW_SMALL_INT(FRAMEBUF_MHMSB) }, + { MP_ROM_QSTR(MP_QSTR_MONO_HLSB), MP_OBJ_NEW_SMALL_INT(FRAMEBUF_MHLSB) }, + { MP_ROM_QSTR(MP_QSTR_MONO_HMSB), MP_OBJ_NEW_SMALL_INT(FRAMEBUF_MHMSB) }, }; STATIC MP_DEFINE_CONST_DICT(framebuf_module_globals, framebuf_module_globals_table); diff --git a/tests/extmod/framebuf1.py b/tests/extmod/framebuf1.py index 0a8e1ae55..990b0b120 100644 --- a/tests/extmod/framebuf1.py +++ b/tests/extmod/framebuf1.py @@ -9,9 +9,9 @@ w = 5 h = 16 size = w * h // 8 buf = bytearray(size) -maps = {framebuf.MVLSB : 'MVLSB', - framebuf.MHLSB : 'MHLSB', - framebuf.MHMSB : 'MHMSB'} +maps = {framebuf.MONO_VLSB : 'MONO_VLSB', + framebuf.MONO_HLSB : 'MONO_HLSB', + framebuf.MONO_HMSB : 'MONO_HMSB'} for mapping in maps.keys(): for x in range(size): @@ -107,3 +107,4 @@ except ValueError: # test legacy constructor fbuf = framebuf.FrameBuffer1(buf, w, h) fbuf = framebuf.FrameBuffer1(buf, w, h, w) +print(framebuf.MVLSB == framebuf.MONO_VLSB) diff --git a/tests/extmod/framebuf1.py.exp b/tests/extmod/framebuf1.py.exp index 736ad7a45..d954623de 100644 --- a/tests/extmod/framebuf1.py.exp +++ b/tests/extmod/framebuf1.py.exp @@ -1,4 +1,4 @@ -MVLSB +MONO_VLSB 0 bytearray(b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff') bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') @@ -20,7 +20,7 @@ bytearray(b'\x00\x7f\x7f\x04\x04\x00\x00\x00\x00\x00') bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') bytearray(b'\xaaU\xaaU\xaa\x00\x00\x00\x00\x00') -MHLSB +MONO_HLSB 0 bytearray(b'\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8') bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') @@ -42,7 +42,7 @@ bytearray(b'``x````\x00\x00\x00') bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') bytearray(b'P\xa8P\xa8P\xa8P\xa8\x00\x00') -MHMSB +MONO_HMSB 0 bytearray(b'\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f') bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') @@ -65,3 +65,4 @@ bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') bytearray(b'\n\x15\n\x15\n\x15\n\x15\x00\x00') ValueError +True -- 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/extmod/framebuf1.py') 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