Skip to content

TST: Handle PY_SSIZE_T_CLEAN warnings - #11019

Merged
dhomeier merged 2 commits into
astropy:masterfrom
pllim:py-ssize-t-clean
Nov 13, 2020
Merged

dhomeier merged 2 commits into
astropy:masterfrom
pllim:py-ssize-t-clean

Conversation

@pllim

@pllim pllim commented Nov 10, 2020

Copy link
Copy Markdown
Member

Description

This pull request is to un-ignore PY_SSIZE_T_CLEAN warnings and handle them. We get reports of these warnings during RC testing because astropy.test() ignores setup.cfg. I forgot why we ignored this warning, but maybe we don't have to anymore.

Fixes #10954

Follow up of #10956

@pllim

pllim commented Nov 10, 2020

Copy link
Copy Markdown
Member Author

Remote data failure is unrelated.

@dhomeier

dhomeier commented Nov 10, 2020 •

Copy link
Copy Markdown
Contributor

Looks straightforward and the warning seems correctly handled in CI now (mpl302 is still running in Python 3.7, so cannot directly test the numpy_warnings case, but I noted there are further PY_SSIZE_T_CLEAN checks in test_slicing_warnings).

One thing I have been wondering about before, why not just adding
"PY_SSIZE_T_CLEAN will be required for '#' formats" in w_msg
to the anticipated warnings – is this because the test is supposed to probe only for immediate warnings from numpy or mpl?

@pllim

pllim commented Nov 10, 2020

Copy link
Copy Markdown
Member Author

Re: #11019 (comment)

Not sure. I didn't write the test. Will have to ask @astrofrog or @Cadair .

@dhomeier

Copy link
Copy Markdown
Contributor

Re: #11019 (comment)

Not sure. I didn't write the test. Will have to ask @astrofrog or @Cadair .

Looks like originally this was intended to make sure no warnings from numpy were issued, but as of #10504 some others (matplotlib-related?) needed to be intercepted, + the DeprecationWarning as of numpy 1.16. Then it might be reasonable to handle the Python 3.8 warning there as well.

@pllim

pllim commented Nov 13, 2020

Copy link
Copy Markdown
Member Author

So, you are saying we should not skip at all and use pytest.warns to catch them all?

@dhomeier

Copy link
Copy Markdown
Contributor

Yes, since we clearly anticipate that warning, I'd say it's better to run the test and catch it (it is not skipped for Numpy >= 1.16 either...). Only possible drawback I can see is too many potential warnings accumulating.

@pllim

pllim commented Nov 13, 2020

Copy link
Copy Markdown
Member Author

RTD reached concurrency limit but we don't really need it (but we cannot cancel). You can ignore the "allowed failure" job. If this looks fine to you, please approve and merge. Thanks!

@dhomeier dhomeier left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

OK, this should have been open for comments long enough.
Thanks for the fix!

@dhomeier
dhomeier merged commit 27ed67f into astropy:master Nov 13, 2020
@pllim
pllim deleted the py-ssize-t-clean branch November 13, 2020 23:09
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.

PY_SSIZE_T_CLEAN warning with Python 3.9 and Matplotlib 3.0

2 participants