Skip to content

Commit 7be7704

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 7be7704

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

test_run.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,24 @@ def retrieve_test_list(config_file=f"{PARENT_DIR}/.buildkite/test_description.js
4343
base branch, and these tests may not work as expected.
4444
"""
4545
)
46-
parser = ArgumentParser(description=help_text, formatter_class=RawTextHelpFormatter)
47-
parser.parse_args()
46+
parser = ArgumentParser(description=help_text,
47+
formatter_class=RawTextHelpFormatter)
48+
parser.add_argument("-l", "--list-tests",
49+
action='store_true', default=False,
50+
help="List available tests")
51+
args = parser.parse_args()
4852

4953
test_config = retrieve_test_list()
54+
5055
for test in test_config["tests"]:
5156
name = test["test_name"]
5257
command = test["command"]
5358
command = command.replace("{target_platform}", platform.machine())
54-
test_func = make_test_function(command)
55-
setattr(TestsContainer, f"test_{name}", test_func)
59+
if args.list_tests:
60+
print(f"{name}: {command}")
61+
else:
62+
test_func = make_test_function(command)
63+
setattr(TestsContainer, f"test_{name}", test_func)
5664

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

0 commit comments

Comments
 (0)