TST: Get rid of wcs test warnings#9010
Conversation
astropy/wcs/tests/test_wcs.py
Outdated
| [202.72053428, 47.37893142]]) | ||
| footprint = w.calc_footprint(axes=axes) | ||
| assert_allclose(footprint, ref) | ||
| with pytest.raises(FITSFixedWarning): |
There was a problem hiding this comment.
For some of these tests, I need to indent the whole block or Python complains about undefined variable (that was defined inside the block). 🤷♀️
| from astropy.tests.helper import raises, catch_warnings | ||
| from astropy import wcs | ||
| from astropy.wcs import _wcs | ||
| from astropy.wcs import _wcs # noqa |
There was a problem hiding this comment.
flake8 complains that this import is not used but if I remove it, tests fail. 🤷♀️
2b4132b to
5d09ffd
Compare
astropy/wcs/tests/test_utils.py
Outdated
| mywcs.wcs.cdelt = cdelt | ||
|
|
||
| mywcs.wcs.ctype = ['RA---TAN', 'FREQ'] | ||
| # Some inputs emit RuntimeWarning |
There was a problem hiding this comment.
The warnings here are because the parameters are set incorrectly.
A WCS cannot have both CD and PC defined. A WCS cannot have CD and CDELT defined.
Since the test is not meant to test the warning messages I think the input data is incorrect.
Either fix the inputs to the test and remove warnings or file an issue and I will fix it in a different PR.
I remember seeing some function code that needs to be fixed in a similar way but I have to find it.
There was a problem hiding this comment.
@nden , I removed the handling of RuntimeWarning. Can we proceed and merge this soon?
There was a problem hiding this comment.
I also opened an issue at #9310 as you requested. Thanks!
|
@pllim Other than that one comment I think this is good. |
|
@nden, thanks for the review! I think I addressed your comment. Feel free to approve and/or merge if you are happy with this. |
|
I don't think |
Some PEP 8 fixes.
|
I think that everything got addressed from the review here, so I go ahead and merge. Thanks @pllim! |
This should get rid of most of the
wcstest warnings. This is part of work for #7928 . The warnings were captured by removing the line insetup.cfgto suppress pytest warnings and then add this in the same section:And then run tests with
python setup.py -P wcs.