Browse Source

tests/extmod: Make tests skippable.

pull/1855/merge
Paul Sokolovsky 8 years ago
parent
commit
f2d732f459
  1. 3
      tests/extmod/machine1.py
  2. 9
      tests/extmod/ubinascii_a2b_base64.py
  3. 9
      tests/extmod/ubinascii_b2a_base64.py
  4. 10
      tests/extmod/ubinascii_crc32.py
  5. 9
      tests/extmod/ubinascii_hexlify.py
  6. 9
      tests/extmod/ubinascii_micropython.py
  7. 9
      tests/extmod/ubinascii_unhexlify.py
  8. 7
      tests/extmod/uctypes_array_assign_le.py
  9. 6
      tests/extmod/uctypes_array_assign_native_le.py
  10. 7
      tests/extmod/uctypes_bytearray.py
  11. 7
      tests/extmod/uctypes_le.py
  12. 7
      tests/extmod/uctypes_le_float.py
  13. 7
      tests/extmod/uctypes_native_float.py
  14. 6
      tests/extmod/uctypes_native_le.py
  15. 8
      tests/extmod/uctypes_print.py
  16. 6
      tests/extmod/uctypes_ptr_le.py
  17. 6
      tests/extmod/uctypes_ptr_native_le.py
  18. 7
      tests/extmod/uctypes_sizeof.py
  19. 7
      tests/extmod/uctypes_sizeof_native.py
  20. 7
      tests/extmod/uheapq1.py
  21. 7
      tests/extmod/ujson_dumps.py
  22. 7
      tests/extmod/ujson_dumps_extra.py
  23. 7
      tests/extmod/ujson_dumps_float.py
  24. 9
      tests/extmod/ujson_load.py
  25. 9
      tests/extmod/ujson_loads.py
  26. 9
      tests/extmod/ujson_loads_float.py
  27. 7
      tests/extmod/urandom_basic.py
  28. 7
      tests/extmod/urandom_extra.py
  29. 7
      tests/extmod/ure1.py
  30. 8
      tests/extmod/ure_debug.py
  31. 9
      tests/extmod/ure_error.py
  32. 9
      tests/extmod/ure_group.py
  33. 9
      tests/extmod/ure_namedclass.py
  34. 7
      tests/extmod/ure_split.py
  35. 7
      tests/extmod/ure_split_empty.py
  36. 7
      tests/extmod/ure_split_notimpl.py
  37. 8
      tests/extmod/uzlib_decompio.py
  38. 8
      tests/extmod/uzlib_decompio_gz.py
  39. 7
      tests/extmod/uzlib_decompress.py
  40. 11
      tests/extmod/vfs_fat_oldproto.py
  41. 11
      tests/extmod/vfs_fat_ramdisk.py

3
tests/extmod/machine1.py

@ -5,7 +5,8 @@ try:
import umachine as machine import umachine as machine
except ImportError: except ImportError:
import machine import machine
except ImportError: machine.mem8
except:
print("SKIP") print("SKIP")
import sys import sys
sys.exit() sys.exit()

9
tests/extmod/ubinascii_a2b_base64.py

@ -1,7 +1,12 @@
try: try:
import ubinascii as binascii try:
import ubinascii as binascii
except ImportError:
import binascii
except ImportError: except ImportError:
import binascii import sys
print("SKIP")
sys.exit()
print(binascii.a2b_base64(b'')) print(binascii.a2b_base64(b''))
print(binascii.a2b_base64(b'Zg==')) print(binascii.a2b_base64(b'Zg=='))

9
tests/extmod/ubinascii_b2a_base64.py

@ -1,7 +1,12 @@
try: try:
import ubinascii as binascii try:
import ubinascii as binascii
except ImportError:
import binascii
except ImportError: except ImportError:
import binascii import sys
print("SKIP")
sys.exit()
print(binascii.b2a_base64(b'')) print(binascii.b2a_base64(b''))
print(binascii.b2a_base64(b'f')) print(binascii.b2a_base64(b'f'))

10
tests/extmod/ubinascii_crc32.py

@ -1,7 +1,13 @@
try: try:
import ubinascii as binascii try:
import ubinascii as binascii
except ImportError:
import binascii
except ImportError: except ImportError:
import binascii import sys
print("SKIP")
sys.exit()
try: try:
binascii.crc32 binascii.crc32
except AttributeError: except AttributeError:

9
tests/extmod/ubinascii_hexlify.py

@ -1,7 +1,12 @@
try: try:
import ubinascii as binascii try:
import ubinascii as binascii
except ImportError:
import binascii
except ImportError: except ImportError:
import binascii import sys
print("SKIP")
sys.exit()
print(binascii.hexlify(b'\x00\x01\x02\x03\x04\x05\x06\x07')) print(binascii.hexlify(b'\x00\x01\x02\x03\x04\x05\x06\x07'))
print(binascii.hexlify(b'\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f')) print(binascii.hexlify(b'\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f'))

9
tests/extmod/ubinascii_micropython.py

@ -1,7 +1,12 @@
try: try:
import ubinascii as binascii try:
import ubinascii as binascii
except ImportError:
import binascii
except ImportError: except ImportError:
import binascii import sys
print("SKIP")
sys.exit()
# two arguments supported in uPy but not CPython # two arguments supported in uPy but not CPython
a = binascii.hexlify(b'123', ':') a = binascii.hexlify(b'123', ':')

9
tests/extmod/ubinascii_unhexlify.py

@ -1,7 +1,12 @@
try: try:
import ubinascii as binascii try:
import ubinascii as binascii
except ImportError:
import binascii
except ImportError: except ImportError:
import binascii import sys
print("SKIP")
sys.exit()
print(binascii.unhexlify(b'0001020304050607')) print(binascii.unhexlify(b'0001020304050607'))
print(binascii.unhexlify(b'08090a0b0c0d0e0f')) print(binascii.unhexlify(b'08090a0b0c0d0e0f'))

7
tests/extmod/uctypes_array_assign_le.py

@ -1,4 +1,9 @@
import uctypes try:
import uctypes
except ImportError:
import sys
print("SKIP")
sys.exit()
desc = { desc = {
# arr is array at offset 0, of UINT8 elements, array size is 2 # arr is array at offset 0, of UINT8 elements, array size is 2

6
tests/extmod/uctypes_array_assign_native_le.py

@ -1,5 +1,9 @@
import sys import sys
import uctypes try:
import uctypes
except ImportError:
print("SKIP")
sys.exit()
if sys.byteorder != "little": if sys.byteorder != "little":
print("SKIP") print("SKIP")

7
tests/extmod/uctypes_bytearray.py

@ -1,4 +1,9 @@
import uctypes try:
import uctypes
except ImportError:
import sys
print("SKIP")
sys.exit()
desc = { desc = {
"arr": (uctypes.ARRAY | 0, uctypes.UINT8 | 2), "arr": (uctypes.ARRAY | 0, uctypes.UINT8 | 2),

7
tests/extmod/uctypes_le.py

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

7
tests/extmod/uctypes_le_float.py

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

7
tests/extmod/uctypes_native_float.py

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

6
tests/extmod/uctypes_native_le.py

@ -2,7 +2,11 @@
# Codepaths for packed vs native structures are different. This test only works # Codepaths for packed vs native structures are different. This test only works
# on little-endian machine (no matter if 32 or 64 bit). # on little-endian machine (no matter if 32 or 64 bit).
import sys import sys
import uctypes try:
import uctypes
except ImportError:
print("SKIP")
sys.exit()
if sys.byteorder != "little": if sys.byteorder != "little":
print("SKIP") print("SKIP")

8
tests/extmod/uctypes_print.py

@ -1,6 +1,10 @@
# test printing of uctypes objects # test printing of uctypes objects
try:
import uctypes import uctypes
except ImportError:
import sys
print("SKIP")
sys.exit()
# we use an address of "0" because we just want to print something deterministic # 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 # and don't actually need to set/get any values in the struct

6
tests/extmod/uctypes_ptr_le.py

@ -1,5 +1,9 @@
import sys import sys
import uctypes try:
import uctypes
except ImportError:
print("SKIP")
sys.exit()
if sys.byteorder != "little": if sys.byteorder != "little":
print("SKIP") print("SKIP")

6
tests/extmod/uctypes_ptr_native_le.py

@ -1,5 +1,9 @@
import sys import sys
import uctypes try:
import uctypes
except ImportError:
print("SKIP")
sys.exit()
if sys.byteorder != "little": if sys.byteorder != "little":
print("SKIP") print("SKIP")

7
tests/extmod/uctypes_sizeof.py

@ -1,4 +1,9 @@
import uctypes try:
import uctypes
except ImportError:
import sys
print("SKIP")
sys.exit()
desc = { desc = {
# arr is array at offset 0, of UINT8 elements, array size is 2 # arr is array at offset 0, of UINT8 elements, array size is 2

7
tests/extmod/uctypes_sizeof_native.py

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

7
tests/extmod/uheapq1.py

@ -1,7 +1,12 @@
try: try:
import uheapq as heapq import uheapq as heapq
except: except:
import heapq try:
import heapq
except ImportError:
import sys
print("SKIP")
sys.exit()
try: try:
heapq.heappop([]) heapq.heappop([])

7
tests/extmod/ujson_dumps.py

@ -1,7 +1,12 @@
try: try:
import ujson as json import ujson as json
except ImportError: except ImportError:
import json try:
import json
except ImportError:
import sys
print("SKIP")
sys.exit()
print(json.dumps(False)) print(json.dumps(False))
print(json.dumps(True)) print(json.dumps(True))

7
tests/extmod/ujson_dumps_extra.py

@ -1,5 +1,10 @@
# test uPy ujson behaviour that's not valid in CPy # test uPy ujson behaviour that's not valid in CPy
import ujson try:
import ujson
except ImportError:
import sys
print("SKIP")
sys.exit()
print(ujson.dumps(b'1234')) print(ujson.dumps(b'1234'))

7
tests/extmod/ujson_dumps_float.py

@ -1,6 +1,11 @@
try: try:
import ujson as json import ujson as json
except ImportError: except ImportError:
import json try:
import json
except ImportError:
import sys
print("SKIP")
sys.exit()
print(json.dumps(1.2)) print(json.dumps(1.2))

9
tests/extmod/ujson_load.py

@ -2,8 +2,13 @@ try:
from uio import StringIO from uio import StringIO
import ujson as json import ujson as json
except: except:
from io import StringIO try:
import json from io import StringIO
import json
except ImportError:
import sys
print("SKIP")
sys.exit()
print(json.load(StringIO('null'))) print(json.load(StringIO('null')))
print(json.load(StringIO('"abc\\u0064e"'))) print(json.load(StringIO('"abc\\u0064e"')))

9
tests/extmod/ujson_loads.py

@ -1,7 +1,12 @@
try: try:
import ujson as json import ujson as json
except: except ImportError:
import json try:
import json
except ImportError:
import sys
print("SKIP")
sys.exit()
def my_print(o): def my_print(o):
if isinstance(o, dict): if isinstance(o, dict):

9
tests/extmod/ujson_loads_float.py

@ -1,7 +1,12 @@
try: try:
import ujson as json import ujson as json
except: except ImportError:
import json try:
import json
except ImportError:
import sys
print("SKIP")
sys.exit()
def my_print(o): def my_print(o):
print('%.3f' % o) print('%.3f' % o)

7
tests/extmod/urandom_basic.py

@ -1,7 +1,12 @@
try: try:
import urandom as random import urandom as random
except ImportError: except ImportError:
import random try:
import random
except ImportError:
import sys
print("SKIP")
sys.exit()
# check getrandbits returns a value within the bit range # check getrandbits returns a value within the bit range
for b in (1, 2, 3, 4, 16, 32): for b in (1, 2, 3, 4, 16, 32):

7
tests/extmod/urandom_extra.py

@ -1,7 +1,12 @@
try: try:
import urandom as random import urandom as random
except ImportError: except ImportError:
import random try:
import random
except ImportError:
import sys
print("SKIP")
sys.exit()
try: try:
random.randint random.randint

7
tests/extmod/ure1.py

@ -1,7 +1,12 @@
try: try:
import ure as re import ure as re
except ImportError: except ImportError:
import re try:
import re
except ImportError:
import sys
print("SKIP")
sys.exit()
r = re.compile(".+") r = re.compile(".+")
m = r.match("abc") m = r.match("abc")

8
tests/extmod/ure_debug.py

@ -1,3 +1,9 @@
# test printing debugging info when compiling # test printing debugging info when compiling
import ure try:
import ure
except ImportError:
import sys
print("SKIP")
sys.exit()
ure.compile('^a|b[0-9]\w$', ure.DEBUG) ure.compile('^a|b[0-9]\w$', ure.DEBUG)

9
tests/extmod/ure_error.py

@ -2,8 +2,13 @@
try: try:
import ure as re import ure as re
except: except ImportError:
import re try:
import re
except ImportError:
import sys
print("SKIP")
sys.exit()
def test_re(r): def test_re(r):
try: try:

9
tests/extmod/ure_group.py

@ -2,8 +2,13 @@
try: try:
import ure as re import ure as re
except: except ImportError:
import re try:
import re
except ImportError:
import sys
print("SKIP")
sys.exit()
def print_groups(match): def print_groups(match):
print('----') print('----')

9
tests/extmod/ure_namedclass.py

@ -2,8 +2,13 @@
try: try:
import ure as re import ure as re
except: except ImportError:
import re try:
import re
except ImportError:
import sys
print("SKIP")
sys.exit()
def print_groups(match): def print_groups(match):
print('----') print('----')

7
tests/extmod/ure_split.py

@ -1,7 +1,12 @@
try: try:
import ure as re import ure as re
except ImportError: except ImportError:
import re try:
import re
except ImportError:
import sys
print("SKIP")
sys.exit()
r = re.compile(" ") r = re.compile(" ")
s = r.split("a b c foobar") s = r.split("a b c foobar")

7
tests/extmod/ure_split_empty.py

@ -4,7 +4,12 @@
# behaviour will change in a future version. MicroPython just stops # behaviour will change in a future version. MicroPython just stops
# splitting as soon as an empty match is found. # splitting as soon as an empty match is found.
import ure as re try:
import ure as re
except ImportError:
import sys
print("SKIP")
sys.exit()
r = re.compile(" *") r = re.compile(" *")
s = r.split("a b c foobar") s = r.split("a b c foobar")

7
tests/extmod/ure_split_notimpl.py

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

8
tests/extmod/uzlib_decompio.py

@ -1,8 +1,10 @@
try: try:
import zlib
except ImportError:
import uzlib as zlib import uzlib as zlib
import uio as io import uio as io
except ImportError:
import sys
print("SKIP")
sys.exit()
# Raw DEFLATE bitstream # Raw DEFLATE bitstream

8
tests/extmod/uzlib_decompio_gz.py

@ -1,8 +1,10 @@
try: try:
import zlib
except ImportError:
import uzlib as zlib import uzlib as zlib
import uio as io import uio as io
except ImportError:
import sys
print("SKIP")
sys.exit()
# gzip bitstream # gzip bitstream

7
tests/extmod/uzlib_decompress.py

@ -1,7 +1,12 @@
try: try:
import zlib import zlib
except ImportError: except ImportError:
import uzlib as zlib try:
import uzlib as zlib
except ImportError:
import sys
print("SKIP")
sys.exit()
PATTERNS = [ PATTERNS = [
# Packed results produced by CPy's zlib.compress() # Packed results produced by CPy's zlib.compress()

11
tests/extmod/vfs_fat_oldproto.py

@ -1,9 +1,14 @@
import sys import sys
import uerrno
try: try:
import uos_vfs as uos import uerrno
try:
import uos_vfs as uos
except ImportError:
import uos
except ImportError: except ImportError:
import uos print("SKIP")
sys.exit()
try: try:
uos.VfsFat uos.VfsFat
except AttributeError: except AttributeError:

11
tests/extmod/vfs_fat_ramdisk.py

@ -1,9 +1,14 @@
import sys import sys
import uerrno
try: try:
import uos_vfs as uos import uerrno
try:
import uos_vfs as uos
except ImportError:
import uos
except ImportError: except ImportError:
import uos print("SKIP")
sys.exit()
try: try:
uos.VfsFat uos.VfsFat
except AttributeError: except AttributeError:

Loading…
Cancel
Save