-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Remove calls to deprecated np.round_
alias for Numpy 2.0
#15266
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
Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.
|
Seems this has to wait until the pip numpy-dev is actually updated. |
Thanks for being proactive on this! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, indeed, for being proactive. I fear we're not yet done but we'll get there...
My pip somehow is unable to install the "2.0.0dev", so I had to install directly from GitHub ;-) The change seems to be in now, so this should be ready once the extra CI is through. |
@@ -692,6 +692,7 @@ def test_round(self): | |||
self.check(np.round) | |||
|
|||
# NUMPY_LT_1_25 | |||
@pytest.mark.skipif(not NUMPY_LT_2_0, reason="np.round_ is removed in NumPy 2.0") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think what is needed here is to only define the function on numpy < 2, i.e.,
if NUMPY_LT_2_0:
@pytest.mark.filterwarnings(...)
def test_round_(...)
The way the test for completeness is done is that defining the test causes the name to be added to a tested list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I did not see that fail in https://github.com/astropy/astropy/actions/runs/6052493225/job/16468784807#step:7:1349 or the tests for #15274 or my local tests so far – I'd expect pytest to skip already the function definition here, could this be different behaviour over different pytest versions? But the reference to np.round_
would only be made once self.check(...)
is executed, so I really see no possible difference to test_function_helpers
here. In what setup did you see the failure?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way the test for completeness is done is that defining the test causes the name to be added to a tested list.
Or what did you mean by "test for completeness" – something codecov-related?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm very confused. When I looked at the tests before, the -dev
test did have a failure, but now it has all passed. I agree that logically pytest.skipif
should work, so all is good now! Let's get it in!!
Sadly, there still is a failure |
Well, hypothesis 6.84.0 is out, solving #15274 (comment), so I've re-run all tests again and still see no failures remaining. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy to approve now tests pass - the changes looked good before and I am not sure why there was a failure in the earlier -dev
run.
removed/restored label to try to get towncrier to pass. |
p.s. Sadly, that triggered a whole slew more. Anyway, enabled auto-merge. Thanks, @dhomeier! |
Thanks for reviewing! The very first test failed because the pip dev version had not updated yet, leaving |
OK, I must have seen something old somehow. Anyway, thanks for the fix!! |
Thank you. It feels good to see green CI after USA Labor Day. 😉 🙇♀️ |
Description
This pull request is to address a new one from numpy/numpy#24477 – apparently 'numpy==2.0.0.dev0' is only updated every couple of days.
To reproduce issue, run e.g.
with current numpy
main
installed.