diff --git a/python/helpers/pycharm/_jb_runner_tools.py b/python/helpers/pycharm/_jb_runner_tools.py index b67dc087b7fb..7ff394f081c8 100644 --- a/python/helpers/pycharm/_jb_runner_tools.py +++ b/python/helpers/pycharm/_jb_runner_tools.py @@ -106,6 +106,14 @@ _old_service_messages = messages.TeamcityServiceMessages PARSE_FUNC = None +class TestSuiteInfo: + def __init__(self, full_name, node_id, parent_node_id, is_test, was_stopped): + self.full_name = full_name + self.node_id = node_id + self.parent_node_id = parent_node_id + self.is_test = is_test + self.was_stopped = was_stopped + class NewTeamcityServiceMessages(_old_service_messages): _latest_subtest_result = None @@ -166,15 +174,14 @@ class NewTeamcityServiceMessages(_old_service_messages): is_test = messageName == "testStarted" if messageName == "testSuiteStarted" or is_test: - self._test_suites[full_name] = (full_name, current, parent, is_test, False) + self._test_suites[full_name] = TestSuiteInfo(full_name, current, parent, is_test, False) elif messageName == "testIgnored" and properties.get("stopped") == "true": ancestors = self._test_to_list(full_name) # mark ancestors as explicitly stopped for i in range(len(ancestors), 0, -1): ancestor = ".".join(ancestors[:i]) # keep old entries intact; only change was_stopped - old_entry = self._test_suites[ancestor] - self._test_suites[ancestor] = old_entry[:4] + (True,) + old_entry[5:] + self._test_suites[ancestor].was_stopped = True _old_service_messages.message(self, messageName, **properties) def _test_to_list(self, test_name): @@ -313,16 +320,15 @@ class NewTeamcityServiceMessages(_old_service_messages): def close_suites(self): # Go in reverse order and close all suites - for (test_suite, node_id, parent_node_id, is_test, was_stopped) in \ - reversed(list(self._test_suites.values())): + for suite in reversed(list(self._test_suites.values())): # suites are explicitly closed, but if test can't been finished, it was either stopped or skipped - message = "testIgnored" if is_test or was_stopped else "testSuiteFinished" + message = "testIgnored" if suite.is_test or suite.was_stopped else "testSuiteFinished" kwargs = { - "name": test_suite, - "nodeId": str(node_id), - "parentNodeId": str(parent_node_id), + "name": suite.full_name, + "nodeId": str(suite.node_id), + "parentNodeId": str(suite.parent_node_id), } - if was_stopped: + if suite.was_stopped: kwargs["stopped"] = "true" _old_service_messages.message(self, message, **kwargs) self._test_suites = OrderedDict()