diff options
| author | Robert Collins <robertc@robertcollins.net> | 2012-05-02 23:04:11 +1200 |
|---|---|---|
| committer | Robert Collins <robertc@robertcollins.net> | 2012-05-02 23:04:11 +1200 |
| commit | 09a69c5bc1ef7daafb2b167c43092bf94dc0dee6 (patch) | |
| tree | c43a3cb6548df891c7e304c6cc41d3ae9cb8d0e0 /python/subunit | |
| parent | 33b73acea72a1799f42f3fabf2034abf2d114964 (diff) | |
| download | subunit-git-09a69c5bc1ef7daafb2b167c43092bf94dc0dee6.tar.gz | |
Restore forwarding of all time calls through TestResultFilter.
Diffstat (limited to 'python/subunit')
| -rw-r--r-- | python/subunit/test_results.py | 5 | ||||
| -rw-r--r-- | python/subunit/tests/test_subunit_filter.py | 28 |
2 files changed, 28 insertions, 5 deletions
diff --git a/python/subunit/test_results.py b/python/subunit/test_results.py index bb67df0..1b14c5f 100644 --- a/python/subunit/test_results.py +++ b/python/subunit/test_results.py @@ -420,10 +420,7 @@ class _PredicateFilter(TestResultDecorator, TagsMixin): return super(_PredicateFilter, self).tags(new_tags, gone_tags) def time(self, a_time): - if self._current_test is not None: - self._buffered_calls.append(('time', [a_time], {})) - else: - return self.decorated.time(a_time) + 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 664fcb3..d716578 100644 --- a/python/subunit/tests/test_subunit_filter.py +++ b/python/subunit/tests/test_subunit_filter.py @@ -233,12 +233,38 @@ xfail todo self.maxDiff = None self.assertSequenceEqual( [('time', date_a), - ('startTest', foo), ('time', date_b), + ('startTest', foo), ('addError', foo, {}), ('stopTest', foo), ('time', date_c)], result._events) + def test_time_passes_through_filtered_tests(self): + # Passing a subunit stream through TestResultFilter preserves 'time' + # directives even if a specific test is filtered out. + 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 = _b('\n'.join([ + "time: %s", + "test: foo", + "time: %s", + "success: foo", + "time: %s", + ""]) % (date_a, date_b, date_c)) + result = ExtendedTestResult() + result_filter = TestResultFilter(result) + result_filter.startTestRun() + self.run_tests(result_filter, subunit_stream) + result_filter.stopTestRun() + foo = subunit.RemotedTestCase('foo') + self.maxDiff = None + self.assertSequenceEqual( + [('startTestRun',), + ('time', date_a), + ('time', date_c), + ('stopTestRun',),], result._events) + def test_skip_preserved(self): subunit_stream = _b('\n'.join([ "test: foo", |
