summaryrefslogtreecommitdiff
path: root/python/subunit/tests
diff options
context:
space:
mode:
authorRobert Collins <robertc@robertcollins.net>2009-12-14 21:57:03 +1100
committerRobert Collins <robertc@robertcollins.net>2009-12-14 21:57:03 +1100
commita5ba0f1e64f426eff1877d82bd60bf3049c255a0 (patch)
tree0478420e0803816e136ea418b81d9d6c7a0990f2 /python/subunit/tests
parent306bae6f0d652becd68501283531b85c71fa75f8 (diff)
downloadsubunit-a5ba0f1e64f426eff1877d82bd60bf3049c255a0.tar.gz
Add --forward option to subunit2junitxml.
Diffstat (limited to 'python/subunit/tests')
-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 00a21ed..01678b1 100644
--- a/python/subunit/tests/test_test_protocol.py
+++ b/python/subunit/tests/test_test_protocol.py
@@ -153,6 +153,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):
@@ -161,6 +162,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):