From bb1884180ba66cdf84a56aac938d676c6860ad07 Mon Sep 17 00:00:00 2001 From: Bradley Dice Date: Thu, 17 Feb 2022 15:29:15 -0600 Subject: [PATCH] Catch specific warning messages. --- python/cudf/cudf/tests/test_array_ufunc.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/python/cudf/cudf/tests/test_array_ufunc.py b/python/cudf/cudf/tests/test_array_ufunc.py index 55c3b868483..e4b4d5020ea 100644 --- a/python/cudf/cudf/tests/test_array_ufunc.py +++ b/python/cudf/cudf/tests/test_array_ufunc.py @@ -22,7 +22,8 @@ @contextmanager def _hide_ufunc_warnings(ufunc): # pandas raises warnings for some inputs to the following ufuncs: - if ufunc.__name__ in { + name = ufunc.__name__ + if name in { "arccos", "arccosh", "arcsin", @@ -34,7 +35,16 @@ def _hide_ufunc_warnings(ufunc): "reciprocal", }: with warnings.catch_warnings(): - warnings.filterwarnings("ignore", category=RuntimeWarning) + warnings.filterwarnings( + "ignore", + f"invalid value encountered in {name}", + category=RuntimeWarning, + ) + warnings.filterwarnings( + "ignore", + f"divide by zero encountered in {name}", + category=RuntimeWarning, + ) yield else: yield