Skip to content

Backport PR #45204 on branch 1.4.x (CI: Use broader condition to maybe catch ResourceWarning from Matplotlib) #45504

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions pandas/_testing/_warnings.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from contextlib import contextmanager
import re
import subprocess
import sys
from typing import (
Sequence,
Type,
Expand Down Expand Up @@ -159,15 +159,9 @@ def _assert_caught_no_extra_warnings(
if any(msg in str(actual_warning.message) for msg in unclosed_ssl):
continue
# GH 44844: Matplotlib leaves font files open during the entire process
# Don't make CI flaky if ResourceWarning raised due to these open files.
try:
lsof = subprocess.check_output(
["lsof", "-d", "0-25", "-F", "n"]
).decode("utf-8")
except (subprocess.CalledProcessError, FileNotFoundError):
# FileNotFoundError for Windows
lsof = ""
if re.search(r"\.ttf|\.ttc|\.otf", lsof):
# upon import. Don't make CI flaky if ResourceWarning raised
# due to these open files.
if any("matplotlib" in mod for mod in sys.modules):
continue

extra_warnings.append(
Expand Down