diff options
| author | Jonathan Lange <jml@canonical.com> | 2011-02-12 12:10:06 +0000 |
|---|---|---|
| committer | Jonathan Lange <jml@canonical.com> | 2011-02-12 12:10:06 +0000 |
| commit | 255d00653139619a8d1eb6a0efaefbbc842e5bbb (patch) | |
| tree | 75da2fb0837796209686ef901c27c29ec8d2e42d /python | |
| parent | aa2d6df69c425888524124575dd4c5d59e6e8eb8 (diff) | |
| download | subunit-git-255d00653139619a8d1eb6a0efaefbbc842e5bbb.tar.gz | |
Get started, fix a bug in subunit's decorator.
Diffstat (limited to 'python')
| -rw-r--r-- | python/subunit/test_results.py | 6 | ||||
| -rw-r--r-- | python/subunit/tests/test_test_results.py | 13 |
2 files changed, 18 insertions, 1 deletions
diff --git a/python/subunit/test_results.py b/python/subunit/test_results.py index a6ad0c6..d248846 100644 --- a/python/subunit/test_results.py +++ b/python/subunit/test_results.py @@ -82,7 +82,7 @@ class TestResultDecorator(object): return self.decorated.stop() def tags(self, new_tags, gone_tags): - return self.decorated.time(new_tags, gone_tags) + return self.decorated.tags(new_tags, gone_tags) def time(self, a_datetime): return self.decorated.time(a_datetime) @@ -195,6 +195,10 @@ class AutoTimingTestResultDecorator(HookedTestResultDecorator): return self.decorated.time(a_datetime) +class TagCollapsingDecorator(TestResultDecorator): + """Collapses many 'tags' calls into one where possible.""" + + class TestResultFilter(TestResultDecorator): """A pyunit TestResult interface implementation which filters tests. diff --git a/python/subunit/tests/test_test_results.py b/python/subunit/tests/test_test_results.py index a2dad96..0bc7e24 100644 --- a/python/subunit/tests/test_test_results.py +++ b/python/subunit/tests/test_test_results.py @@ -17,6 +17,9 @@ import datetime import unittest +from testtools import TestCase +from testtools.testresult.doubles import ExtendedTestResult + import subunit import subunit.iso8601 as iso8601 import subunit.test_results @@ -187,6 +190,16 @@ class TestAutoTimingTestResultDecorator(unittest.TestCase): self.assertNotEqual(None, self.decorated._calls[2]) +class TestTagCollapsingDecorator(TestCase): + + def test_tags_forwarded_outside_of_tests(self): + result = ExtendedTestResult() + tag_collapser = subunit.test_results.TagCollapsingDecorator(result) + tag_collapser.tags(set(['a', 'b']), set()) + self.assertEquals( + [('tags', set(['a', 'b']), set([]))], result._events) + + def test_suite(): loader = subunit.tests.TestUtil.TestLoader() result = loader.loadTestsFromName(__name__) |
