Skip to content

Commit

Permalink
test_run.py: allow specifying of individual tests
Browse files Browse the repository at this point in the history
If the user specifies any tests on the command line then only run
those.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
  • Loading branch information
stsquad committed Jul 17, 2023
1 parent 7be7704 commit 262f262
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,20 @@ def retrieve_test_list(config_file=f"{PARENT_DIR}/.buildkite/test_description.js
parser.add_argument("-l", "--list-tests",
action='store_true', default=False,
help="List available tests")
parser.add_argument('tests', nargs='*',
help="The tests to run. If none are specified "
"run all the available tests.")
args = parser.parse_args()

test_config = retrieve_test_list()

for test in test_config["tests"]:
name = test["test_name"]

if len(args.tests) > 0:
if name not in args.tests:
continue

command = test["command"]
command = command.replace("{target_platform}", platform.machine())
if args.list_tests:
Expand All @@ -63,4 +71,5 @@ def retrieve_test_list(config_file=f"{PARENT_DIR}/.buildkite/test_description.js
setattr(TestsContainer, f"test_{name}", test_func)

if not args.list_tests:
unittest.main(verbosity=2)
tests_suite = unittest.TestLoader().loadTestsFromTestCase(TestsContainer)
unittest.TextTestRunner(verbosity=2).run(tests_suite)

0 comments on commit 262f262

Please sign in to comment.