summaryrefslogtreecommitdiff
path: root/filters
diff options
context:
space:
mode:
authorRobert Collins <robertc@robertcollins.net>2013-03-06 23:16:03 +1300
committerRobert Collins <robertc@robertcollins.net>2013-03-06 23:16:03 +1300
commit6f4a13700850e83a55ba9851a86276c75c80dd21 (patch)
tree654c2e1b3161b1ec7150bea04e01688a612a3c6a /filters
parent187d5bfa4c441b03ca2a85446bf6c993665c40b4 (diff)
downloadsubunit-6f4a13700850e83a55ba9851a86276c75c80dd21.tar.gz
Fixes from getting testrepository running with v2.
Diffstat (limited to 'filters')
-rwxr-xr-xfilters/subunit-ls21
1 files changed, 12 insertions, 9 deletions
diff --git a/filters/subunit-ls b/filters/subunit-ls
index 912bc80..4eb164d 100755
--- a/filters/subunit-ls
+++ b/filters/subunit-ls
@@ -19,7 +19,9 @@
from optparse import OptionParser
import sys
-from testtools import StreamToExtendedDecorator, StreamResultRouter
+from testtools import (
+ CopyStreamResult, StreamToExtendedDecorator, StreamResultRouter,
+ StreamSummary)
from subunit import ByteStreamToStreamResult
from subunit.filters import run_tests_from_stream
@@ -33,23 +35,24 @@ parser = OptionParser(description=__doc__)
parser.add_option("--times", action="store_true",
help="list the time each test took (requires a timestamped stream)",
default=False)
+parser.add_option("--exists", action="store_true",
+ help="list tests that are reported as existing (as well as ran)",
+ default=False)
parser.add_option("--no-passthrough", action="store_true",
help="Hide all non subunit input.", default=False, dest="no_passthrough")
(options, args) = parser.parse_args()
test = ByteStreamToStreamResult(sys.stdin, non_subunit_name="stdout")
-printer = TestIdPrintingResult(sys.stdout, options.times)
-result = StreamToExtendedDecorator(printer)
+result = TestIdPrintingResult(sys.stdout, options.times, options.exists)
if not options.no_passthrough:
- orig_result = result
result = StreamResultRouter(result)
cat = CatFiles(sys.stdout)
result.map(cat, 'test_id', test_id=None)
-else:
- orig_result = result
-orig_result.startTestRun()
+summary = StreamSummary()
+result = CopyStreamResult([result, summary])
+result.startTestRun()
test.run(result)
-orig_result.stopTestRun()
-if printer.wasSuccessful():
+result.stopTestRun()
+if summary.wasSuccessful():
exit_code = 0
else:
exit_code = 1