diff options
| author | Jeff Epler <jepler@gmail.com> | 2018-03-31 09:08:37 -0500 |
|---|---|---|
| committer | Jeff Epler <jepler@gmail.com> | 2018-03-31 10:38:04 -0500 |
| commit | 4767d23db30e4adc09c8173ab71c4c8c63db1512 (patch) | |
| tree | b10aa2c98b85f0d30a9fe4dd935d50b9c59cbdd9 /tests/run-tests | |
| parent | 1eba5804434a8acc182c23aadf5b5a5dcbe901fa (diff) | |
run_tests: factor run_one_test to function
Diffstat (limited to 'tests/run-tests')
| -rwxr-xr-x | tests/run-tests | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/tests/run-tests b/tests/run-tests index f1035c435..3f8a2a827 100755 --- a/tests/run-tests +++ b/tests/run-tests @@ -354,7 +354,9 @@ def run_tests(pyb, tests, args, base_path="."): skip_tests.add('micropython/heapalloc_iter.py') # requires generators skip_tests.add('micropython/schedule.py') # native code doesn't check pending events - for test_file in tests: + def run_one_test(test_file): + nonlocal test_count, testcase_count, passed_count, failed_tests + test_file = test_file.replace('\\', '/') test_basename = os.path.basename(test_file) test_name = os.path.splitext(test_basename)[0] @@ -377,7 +379,7 @@ def run_tests(pyb, tests, args, base_path="."): if skip_it: print("skip ", test_file) skipped_tests.append(test_name) - continue + return # get expected output test_file_expected = test_file + '.exp' @@ -405,7 +407,7 @@ def run_tests(pyb, tests, args, base_path="."): output_expected = output_expected.replace(b'\r\n', b'\n') if args.write_exp: - continue + return # run MicroPython output_mupy = run_micropython(pyb, args, test_file) @@ -413,7 +415,7 @@ def run_tests(pyb, tests, args, base_path="."): if output_mupy == b'SKIP\n': print("skip ", test_file) skipped_tests.append(test_name) - continue + return testcase_count += len(output_expected.splitlines()) @@ -439,6 +441,9 @@ def run_tests(pyb, tests, args, base_path="."): test_count += 1 + for test_file in tests: + run_one_test(test_file) + print("{} tests performed ({} individual testcases)".format(test_count, testcase_count)) print("{} tests passed".format(passed_count)) |
