|
1 | 1 | from __future__ import annotations |
2 | 2 |
|
| 3 | +import json |
3 | 4 | from importlib.util import find_spec |
| 5 | +from pathlib import Path |
4 | 6 | from typing import TYPE_CHECKING |
5 | 7 |
|
6 | 8 | import numpy as np |
|
23 | 25 |
|
24 | 26 | if TYPE_CHECKING: |
25 | 27 | from collections.abc import Callable |
26 | | - from pathlib import Path |
27 | 28 |
|
28 | 29 | from anndata._types import AnnDataElem |
29 | 30 |
|
@@ -188,14 +189,19 @@ def test_unconsolidated(tmp_path: Path, mtx_format): |
188 | 189 | adata = gen_adata((10, 10), mtx_format, **GEN_ADATA_NO_XARRAY_ARGS) |
189 | 190 | orig_pth = tmp_path / "orig.zarr" |
190 | 191 | adata.write_zarr(orig_pth) |
191 | | - (orig_pth / ".zmetadata").unlink() |
| 192 | + with Path.open(orig_pth / "zarr.json", "r+") as f: |
| 193 | + data = json.load(f) |
| 194 | + del data["consolidated_metadata"] |
| 195 | + f.seek(0) |
| 196 | + json.dump(data, f) |
| 197 | + f.truncate() |
192 | 198 | store = AccessTrackingStore(orig_pth, read_only=True) |
193 | | - store.initialize_key_trackers(["obs/.zgroup", ".zgroup"]) |
| 199 | + store.initialize_key_trackers(["obs/zarr.json", "zarr.json"]) |
194 | 200 | with pytest.warns(UserWarning, match=r"Did not read zarr as consolidated"): |
195 | 201 | remote = read_lazy(store) |
196 | 202 | remote_to_memory = remote.to_memory() |
197 | 203 | assert_equal(remote_to_memory, adata) |
198 | | - store.assert_access_count("obs/.zgroup", 1) |
| 204 | + store.assert_access_count("obs/zarr.json", 1) |
199 | 205 |
|
200 | 206 |
|
201 | 207 | @pytest.mark.zarr_io |
|
0 commit comments