WIP: Add capture mode to CliRunner and revert default fileno exposure#3391
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#3391Conversation
CliRunner and revert default-mode fileno exposureCliRunner and revert default fileno exposure
b1a4103 to
aad0fd6
Compare
|
How does this interact with pytest's capturing modes? |
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 |
aad0fd6 to
1551d57
Compare
Addressed in https://github.com/pallets/click/compare/aad0fd68b6e20e33438bba3e7fb9bb637822effc..1551d57f2bd86c88c2b40be1e688446a0a7d9751 . Added a double |
1551d57 to
02b2340
Compare
…o` exposure Closes: pallets#3384 Refs: pallets#3244
02b2340 to
4ec81c8
Compare
|
PR is ready for review. |
|
I will review this. @davidism can you also take a look? |
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.