Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
capsys + sys.stdout.buffer => AttributeError #1407
Applicable versions where sys.stdout.buffer should exist and be a bytestream:
import sys def test(capsys): sys.stdout.buffer.write(b'hi\n') assert capsys.readouterr() == 'hi\n'
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
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.