Pass through time when we aren't in tests.
authorJonathan Lange <jml@canonical.com>
Fri, 11 Feb 2011 17:45:41 +0000 (17:45 +0000)
committerJonathan Lange <jml@canonical.com>
Fri, 11 Feb 2011 17:45:41 +0000 (17:45 +0000)
python/subunit/test_results.py
python/subunit/tests/test_subunit_filter.py

index 4079cea0fd062e66a7e1e96ca1ab940ece3c9f44..f2f5d82c69e532398150326374edac775086d304 100644 (file)
@@ -333,7 +333,10 @@ class TestResultFilter(TestResultDecorator):
         return self.decorated.tags(new_tags, gone_tags)
 
     def time(self, a_time):
-        self._buffered_calls.append(('time', [a_time], {}))
+        if self._current_test is not None:
+            self._buffered_calls.append(('time', [a_time], {}))
+        else:
+            return self.decorated.time(a_time)
 
     def id_to_orig_id(self, id):
         if id.startswith("subunit.RemotedTestCase."):
index 05489668362c743ed8705a797f3d6108d23ab5d0..a72886011d295eb9dbd8e9f052d1bae4ca622592 100644 (file)
@@ -146,12 +146,14 @@ xfail todo
         # directives that are still included.
         date_a = datetime(year=2000, month=1, day=1, tzinfo=iso8601.UTC)
         date_b = datetime(year=2000, month=1, day=2, tzinfo=iso8601.UTC)
+        date_c = datetime(year=2000, month=1, day=3, tzinfo=iso8601.UTC)
         subunit_stream = '\n'.join([
             "time: %s",
             "test: foo",
             "time: %s",
             "error: foo",
-            ""]) % (date_a, date_b)
+            "time: %s",
+            ""]) % (date_a, date_b, date_c)
         result = ExtendedTestResult()
         result_filter = TestResultFilter(result)
         self.run_tests(result_filter, subunit_stream)
@@ -161,7 +163,8 @@ xfail todo
              ('startTest', foo),
              ('time', date_b),
              ('addError', foo, {}),
-             ('stopTest', foo)], result._events)
+             ('stopTest', foo),
+             ('time', date_c)], result._events)
 
 
 def test_suite():