diff options
| author | jml@canonical.com <> | 2007-03-18 22:24:07 +1100 |
|---|---|---|
| committer | jml@canonical.com <> | 2007-03-18 22:24:07 +1100 |
| commit | d2837ad9ecad97f7b4ccd76180d8c9e429a42419 (patch) | |
| tree | f81f5a7229779a8645a9f43aa11c6beb28a74ce8 /python/subunit/tests/test_test_protocol.py | |
| parent | 3a3307fcab75ecaf03b225e8894ead5167aebdcb (diff) | |
| parent | ce0f16df1eef98141ba4c71399a793d0156ef10d (diff) | |
| download | subunit-git-d2837ad9ecad97f7b4ccd76180d8c9e429a42419.tar.gz | |
Apply exarkun's fix to stdout pass-through
Diffstat (limited to 'python/subunit/tests/test_test_protocol.py')
| -rw-r--r-- | python/subunit/tests/test_test_protocol.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/python/subunit/tests/test_test_protocol.py b/python/subunit/tests/test_test_protocol.py index 9950f8a..ba33665 100644 --- a/python/subunit/tests/test_test_protocol.py +++ b/python/subunit/tests/test_test_protocol.py @@ -110,6 +110,7 @@ class TestMockTestProtocolServer(unittest.TestCase): self.assertEqual(protocol.success_calls, []) self.assertEqual(protocol.start_calls, []) + class TestTestImports(unittest.TestCase): def test_imports(self): @@ -177,15 +178,10 @@ class TestTestProtocolServerPassThrough(unittest.TestCase): def setUp(self): from StringIO import StringIO - self.real_stdout = sys.stdout self.stdout = StringIO() - sys.stdout = self.stdout self.test = subunit.RemotedTestCase("old mcdonald") self.client = MockTestProtocolServerClient() - self.protocol = subunit.TestProtocolServer(self.client) - - def tearDown(self): - sys.stdout = self.real_stdout + self.protocol = subunit.TestProtocolServer(self.client, self.stdout) def keywords_before_test(self): self.protocol.lineReceived("failure a\n") @@ -307,6 +303,15 @@ class TestTestProtocolServerPassThrough(unittest.TestCase): self.assertEqual(self.client.error_calls, []) self.assertEqual(self.client.success_calls, []) + def test_stdout_passthrough(self): + """ + Verify that lines received which cannot be interpreted as any + protocol action are passed through to sys.stdout. + """ + bytes = "randombytes\n" + self.protocol.lineReceived(bytes) + self.assertEqual(self.stdout.getvalue(), bytes) + class TestTestProtocolServerLostConnection(unittest.TestCase): |
