Make EncodedFile.write() return the return value from inner write()#6558
Make EncodedFile.write() return the return value from inner write()#6558blueyed merged 1 commit intopytest-dev:masterfrom
Conversation
nicoddemus
left a comment
There was a problem hiding this comment.
Great work @gavento, thanks! See my suggestions. 👍
There was a problem hiding this comment.
👍 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 <nicoddemus@gmail.com>
|
@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