From 0a3b89b75a2f3802c913cce48fab593b9415c5be Mon Sep 17 00:00:00 2001 From: Deepak Cherian Date: Mon, 10 Mar 2025 11:43:39 -0600 Subject: [PATCH] Fix broken Zarr test Zarr's implementation of `attrs.__delitem__` is broken. --- xarray/tests/test_backends.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/xarray/tests/test_backends.py b/xarray/tests/test_backends.py index a3bb0e1488f..bcbc56108e0 100644 --- a/xarray/tests/test_backends.py +++ b/xarray/tests/test_backends.py @@ -2628,12 +2628,10 @@ def test_hidden_zarr_keys(self) -> None: for var in expected.variables.keys(): assert self.DIMENSION_KEY not in expected[var].attrs - if has_zarr_v3: - # temporary workaround for https://github.com/zarr-developers/zarr-python/issues/2338 - zarr_group.store._is_open = True - # put it back and try removing from a variable - del zarr_group["var2"].attrs[self.DIMENSION_KEY] + attrs = dict(zarr_group["var2"].attrs) + del attrs[self.DIMENSION_KEY] + zarr_group["var2"].attrs.put(attrs) with pytest.raises(KeyError): with xr.decode_cf(store):