Skip to content

Commit c47f35d

Browse files
authored
ignore a DeprecationWarning emitted by seaborn (#8576)
* move the ignore from the cli to `xarray.tests` * ignore `seaborn` using deprecated API
1 parent 03ec3cb commit c47f35d

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

.github/workflows/ci-additional.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,10 @@ jobs:
7676
# Raise an error if there are warnings in the doctests, with `-Werror`.
7777
# This is a trial; if it presents an problem, feel free to remove.
7878
# See https://github.com/pydata/xarray/issues/7164 for more info.
79-
80-
# ignores:
81-
# 1. h5py: see https://github.com/pydata/xarray/issues/8537
82-
python -m pytest --doctest-modules xarray --ignore xarray/tests -Werror \
83-
-W "ignore:h5py is running against HDF5 1.14.3:UserWarning"
79+
#
80+
# If dependencies emit warnings we can't do anything about, add ignores to
81+
# `xarray/tests/__init__.py`.
82+
python -m pytest --doctest-modules xarray --ignore xarray/tests -Werror
8483
8584
mypy:
8685
name: Mypy

xarray/tests/__init__.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,17 @@ def _importorskip(
7171
message="'cgi' is deprecated and slated for removal in Python 3.13",
7272
category=DeprecationWarning,
7373
)
74-
7574
has_pydap, requires_pydap = _importorskip("pydap.client")
7675
has_netCDF4, requires_netCDF4 = _importorskip("netCDF4")
77-
has_h5netcdf, requires_h5netcdf = _importorskip("h5netcdf")
76+
with warnings.catch_warnings():
77+
# see https://github.com/pydata/xarray/issues/8537
78+
warnings.filterwarnings(
79+
"ignore",
80+
message="h5py is running against HDF5 1.14.3",
81+
category=UserWarning,
82+
)
83+
84+
has_h5netcdf, requires_h5netcdf = _importorskip("h5netcdf")
7885
has_pynio, requires_pynio = _importorskip("Nio")
7986
has_cftime, requires_cftime = _importorskip("cftime")
8087
has_dask, requires_dask = _importorskip("dask")
@@ -84,7 +91,14 @@ def _importorskip(
8491
has_fsspec, requires_fsspec = _importorskip("fsspec")
8592
has_iris, requires_iris = _importorskip("iris")
8693
has_numbagg, requires_numbagg = _importorskip("numbagg", "0.4.0")
87-
has_seaborn, requires_seaborn = _importorskip("seaborn")
94+
with warnings.catch_warnings():
95+
warnings.filterwarnings(
96+
"ignore",
97+
message="is_categorical_dtype is deprecated and will be removed in a future version.",
98+
category=DeprecationWarning,
99+
)
100+
# seaborn uses the deprecated `pandas.is_categorical_dtype`
101+
has_seaborn, requires_seaborn = _importorskip("seaborn")
88102
has_sparse, requires_sparse = _importorskip("sparse")
89103
has_cupy, requires_cupy = _importorskip("cupy")
90104
has_cartopy, requires_cartopy = _importorskip("cartopy")

0 commit comments

Comments
 (0)