Bug 1632242 - Mention results for groups in errorsummary even when the group passed or was skipped. r=ahal

Differential Revision: https://phabricator.services.mozilla.com/D74131
This commit is contained in:
Marco Castelluccio 2020-05-19 20:51:10 +00:00
Родитель 7cdabe3c51
Коммит 540b5cef71
1 изменённых файлов: 23 добавлений и 0 удалений

Просмотреть файл

@ -14,6 +14,7 @@ class ErrorSummaryFormatter(BaseFormatter):
def __init__(self):
self.groups = {}
self.group_results = {}
self.line_count = 0
def __call__(self, data):
@ -36,16 +37,38 @@ class ErrorSummaryFormatter(BaseFormatter):
"stack": item.get("stack")}
return self._output("test_result", data)
def _update_results(self, item):
group = self.groups.get(item["test"], None)
if group is None:
return
if item["status"] == "SKIP":
if group not in self.group_results:
self.group_results[group] = "SKIP"
elif "expected" not in item or item["status"] == item["expected"]:
if group not in self.group_results or self.group_results[group] == "SKIP":
self.group_results[group] = "OK"
else:
self.group_results[group] = "ERROR"
def suite_start(self, item):
self.groups = {v: k for k in item["tests"] for v in item["tests"][k]}
return self._output("test_groups", {"groups": list(item["tests"].keys())})
def suite_end(self, data):
return "".join(
self._output("group_result", {"group": group, "status": status})
for group, status in self.group_results.items()
)
def test_status(self, item):
self._update_results(item)
if "expected" not in item:
return
return self._output_test(item["test"], item["subtest"], item)
def test_end(self, item):
self._update_results(item)
if "expected" not in item:
return
return self._output_test(item["test"], None, item)