Skip to content

Commit 26f00ff

Browse files
committed
tests/run-tests: Allow to skip set tests.
If sets are not enabled, set literals lead to SyntaxError during parsing, so it requires feature_check. Set tests are skipped based on set_*.py pattern.
1 parent eac22e2 commit 26f00ff

File tree

4 files changed

+15
-1
lines changed

4 files changed

+15
-1
lines changed
File renamed without changes.

tests/feature_check/set_check.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# check if set literal syntax is supported
2+
{1}

tests/feature_check/set_check.py.exp

Whitespace-only changes.

tests/run-tests

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,12 +195,18 @@ def run_tests(pyb, tests, args):
195195

196196
skip_tests = set()
197197
skip_native = False
198+
skip_set_type = False
198199

199200
# Check if micropython.native is supported, and skip such tests if it's not
200201
native = run_micropython(pyb, args, 'feature_check/native_check.py')
201202
if native == b'CRASH':
202203
skip_native = True
203204

205+
# Check if set type (and set literals) is supported, and skip such tests if it's not
206+
native = run_micropython(pyb, args, 'feature_check/set_check.py')
207+
if native == b'CRASH':
208+
skip_set_type = True
209+
204210
# Check if emacs repl is supported, and skip such tests if it's not
205211
t = run_micropython(pyb, args, 'feature_check/repl_emacs_check.py')
206212
if not 'True' in str(t, 'ascii'):
@@ -304,8 +310,14 @@ def run_tests(pyb, tests, args):
304310
test_name = os.path.splitext(test_basename)[0]
305311
is_native = test_name.startswith("native_") or test_name.startswith("viper_")
306312
is_endian = test_name.endswith("_endian")
313+
is_set_type = test_name.startswith("set_")
314+
315+
skip_it = test_file in skip_tests
316+
skip_it |= skip_native and is_native
317+
skip_it |= skip_endian and is_endian
318+
skip_it |= skip_set_type and is_set_type
307319

308-
if test_file in skip_tests or (skip_native and is_native) or (skip_endian and is_endian):
320+
if skip_it:
309321
print("skip ", test_file)
310322
skipped_tests.append(test_name)
311323
continue

0 commit comments

Comments
 (0)