Esempio n. 1
0
    def execute_main_with_format(self, report_format, test_output=False):
        report_file = self.test_dir + "report.log"
        args = [
            "compare_perf_tests.py",
            "--old-file",
            self.old_log,
            "--new-file",
            self.new_log,
            "--format",
            report_format,
        ]

        sys.argv = args if not test_output else args + [
            "--output", report_file
        ]

        with captured_output() as (out, _):
            main()
        report_out = out.getvalue()

        if test_output:
            with open(report_file, "r") as f:
                report = f.read()
            # because print adds newline, add one here, too:
            report_file = str(report + "\n")
        else:
            report_file = None

        return report_out, report_file
    def execute_main_with_format(self, report_format, test_output=False):
        report_file = self.test_dir + 'report.log'
        args = ['compare_perf_tests.py',
                '--old-file', self.old_log,
                '--new-file', self.new_log,
                '--format', report_format]

        sys.argv = (args if not test_output else
                    args + ['--output', report_file])

        with captured_output() as (out, _):
            main()
        report_out = out.getvalue()

        if test_output:
            with open(report_file, 'r') as f:
                report = f.read()
            # because print adds newline, add one here, too:
            report_file = str(report + '\n')
        else:
            report_file = None

        return report_out, report_file
Esempio n. 3
0
    def execute_main_with_format(self, report_format, test_output=False):
        report_file = self.test_dir + 'report.log'
        args = [
            'compare_perf_tests.py', '--old-file', self.old_log, '--new-file',
            self.new_log, '--format', report_format
        ]

        sys.argv = (args if not test_output else args +
                    ['--output', report_file])

        with captured_output() as (out, _):
            main()
        report_out = out.getvalue()

        if test_output:
            with open(report_file, 'r') as f:
                report = f.read()
            # because print adds newline, add one here, too:
            report_file = str(report + '\n')
        else:
            report_file = None

        return report_out, report_file