Skip to content
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
31 changes: 21 additions & 10 deletions pandas/_testing/_warnings.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from contextlib import contextmanager
import re
import subprocess
from typing import (
Sequence,
Type,
Expand Down Expand Up @@ -147,17 +148,27 @@ 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 <asyncio.sslproto._SSLProtocolTransport",
"unclosed <ssl.SSLSocket",
)
if actual_warning.category == ResourceWarning and any(
msg in str(actual_warning.message) for msg in unclosed_ssl
):
continue
if actual_warning.category == ResourceWarning:
# GH 44732: Don't make the CI flaky by filtering SSL-related
# ResourceWarning from dependencies
unclosed_ssl = (
"unclosed transport <asyncio.sslproto._SSLProtocolTransport",
"unclosed <ssl.SSLSocket",
)
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):
continue

extra_warnings.append(
(
Expand Down