Skip to content

Commit 09f4273

Browse files
committed
test_run.py: allow specifying of individual tests
If the user specifies any tests on the command line then only run those. Signed-off-by: Alex Bennée <[email protected]>
1 parent 370add9 commit 09f4273

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

test_run.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,22 @@ def retrieve_test_list(config_file=f"{PARENT_DIR}/.buildkite/test_description.js
5151
default=False,
5252
help="List available tests",
5353
)
54+
parser.add_argument(
55+
"tests",
56+
nargs="*",
57+
help="The tests to run. If none are specified run all the available tests.",
58+
)
5459
args = parser.parse_args()
5560

5661
test_config = retrieve_test_list()
5762

5863
for test in test_config["tests"]:
5964
name = test["test_name"]
65+
66+
if len(args.tests) > 0:
67+
if name not in args.tests:
68+
continue
69+
6070
command = test["command"]
6171
command = command.replace("{target_platform}", platform.machine())
6272
if args.list_tests:
@@ -66,4 +76,5 @@ def retrieve_test_list(config_file=f"{PARENT_DIR}/.buildkite/test_description.js
6676
setattr(TestsContainer, f"test_{name}", test_func)
6777

6878
if not args.list_tests:
69-
unittest.main(verbosity=2)
79+
tests_suite = unittest.TestLoader().loadTestsFromTestCase(TestsContainer)
80+
unittest.TextTestRunner(verbosity=2).run(tests_suite)

0 commit comments

Comments
 (0)