From dc7bac6b42b7c695e6d0ef7fdbc534e3f98a90b9 Mon Sep 17 00:00:00 2001 From: Sebastian Berg Date: Thu, 22 Dec 2022 16:33:55 +0100 Subject: [PATCH] TST: Ignore nan-warnings in randomized out tests The tests randomize the nan pattern and thus can run into these (additional) warnings, so ignore them. (Could also fix the random seed, but this should do) Closes gh-22835 --- numpy/lib/tests/test_nanfunctions.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/numpy/lib/tests/test_nanfunctions.py b/numpy/lib/tests/test_nanfunctions.py index 64464edccfc0..7cdcff32dc80 100644 --- a/numpy/lib/tests/test_nanfunctions.py +++ b/numpy/lib/tests/test_nanfunctions.py @@ -818,6 +818,7 @@ def test_keepdims(self): (-3, -1), ] ) + @pytest.mark.filterwarnings("ignore:All-NaN slice:RuntimeWarning") def test_keepdims_out(self, axis): d = np.ones((3, 5, 7, 11)) # Randomly set some elements to NaN: @@ -1021,6 +1022,7 @@ def test_keepdims(self): (-3, -1), ] ) + @pytest.mark.filterwarnings("ignore:All-NaN slice:RuntimeWarning") def test_keepdims_out(self, q, axis): d = np.ones((3, 5, 7, 11)) # Randomly set some elements to NaN: