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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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.

Closes pallets#2522

[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
@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! 😁

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
3 participants