diff options
author | Robert Collins <robertc@robertcollins.net> | 2013-02-27 23:30:53 +1300 |
---|---|---|
committer | Robert Collins <robertc@robertcollins.net> | 2013-02-27 23:30:53 +1300 |
commit | 1794ee2ec32dc081a5a68cef079976378b33464b (patch) | |
tree | 7bebcfcf2ea60cfa17d5b7cb5b00bf77e018e1f5 /filters | |
parent | b6cb3c4d694d4621e83b8bdaf18f54cff87f8074 (diff) | |
download | subunit-1794ee2ec32dc081a5a68cef079976378b33464b.tar.gz |
Update subunit-ls.
Diffstat (limited to 'filters')
-rwxr-xr-x | filters/subunit-ls | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/filters/subunit-ls b/filters/subunit-ls index 82db4c3..912bc80 100755 --- a/filters/subunit-ls +++ b/filters/subunit-ls @@ -19,9 +19,12 @@ from optparse import OptionParser import sys -from subunit import DiscardStream, ProtocolTestCase +from testtools import StreamToExtendedDecorator, StreamResultRouter + +from subunit import ByteStreamToStreamResult +from subunit.filters import run_tests_from_stream from subunit.test_results import ( - AutoTimingTestResultDecorator, + CatFiles, TestIdPrintingResult, ) @@ -33,15 +36,20 @@ parser.add_option("--times", action="store_true", parser.add_option("--no-passthrough", action="store_true", help="Hide all non subunit input.", default=False, dest="no_passthrough") (options, args) = parser.parse_args() -result = AutoTimingTestResultDecorator( - TestIdPrintingResult(sys.stdout, options.times)) -if options.no_passthrough: - passthrough_stream = DiscardStream() +test = ByteStreamToStreamResult(sys.stdin, non_subunit_name="stdout") +printer = TestIdPrintingResult(sys.stdout, options.times) +result = StreamToExtendedDecorator(printer) +if not options.no_passthrough: + orig_result = result + result = StreamResultRouter(result) + cat = CatFiles(sys.stdout) + result.map(cat, 'test_id', test_id=None) else: - passthrough_stream = None -test = ProtocolTestCase(sys.stdin, passthrough=passthrough_stream) + orig_result = result +orig_result.startTestRun() test.run(result) -if result.wasSuccessful(): +orig_result.stopTestRun() +if printer.wasSuccessful(): exit_code = 0 else: exit_code = 1 |