1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00
samba-mirror/selftest/format-subunit
Jelmer Vernooij 7dbc58f524 Reduce number of places where sys.path is (possibly) updated for external module paths.
Change-Id: I69d060f27ea090d14405e884d1ce271975358c56
Signed-Off-By: Jelmer Vernooij <jelmer@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Jelmer Vernooij <jelmer@samba.org>
Autobuild-Date(master): Sun Nov 30 20:54:04 CET 2014 on sn-devel-104
2014-11-30 20:54:03 +01:00

58 lines
1.5 KiB
Python
Executable File

#!/usr/bin/env python
# vim: expandtab
# Pretty-format subunit output
# Copyright (C) 2008-2010 Jelmer Vernooij <jelmer@samba.org>
# Published under the GNU GPL, v3 or later
import optparse
import os
import signal
import sys
sys.path.insert(0, "bin/python")
import samba
samba.ensure_external_module("mimeparse", "mimeparse")
samba.ensure_external_module("extras", "extras")
samba.ensure_external_module("testtools", "testtools")
samba.ensure_external_module("subunit", "subunit/python")
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()
def handle_sigint(sig, stack):
sys.exit(0)
signal.signal(signal.SIGINT, handle_sigint)
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 = subunithelper.PlainFormatter(opts.verbose, opts.immediate, statistics)
expected_ret = subunithelper.parse_results(msg_ops, statistics, sys.stdin)
summaryfile = os.path.join(opts.prefix, "summary")
msg_ops.write_summary(summaryfile)
print "\nA summary with detailed information can be found in:"
print " %s" % summaryfile
sys.exit(expected_ret)