tests: Convert remaining "sys.exit()" to "raise SystemExit".

This commit is contained in:
Paul Sokolovsky 2017-06-10 20:14:16 +03:00
parent a2803b74f4
commit 85d809d1f4
88 changed files with 107 additions and 188 deletions

View File

@ -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()

View File

@ -2,8 +2,7 @@ try:
import framebuf
except ImportError:
print("SKIP")
import sys
sys.exit()
raise SystemExit
w = 5
h = 16

View File

@ -2,8 +2,7 @@ try:
import framebuf
except ImportError:
print("SKIP")
import sys
sys.exit()
raise SystemExit
def printbuf():
print("--8<--")

View File

@ -2,8 +2,7 @@ try:
import framebuf
except ImportError:
print("SKIP")
import sys
sys.exit()
raise SystemExit
def printbuf():
print("--8<--")

View File

@ -8,8 +8,7 @@ try:
machine.mem8
except:
print("SKIP")
import sys
sys.exit()
raise SystemExit
print(machine.mem8)

View File

@ -6,8 +6,7 @@ try:
machine.PinBase
except AttributeError:
print("SKIP")
import sys
sys.exit()
raise SystemExit
class MyPin(machine.PinBase):

View File

@ -7,8 +7,7 @@ try:
machine.time_pulse_us
except AttributeError:
print("SKIP")
import sys
sys.exit()
raise SystemExit
class ConstPin(machine.PinBase):

View File

@ -9,8 +9,7 @@ try:
machine.Signal
except AttributeError:
print("SKIP")
import sys
sys.exit()
raise SystemExit
class Pin(machine.PinBase):
def __init__(self):

View File

@ -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)

View File

@ -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=='))

View File

@ -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'))

View File

@ -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)))

View File

@ -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'))

View File

@ -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', ':')

View File

@ -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'))

View File

@ -3,9 +3,8 @@
try:
import uctypes
except ImportError:
import sys
print("SKIP")
sys.exit()
raise SystemExit
buf = b"12345678abcd"
struct = uctypes.struct(

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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),

View File

@ -1,9 +1,8 @@
try:
import uctypes
except ImportError:
import sys
print("SKIP")
sys.exit()
raise SystemExit
desc = {
"s0": uctypes.UINT16 | 0,

View File

@ -1,9 +1,8 @@
try:
import uctypes
except ImportError:
import sys
print("SKIP")
sys.exit()
raise SystemExit
desc = {
"f32": uctypes.FLOAT32 | 0,

View File

@ -1,9 +1,8 @@
try:
import uctypes
except ImportError:
import sys
print("SKIP")
sys.exit()
raise SystemExit
desc = {
"f32": uctypes.FLOAT32 | 0,

View File

@ -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 = {

View File

@ -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

View File

@ -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),

View File

@ -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 = {

View File

@ -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

View File

@ -1,9 +1,8 @@
try:
import uctypes
except ImportError:
import sys
print("SKIP")
sys.exit()
raise SystemExit
S1 = {}
assert uctypes.sizeof(S1) == 0

View File

@ -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')

View File

@ -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()

View File

@ -4,9 +4,8 @@ except:
try:
import heapq
except ImportError:
import sys
print("SKIP")
sys.exit()
raise SystemExit
try:
heapq.heappop([])

View File

@ -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))

View File

@ -3,8 +3,7 @@
try:
import ujson
except ImportError:
import sys
print("SKIP")
sys.exit()
raise SystemExit
print(ujson.dumps(b'1234'))

View File

@ -4,8 +4,7 @@ except ImportError:
try:
import json
except ImportError:
import sys
print("SKIP")
sys.exit()
raise SystemExit
print(json.dumps(1.2))

View File

@ -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"')))

View File

@ -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):

View File

@ -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)

View File

@ -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):

View File

@ -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):

View File

@ -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")

View File

@ -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)

View File

@ -6,9 +6,8 @@ except ImportError:
try:
import re
except ImportError:
import sys
print("SKIP")
sys.exit()
raise SystemExit
def test_re(r):
try:

View File

@ -6,9 +6,8 @@ except ImportError:
try:
import re
except ImportError:
import sys
print("SKIP")
sys.exit()
raise SystemExit
def print_groups(match):
print('----')

View File

@ -6,9 +6,8 @@ except ImportError:
try:
import re
except ImportError:
import sys
print("SKIP")
sys.exit()
raise SystemExit
def print_groups(match):
print('----')

View File

@ -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")

View File

@ -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")

View File

@ -1,9 +1,8 @@
try:
import ure as re
except ImportError:
import sys
print("SKIP")
sys.exit()
raise SystemExit
r = re.compile('( )')
try:

View File

@ -5,8 +5,7 @@ try:
import ussl as ssl
except ImportError:
print("SKIP")
import sys
sys.exit()
raise SystemExit
# create in client mode
try:

View File

@ -5,8 +5,7 @@ try:
from utimeq import utimeq
except ImportError:
print("SKIP")
import sys
sys.exit()
raise SystemExit
DEBUG = 0

View File

@ -2,8 +2,7 @@ try:
from utimeq import utimeq
except ImportError:
print("SKIP")
import sys
sys.exit()
raise SystemExit
h = utimeq(10)

View File

@ -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

View File

@ -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

View File

@ -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()

View File

@ -9,8 +9,7 @@ try:
uos.mount
except (ImportError, AttributeError):
print("SKIP")
import sys
sys.exit()
raise SystemExit
class Filesystem:

View File

@ -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)

View File

@ -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)

View File

@ -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:

View File

@ -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)

View File

@ -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)

View File

@ -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):

View File

@ -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)

View File

@ -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:

View File

@ -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:

View File

@ -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())

View File

@ -5,9 +5,8 @@ import uio
try:
uio.BytesIO
except AttributeError:
import sys
print('SKIP')
sys.exit()
raise SystemExit
buf = uio.BytesIO()

View File

@ -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)

View File

@ -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)

View File

@ -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!")

View File

@ -1,9 +1,8 @@
try:
import uio
except ImportError:
import sys
print("SKIP")
sys.exit()
raise SystemExit
import micropython

View File

@ -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

View File

@ -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()

View File

@ -1,5 +1,5 @@
StopIteration
Traceback (most recent call last):
File , line 23, in test
File , line 22, in test
StopIteration:

View File

@ -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)

View File

@ -6,8 +6,7 @@ try:
micropython.schedule
except AttributeError:
print('SKIP')
import sys
sys.exit()
raise SystemExit
# Basic test of scheduling a function.

View File

@ -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:

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -3,7 +3,7 @@ try:
sys.exc_info
except:
print("SKIP")
sys.exit()
raise SystemExit
def f():
print(sys.exc_info()[0:2])

View File

@ -2,8 +2,7 @@ try:
from pyb import CAN
except ImportError:
print('SKIP')
import sys
sys.exit()
raise SystemExit
import pyb

View File

@ -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)

View File

@ -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()))

View File

@ -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())

View File

@ -2,8 +2,7 @@ try:
extra_coverage
except NameError:
print("SKIP")
import sys
sys.exit()
raise SystemExit
import uerrno
import uio

View File

@ -1,9 +1,8 @@
import sys
try:
import ffi
except ImportError:
print("SKIP")
sys.exit()
raise SystemExit
def ffi_open(names):

View File

@ -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):

View File

@ -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):