Skip to content

Silence some test warnings #5451

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 3 commits into from
Jun 9, 2021
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion xarray/core/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -5319,7 +5319,7 @@ def _set_sparse_data_from_dataframe(

if isinstance(idx, pd.MultiIndex):
coords = np.stack([np.asarray(code) for code in idx.codes], axis=0)
is_sorted = idx.is_lexsorted()
is_sorted = idx.is_monotonic_increasing
shape = tuple(lev.size for lev in idx.levels)
else:
coords = np.arange(idx.size).reshape(1, -1)
Expand Down
1 change: 1 addition & 0 deletions xarray/tests/test_backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -5055,6 +5055,7 @@ def test_extract_zarr_variable_encoding():

@requires_zarr
@requires_fsspec
@pytest.mark.filterwarnings("ignore:deallocating CachingFileManager")
def test_open_fsspec():
import fsspec
import zarr
Expand Down
2 changes: 1 addition & 1 deletion xarray/tests/test_dask.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def test_copy(self):

def test_chunk(self):
for chunks, expected in [
(None, ((2, 2), (2, 2, 2))),
({}, ((2, 2), (2, 2, 2))),
(3, ((3, 1), (3, 3))),
({"x": 3, "y": 3}, ((3, 1), (3, 3))),
({"x": 3}, ((3, 1), (2, 2, 2))),
Expand Down
1 change: 1 addition & 0 deletions xarray/tests/test_dataarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -4450,6 +4450,7 @@ def test_rank(self):

@pytest.mark.parametrize("use_dask", [True, False])
@pytest.mark.parametrize("use_datetime", [True, False])
@pytest.mark.filterwarnings("ignore:overflow encountered in multiply")
def test_polyfit(self, use_dask, use_datetime):
if use_dask and not has_dask:
pytest.skip("requires dask")
Expand Down
2 changes: 1 addition & 1 deletion xarray/tests/test_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -7056,7 +7056,7 @@ def test_trapz_datetime(dask, which_datetime):

actual = da.integrate("time", datetime_unit="D")
expected_data = np.trapz(
da.data,
da.compute().data,
duck_array_ops.datetime_to_numeric(da["time"].data, datetime_unit="D"),
axis=0,
)
Expand Down
1 change: 1 addition & 0 deletions xarray/tests/test_distributed.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ def test_dask_distributed_rasterio_integration_test(loop):


@requires_cfgrib
@pytest.mark.filterwarnings("ignore:deallocating CachingFileManager")
def test_dask_distributed_cfgrib_integration_test(loop):
with cluster() as (s, [a, b]):
with Client(s["address"], loop=loop):
Expand Down
2 changes: 1 addition & 1 deletion xarray/tests/test_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ def test_posify_mask_subindexer(indices, expected):

def test_indexing_1d_object_array():
items = (np.arange(3), np.arange(6))
arr = DataArray(np.array(items))
arr = DataArray(np.array(items, dtype=object))

actual = arr[0]

Expand Down
1 change: 1 addition & 0 deletions xarray/tests/test_interp.py
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,7 @@ def test_interpolate_chunk_1d(method, data_ndim, interp_ndim, nscalar, chunked):
@requires_scipy
@requires_dask
@pytest.mark.parametrize("method", ["linear", "nearest"])
@pytest.mark.filterwarnings("ignore:Increasing number of chunks")
def test_interpolate_chunk_advanced(method):
"""Interpolate nd array with an nd indexer sharing coordinates."""
# Create original array
Expand Down
21 changes: 17 additions & 4 deletions xarray/tests/test_sparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

from . import assert_equal, assert_identical, requires_dask

filterwarnings = pytest.mark.filterwarnings
param = pytest.param
xfail = pytest.mark.xfail

Expand Down Expand Up @@ -118,12 +119,18 @@ def test_variable_property(prop):
param(
do("argmax"),
True,
marks=xfail(reason="Missing implementation for np.argmin"),
marks=[
xfail(reason="Missing implementation for np.argmin"),
filterwarnings("ignore:Behaviour of argmin/argmax"),
],
),
param(
do("argmin"),
True,
marks=xfail(reason="Missing implementation for np.argmax"),
marks=[
xfail(reason="Missing implementation for np.argmax"),
filterwarnings("ignore:Behaviour of argmin/argmax"),
],
),
param(
do("argsort"),
Expand Down Expand Up @@ -373,12 +380,18 @@ def test_dataarray_property(prop):
param(
do("argmax"),
True,
marks=xfail(reason="Missing implementation for np.argmax"),
marks=[
xfail(reason="Missing implementation for np.argmax"),
filterwarnings("ignore:Behaviour of argmin/argmax"),
],
),
param(
do("argmin"),
True,
marks=xfail(reason="Missing implementation for np.argmin"),
marks=[
xfail(reason="Missing implementation for np.argmin"),
filterwarnings("ignore:Behaviour of argmin/argmax"),
],
),
param(
do("argsort"),
Expand Down