Skip to content

Commit 96e20c6

Browse files
committed
tests: Fix uctypes tests to run on 64bit arch; enable more native tests.
1 parent 5a5555e commit 96e20c6

File tree

5 files changed

+9
-11
lines changed

5 files changed

+9
-11
lines changed

tests/basics/bytes.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,6 @@
3333
print(bytes([3, 2, 1]))
3434
print(bytes(range(5)))
3535

36-
def gen():
37-
for i in range(4):
38-
yield i
39-
print(bytes(gen()))
40-
4136
# Make sure bytes are not mistreated as unicode
4237
x = b"\xff\x8e\xfe}\xfd\x7f"
4338
print(len(x))

tests/basics/bytes_gen.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# construct a bytes object from a generator
2+
def gen():
3+
for i in range(4):
4+
yield i
5+
print(bytes(gen()))

tests/extmod/uctypes_ptr_le.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
bytes = b"01"
1010

1111
addr = uctypes.addressof(bytes)
12-
buf = addr.to_bytes(4)
12+
buf = addr.to_bytes(uctypes.sizeof(desc))
1313

1414
S = uctypes.struct(desc, uctypes.addressof(buf), uctypes.LITTLE_ENDIAN)
1515

tests/extmod/uctypes_ptr_native_le.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
bytes = b"01"
1616

1717
addr = uctypes.addressof(bytes)
18-
buf = addr.to_bytes(4)
18+
buf = addr.to_bytes(uctypes.sizeof(desc))
1919

2020
S = uctypes.struct(desc, uctypes.addressof(buf), uctypes.NATIVE)
2121

tests/run-tests

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,17 @@ def run_tests(pyb, tests, args):
4040

4141
# Some tests are known to fail on 64-bit machines
4242
if pyb is None and platform.architecture()[0] == '64bit':
43-
skip_tests.add('extmod/uctypes_ptr_le.py')
44-
skip_tests.add('extmod/uctypes_ptr_native_le.py')
43+
pass
4544

4645
# Some tests are known to fail with native emitter
4746
# Remove them from the below when they work
4847
if args.emit == 'native':
49-
skip_tests.update({'basics/%s.py' % t for t in 'bytes class_store_class class_super class_super_object closure1 closure2 closure_defargs compare_multi containment del_deref del_local del_name fun3 fun_calldblstar fun_callstar fun_callstardblstar fun_defargs fun_defargs2 fun_kwargs fun_kwonly fun_kwonlydef fun_kwvarargs fun_varargs gen_yield_from gen_yield_from_close gen_yield_from_ducktype gen_yield_from_exc gen_yield_from_iter gen_yield_from_send gen_yield_from_throw generator1 generator2 generator_args generator_close generator_closure generator_exc generator_return generator_send globals_del is_isnot string_format string_join subclass_native2_list subclass_native2_tuple subclass_native3 try2 try_as_var try_finally1 try_finally_loops try_finally_return try_reraise try_reraise2 unary_op unboundlocal with1 with_break with_continue with_return'.split()})
48+
skip_tests.update({'basics/%s.py' % t for t in 'bytes_gen class_store_class class_super class_super_object closure1 closure2 closure_defargs compare_multi containment del_deref del_local fun3 fun_calldblstar fun_callstar fun_callstardblstar fun_defargs fun_defargs2 fun_kwargs fun_kwonly fun_kwonlydef fun_kwvarargs fun_varargs gen_yield_from gen_yield_from_close gen_yield_from_ducktype gen_yield_from_exc gen_yield_from_iter gen_yield_from_send gen_yield_from_throw generator1 generator2 generator_args generator_close generator_closure generator_exc generator_return generator_send globals_del is_isnot string_format string_join subclass_native2_list subclass_native2_tuple try2 try_finally1 try_finally_loops try_finally_return try_reraise try_reraise2 unary_op unboundlocal with1 with_break with_continue with_return'.split()})
5049
skip_tests.add('float/string_format.py')
5150
skip_tests.add('import/gen_context.py')
5251
skip_tests.add('import/import_pkg1.py')
5352
skip_tests.add('io/file_with.py')
5453
skip_tests.add('micropython/heapalloc.py')
55-
skip_tests.add('micropython/viper.py')
5654
skip_tests.add('misc/features.py')
5755
skip_tests.add('misc/recursion.py')
5856
skip_tests.add('misc/rge_sm.py')

0 commit comments

Comments
 (0)