From 77c9c58133de6bee368c524918c0fa8978d254da Mon Sep 17 00:00:00 2001 From: Jonathan Lange Date: Fri, 11 Feb 2011 17:45:41 +0000 Subject: Pass through time when we aren't in tests. --- python/subunit/test_results.py | 5 ++++- python/subunit/tests/test_subunit_filter.py | 7 +++++-- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'python/subunit') diff --git a/python/subunit/test_results.py b/python/subunit/test_results.py index 4079cea..f2f5d82 100644 --- a/python/subunit/test_results.py +++ b/python/subunit/test_results.py @@ -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."): diff --git a/python/subunit/tests/test_subunit_filter.py b/python/subunit/tests/test_subunit_filter.py index 0548966..a728860 100644 --- a/python/subunit/tests/test_subunit_filter.py +++ b/python/subunit/tests/test_subunit_filter.py @@ -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(): -- cgit v1.2.1