Skip to content

BUG: Doctest doesn't have a SHOW_WARNINGS directive. #23819

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

Merged
merged 1 commit into from
May 27, 2023

Conversation

charris
Copy link
Member

@charris charris commented May 26, 2023

No description provided.

@@ -154,7 +154,7 @@ def geterr():
--------
>>> np.geterr()
{'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'}
>>> np.arange(3.) / np.arange(3.) # doctest: +SHOW_WARNINGS
Copy link
Member

Choose a reason for hiding this comment

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

ahh, yes, this was a premature change that requires pytest-doctestplus (@seberg was originally working on the #23812 branch)

Copy link
Member Author

Choose a reason for hiding this comment

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

@bsipocz Hmm, removing that fails differently on the refguide checks. I think the best short term fix is to skip that test. Could you make sure to add it back in your PR?

@@ -154,7 +154,7 @@ def geterr():
--------
>>> np.geterr()
{'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'}
>>> np.arange(3.) / np.arange(3.) # doctest: +SHOW_WARNINGS
>>> np.arange(3.) / np.arange(3.)
array([nan, 1., 1.])
RuntimeWarning: invalid value encountered in divide
Copy link
Member

Choose a reason for hiding this comment

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

I believe the exception needs to be removed here in here.

Suggested change
RuntimeWarning: invalid value encountered in divide

Copy link
Member

Choose a reason for hiding this comment

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

I think the warning is correct, but maybe warnings are set up differently in the two runs. With pytest, we have the problem that warnings are set to errors (when they should probably not be for the doctest part), and maybe the current checks don't handle them at all?

In any case, I tend towards the +SKIP. If we forget about it... this function should maybe be hidden away from public anyway...

@charris charris force-pushed the fix-refguide-check-failure branch from acd6d02 to 37e14b7 Compare May 27, 2023 01:03
@seberg seberg merged commit 00e5923 into numpy:main May 27, 2023
@seberg
Copy link
Member

seberg commented May 27, 2023

Not sure that SKIP is ideal, but I do think the warning should be in the docs (it would show the warning in a normal setup there), so SKIP is hopefully OK for now and unblocks CI.

Thanks for fixing this up Chuck!

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

Successfully merging this pull request may close these issues.

3 participants