Skip to content
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

mix_stderr parameter was removed from click 8.2.0 #4577

Merged
merged 4 commits into from
Feb 18, 2025

Conversation

MeggyCal
Copy link
Contributor

@MeggyCal MeggyCal commented Feb 7, 2025

From click 8.2.0 changelog:

Keep stdout and stderr streams independent in CliRunner. Always collect stderr output and never raise an exception. Add a new output stream to simulate what the user sees in its terminal. Removes the mix_stderr parameter in CliRunner. [:issue:`2522`](https://github.com/pallets/click/blob/main/CHANGES.rst#id27) [:pr:`2523`](https://github.com/pallets/click/blob/main/CHANGES.rst#id29)

so mix_stderr=False throws an error and is redundant.

@MeGaGiGaGon MeGaGiGaGon added the skip news Pull requests that don't need a changelog entry. label Feb 7, 2025
@MeGaGiGaGon
Copy link
Collaborator

Thanks for the contribution!
I don't understand the point/default behavior for why mix_stderr=False, but wouldn't that regress while click 8.2.0 is still unreleased?

@cobaltt7
Copy link
Collaborator

cobaltt7 commented Feb 7, 2025

Also, wouldn't this change make the entire class redundant?

@JelleZijlstra
Copy link
Collaborator

Yes, seems like we may have to make this conditional on Click version.

@MeggyCal
Copy link
Contributor Author

Ok, I will try to make it conditional 🙂

@MeggyCal
Copy link
Contributor Author

sorry, I couldn't think of a more pythonic way

@@ -114,7 +116,10 @@ class BlackRunner(CliRunner):
"""Make sure STDOUT and STDERR are kept separate when testing Black via its CLI."""

def __init__(self) -> None:
super().__init__(mix_stderr=False)
if Version(imp_version('click')) >= Version('8.2.0'):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if Version(imp_version('click')) >= Version('8.2.0'):
if Version(imp_version("click")) >= Version("8.2.0"):

CI is unhappy because the quotes get reformatted to double quotes, but I think it should be gtg after this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@JelleZijlstra JelleZijlstra merged commit 14e1de8 into psf:main Feb 18, 2025
43 checks passed
@MeggyCal MeggyCal deleted the click branch February 18, 2025 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news Pull requests that don't need a changelog entry.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants