-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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: