capsys + sys.stdout.buffer => AttributeError #1407
Comments
Hmm I'm not sure how to solve this @asottile... after all |
Perhaps an object that looks something like this? class FakeStdout(object):
def __init__(self):
self.buffer = io.BytesIO()
def write(self, s):
self.buffer.write(s.encode('UTF-8'))
def _read_out(self):
return self.buffer.getvalue().decode('UTF-8') though that has at least 3 cases where I can see it not working :S Maybe introduce a |
i also am in need of such functionality. any idea for a simple workaround for now? propably i will concerning the design of a native support for this, i have these considerations:
i'm not really fond of further, longer fixture names. though the idea of configuring the fixtures (e.g. with a |
Good point.
I think a Btw, I mention |
okay, should be well documented. your signature proposal looks good. the complement should be when i'm responsible towards myself and my schedule, i will not implement that too soon. :-/ i certainly appreciate if someone else did it. |
Yeah, a PR would be most welcome. |
imho capture should NOT support buffer by default, only if its requested as encoded |
as far as i understood, no one is proposing a different default behavior. could you elaborate your point? |
Make capsys more like stdio streams in python3. Resolves #1407.
Fixed by #2266 |
Applicable versions where sys.stdout.buffer should exist and be a bytestream:
The text was updated successfully, but these errors were encountered: