3 # Pretty-format subunit output
4 # Copyright (C) 2008-2010 Jelmer Vernooij <jelmer@samba.org>
5 # Published under the GNU GPL, v3 or later
12 sys
.path
.insert(0, os
.path
.join(os
.path
.dirname(__file__
), "../lib/subunit/python"))
13 sys
.path
.insert(0, os
.path
.join(os
.path
.dirname(__file__
), "../lib/testtools"))
17 parser
= optparse
.OptionParser("format-subunit [options]")
18 parser
.add_option("--verbose", action
="store_true",
20 parser
.add_option("--immediate", action
="store_true",
21 help="Show failures immediately, don't wait until test run has finished")
22 parser
.add_option("--prefix", type="string", default
=".",
23 help="Prefix to write summary to")
25 opts
, args
= parser
.parse_args()
27 def handle_sigint(sig
, stack
):
29 signal
.signal(signal
.SIGINT
, handle_sigint
)
33 'TESTS_UNEXPECTED_OK': 0,
34 'TESTS_EXPECTED_OK': 0,
35 'TESTS_UNEXPECTED_FAIL': 0,
36 'TESTS_EXPECTED_FAIL': 0,
41 msg_ops
= subunithelper
.PlainFormatter(opts
.verbose
, opts
.immediate
, statistics
)
43 expected_ret
= subunithelper
.parse_results(msg_ops
, statistics
, sys
.stdin
)
45 summaryfile
= os
.path
.join(opts
.prefix
, "summary")
47 msg_ops
.write_summary(summaryfile
)
49 print "\nA summary with detailed information can be found in:"
50 print " %s" % summaryfile
52 sys
.exit(expected_ret
)