summaryrefslogtreecommitdiff
path: root/python/subunit
diff options
context:
space:
mode:
authorJonathan Lange <jml@canonical.com>2011-02-11 17:45:41 +0000
committerJonathan Lange <jml@canonical.com>2011-02-11 17:45:41 +0000
commit77c9c58133de6bee368c524918c0fa8978d254da (patch)
tree9d7ad5f9c0a1bbadb2295632f0679fd6ed69b1fe /python/subunit
parentdd089db28901fa5c05dc5ead9a6db1ca9ef5e80b (diff)
downloadsubunit-git-77c9c58133de6bee368c524918c0fa8978d254da.tar.gz
Pass through time when we aren't in tests.
Diffstat (limited to 'python/subunit')
-rw-r--r--python/subunit/test_results.py5
-rw-r--r--python/subunit/tests/test_subunit_filter.py7
2 files changed, 9 insertions, 3 deletions
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():