From 25aab00c7708bfa42fe4abafb48473e88b927d2d Mon Sep 17 00:00:00 2001 From: Romulo Quidute Filho Date: Mon, 2 Dec 2024 14:24:24 +0000 Subject: [PATCH] code review --- .../list_python_tests_classes.py | 20 ++++++++++--------- .../models/rpc_client/test_harness_client.py | 3 ++- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/test_collections/matter/sdk_tests/support/python_testing/list_python_tests_classes.py b/test_collections/matter/sdk_tests/support/python_testing/list_python_tests_classes.py index 65c8a8db..30a4414d 100644 --- a/test_collections/matter/sdk_tests/support/python_testing/list_python_tests_classes.py +++ b/test_collections/matter/sdk_tests/support/python_testing/list_python_tests_classes.py @@ -95,7 +95,7 @@ async def proccess_commands_sdk_container( ) -> None: complete_json = [] errors_found: list[str] = [] - warning_found: list[str] = [] + warnings_found: list[str] = [] test_function_count = 0 invalid_test_function_count = 0 @@ -116,11 +116,11 @@ async def proccess_commands_sdk_container( json_data = json.load(json_file) errors_found.append( - f"Failed running command: {command}.\nError message: {json_data['detail']}" + f"Failed running command: {command}.\n" + f"Error message: {json_data['detail']}" ) - except: - pass - continue + finally: + continue with open(JSON_OUTPUT_FILE_PATH, "r") as json_file: json_data = json.load(json_file) @@ -132,8 +132,10 @@ async def proccess_commands_sdk_container( function = json_dict["function"] if not function.startswith("test_TC_"): invalid_test_function_count += 1 - warning_found.append( - f"Warning: File path: {json_dict['path']} Class: {json_dict['class_name']}. Invalid test function: {function}" + warnings_found.append( + f"Warning: File path: {json_dict['path']} " + f"Class: {json_dict['class_name']}. " + f"Invalid test function: {function}" ) complete_json.append(json_dict) @@ -158,8 +160,8 @@ async def proccess_commands_sdk_container( f"{invalid_test_function_count}" ) ) - if len(warning_found) > 0: - print(*warning_found, sep="\n") + if len(warnings_found) > 0: + print(*warnings_found, sep="\n") error_count = len(errors_found) print(f">>>>>>>> Total of scripts with error: {error_count}") if error_count > 0: diff --git a/test_collections/matter/sdk_tests/support/python_testing/models/rpc_client/test_harness_client.py b/test_collections/matter/sdk_tests/support/python_testing/models/rpc_client/test_harness_client.py index dac0c0c8..bf8c8fd2 100644 --- a/test_collections/matter/sdk_tests/support/python_testing/models/rpc_client/test_harness_client.py +++ b/test_collections/matter/sdk_tests/support/python_testing/models/rpc_client/test_harness_client.py @@ -63,7 +63,8 @@ def main() -> None: with open(TEST_INFO_JSON_PATH, "w") as f: json.dump(info, f, indent=4) else: - # TODO: find a better solution. This is a temporary workaround since Python Tests + # TODO: find a better solution. + # This is a temporary workaround since Python Tests # are generating a big amount of log with open(EXECUTION_LOG_OUTPUT, "w") as f: with redirect_stdout(f):