Error printing tracebacks to StringIO stream on Python 3
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
subunit |
Invalid
|
Critical
|
Unassigned |
Bug Description
subunit is used in zope.testrunner
It's test fail under Python 3(.4). Example:
Error in test test_print_
Traceback (most recent call last):
File "/usr/lib/
yield
File "/usr/lib/
self.setUp()
File "/home/
options, stream=self.output)
File "/home/
self._subunit = subunit.
File "/home/
stream = make_stream_
File "/home/
return _unwrap_
File "/home/
return stream.buffer
AttributeError: '_io.StringIO' object has no attribute 'buffer'
Related branches
Changed in subunit: | |
status: | Triaged → Incomplete |
So, I'm a bit uncomfortable with the patch - because we require the ability to write raw bytes to a stream - and _io.StringIO will not accept raw bytes. What zope's own tests should be doing is something like:
bytestream = io.BytesIO() r(bytestream, "utf8")
stringstream = io.TextIOWrappe
# now you can do string operations on stringstream and byte operations on bytestream.
which will work on all pythons from 2.6 through 3.4 and pypy.