#!/usr/bin/env python # Pretty-format subunit output # Copyright (C) 2008-2010 Jelmer Vernooij # Published under the GNU GPL, v3 or later import optparse import os import sys import subunithelper parser = optparse.OptionParser("format-subunit [options]") parser.add_option("--verbose", action="store_true", help="Be verbose") parser.add_option("--immediate", action="store_true", help="Show failures immediately, don't wait until test run has finished") parser.add_option("--prefix", type="string", default=".", help="Prefix to write summary to") opts, args = parser.parse_args() statistics = { 'SUITES_FAIL': 0, 'TESTS_UNEXPECTED_OK': 0, 'TESTS_EXPECTED_OK': 0, 'TESTS_UNEXPECTED_FAIL': 0, 'TESTS_EXPECTED_FAIL': 0, 'TESTS_ERROR': 0, 'TESTS_SKIP': 0, } msg_ops = PlainFormatter(os.path.join(opts.prefix, "summary"), opts.verbose, opts.immediate, statistics) expected_ret = subunithelper.parse_results(msg_ops, statistics, sys.stdin) msg_ops.summary() sys.exit(expected_ret)