Skip to content

Commit 262f262

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 7be7704 commit 262f262

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

test_run.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,20 @@ def retrieve_test_list(config_file=f"{PARENT_DIR}/.buildkite/test_description.js
4848
parser.add_argument("-l", "--list-tests",
4949
action='store_true', default=False,
5050
help="List available tests")
51+
parser.add_argument('tests', nargs='*',
52+
help="The tests to run. If none are specified "
53+
"run all the available tests.")
5154
args = parser.parse_args()
5255

5356
test_config = retrieve_test_list()
5457

5558
for test in test_config["tests"]:
5659
name = test["test_name"]
60+
61+
if len(args.tests) > 0:
62+
if name not in args.tests:
63+
continue
64+
5765
command = test["command"]
5866
command = command.replace("{target_platform}", platform.machine())
5967
if args.list_tests:
@@ -63,4 +71,5 @@ def retrieve_test_list(config_file=f"{PARENT_DIR}/.buildkite/test_description.js
6371
setattr(TestsContainer, f"test_{name}", test_func)
6472

6573
if not args.list_tests:
66-
unittest.main(verbosity=2)
74+
tests_suite = unittest.TestLoader().loadTestsFromTestCase(TestsContainer)
75+
unittest.TextTestRunner(verbosity=2).run(tests_suite)

0 commit comments

Comments
 (0)