diff options
| author | Robert Collins <robertc@robertcollins.net> | 2008-12-07 14:37:48 +1100 |
|---|---|---|
| committer | Robert Collins <robertc@robertcollins.net> | 2008-12-07 14:37:48 +1100 |
| commit | 9a915af1f70344c63f232a2d82d14cf6e01aa84f (patch) | |
| tree | d44b7ca9d66d22d0bff430f077d42555f6d9ab0a /python/subunit/tests | |
| parent | 5c3c88265d467555e2e92f1a7f445f69b3c0a261 (diff) | |
| download | subunit-git-9a915af1f70344c63f232a2d82d14cf6e01aa84f.tar.gz | |
Add XFAIL support. As with Skip, there is no python object representation of the skip, because there is no standard for reporting them.
Diffstat (limited to 'python/subunit/tests')
| -rw-r--r-- | python/subunit/tests/test_test_protocol.py | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/python/subunit/tests/test_test_protocol.py b/python/subunit/tests/test_test_protocol.py index d12b0ac..842e887 100644 --- a/python/subunit/tests/test_test_protocol.py +++ b/python/subunit/tests/test_test_protocol.py @@ -505,6 +505,61 @@ class TestTestProtocolServerAddFailure(unittest.TestCase): self.failure_quoted_bracket("failure:") +class TestTestProtocolServerAddxFail(unittest.TestCase): + """Tests for the xfail keyword. + + In python this thunks through to Success due to stdlib limitations. + """ + + def setUp(self): + """Setup a test object ready to be xfailed.""" + self.client = MockTestProtocolServerClient() + self.protocol = subunit.TestProtocolServer(self.client) + self.protocol.lineReceived("test mcdonalds farm\n") + self.test = self.client.start_calls[-1] + + def simple_xfail_keyword(self, keyword): + self.protocol.lineReceived("%s mcdonalds farm\n" % keyword) + self.assertEqual(self.client.start_calls, [self.test]) + self.assertEqual(self.client.end_calls, [self.test]) + self.assertEqual(self.client.error_calls, []) + self.assertEqual(self.client.failure_calls, []) + self.assertEqual(self.client.success_calls, [self.test]) + + def test_simple_xfail(self): + self.simple_xfail_keyword("xfail") + + def test_simple_xfail_colon(self): + self.simple_xfail_keyword("xfail:") + + def test_xfail_empty_message(self): + self.protocol.lineReceived("xfail mcdonalds farm [\n") + self.protocol.lineReceived("]\n") + self.assertEqual(self.client.start_calls, [self.test]) + self.assertEqual(self.client.end_calls, [self.test]) + self.assertEqual(self.client.error_calls, []) + self.assertEqual(self.client.failure_calls, []) + self.assertEqual(self.client.success_calls, [self.test]) + + def xfail_quoted_bracket(self, keyword): + # This tests it is accepted, but cannot test it is used today, because + # of not having a way to expose it in python so far. + self.protocol.lineReceived("%s mcdonalds farm [\n" % keyword) + self.protocol.lineReceived(" ]\n") + self.protocol.lineReceived("]\n") + self.assertEqual(self.client.start_calls, [self.test]) + self.assertEqual(self.client.end_calls, [self.test]) + self.assertEqual(self.client.error_calls, []) + self.assertEqual(self.client.failure_calls, []) + self.assertEqual(self.client.success_calls, [self.test]) + + def test_xfail_quoted_bracket(self): + self.xfail_quoted_bracket("xfail") + + def test_xfail_colon_quoted_bracket(self): + self.xfail_quoted_bracket("xfail:") + + class TestTestProtocolServerAddSkip(unittest.TestCase): """Tests for the skip keyword. |
