mirror of
https://github.com/micropython/micropython.git
synced 2026-03-10 19:00:30 +01:00
tests/run-tests.py: Add an argument for showing which tests would run.
This is convenient when trying to figure out the correct values for --include/--exclude/--test-dirs/... arguments. Signed-off-by: stijn <stijn@ignitron.net>
This commit is contained in:
@@ -887,6 +887,10 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1):
|
||||
print("skip ", test_file)
|
||||
test_results.append((test_file, "skip", ""))
|
||||
return
|
||||
elif args.dry_run:
|
||||
print("found", test_file)
|
||||
test_results.append((test_file, "found", ""))
|
||||
return
|
||||
|
||||
# Run the test on the MicroPython target.
|
||||
output_mupy = run_micropython(pyb, args, test_file, test_file_abspath)
|
||||
@@ -1109,6 +1113,11 @@ the last matching regex is used:
|
||||
dest="filters",
|
||||
help="include test by regex on path/name.py",
|
||||
)
|
||||
cmd_parser.add_argument(
|
||||
"--dry-run",
|
||||
action="store_true",
|
||||
help="Show tests which would run (though might still be skipped at runtime)",
|
||||
)
|
||||
cmd_parser.add_argument(
|
||||
"--emit", default="bytecode", help="MicroPython emitter to use (bytecode or native)"
|
||||
)
|
||||
|
||||
@@ -313,15 +313,21 @@ def create_test_report(args, test_results, testcase_count=None):
|
||||
r for r in test_results if r[1] == "skip" and r[2] == "too large"
|
||||
)
|
||||
failed_tests = list(r for r in test_results if r[1] == "fail")
|
||||
dry_run = getattr(args, "dry_run", False)
|
||||
if dry_run:
|
||||
found_tests = list(r for r in test_results if r[1] == "found")
|
||||
|
||||
num_tests_performed = len(passed_tests) + len(failed_tests)
|
||||
|
||||
testcase_count_info = ""
|
||||
if testcase_count is not None:
|
||||
testcase_count_info = " ({} individual testcases)".format(testcase_count)
|
||||
print("{} tests performed{}".format(num_tests_performed, testcase_count_info))
|
||||
if dry_run:
|
||||
print("{} tests found".format(len(found_tests)))
|
||||
else:
|
||||
testcase_count_info = ""
|
||||
if testcase_count is not None:
|
||||
testcase_count_info = " ({} individual testcases)".format(testcase_count)
|
||||
print("{} tests performed{}".format(num_tests_performed, testcase_count_info))
|
||||
|
||||
print("{} tests passed".format(len(passed_tests)))
|
||||
print("{} tests passed".format(len(passed_tests)))
|
||||
|
||||
if len(skipped_tests) > 0:
|
||||
print(
|
||||
|
||||
Reference in New Issue
Block a user