From e1178b46e0ae634d8813d6a63d79c491bbfa7074 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Tue, 21 Nov 2023 16:46:15 -0800 Subject: [PATCH] CI: Ignore EncodingWarning in assert_produces_warning --- pandas/_testing/_warnings.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pandas/_testing/_warnings.py b/pandas/_testing/_warnings.py index 4b087c75f5d74..f11dc11f6ac0d 100644 --- a/pandas/_testing/_warnings.py +++ b/pandas/_testing/_warnings.py @@ -14,6 +14,8 @@ ) import warnings +from pandas.compat import PY311 + if TYPE_CHECKING: from collections.abc import ( Generator, @@ -180,6 +182,11 @@ def _assert_caught_no_extra_warnings( # due to these open files. if any("matplotlib" in mod for mod in sys.modules): continue + if PY311 and actual_warning.category == EncodingWarning: + # EncodingWarnings are checked in the CI + # pyproject.toml errors on EncodingWarnings in pandas + # Ignore EncodingWarnings from other libraries + continue extra_warnings.append( ( actual_warning.category.__name__,