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
except ImportError:
import machine
except ImportError:
machine.mem8
except:
print("SKIP")
import sys
sys.exit()

9
tests/extmod/ubinascii_a2b_base64.py

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

9
tests/extmod/ubinascii_b2a_base64.py

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

10
tests/extmod/ubinascii_crc32.py

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

9
tests/extmod/ubinascii_hexlify.py

@ -1,7 +1,12 @@
try:
import ubinascii as binascii
try:
import ubinascii as binascii
except ImportError:
import binascii
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'\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f'))

9
tests/extmod/ubinascii_micropython.py

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

9
tests/extmod/ubinascii_unhexlify.py

@ -1,7 +1,12 @@
try:
import ubinascii as binascii
try:
import ubinascii as binascii
except ImportError:
import binascii
except ImportError:
import binascii
import sys
print("SKIP")
sys.exit()
print(binascii.unhexlify(b'0001020304050607'))
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 = {
# 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 uctypes
try:
import uctypes
except ImportError:
print("SKIP")
sys.exit()
if sys.byteorder != "little":
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 = {
"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 = {
"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 = {
"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 = {
"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
# on little-endian machine (no matter if 32 or 64 bit).
import sys
import uctypes
try:
import uctypes
except ImportError:
print("SKIP")
sys.exit()
if sys.byteorder != "little":
print("SKIP")

8
tests/extmod/uctypes_print.py

@ -1,6 +1,10 @@
# test printing of uctypes objects
import uctypes
try:
import uctypes
except ImportError:
import sys
print("SKIP")
sys.exit()
# 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

6
tests/extmod/uctypes_ptr_le.py

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

6
tests/extmod/uctypes_ptr_native_le.py

@ -1,5 +1,9 @@
import sys
import uctypes
try:
import uctypes
except ImportError:
print("SKIP")
sys.exit()
if sys.byteorder != "little":
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 = {
# 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 = {}
assert uctypes.sizeof(S1) == 0

7
tests/extmod/uheapq1.py

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

7
tests/extmod/ujson_dumps.py

@ -1,7 +1,12 @@
try:
import ujson as json
except ImportError:
import json
try:
import json
except ImportError:
import sys
print("SKIP")
sys.exit()
print(json.dumps(False))
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
import ujson
try:
import ujson
except ImportError:
import sys
print("SKIP")
sys.exit()
print(ujson.dumps(b'1234'))

7
tests/extmod/ujson_dumps_float.py

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

9
tests/extmod/ujson_load.py

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

9
tests/extmod/ujson_loads.py

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

9
tests/extmod/ujson_loads_float.py

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

7
tests/extmod/urandom_basic.py

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

7
tests/extmod/urandom_extra.py

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

7
tests/extmod/ure1.py

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

8
tests/extmod/ure_debug.py

@ -1,3 +1,9 @@
# 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)

9
tests/extmod/ure_error.py

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

9
tests/extmod/ure_group.py

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

9
tests/extmod/ure_namedclass.py

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

7
tests/extmod/ure_split.py

@ -1,7 +1,12 @@
try:
import ure as re
except ImportError:
import re
try:
import re
except ImportError:
import sys
print("SKIP")
sys.exit()
r = re.compile(" ")
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
# 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(" *")
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('( )')
try:

8
tests/extmod/uzlib_decompio.py

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

8
tests/extmod/uzlib_decompio_gz.py

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

7
tests/extmod/uzlib_decompress.py

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

11
tests/extmod/vfs_fat_oldproto.py

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

11
tests/extmod/vfs_fat_ramdisk.py

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

Loading…
Cancel
Save