mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[python, tests] extract test suite info into class
GitOrigin-RevId: fef28a4257affb23cc1268f0f4dc09584fc4f682
This commit is contained in:
committed by
intellij-monorepo-bot
parent
ae854ee75b
commit
4fb11f57ce
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user