WIP: Add capture mode to CliRunner and revert default fileno exposure#3391
Draft
kdeldycke wants to merge 1 commit intopallets:mainfrom
Draft
WIP: Add capture mode to CliRunner and revert default fileno exposure#3391kdeldycke wants to merge 1 commit intopallets:mainfrom
CliRunner and revert default fileno exposure#3391kdeldycke wants to merge 1 commit intopallets:mainfrom
Conversation
CliRunner and revert default-mode fileno exposureCliRunner and revert default fileno exposure
This was
linked to
issues
Apr 29, 2026
This was referenced Apr 29, 2026
…o` exposure Closes: pallets#3384 Refs: pallets#3244
b1a4103 to
aad0fd6
Compare
Member
|
How does this interact with pytest's capturing modes? |
Collaborator
Author
Oh right. That's an excellent question. I went to the mode route with 2 distinctive cases because I could not figure out a magic way to auto-guess what was the user's intention. And if Pytest had already solve this issue this way it's probably because there is no silver bullet. Still, I did not tested this proposal within the different modes of Pytest itself. I'll add a couple of unit tests to try the matrix of Pytest's |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This follows up on #3244 which worked great to fix #2865 where a user was bitten
CliRunnerwholesale substitution ofstdoutandstderrby its own wrappers to capture a CLI I/O. Unfortunately this broke tests for users bypassing the bypass and duplicating standard streams is duplicated withos.dup2. This is what was reported in #3384.To fix this tension, we extend the solution introduced in #3244 by adding a capture mode parameter to the
CliRunner. This complete what we started in #3244 by mirroring Pytestcapsysandcapfdmodes.Modes have the advantage of flexibility to address each user's own needs, while establishing a contract of expectations. I updated the docs to explain each mode and their expectations.
I also reverted back to the behavior of
CliRunnerpre-8.3.3release.Also note that this pave the way to fix #737 in the future by extending
_FDCaptureby opening the possibility of adding ateemode.