summaryrefslogtreecommitdiff
path: root/python/subunit
diff options
context:
space:
mode:
authorRobert Collins <robertc@robertcollins.net>2011-04-25 17:07:43 +1200
committerRobert Collins <robertc@robertcollins.net>2011-04-25 17:07:43 +1200
commit65ceb1a7645b132fb831344c0d0ddf986e93d6fe (patch)
tree0dde400005ef1eeee6f8a2482bdf6ee92e49dbdf /python/subunit
parent86b85e3f83f4030a63026386ffc3d3488ab34d13 (diff)
downloadsubunit-git-65ceb1a7645b132fb831344c0d0ddf986e93d6fe.tar.gz
Test suite passing on 3.1.
Diffstat (limited to 'python/subunit')
-rw-r--r--python/subunit/__init__.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/python/subunit/__init__.py b/python/subunit/__init__.py
index 8fb3ab7..a7048d3 100644
--- a/python/subunit/__init__.py
+++ b/python/subunit/__init__.py
@@ -468,10 +468,9 @@ class TestProtocolServer(object):
"""
self.client = ExtendedToOriginalDecorator(client)
if stream is None:
+ stream = sys.stdout
if sys.version_info > (3, 0):
- stream = sys.stdout.buffer
- else:
- stream = sys.stdout
+ stream = stream.buffer
self._stream = stream
self._forward_stream = forward_stream or DiscardStream()
# state objects we can switch too
@@ -885,10 +884,10 @@ def run_isolated(klass, self, result):
# at this point, sys.stdin is redirected, now we want
# to filter it to escape ]'s.
### XXX: test and write that bit.
-
- result = TestProtocolClient(sys.stdout)
+ stream = os.fdopen(1, 'wb')
+ result = TestProtocolClient(stream)
klass.run(self, result)
- sys.stdout.flush()
+ stream.flush()
sys.stderr.flush()
# exit HARD, exit NOW.
os._exit(0)
@@ -898,7 +897,8 @@ def run_isolated(klass, self, result):
os.close(c2pwrite)
# hookup a protocol engine
protocol = TestProtocolServer(result)
- protocol.readFrom(os.fdopen(c2pread, 'rU'))
+ fileobj = os.fdopen(c2pread, 'rb')
+ protocol.readFrom(fileobj)
os.waitpid(pid, 0)
# TODO return code evaluation.
return result
@@ -1168,7 +1168,10 @@ def get_default_formatter():
if formatter:
return os.popen(formatter, "w")
else:
- return sys.stdout
+ stream = sys.stdout
+ if sys.version_info > (3, 0):
+ stream = stream.buffer
+ return stream
if sys.version_info > (3, 0):