Пример #1
0
        print(
            Perf.allow_changes_string([(m.change, m.stat) for m in t.metrics]))
        print('-' * 25)

    summary(t, sys.stdout, config.no_print_summary, config.supports_colors)

    # Write perf stats if any exist or if a metrics file is specified.
    stats_metrics = [stat
                     for (_, stat, __) in t.metrics]  # type: List[PerfStat]
    if hasMetricsFile:
        print('Appending ' + str(len(stats_metrics)) + ' stats to file: ' +
              config.metrics_file)
        with open(config.metrics_file, 'a') as f:
            f.write("\n" + Perf.format_perf_stat(stats_metrics))
    elif inside_git_repo() and any(stats_metrics):
        if is_worktree_dirty():
            print()
            print(str_warn('Performance Metrics NOT Saved') + \
                ' working tree is dirty. Commit changes or use ' + \
                '--metrics-file to save metrics to a file.')
        else:
            Perf.append_perf_stat(stats_metrics)

    # Write summary
    if config.summary_file:
        with open(config.summary_file, 'w') as f:
            summary(t, f)

    if args.junit:
        junit(t).write(args.junit)
Пример #2
0
        print(str_info("Some stats have changed") + " If this is expected, " + \
            "allow changes by appending the git commit message with this:")
        print('-' * 25)
        print(Perf.allow_changes_string(t.metrics))
        print('-' * 25)

    summary(t, sys.stdout, config.no_print_summary, True)

    # Write perf stats if any exist or if a metrics file is specified.
    stats = [stat for (_, stat) in t.metrics]
    if hasMetricsFile:
        print('Appending ' + str(len(stats)) + ' stats to file: ' + config.metrics_file)
        with open(config.metrics_file, 'a') as file:
            file.write("\n" + Perf.format_perf_stat(stats))
    elif inside_git_repo() and any(stats):
        if is_worktree_dirty():
            print()
            print(str_warn('Performance Metrics NOT Saved') + \
                ' working tree is dirty. Commit changes or use ' + \
                '--metrics-file to save metrics to a file.')
        else:
            Perf.append_perf_stat(stats)

    # Write summary
    if config.summary_file:
        with open(config.summary_file, 'w') as file:
            summary(t, file)

    if args.junit:
        junit(t).write(args.junit)