Skip to content

TST: filter out {invalid value, overflow, divide by zero} warnings #305

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 2 commits into from
Nov 18, 2024

Conversation

ev-br
Copy link
Member

@ev-br ev-br commented Nov 16, 2024

This is a minor usability tweak: IIUC (and please correct me if not), we are testing elementwise functions with various invalid arguments (nans, divide-by-zero, overflows) against "reference implementations". These operations generate walls of warnings, which are annoying if benign.
So mass-filter these warnings.
I suppose warning filters should be very specific to avoid masking genuine problems, so am adding the "message" argument to the filters.
In principle, one can make it even more specific if a bit more verbose--- and list warning-emitting functions explicitly: instead of

ignore:invalid value encountered in:RuntimeWarning

use

ignore:invalid value encountered in divide:RuntimeWarning
ignore:invalid value encountered in sqrt:RuntimeWarning

etc

@asmeurer
Copy link
Member

I think the idea in the past that this was too NumPy specific, but I tend to agree that the wall of warnings is annoying, and I don't see any particular issue with just ignoring them. I agree with keeping the warning text specific so we don't catch too much.

Maybe if it were easier to suppress the warnings from the NumPy side this would be unnecessary, but that isn't straightforward to do from the way the test suite works as far as I can tell. I think NumPy would need something like support for setting the error state with an environment variable.

@asmeurer asmeurer enabled auto-merge November 18, 2024 22:16
@asmeurer asmeurer merged commit 15eb045 into data-apis:master Nov 18, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants