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

📝 Clarify testing documentation about checking stderr #335

Merged
merged 3 commits into from
Jul 2, 2022
Merged

📝 Clarify testing documentation about checking stderr #335

merged 3 commits into from
Jul 2, 2022

Conversation

cgabard
Copy link
Contributor

@cgabard cgabard commented Oct 8, 2021

Hello.
First thank for all your hard work on this project.

Today I wanted to test a small utility function and check that a message was printed into the standard error.

From the documentation, the only mention was

You could also check result.stderr for "standard error".

But using it directly, in fact, does not work.

After looking the code, it seems that Click's CliRunner mix standard output and error on stdout by default. You need to ask explicitly to do not mix them in order to be able to read the result.stderr property.

Then, I find the current documentation confusing because does not mention that and can lead reader to think it should work out of the box. In fact, I firsts started by double-checking my code before understand that the runner did not have the expected behavior.

So I suggest a small addition to the current note, at least to provide insight for readers.

Please let me know if I can improve it.

Try clarify use of `result.stderr`
@svlandeg svlandeg added the docs Improvements or additions to documentation label Apr 21, 2022
@tiangolo tiangolo changed the title Try clarify testing documentation about stderr 📝 Clarify testing documentation about checking stderr Jul 2, 2022
@tiangolo
Copy link
Member

tiangolo commented Jul 2, 2022

Good point, thank you @cgabard! 🍰

(and thanks @svlandeg for reviewing and labeling 🤓 )

@tiangolo tiangolo enabled auto-merge (squash) July 2, 2022 17:35
@github-actions
Copy link

github-actions bot commented Jul 2, 2022

📝 Docs preview for commit 9d643ee at: https://62c081ce31de8d695a53bc85--typertiangolo.netlify.app

@codecov
Copy link

codecov bot commented Jul 2, 2022

Codecov Report

Merging #335 (9d643ee) into master (4d26e77) will not change coverage.
The diff coverage is n/a.

@@            Coverage Diff            @@
##            master      #335   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          253       253           
  Lines         5340      5340           
=========================================
  Hits          5340      5340           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4d26e77...9d643ee. Read the comment docs.

@tiangolo tiangolo merged commit f4a5ee1 into fastapi:master Jul 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants