Skip to content

Remove use of numpy.testing.suppress_warnings in tests #2529

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
Jul 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Bumped oneMKL version up to `v0.8` [#2514](https://github.com/IntelPython/dpnp/pull/2514)
* Removed the use of class template argument deduction for alias template to conform to the C++17 standard [#2517](https://github.com/IntelPython/dpnp/pull/2517)
* Changed th order of individual FFTs over `axes` for `dpnp.fft.irfftn` to be in forward order [#2524](https://github.com/IntelPython/dpnp/pull/2524)
* Replaced the use of `numpy.testing.suppress_warnings` with appropriate calls from the warnings module [#2529](https://github.com/IntelPython/dpnp/pull/2529)

### Deprecated

Expand Down
5 changes: 2 additions & 3 deletions dpnp/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,8 @@ def allow_fall_back_on_numpy(monkeypatch):

@pytest.fixture
def suppress_complex_warning():
sup = numpy.testing.suppress_warnings("always")
sup.filter(ComplexWarning)
with sup:
with warnings.catch_warnings():
warnings.simplefilter("ignore", ComplexWarning)
yield


Expand Down
7 changes: 4 additions & 3 deletions dpnp/tests/test_linalg.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import warnings

import dpctl
import dpctl.tensor as dpt
import numpy
Expand All @@ -10,7 +12,6 @@
assert_equal,
assert_raises,
assert_raises_regex,
suppress_warnings,
)

import dpnp
Expand Down Expand Up @@ -847,8 +848,8 @@ def check_einsum_sums(self, dtype, do_opt=False):
)

# Suppress the complex warnings for the 'as f8' tests
with suppress_warnings() as sup:
sup.filter(numpy.exceptions.ComplexWarning)
with warnings.catch_warnings():
warnings.simplefilter("ignore", numpy.exceptions.ComplexWarning)

# matvec(a,b) / a.dot(b) where a is matrix, b is vector
for n in range(1, 17):
Expand Down
Loading