* ``subunit-ls`` now handles a stream with time: instructions that start
authorRobert Collins <robertc@robertcollins.net>
Mon, 23 May 2011 09:57:58 +0000 (21:57 +1200)
committerRobert Collins <robertc@robertcollins.net>
Mon, 23 May 2011 09:57:58 +0000 (21:57 +1200)
  partway through the stream (which may lead to strange times) more gracefully.
  (Robert Collins, #785954)

NEWS
filters/subunit-ls
python/subunit/test_results.py

diff --git a/NEWS b/NEWS
index 62f44e9..ee6ceb1 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -38,6 +38,10 @@ IMPROVEMENTS
   so you can now use filtered streams to gather data about how long it takes
   to run a test. (Jonathan Lange, #716554)
 
+* ``subunit-ls`` now handles a stream with time: instructions that start
+  partway through the stream (which may lead to strange times) more gracefully.
+  (Robert Collins, #785954)
+
 * ``TestResultFilter`` now collapses sequential calls to time().
   (Jonathan Lange, #567150)
 
index 8646134..82db4c3 100755 (executable)
@@ -20,7 +20,10 @@ from optparse import OptionParser
 import sys
 
 from subunit import DiscardStream, ProtocolTestCase
-from subunit.test_results import TestIdPrintingResult
+from subunit.test_results import (
+    AutoTimingTestResultDecorator,
+    TestIdPrintingResult,
+    )
 
 
 parser = OptionParser(description=__doc__)
@@ -30,7 +33,8 @@ 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 = TestIdPrintingResult(sys.stdout, options.times)
+result = AutoTimingTestResultDecorator(
+    TestIdPrintingResult(sys.stdout, options.times))
 if options.no_passthrough:
     passthrough_stream = DiscardStream()
 else:
index f312416..fd54b00 100644 (file)
@@ -439,7 +439,7 @@ class TestIdPrintingResult(testtools.TestResult):
         super(TestIdPrintingResult, self).__init__()
         self._stream = stream
         self.failed_tests = 0
-        self.__time = 0
+        self.__time = None
         self.show_times = show_times
         self._test = None
         self._test_duration = 0