def main():
    args = parse_flags()  # type: argparse.Namespace

    logging_level = getattr(logging, args.log.upper(), None)
    logging.basicConfig(level=logging_level)
    logger = logging.getLogger()

    if sys.version_info < (2, 7, 11):
        # SSL requests fail for earlier versions (e.g. 2.7.6)
        logger.fatal('python version 2.7.11 or greater required')
        return

    fetcher = Fetcher()
    run_before = fetcher.fetchResults(args.before)

    report_summary = None
    with open(args.report) as f:
        report = json.load(f)
        assert len(report['results']) > 0, (
            '0 test results, something went wrong, stopping.')
        report_summary = report_to_summary(report)

    differ = RunDiffer(args, logger, fetcher)
    diff = differ.diff_results_summaries(
        run_before, TestRunSummary(args.after, report_summary))

    diff.print_summary(logger)
Beispiel #2
0
 def test_report_to_summary(self):
     actual = report_to_summary({
         'results': [{
             'test': '/dom/a.html',
             'status': 'OK',
             'subtests': [{
                 'status': 'PASS'
             }]
         }, {
             'test': '/dom/b.html',
             'status': 'OK',
             'subtests': [{
                 'status': 'FAIL'
             }]
         }]
     })
     self.assertEqual(actual, {
         '/dom/a.html': [2, 2],
         '/dom/b.html': [1, 2],
     })