-
-
Notifications
You must be signed in to change notification settings - Fork 700
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
📝 Clarify the need for mix_stderr
when accessing the output of stderr
in tests
#1045
base: master
Are you sure you want to change the base?
📝 Clarify the need for mix_stderr
when accessing the output of stderr
in tests
#1045
Conversation
📝 Docs preview for commit fdbe59e at: https://b8d2cea1.typertiangolo.pages.dev Modified Pages |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see your point for making this more clear in the docs. I've proposed a slightly different phrasing, including a reference to stdout
to refer to the code snippet that is shown in the docs right before.
mix_stderr
when accessing the output of stderr
in tests
hi @svlandeg I have no objections to that change 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feedback @mrchrisadams! This should now be good to merge, I'll just run it by Tiangolo for final approval.
This pull request includes a small change to the
docs/tutorial/testing.md
file. The change updates the documentation to clarify how to check for output sent to standard error when usingCliRunner
.Documentation update:
docs/tutorial/testing.md
: Clarified that theCliRunner
instance must be created with themix_stderr=False
argument to accessresult.stderr
in tests.Why would this change be necessary?
I've made this because I was left scratching my head trying to test the output of
stderr
today in a project using Typer, and I only found the solution when I came across #385, an issue that was filed in 2022.I looked for a better
Exception
to raise, but it looks like this more a problem with Click'sResult
class than Typer; after looking into the codebase there didn't seem to be an obvious place in Typer to create a new, clearer exception class.So, I've tried to go for some clearer text in the docs instead.
This is the before version:
This is the after version: