diff options
Diffstat (limited to 'python/subunit/tests/test_test_protocol.py')
| -rw-r--r-- | python/subunit/tests/test_test_protocol.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/python/subunit/tests/test_test_protocol.py b/python/subunit/tests/test_test_protocol.py index 99856e2..9e9db18 100644 --- a/python/subunit/tests/test_test_protocol.py +++ b/python/subunit/tests/test_test_protocol.py @@ -43,6 +43,7 @@ class TestTestImports(unittest.TestCase): from subunit import ExecTestCase from subunit import IsolatedTestCase from subunit import TestProtocolClient + from subunit import ProtocolTestCase class TestDiscardStream(unittest.TestCase): @@ -51,6 +52,30 @@ class TestDiscardStream(unittest.TestCase): subunit.DiscardStream().write("content") +class TestProtocolServerForward(unittest.TestCase): + + def test_story(self): + client = unittest.TestResult() + out = StringIO() + protocol = subunit.TestProtocolServer(client, forward_stream=out) + pipe = StringIO("test old mcdonald\n" + "success old mcdonald\n") + protocol.readFrom(pipe) + mcdonald = subunit.RemotedTestCase("old mcdonald") + self.assertEqual(client.testsRun, 1) + self.assertEqual(pipe.getvalue(), out.getvalue()) + + def test_not_command(self): + client = unittest.TestResult() + out = StringIO() + protocol = subunit.TestProtocolServer(client, + stream=subunit.DiscardStream(), forward_stream=out) + pipe = StringIO("success old mcdonald\n") + protocol.readFrom(pipe) + self.assertEqual(client.testsRun, 0) + self.assertEqual("", out.getvalue()) + + class TestTestProtocolServerPipe(unittest.TestCase): def test_story(self): |
