-
-
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
Add capfdbinary fixture #2925
Add capfdbinary fixture #2925
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 |
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.
Awesome work!
I left some small comments, but overall this is top-notch.
doc/en/capture.rst
Outdated
@@ -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). | |||
|
|||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to use "fixtures" instead of "function argument".
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.
👍 , 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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! |
capfdbinary
works likecapfd
but produces bytes forreadouterr()
.See #2923