Skip to content

Commit 7803d3a

Browse files
authored
Mute expecting runtime warning raised in tests (#2792)
The PR updates marks observing `RuntimeWarning` as expected to suppress them. Also the PR update DLPack tests to avoid raising the warning in SYCL queue relating tests.
1 parent fd64f3c commit 7803d3a

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

dpnp/tests/test_mathematical.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1733,6 +1733,7 @@ def test_nan_infs_complex(self):
17331733

17341734

17351735
class TestSpacing:
1736+
@pytest.mark.filterwarnings("ignore::RuntimeWarning")
17361737
@pytest.mark.parametrize("sign", [1, -1])
17371738
@pytest.mark.parametrize("dt", get_float_dtypes())
17381739
def test_basic(self, sign, dt):

dpnp/tests/test_special.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ def _check_variant_func(
9494
# calling numpy testing func, because it's more verbose
9595
assert_allclose(x.asnumpy(), y.asnumpy(), rtol=rtol, atol=atol)
9696

97+
@pytest.mark.usefixtures(
98+
"suppress_overflow_encountered_in_cast_numpy_warnings"
99+
)
97100
def test_erfc(self, inverse):
98101
self._check_variant_func(
99102
inverse,

dpnp/tests/test_sycl_queue.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,7 +1086,7 @@ def test_array_creation_from_dpctl(copy, device):
10861086
@pytest.mark.parametrize("arr_dtype", get_all_dtypes(no_float16=True))
10871087
@pytest.mark.parametrize("shape", [tuple(), (2,), (3, 0, 1), (2, 2, 2)])
10881088
def test_from_dlpack(arr_dtype, shape, device):
1089-
X = dpnp.empty(shape=shape, dtype=arr_dtype, device=device)
1089+
X = dpnp.ones(shape=shape, dtype=arr_dtype, device=device)
10901090
Y = dpnp.from_dlpack(X)
10911091
assert_array_equal(X, Y)
10921092
assert X.__dlpack_device__() == Y.__dlpack_device__()
@@ -1101,7 +1101,7 @@ def test_from_dlpack(arr_dtype, shape, device):
11011101
@pytest.mark.parametrize("device", valid_dev, ids=dev_ids)
11021102
@pytest.mark.parametrize("arr_dtype", get_all_dtypes(no_float16=True))
11031103
def test_from_dlpack_with_dpt(arr_dtype, device):
1104-
X = dpctl.tensor.empty((64,), dtype=arr_dtype, device=device)
1104+
X = dpt.ones((64,), dtype=arr_dtype, device=device)
11051105
Y = dpnp.from_dlpack(X)
11061106
assert_array_equal(X, Y)
11071107
assert isinstance(Y, dpnp.dpnp_array.dpnp_array)

0 commit comments

Comments
 (0)