From 2a4da579159a601a9cd080c394c9371e23e1b2ba Mon Sep 17 00:00:00 2001 From: Matthew Roeschke Date: Sat, 25 Dec 2021 17:36:20 -0800 Subject: [PATCH 1/2] CI: Ignore Matplotlib related ResouceWarnings from assert_produces_warning --- pandas/_testing/_warnings.py | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/pandas/_testing/_warnings.py b/pandas/_testing/_warnings.py index b78cfd3fb39fb..9b603e91a39bd 100644 --- a/pandas/_testing/_warnings.py +++ b/pandas/_testing/_warnings.py @@ -2,6 +2,7 @@ from contextlib import contextmanager import re +import subprocess from typing import ( Sequence, Type, @@ -147,17 +148,26 @@ def _assert_caught_no_extra_warnings( for actual_warning in caught_warnings: if _is_unexpected_warning(actual_warning, expected_warning): - # GH 44732: Don't make the CI flaky by filtering SSL-related - # ResourceWarning from dependencies # GH#38630 pytest.filterwarnings does not suppress these. - unclosed_ssl = ( - "unclosed transport Date: Sat, 25 Dec 2021 22:24:37 -0800 Subject: [PATCH 2/2] Add exception for windows --- pandas/_testing/_warnings.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pandas/_testing/_warnings.py b/pandas/_testing/_warnings.py index 9b603e91a39bd..44a62e607555e 100644 --- a/pandas/_testing/_warnings.py +++ b/pandas/_testing/_warnings.py @@ -164,7 +164,8 @@ def _assert_caught_no_extra_warnings( lsof = subprocess.check_output( ["lsof", "-d", "0-25", "-F", "n"] ).decode("utf-8") - except subprocess.CalledProcessError: + except (subprocess.CalledProcessError, FileNotFoundError): + # FileNotFoundError for Windows lsof = "" if re.search(r"\.ttf|\.ttc|\.otf", lsof): continue