diff --git a/test_collections/sdk_tests/support/python_testing/models/python_test_parser.py b/test_collections/sdk_tests/support/python_testing/models/python_test_parser.py index 4f22227f..2cef81ee 100644 --- a/test_collections/sdk_tests/support/python_testing/models/python_test_parser.py +++ b/test_collections/sdk_tests/support/python_testing/models/python_test_parser.py @@ -23,6 +23,7 @@ ARG_STEP_DESCRIPTION_INDEX = 1 KEYWORD_IS_COMISSIONING_INDEX = 0 +BODY_INDEX = 0 class PythonParserException(Exception): @@ -68,7 +69,7 @@ def __extract_tcs_info(path: Path) -> Tuple[str, List[PythonTestStep]]: methods = [m for m in class_.body if isinstance(m, ast.FunctionDef)] for method in methods: if "desc_" in method.name: - tc_desc = method.body[0].value.value + tc_desc = method.body[BODY_INDEX].value.value elif "steps_" in method.name: tc_steps = __retrieve_steps(method) @@ -77,7 +78,7 @@ def __extract_tcs_info(path: Path) -> Tuple[str, List[PythonTestStep]]: def __retrieve_steps(method: ast.FunctionDef) -> List[PythonTestStep]: python_steps: List[PythonTestStep] = [] - for step in method.body[0].value.elts: + for step in method.body[BODY_INDEX].value.elts: step_name = step.args[ARG_STEP_DESCRIPTION_INDEX].value arg_is_commissioning = False if (