0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00
mongodb/buildscripts/resmokelib/reportfile.py

30 lines
658 B
Python

"""
Manages interactions with the report.json file.
"""
from __future__ import absolute_import
import json
from . import config
from .testing import report as _report
def write(suites):
"""
Writes the combined report of all executions if --reportFile was
specified on the command line.
"""
if config.REPORT_FILE is None:
return
reports = []
for suite in suites:
for group in suite.test_groups:
reports.extend(group.get_reports())
combined_report_dict = _report.TestReport.combine(*reports).as_dict()
with open(config.REPORT_FILE, "w") as fp:
json.dump(combined_report_dict, fp)