From df647869fea52d179c4821633caa7989b56098b3 Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Wed, 16 Jul 2025 15:01:29 +0200 Subject: [PATCH 1/2] Remove use of numpy.testing.suppress_warnings --- dpnp/tests/conftest.py | 5 ++--- dpnp/tests/test_linalg.py | 7 ++++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dpnp/tests/conftest.py b/dpnp/tests/conftest.py index 7544949f1bd3..a0a76e3edb4e 100644 --- a/dpnp/tests/conftest.py +++ b/dpnp/tests/conftest.py @@ -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 diff --git a/dpnp/tests/test_linalg.py b/dpnp/tests/test_linalg.py index 19943b6fcd6f..931c631b5633 100644 --- a/dpnp/tests/test_linalg.py +++ b/dpnp/tests/test_linalg.py @@ -1,3 +1,5 @@ +import warnings + import dpctl import dpctl.tensor as dpt import numpy @@ -10,7 +12,6 @@ assert_equal, assert_raises, assert_raises_regex, - suppress_warnings, ) import dpnp @@ -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): From 7b8386ae6dacc60f5515dd976451c8a30abef4e8 Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Wed, 16 Jul 2025 16:16:56 +0200 Subject: [PATCH 2/2] Add PR to the changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe489e21b506..8f4326a256ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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