Skip to content

Commit 370add9

Browse files
committed
test_run.py: make it easy to see all the tests
Rather than make developers dive into the json configuration provide a little introspection command line to list the available tests. Signed-off-by: Alex Bennée <[email protected]>
1 parent 8f1ec16 commit 370add9

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

test_run.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,26 @@ def retrieve_test_list(config_file=f"{PARENT_DIR}/.buildkite/test_description.js
4444
"""
4545
)
4646
parser = ArgumentParser(description=help_text, formatter_class=RawTextHelpFormatter)
47-
parser.parse_args()
47+
parser.add_argument(
48+
"-l",
49+
"--list-tests",
50+
action="store_true",
51+
default=False,
52+
help="List available tests",
53+
)
54+
args = parser.parse_args()
4855

4956
test_config = retrieve_test_list()
57+
5058
for test in test_config["tests"]:
5159
name = test["test_name"]
5260
command = test["command"]
5361
command = command.replace("{target_platform}", platform.machine())
54-
test_func = make_test_function(command)
55-
setattr(TestsContainer, f"test_{name}", test_func)
62+
if args.list_tests:
63+
print(f"{name}: {command}")
64+
else:
65+
test_func = make_test_function(command)
66+
setattr(TestsContainer, f"test_{name}", test_func)
5667

57-
unittest.main(verbosity=2)
68+
if not args.list_tests:
69+
unittest.main(verbosity=2)

0 commit comments

Comments
 (0)