Skip to content

Commit

Permalink
Backport PR pandas-dev#45204: CI: Use broader condition to maybe catc…
Browse files Browse the repository at this point in the history
…h ResourceWarning from Matplotlib
  • Loading branch information
mroeschke authored and meeseeksmachine committed Jan 20, 2022
1 parent 8c7bf8f commit 9880696
Showing 1 changed file with 4 additions and 10 deletions.
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

0 comments on commit 9880696

Please sign in to comment.