summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorRobert Collins <robertc@robertcollins.net>2011-04-25 11:19:53 +1200
committerRobert Collins <robertc@robertcollins.net>2011-04-25 11:19:53 +1200
commit970fe166268ac41a20aa6dc78e4c491ae5449173 (patch)
treebf332eccd78b219cbd56e85cef9643de764e0b02 /python
parent86cff2f184f6bbd34fd330bae739a29a34a78d2a (diff)
downloadsubunit-git-970fe166268ac41a20aa6dc78e4c491ae5449173.tar.gz
More small stuff.
Diffstat (limited to 'python')
-rw-r--r--python/subunit/__init__.py4
-rw-r--r--python/subunit/tests/test_test_protocol.py14
2 files changed, 9 insertions, 9 deletions
diff --git a/python/subunit/__init__.py b/python/subunit/__init__.py
index 6a46a40..5387cae 100644
--- a/python/subunit/__init__.py
+++ b/python/subunit/__init__.py
@@ -696,14 +696,14 @@ class TestProtocolClient(testresult.TestResult):
:param details: An extended details dict for a test outcome.
"""
self._stream.write(" [ multipart\n")
- for name, content in sorted(details.iteritems()):
+ for name, content in sorted(details.items()):
self._stream.write("Content-Type: %s/%s" %
(content.content_type.type, content.content_type.subtype))
parameters = content.content_type.parameters
if parameters:
self._stream.write(";")
param_strs = []
- for param, value in parameters.iteritems():
+ for param, value in parameters.items():
param_strs.append("%s=%s" % (param, value))
self._stream.write(",".join(param_strs))
self._stream.write("\n%s\n" % name)
diff --git a/python/subunit/tests/test_test_protocol.py b/python/subunit/tests/test_test_protocol.py
index 5541653..9152cce 100644
--- a/python/subunit/tests/test_test_protocol.py
+++ b/python/subunit/tests/test_test_protocol.py
@@ -18,7 +18,7 @@ import datetime
import unittest
import os
-from testtools.compat import _b, _u, StringIO
+from testtools.compat import _b, _u, BytesIO, StringIO
from testtools.content import Content, TracebackContent
from testtools.content_type import ContentType
from testtools.tests.helpers import (
@@ -55,23 +55,23 @@ class TestProtocolServerForward(unittest.TestCase):
def test_story(self):
client = unittest.TestResult()
- out = StringIO()
+ out = BytesIO()
protocol = subunit.TestProtocolServer(client, forward_stream=out)
- pipe = StringIO("test old mcdonald\n"
- "success old mcdonald\n")
+ pipe = BytesIO(_b("test old mcdonald\n"
+ "success old mcdonald\n"))
protocol.readFrom(pipe)
self.assertEqual(client.testsRun, 1)
self.assertEqual(pipe.getvalue(), out.getvalue())
def test_not_command(self):
client = unittest.TestResult()
- out = StringIO()
+ out = BytesIO()
protocol = subunit.TestProtocolServer(client,
stream=subunit.DiscardStream(), forward_stream=out)
- pipe = StringIO("success old mcdonald\n")
+ pipe = BytesIO(_b("success old mcdonald\n"))
protocol.readFrom(pipe)
self.assertEqual(client.testsRun, 0)
- self.assertEqual("", out.getvalue())
+ self.assertEqual(_b(""), out.getvalue())
class TestTestProtocolServerPipe(unittest.TestCase):