From 7a9ab9c58a1d8ba9be54e86490186bd098d60e42 Mon Sep 17 00:00:00 2001 From: Ilija Lazoroski Date: Mon, 1 Aug 2022 15:37:33 +0200 Subject: [PATCH] BB: Catch KeyError and log a warning message when starting single tests --- envs/monkey_zoo/blackbox/test_blackbox.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/envs/monkey_zoo/blackbox/test_blackbox.py b/envs/monkey_zoo/blackbox/test_blackbox.py index f9fa72c9b..4731a70ae 100644 --- a/envs/monkey_zoo/blackbox/test_blackbox.py +++ b/envs/monkey_zoo/blackbox/test_blackbox.py @@ -42,7 +42,12 @@ def GCPHandler(request, no_gcp, machines_to_start): if not no_gcp: list_machines = GCP_TEST_MACHINE_LIST if machines_to_start: - list_machines = GCP_SINGLE_TEST_LIST[machines_to_start] + try: + list_machines = GCP_SINGLE_TEST_LIST[machines_to_start] + except KeyError as err: + LOGGER.warning( + f"Partial or wrong test name provided. " f"Starting all GCP machines:{err}" + ) try: initialize_gcp_client() start_machines(list_machines)