コード例 #1
0
ファイル: json_to_pdf.py プロジェクト: morganstanley/testplan
def main(source, target):

    with open(source) as source_file:
        data = json.loads(source_file.read())
        if data.get("version", 1) >= 2 or len(data.get("entries", [])) == 0:
            raise RuntimeError(
                "This utility can only process a single all-in-one JSON"
                " report, you can set `split_json_report` to False in"
                " `JSONExporter` while running Testplan script to get a"
                " single JSON report.")

        report_obj = TestReport.deserialize(data)
        print("Loaded report: {}".format(report_obj.name))

        # We can initialize an exporter object directly, without relying on
        # Testplan internals to trigger the export operation.
        exporter = PDFExporter(
            pdf_path=target,
            pdf_style=Style(
                passing=StyleEnum.ASSERTION_DETAIL,
                failing=StyleEnum.ASSERTION_DETAIL,
            ),
        )

        exporter.export(report_obj)
コード例 #2
0
ファイル: json_to_pdf.py プロジェクト: petrkalos/testplan
def main(source, target):

    with open(source) as source_file:
        data = json.loads(source_file.read())
        report_obj = TestReport.deserialize(data)

        print('Loaded report: {}'.format(report_obj.name))

        # We can initialize an exporter object directly, without relying on
        # Testplan internals to trigger the export operation.
        exporter = PDFExporter(pdf_path=target,
                               pdf_style=Style(
                                   passing=StyleEnum.ASSERTION_DETAIL,
                                   failing=StyleEnum.ASSERTION_DETAIL))

        exporter.export(report_obj)