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

MAINT: Use contextmanager in _run_doctests #15430

Merged
merged 2 commits into from
Feb 3, 2020

Conversation

sethtroisi
Copy link
Contributor

No description provided.

Copy link
Contributor Author

@sethtroisi sethtroisi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side question.

This docstring results in a warning intentionally being printed
https://github.com/numpy/numpy/blob/master/numpy/core/_ufunc_config.py#L105

Do you know of a pattern to expect a warning in the doctest?
I could execute the docstring line in an with assert_warns but that seemed overkill.

@@ -25,21 +25,23 @@

$ python refguide_check.py --rst docs
"""
import sys
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can revert the sorting of imports if alphabetical isn't the way to sort them.

tools/refguide_check.py Outdated Show resolved Hide resolved

return success, output
return success, output.read()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

output is now a str instead of array but this method starts with _ so I think this is fine.

@eric-wieser
Copy link
Member

@rgommers expressed some concerns about refguide cleanups - sorry for not mentioning that earlier. It might be ok, so long as you make the same fixes upstream in scipy.

Copy link
Member

@eric-wieser eric-wieser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good now, but let's not ship this without a sign off from Ralf

@sethtroisi
Copy link
Contributor Author

sethtroisi commented Jan 24, 2020

@rgommers expressed some concerns about refguide cleanups - sorry for not mentioning that earlier. It might be ok, so long as you make the same fixes upstream in scipy.

I'll try to upstream this (either after this is merged or given LGTM) with the caveat that I've never submitted to scipy so the outcome is uncertain.

@charris charris changed the title DEV: Use contextmanager in _run_doctests MAINT: Use contextmanager in _run_doctests Jan 25, 2020
@mattip
Copy link
Member

mattip commented Jan 26, 2020

I think our version has diverged significantly from scipy since we have the doc/rst checks from gh-14732 which I do not think were merged to scipy.

@sethtroisi
Copy link
Contributor Author

@rgommers Will you have some time to review this PR this week? I'm eager to get it committed so I can try to upstream it and other changes to scipy.

Copy link
Member

@rgommers rgommers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a reasonable cleanup. I haven't testing, but it looks fine to merge. Thanks @sethtroisi

@sethtroisi
Copy link
Contributor Author

Thanks for taking a look Ralf!

@mattip mattip merged commit 85be00a into numpy:master Feb 3, 2020
@sethtroisi sethtroisi deleted the refguide_warning branch February 3, 2020 21:10
@mattip
Copy link
Member

mattip commented Feb 5, 2020

This broke error reporting. Before this

python tools/refguide_check.py --rst doc/source/user/c-info.python-as-glue.rst 

would show the actual doctest failures. Now it only reports that the test fails, without any output.

If we cannot fix it quickly, I will have to revert the merge.

@sethtroisi
Copy link
Contributor Author

I'm still awake and will take a look but if you don't here from me in ~30 minutes please revert.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants