-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Make EncodedFile.write() return the return value from inner write() #6558
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @gavento, thanks! See my suggestions. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 for @nicoddemus's suggestions.
Please squash into a single commit, and force-push then also.
Should also have a Lines 429 to 431 in 1ef137c
|
Thanks for the pointer, however |
I'd still make it into a |
Make EncodedFile, used for captured output streams, method .write return the number of characters written. Add test for captured stderr write. Fixes pytest-dev#6557. Co-Authored-By: Bruno Oliveira <[email protected]>
@blueyed I had another suggestion I would make into a separate PR if you think it useful, that would resolve
|
This is implemented by IOBase already, which additionally checks if the stream is not closed, and calls `write` per line. Ref/via: pytest-dev#6558 (comment)
@gavento just for info: it redirects attribute lookup to the original buffer already: https://github.com/pytest-dev/pytest/pull/6566/files#diff-e4269384a671a462a4824e8b06d4644bR441-R442 |
Right, 🤦♂️ I noticed that elegant piece earlier. In that case, adding inheritance from Other file-like objects already do not inherit |
This is implemented by IOBase already, which additionally checks if the stream is not closed, and calls `write` per line. Ref/via: pytest-dev#6558 (comment)
This is implemented by the underlying stream already, which additionally checks if the stream is not closed, and calls `write` per line. Ref/via: pytest-dev#6558 (comment)
This is implemented by the underlying stream already, which additionally checks if the stream is not closed, and calls `write` per line. Ref/via: pytest-dev#6558 (comment)
This is implemented by the underlying stream already, which additionally checks if the stream is not closed, and calls `write` per line. Ref/via: pytest-dev#6558 (comment)
Stream write() methods should/may return the number of characters or bytes written. Encoded file needlessly discarded the value returned from the wrapped stream write.
Fixes #6557