summaryrefslogtreecommitdiff
path: root/python/subunit/tests/test_test_protocol.py
diff options
context:
space:
mode:
authorRobert Collins <robertc@robertcollins.net>2009-12-14 22:20:30 +1100
committerRobert Collins <robertc@robertcollins.net>2009-12-14 22:20:30 +1100
commitb05256add5ef737448755b62cccce189b45df69b (patch)
tree1c9a4eeda9b6902dd13f60110ef957756f271bcb /python/subunit/tests/test_test_protocol.py
parent090f67a539c1b77bcdfaf6766f413a2f6202d5e8 (diff)
parent195ccad0d1f9bba37fcf3ab8d2051a78f6a1f217 (diff)
downloadsubunit-git-b05256add5ef737448755b62cccce189b45df69b.tar.gz
Merge junitxml --forward branch.
Diffstat (limited to 'python/subunit/tests/test_test_protocol.py')
-rw-r--r--python/subunit/tests/test_test_protocol.py25
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):