Skip to content

MAINT: remove internal uses of assert_warns and suppress_warnings #29322

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 5 commits into from
Jul 7, 2025

Conversation

ngoldbaum
Copy link
Member

Towards fixing #29293, also see scipy/scipy#23275 where I did this in SciPy.

The only nontrivial changes (IMO, anyway) are in numpy/ma/tests/test_core.py.

Copy link
Member

@seberg seberg left a comment

Choose a reason for hiding this comment

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

Looks good to me, didn't find any larger change that I would worry about. I suspect many would be better as np.errstate, but sometimes that may also be less precise (i.e. doesn't include the function that caused the warning).

The one thing I think, I care about a bit is that it would be nice to use @pytest.mark.filterwarnings() instead of those massive indentations. (Using pytest.warns() as rec would also make the diff smaller in a few places and be nicer).

But, overall nice. And pytest.warns and some other changes improve things quite a bit!

@ngoldbaum ngoldbaum added the 39 - free-threading PRs and issues related to support for free-threading CPython (a.k.a. no-GIL, PEP 703) label Jul 7, 2025
@ngoldbaum
Copy link
Member Author

There are some unrelated failures because of cache mismatches reported by apt.

Let's bring this in - thanks for looking this over and the suggestions @seberg!

@ngoldbaum ngoldbaum merged commit fdf5f1b into numpy:main Jul 7, 2025
77 of 82 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
03 - Maintenance 39 - free-threading PRs and issues related to support for free-threading CPython (a.k.a. no-GIL, PEP 703)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants