run-tests: Add support for skipping tests.
MicrpPython test should print single "SKIP" line for test to be skipped.
This commit is contained in:
parent
0f14fdea0c
commit
43d4a6fa31
|
@ -25,6 +25,7 @@ def run_tests(pyb, tests):
|
||||||
testcase_count = 0
|
testcase_count = 0
|
||||||
passed_count = 0
|
passed_count = 0
|
||||||
failed_tests = []
|
failed_tests = []
|
||||||
|
skipped_tests = []
|
||||||
|
|
||||||
running_under_travis = os.getenv('TRAVIS') == 'true'
|
running_under_travis = os.getenv('TRAVIS') == 'true'
|
||||||
|
|
||||||
|
@ -34,6 +35,7 @@ def run_tests(pyb, tests):
|
||||||
for test_file in tests:
|
for test_file in tests:
|
||||||
if running_under_travis and test_file in skip_travis_tests:
|
if running_under_travis and test_file in skip_travis_tests:
|
||||||
print("skip ", test_file)
|
print("skip ", test_file)
|
||||||
|
skipped_tests.append(test_name)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# get expected output
|
# get expected output
|
||||||
|
@ -64,10 +66,16 @@ def run_tests(pyb, tests):
|
||||||
except pyboard.PyboardError:
|
except pyboard.PyboardError:
|
||||||
output_mupy = b'CRASH'
|
output_mupy = b'CRASH'
|
||||||
|
|
||||||
testcase_count += len(output_expected.splitlines())
|
|
||||||
|
|
||||||
test_basename = os.path.basename(test_file)
|
test_basename = os.path.basename(test_file)
|
||||||
test_name = os.path.splitext(test_basename)[0]
|
test_name = os.path.splitext(test_basename)[0]
|
||||||
|
|
||||||
|
if output_mupy == b'SKIP\n':
|
||||||
|
print("skip ", test_file)
|
||||||
|
skipped_tests.append(test_name)
|
||||||
|
continue
|
||||||
|
|
||||||
|
testcase_count += len(output_expected.splitlines())
|
||||||
|
|
||||||
filename_expected = test_basename + ".exp"
|
filename_expected = test_basename + ".exp"
|
||||||
filename_mupy = test_basename + ".out"
|
filename_mupy = test_basename + ".out"
|
||||||
|
|
||||||
|
@ -89,6 +97,8 @@ def run_tests(pyb, tests):
|
||||||
print("{} tests performed ({} individual testcases)".format(test_count, testcase_count))
|
print("{} tests performed ({} individual testcases)".format(test_count, testcase_count))
|
||||||
print("{} tests passed".format(passed_count))
|
print("{} tests passed".format(passed_count))
|
||||||
|
|
||||||
|
if len(skipped_tests) > 0:
|
||||||
|
print("{} tests skipped: {}".format(len(skipped_tests), ' '.join(skipped_tests)))
|
||||||
if len(failed_tests) > 0:
|
if len(failed_tests) > 0:
|
||||||
print("{} tests failed: {}".format(len(failed_tests), ' '.join(failed_tests)))
|
print("{} tests failed: {}".format(len(failed_tests), ' '.join(failed_tests)))
|
||||||
return False
|
return False
|
||||||
|
|
Loading…
Reference in New Issue