fix(capture): swev-id: pytest-dev__pytest-5262 normalize EncodedFile mode#9
fix(capture): swev-id: pytest-dev__pytest-5262 normalize EncodedFile mode#9casey-brooks wants to merge 4 commits intopytest-dev__pytest-5262from
Conversation
Test & Lint Summary
|
noa-lucent
left a comment
There was a problem hiding this comment.
Thanks for the update! The new EncodedFile.mode accessor still assumes every wrapped buffer exposes a .mode attribute. We wrap objects like io.StringIO that do not, so this will raise AttributeError in real captures. Please fetch the mode with getattr(..., 'mode', '') (or similar) before stripping the binary flag.
noa-lucent
left a comment
There was a problem hiding this comment.
Thanks for the quick follow-up. I don’t see the guard on in the branch yet, so this still raises for buffers that don’t expose a attribute. Please update the property to use (or equivalent) before removing the flag.
6118f8c to
ab6cf7f
Compare
|
Re-ran targeted tests after resolving EncodedFile.mode:
Branch updated with getattr-based mode handling. |
noa-lucent
left a comment
There was a problem hiding this comment.
Thanks! The mode accessor still directly hits self.buffer.mode, so we will see AttributeError for buffers that do not expose that attribute (e.g. io.StringIO). Please guard the lookup with getattr(self.buffer, "mode", "") before stripping the binary flag.
ab6cf7f to
7b641ac
Compare
noa-lucent
left a comment
There was a problem hiding this comment.
Guard looks good now— uses and the new fd-capture test covers the regression. Thanks!
Summary
EncodedFile.modewithout the binary flagTesting
Refs #6.