diff --git a/pyproject.toml b/pyproject.toml index e6c63c4d010..fd4a4293882 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -336,7 +336,8 @@ filterwarnings = [ "default:the `pandas.MultiIndex` object:FutureWarning:xarray.tests.test_variable", "default:Using a non-tuple sequence for multidimensional indexing is deprecated:FutureWarning", "default:Duplicate dimension names present:UserWarning:xarray.namedarray.core", - + # TODO: this is raised for vlen-utf8, consolidated metadata, U1 dtype + "ignore:is currently not part .* the Zarr version 3 specification.", # TODO: remove once we know how to deal with a changed signature in protocols "default:::xarray.tests.test_strategies", ] diff --git a/xarray/tests/test_backends.py b/xarray/tests/test_backends.py index 560090e122c..79aa2027ca5 100644 --- a/xarray/tests/test_backends.py +++ b/xarray/tests/test_backends.py @@ -2435,10 +2435,16 @@ def test_warning_on_bad_chunks(self) -> None: for chunks in good_chunks: kwargs = {"chunks": chunks} with assert_no_warnings(): - with self.roundtrip(original, open_kwargs=kwargs) as actual: - for k, v in actual.variables.items(): - # only index variables should be in memory - assert v._in_memory == (k in actual.dims) + with warnings.catch_warnings(): + warnings.filterwarnings( + "ignore", + message=".*Zarr version 3 specification.*", + category=UserWarning, + ) + with self.roundtrip(original, open_kwargs=kwargs) as actual: + for k, v in actual.variables.items(): + # only index variables should be in memory + assert v._in_memory == (k in actual.dims) @requires_dask def test_deprecate_auto_chunk(self) -> None: @@ -2985,8 +2991,14 @@ def test_save_emptydim(self, chunk) -> None: def test_no_warning_from_open_emptydim_with_chunks(self) -> None: ds = Dataset({"x": (("a", "b"), np.empty((5, 0)))}).chunk({"a": 1}) with assert_no_warnings(): - with self.roundtrip(ds, open_kwargs=dict(chunks={"a": 1})) as ds_reload: - assert_identical(ds, ds_reload) + with warnings.catch_warnings(): + warnings.filterwarnings( + "ignore", + message=".*Zarr version 3 specification.*", + category=UserWarning, + ) + with self.roundtrip(ds, open_kwargs=dict(chunks={"a": 1})) as ds_reload: + assert_identical(ds, ds_reload) @pytest.mark.parametrize("consolidated", [False, True, None]) @pytest.mark.parametrize("compute", [False, True]) diff --git a/xarray/tests/test_variable.py b/xarray/tests/test_variable.py index f4f353eda7d..c3de2253186 100644 --- a/xarray/tests/test_variable.py +++ b/xarray/tests/test_variable.py @@ -1108,6 +1108,7 @@ def test_0d_str(self): assert v.dtype == np.dtype("S3") assert v.values == "foo".encode("ascii") + @pytest.mark.filterwarnings("ignore:Converting non-nanosecond") def test_0d_datetime(self): v = Variable([], pd.Timestamp("2000-01-01")) assert v.dtype == np.dtype("datetime64[ns]") @@ -1954,6 +1955,7 @@ def test_big_endian_reduce(self): expected = Variable([], 5) assert_identical(expected, v.sum()) + @pytest.mark.filterwarnings("ignore:Converting non-nanosecond") def test_reduce_funcs(self): v = Variable("x", np.array([1, np.nan, 2, 3])) assert_identical(v.mean(), Variable([], 2))