source: trunk/server/selftest/format-subunit@ 745

Last change on this file since 745 was 745, checked in by Silvan Scherrer, 13 years ago

Samba Server: updated trunk to 3.6.0

File size: 1.5 KB
Line 
1#!/usr/bin/env python
2# vim: expandtab
3# Pretty-format subunit output
4# Copyright (C) 2008-2010 Jelmer Vernooij <jelmer@samba.org>
5# Published under the GNU GPL, v3 or later
6
7import optparse
8import os
9import signal
10import sys
11
12sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../lib/subunit/python"))
13sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../lib/testtools"))
14
15import subunithelper
16
17parser = optparse.OptionParser("format-subunit [options]")
18parser.add_option("--verbose", action="store_true",
19 help="Be verbose")
20parser.add_option("--immediate", action="store_true",
21 help="Show failures immediately, don't wait until test run has finished")
22parser.add_option("--prefix", type="string", default=".",
23 help="Prefix to write summary to")
24
25opts, args = parser.parse_args()
26
27def handle_sigint(sig, stack):
28 sys.exit(0)
29signal.signal(signal.SIGINT, handle_sigint)
30
31statistics = {
32 'SUITES_FAIL': 0,
33 'TESTS_UNEXPECTED_OK': 0,
34 'TESTS_EXPECTED_OK': 0,
35 'TESTS_UNEXPECTED_FAIL': 0,
36 'TESTS_EXPECTED_FAIL': 0,
37 'TESTS_ERROR': 0,
38 'TESTS_SKIP': 0,
39}
40
41msg_ops = subunithelper.PlainFormatter(opts.verbose, opts.immediate, statistics)
42
43expected_ret = subunithelper.parse_results(msg_ops, statistics, sys.stdin)
44
45summaryfile = os.path.join(opts.prefix, "summary")
46
47msg_ops.write_summary(summaryfile)
48
49print "\nA summary with detailed information can be found in:"
50print " %s" % summaryfile
51
52sys.exit(expected_ret)
Note: See TracBrowser for help on using the repository browser.