summaryrefslogtreecommitdiff
path: root/python/subunit/tests
diff options
context:
space:
mode:
authorJonathan Lange <jml@mumak.net>2012-04-13 00:12:32 +0100
committerJonathan Lange <jml@mumak.net>2012-04-13 00:12:32 +0100
commitcfc845f282d497ee6f4430022808ce2a4d526ac9 (patch)
treeaee41464272a06c2e7973225186e91606be9f95f /python/subunit/tests
parent65d6888d9cd9c37b5d2c63b8c6c0ed4073c9161e (diff)
downloadsubunit-cfc845f282d497ee6f4430022808ce2a4d526ac9.tar.gz
Progress, of a sort.
Diffstat (limited to 'python/subunit/tests')
-rw-r--r--python/subunit/tests/test_subunit_filter.py35
1 files changed, 34 insertions, 1 deletions
diff --git a/python/subunit/tests/test_subunit_filter.py b/python/subunit/tests/test_subunit_filter.py
index 1cae791..d5f204a 100644
--- a/python/subunit/tests/test_subunit_filter.py
+++ b/python/subunit/tests/test_subunit_filter.py
@@ -28,7 +28,7 @@ from testtools.compat import _b, BytesIO
from testtools.testresult.doubles import ExtendedTestResult
import subunit
-from subunit.test_results import TestResultFilter
+from subunit.test_results import _make_tag_filter, TestResultFilter
class TestTestResultFilter(TestCase):
@@ -80,6 +80,22 @@ xfail todo
filtered_result.failures])
self.assertEqual(4, filtered_result.testsRun)
+ def test_tag_filter(self):
+ tag_filter = _make_tag_filter(['global'], ['local'])
+ result = ExtendedTestResult()
+ result_filter = TestResultFilter(
+ result, filter_success=False, filter_predicate=tag_filter)
+ self.run_tests(result_filter)
+ test = subunit.RemotedTestCase('passed')
+ self.assertEquals(
+ [('tags', set(['global']), set()),
+ ('startTest', test),
+ ('addSuccess', test),
+ ('stopTest', test),
+ ('tags', set(['local']), set()),
+ ],
+ result._events)
+
def test_exclude_errors(self):
filtered_result = unittest.TestResult()
result_filter = TestResultFilter(filtered_result, filter_error=True)
@@ -270,6 +286,23 @@ xfail todo
('stopTest', foo)],
events)
+ def test_tags(self):
+ output = self.run_command(['-s', '--with-tag', 'a'], (
+ "tags: a\n"
+ "test: foo\n"
+ "success: foo\n"
+ "tags: -a\n"
+ "test: bar\n"
+ "success: bar\n"
+ ))
+ events = self.to_events(output)
+ foo = subunit.RemotedTestCase('foo')
+ self.assertEqual(
+ [('startTest', foo),
+ ('addSuccess', foo),
+ ('stopTest', foo)],
+ events)
+
def test_suite():
loader = subunit.tests.TestUtil.TestLoader()