Skip to content

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

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

Merged
merged 3 commits into from
Nov 3, 2024
Merged

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

merged 3 commits into from
Nov 3, 2024

Conversation

kdeldycke
Copy link
Collaborator

@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
Copy link
Collaborator 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
Collaborator 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
Copy link
Collaborator Author

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

@kdeldycke
Copy link
Collaborator 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
Collaborator 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
Copy link
Collaborator Author

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

@rsyring
Copy link

rsyring commented Feb 29, 2024

FWIW, I think getting rid of mix_stderr makes sense.

@kdeldycke
Copy link
Collaborator Author

FWIW, I think getting rid of mix_stderr makes sense.

Thanks for chiming in on an obscure cleanup PR! 😁

@kdeldycke
Copy link
Collaborator 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
Collaborator 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 mentioned this pull request Oct 20, 2024
34 tasks
@AndreasBackx AndreasBackx merged commit 0e0c003 into pallets:main Nov 3, 2024
12 checks passed
@kdeldycke
Copy link
Collaborator 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
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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