Add capfdbinary fixture#2925
Add capfdbinary fixture#2925nicoddemus merged 1 commit intopytest-dev:featuresfrom asottile:capfdbinary
Conversation
|
CC @nicoddemus I approached this only from the Feedback appreciated, I threw this together quickly and might've missed some documentation / naming / etc. |
|
Thanks a lot @asottile, that was quick! 👍
This is fine, but it is easy to implement |
nicoddemus
left a comment
There was a problem hiding this comment.
Awesome work!
I left some small comments, but overall this is top-notch.
doc/en/capture.rst
Outdated
| system level output streams (FD1 and FD2). | ||
|
|
||
| If the code under test writes non-textual data, you can capture this using | ||
| the ``capfdbinary`` function argument which instead returns ``bytes`` from |
There was a problem hiding this comment.
I would prefer to use "fixtures" instead of "function argument".
There was a problem hiding this comment.
👍 , while writing this I myself wrote "fixtures" but then matched it with the paragraph above -- I'll update both of them
| @@ -115,6 +115,10 @@ same interface but allows to also capture output from | |||
| libraries or subprocesses that directly write to operating | |||
| system level output streams (FD1 and FD2). | |||
|
|
|||
There was a problem hiding this comment.
Please add here, before the next paragraph:
.. versionadded:: 3.3|
Yeah |
I'm OK with making But let's see what others think about this first. |
`capfdbinary` works like `capfd` but produces bytes for `readouterr()`.
|
we can start with python3 only, but we should take a look at exposing a encoded bytesio kinda thing in future |
|
@asottile so I guess we can go ahead with |
|
@nicoddemus cool, ok for me to do that in a followup? |
|
@asottile yup |
|
@RonnyPfannschmidt want some more time to take look at this? Otherwise I will merge this tomorrow. 👍 |
|
Thanks again @asottile! |
capfdbinaryworks likecapfdbut produces bytes forreadouterr().See #2923