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

Keep track of <stderr> and <stdout> mix in CliRunner results #2523

Merged
merged 3 commits into from
Nov 3, 2024

Conversation

kdeldycke
Copy link
Contributor

@kdeldycke kdeldycke commented May 30, 2023

This PR:

  • Fixes CliRunner: restrict mix_stderr influence to <output>; keep <stderr> and <stdout> stable #2522
  • Let result.stdout always contain the pure output to <stdout>. Never mangle <stderr> in it.
  • Let result.stderr always contain the pure output to <stderr>. Never raise an error.
  • Update result.output to be a perfect copy of what the user is expected to see in its terminal; i.e. produce a mix of <stdout> and <stderr>, in their natural order.
  • Remove the mix_stderr parameter from CliRunner.

Checklist:

  • Add tests that demonstrate the correct behavior of the change. Tests should fail without the change.
  • Add or update relevant docs, in the docs folder and in code.
  • Add an entry in CHANGES.rst summarizing the change and linking to the issue.
  • Add .. versionchanged:: entries in any relevant code docs.
  • Run pre-commit hooks and fix any issues.
  • Run pytest and tox, no tests failed.

@kdeldycke kdeldycke force-pushed the clirunner-mixed-output branch 3 times, most recently from b98828a to 7212e53 Compare May 30, 2023 12:36
@kdeldycke
Copy link
Contributor Author

All the tests but the 3.12-dev job are passing. That is because Click is not compatible with the latest Python 3.12.0-beta.1. See: #2524

Other than that, this PR is ready to be reviewed or merged upstream.

@kdeldycke
Copy link
Contributor Author

PR has been rebased, all tests are passing. This PR is ready to be merged.

@davidism davidism added this to the 8.2.0 milestone Jul 4, 2023
@kdeldycke kdeldycke force-pushed the clirunner-mixed-output branch 2 times, most recently from 7ae205d to 8ab833c Compare July 9, 2023 10:18
@kdeldycke
Copy link
Contributor Author

Following the recent 8.1.4 release, this PR has been rebased and is ready to be reviewed/merged.

@kdeldycke kdeldycke force-pushed the clirunner-mixed-output branch 3 times, most recently from 497f9dd to 073216d Compare August 31, 2023 08:40
@kdeldycke
Copy link
Contributor Author

All typing issues and conflicts have been fixed. The PR has been rebased on top of the latest main branch.

This PR is ready to be merged for the upcoming Click 8.2.x.

@davidism
Copy link
Member

davidism commented Sep 1, 2023

I think it makes more sense to deprecate/remove mix_stderr, and just always have stdout, stderr, and output attributes as described here. Doesn't seem useful to keep mix_stderr anymore.

@kdeldycke
Copy link
Contributor Author

I think it makes more sense to deprecate/remove mix_stderr, and just always have stdout, stderr, and output attributes as described here. Doesn't seem useful to keep mix_stderr anymore.

I like that. Let's remove it then.

@kdeldycke kdeldycke force-pushed the clirunner-mixed-output branch 2 times, most recently from 60d60f8 to 5d8ed45 Compare September 2, 2023 08:05
@kdeldycke
Copy link
Contributor Author

mix_stderr has been removed, all conflicts fixed. This PR is ready to be merged.

@kdeldycke kdeldycke force-pushed the clirunner-mixed-output branch 2 times, most recently from 147fe4d to b9c2580 Compare February 23, 2024 07:56
@rsyring
Copy link

rsyring commented Feb 29, 2024

FWIW, I think getting rid of mix_stderr makes sense.

@kdeldycke
Copy link
Contributor Author

FWIW, I think getting rid of mix_stderr makes sense.

Thanks for chiming in on an obscure cleanup PR! 😁

@kdeldycke kdeldycke force-pushed the clirunner-mixed-output branch 2 times, most recently from 4f03e37 to fc952ec Compare May 18, 2024 12:23
@kdeldycke
Copy link
Contributor Author

I just fixed the merging conflict. This PR is ready to be merged upstream.

@davidism
Copy link
Member

Thanks for keeping it up to date, sorry it's been so long. I will try to get to merging this during PyCon sprints.

@kdeldycke
Copy link
Contributor Author

No worries @davidism ! Take your time, and do not hesitate to request some changes from my PR if needed. Thanks again for maintaining click! 🤗

@AndreasBackx AndreasBackx merged commit 0e0c003 into pallets:main Nov 3, 2024
12 checks passed
@kdeldycke
Copy link
Contributor Author

Thanks @AndreasBackx for merging it! The upcoming 8.2.0 looks great!

@kdeldycke kdeldycke deleted the clirunner-mixed-output branch November 3, 2024 04:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CliRunner: restrict mix_stderr influence to <output>; keep <stderr> and <stdout> stable
4 participants