Skip to content

Commit

Permalink
tests/basics: Convert "sys.exit()" to "raise SystemExit".
Browse files Browse the repository at this point in the history
  • Loading branch information
pfalcon committed Jun 10, 2017
1 parent 0161939 commit a2803b7
Show file tree
Hide file tree
Showing 69 changed files with 69 additions and 137 deletions.
3 changes: 1 addition & 2 deletions tests/basics/array1.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
try:
import array
except ImportError:
import sys
print("SKIP")
sys.exit()
raise SystemExit

a = array.array('B', [1, 2, 3])
print(a, len(a))
Expand Down
3 changes: 1 addition & 2 deletions tests/basics/array_add.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
try:
import array
except ImportError:
import sys
print("SKIP")
sys.exit()
raise SystemExit

a1 = array.array('I', [1])
a2 = array.array('I', [2])
Expand Down
3 changes: 1 addition & 2 deletions tests/basics/array_construct.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
try:
from array import array
except ImportError:
import sys
print("SKIP")
sys.exit()
raise SystemExit

# tuple, list
print(array('b', (1, 2)))
Expand Down
3 changes: 1 addition & 2 deletions tests/basics/array_construct2.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
try:
from array import array
except ImportError:
import sys
print("SKIP")
sys.exit()
raise SystemExit

# construct from something with unknown length (requires generators)
print(array('i', (i for i in range(10))))
3 changes: 1 addition & 2 deletions tests/basics/array_construct_endian.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
try:
from array import array
except ImportError:
import sys
print("SKIP")
sys.exit()
raise SystemExit

# raw copy from bytes, bytearray
print(array('h', b'12'))
3 changes: 1 addition & 2 deletions tests/basics/array_intbig.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
try:
from array import array
except ImportError:
import sys
print("SKIP")
sys.exit()
raise SystemExit

print(array('L', [0, 2**32-1]))
print(array('l', [-2**31, 0, 2**31-1]))
Expand Down
3 changes: 1 addition & 2 deletions tests/basics/array_micropython.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
try:
import array
except ImportError:
import sys
print("SKIP")
sys.exit()
raise SystemExit

# arrays of objects
a = array.array('O')
Expand Down
3 changes: 1 addition & 2 deletions tests/basics/attrtuple1.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@
try:
t.name
except AttributeError:
import sys
print("SKIP")
sys.exit()
raise SystemExit


# test printing of attrtuple
Expand Down
3 changes: 1 addition & 2 deletions tests/basics/builtin_delattr.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
try:
delattr
except:
import sys
print("SKIP")
sys.exit()
raise SystemExit

class A: pass
a = A()
Expand Down
3 changes: 1 addition & 2 deletions tests/basics/builtin_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
help
except NameError:
print("SKIP")
import sys
sys.exit()
raise SystemExit

help() # no args
help(help) # help for a function
Expand Down
3 changes: 1 addition & 2 deletions tests/basics/builtin_minmax.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
min
max
except:
import sys
print("SKIP")
sys.exit()
raise SystemExit

print(min(0,1))
print(min(1,0))
Expand Down
3 changes: 1 addition & 2 deletions tests/basics/builtin_override.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
try:
builtins.abs = lambda x: x + 1
except AttributeError:
import sys
print("SKIP")
sys.exit()
raise SystemExit

print(abs(1))

Expand Down
3 changes: 1 addition & 2 deletions tests/basics/builtin_pow3.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
try:
print(pow(3, 4, 7))
except NotImplementedError:
import sys
print("SKIP")
sys.exit()
raise SystemExit

# 3 arg pow is defined to only work on integers
try:
Expand Down
3 changes: 1 addition & 2 deletions tests/basics/builtin_pow3_intbig.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
try:
print(pow(3, 4, 7))
except NotImplementedError:
import sys
print("SKIP")
sys.exit()
raise SystemExit

print(pow(555557, 1000002, 1000003))

Expand Down
3 changes: 1 addition & 2 deletions tests/basics/builtin_property.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
try:
property
except:
import sys
print("SKIP")
sys.exit()
raise SystemExit

# create a property object explicitly
property()
Expand Down
3 changes: 1 addition & 2 deletions tests/basics/builtin_range_attrs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
try:
range(0).start
except AttributeError:
import sys
print("SKIP")
sys.exit()
raise SystemExit

# attrs
print(range(1, 2, 3).start)
Expand Down
3 changes: 1 addition & 2 deletions tests/basics/builtin_reversed.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
try:
reversed
except:
import sys
print("SKIP")
sys.exit()
raise SystemExit

# list
print(list(reversed([])))
Expand Down
3 changes: 1 addition & 2 deletions tests/basics/builtin_sorted.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
sorted
set
except:
import sys
print("SKIP")
sys.exit()
raise SystemExit

print(sorted(set(range(100))))
print(sorted(set(range(100)), key=lambda x: x + 100*(x % 2)))
Expand Down
3 changes: 1 addition & 2 deletions tests/basics/bytearray_construct_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
try:
from array import array
except ImportError:
import sys
print("SKIP")
sys.exit()
raise SystemExit

# arrays
print(bytearray(array('b', [1, 2])))
Expand Down
3 changes: 1 addition & 2 deletions tests/basics/bytearray_construct_endian.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
try:
from array import array
except ImportError:
import sys
print("SKIP")
sys.exit()
raise SystemExit

# arrays
print(bytearray(array('h', [1, 2])))
Expand Down
3 changes: 1 addition & 2 deletions tests/basics/bytearray_slice_assign.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
bytearray()[:] = bytearray()
except TypeError:
print("SKIP")
import sys
sys.exit()
raise SystemExit

# test slices; only 2 argument version supported by Micro Python at the moment
x = bytearray(range(10))
Expand Down
3 changes: 1 addition & 2 deletions tests/basics/bytes_add_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
try:
import array
except ImportError:
import sys
print("SKIP")
sys.exit()
raise SystemExit

# should be byteorder-neutral
print(b"123" + array.array('h', [0x1515]))
Expand Down
3 changes: 1 addition & 2 deletions tests/basics/bytes_add_endian.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
try:
import array
except ImportError:
import sys
print("SKIP")
sys.exit()
raise SystemExit

print(b"123" + array.array('i', [1]))
3 changes: 1 addition & 2 deletions tests/basics/bytes_compare_array.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
try:
import array
except ImportError:
import sys
print("SKIP")
sys.exit()
raise SystemExit

print(array.array('b', [1, 2]) in b'\x01\x02\x03')
# CPython gives False here
Expand Down
3 changes: 1 addition & 2 deletions tests/basics/bytes_construct_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
try:
from array import array
except ImportError:
import sys
print("SKIP")
sys.exit()
raise SystemExit

# arrays
print(bytes(array('b', [1, 2])))
Expand Down
3 changes: 1 addition & 2 deletions tests/basics/bytes_construct_endian.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
try:
from array import array
except ImportError:
import sys
print("SKIP")
sys.exit()
raise SystemExit

# arrays
print(bytes(array('h', [1, 2])))
Expand Down
3 changes: 1 addition & 2 deletions tests/basics/bytes_partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
str.partition
except AttributeError:
print("SKIP")
import sys
sys.exit()
raise SystemExit

print(b"asdf".partition(b'g'))
print(b"asdf".partition(b'a'))
Expand Down
3 changes: 1 addition & 2 deletions tests/basics/class_delattr_setattr.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ class Test():
def __delattr__(self, attr): pass
del Test().noexist
except AttributeError:
import sys
print('SKIP')
sys.exit()
raise SystemExit

# this class just prints the calls to see if they were executed
class A():
Expand Down
3 changes: 1 addition & 2 deletions tests/basics/class_descriptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ class Main:
try:
m.__class__
except AttributeError:
import sys
print("SKIP")
sys.exit()
raise SystemExit

r = m.Forward
if 'Descriptor' in repr(r.__class__):
Expand Down
3 changes: 1 addition & 2 deletions tests/basics/class_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
# nothing to test.
object.__new__
except AttributeError:
import sys
print("SKIP")
sys.exit()
raise SystemExit
class A:
def __new__(cls):
print("A.__new__")
Expand Down
3 changes: 1 addition & 2 deletions tests/basics/class_store_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@
try:
from ucollections import namedtuple
except ImportError:
import sys
print("SKIP")
sys.exit()
raise SystemExit

_DefragResultBase = namedtuple('DefragResult', [ 'foo', 'bar' ])

Expand Down
3 changes: 1 addition & 2 deletions tests/basics/class_super_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
# nothing to test.
object.__init__
except AttributeError:
import sys
print("SKIP")
sys.exit()
raise SystemExit

class Test(object):
def __init__(self):
Expand Down
3 changes: 1 addition & 2 deletions tests/basics/dict_fromkeys2.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
try:
reversed
except:
import sys
print("SKIP")
sys.exit()
raise SystemExit

# argument to fromkeys has no __len__
d = dict.fromkeys(reversed(range(1)))
Expand Down
3 changes: 1 addition & 2 deletions tests/basics/enumerate.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
try:
enumerate
except:
import sys
print("SKIP")
sys.exit()
raise SystemExit

print(list(enumerate([])))
print(list(enumerate([1, 2, 3])))
Expand Down
3 changes: 1 addition & 2 deletions tests/basics/errno1.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
import uerrno
except ImportError:
print("SKIP")
import sys
sys.exit()
raise SystemExit

# check that constants exist and are integers
print(type(uerrno.EIO))
Expand Down
3 changes: 1 addition & 2 deletions tests/basics/filter.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
try:
filter
except:
import sys
print("SKIP")
sys.exit()
raise SystemExit

print(list(filter(lambda x: x & 1, range(-3, 4))))
print(list(filter(None, range(-3, 4))))
Loading

0 comments on commit a2803b7

Please sign in to comment.