Skip to content

Commit 43d4a6f

Browse files
committed
run-tests: Add support for skipping tests.
MicrpPython test should print single "SKIP" line for test to be skipped.
1 parent 0f14fde commit 43d4a6f

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

tests/run-tests

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ def run_tests(pyb, tests):
2525
testcase_count = 0
2626
passed_count = 0
2727
failed_tests = []
28+
skipped_tests = []
2829

2930
running_under_travis = os.getenv('TRAVIS') == 'true'
3031

@@ -34,6 +35,7 @@ def run_tests(pyb, tests):
3435
for test_file in tests:
3536
if running_under_travis and test_file in skip_travis_tests:
3637
print("skip ", test_file)
38+
skipped_tests.append(test_name)
3739
continue
3840

3941
# get expected output
@@ -64,10 +66,16 @@ def run_tests(pyb, tests):
6466
except pyboard.PyboardError:
6567
output_mupy = b'CRASH'
6668

67-
testcase_count += len(output_expected.splitlines())
68-
6969
test_basename = os.path.basename(test_file)
7070
test_name = os.path.splitext(test_basename)[0]
71+
72+
if output_mupy == b'SKIP\n':
73+
print("skip ", test_file)
74+
skipped_tests.append(test_name)
75+
continue
76+
77+
testcase_count += len(output_expected.splitlines())
78+
7179
filename_expected = test_basename + ".exp"
7280
filename_mupy = test_basename + ".out"
7381

@@ -89,6 +97,8 @@ def run_tests(pyb, tests):
8997
print("{} tests performed ({} individual testcases)".format(test_count, testcase_count))
9098
print("{} tests passed".format(passed_count))
9199

100+
if len(skipped_tests) > 0:
101+
print("{} tests skipped: {}".format(len(skipped_tests), ' '.join(skipped_tests)))
92102
if len(failed_tests) > 0:
93103
print("{} tests failed: {}".format(len(failed_tests), ' '.join(failed_tests)))
94104
return False

0 commit comments

Comments
 (0)