-
-
Notifications
You must be signed in to change notification settings - Fork 600
Redirect warning output from stderr to stdout in doctests #39647
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
Conversation
Documentation preview for this PR (built with commit 5d573c3; changes) is ready! 🎉 |
Seems semantically incorrect because…
→ https://docs.python.org/3/library/warnings.html#warnings.showwarning
How would programs that are tested using pytest normally test for warnings to be raised then? |
Right, but in the context of doctest the distinction between stdout and stderr doesn't seem to be relevant (both are printed-out as strings by default).
In normal pytest methods, one can use the Sympy has a [ |
If this function is to be used nowhere outside doctest then I suppose this is acceptable. But I suggest modify the documentation for Is there really no other occurrence of stderr being used? This feels weird. |
Yes, it's part of
Done.
Not that I could find. |
@user202729 does this look good to you, or do you have further suggestions? |
sagemathgh-39647: Redirect warning output from stderr to stdout in doctests <!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes sagemath#12345". --> Pytest considers ouput in `stderr` as errors, thus we redirect the doctest warnings to `stdout` instead. Doesn't seem to make a difference for sage's doctest runner. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [ ] The title is concise and informative. - [ ] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#39647 Reported by: Tobias Diez Reviewer(s):
Pytest considers ouput in
stderr
as errors, thus we redirect the doctest warnings tostdout
instead. Doesn't seem to make a difference for sage's doctest runner.📝 Checklist
⌛ Dependencies