|
6 | 6 |
|
7 | 7 | import pytest
|
8 | 8 | from botocore.session import Session
|
| 9 | +from packaging.version import parse as parse_version |
9 | 10 |
|
10 | 11 | import zarr.api.asynchronous
|
11 | 12 | from zarr.abc.store import OffsetByteRequest
|
@@ -215,3 +216,31 @@ async def test_empty_nonexistent_path(self, store_kwargs) -> None:
|
215 | 216 | store_kwargs["path"] += "/abc"
|
216 | 217 | store = await self.store_cls.open(**store_kwargs)
|
217 | 218 | assert await store.is_empty("")
|
| 219 | + |
| 220 | + |
| 221 | +@pytest.mark.skipif( |
| 222 | + parse_version(fsspec.__version__) < parse_version("2024.12.0"), |
| 223 | + reason="No AsyncFileSystemWrapper", |
| 224 | +) |
| 225 | +def test_wrap_sync_filesystem(): |
| 226 | + """The local fs is not async so we should expect it to be wrapped automatically""" |
| 227 | + from fsspec.implementations.asyn_wrapper import AsyncFileSystemWrapper |
| 228 | + |
| 229 | + store = FsspecStore.from_url("local://test/path") |
| 230 | + |
| 231 | + assert isinstance(store.fs, AsyncFileSystemWrapper) |
| 232 | + assert store.fs.async_impl |
| 233 | + |
| 234 | + |
| 235 | +@pytest.mark.skipif( |
| 236 | + parse_version(fsspec.__version__) < parse_version("2024.12.0"), |
| 237 | + reason="No AsyncFileSystemWrapper", |
| 238 | +) |
| 239 | +def test_no_wrap_async_filesystem(): |
| 240 | + """An async fs should not be wrapped automatically; fsspec's https filesystem is such an fs""" |
| 241 | + from fsspec.implementations.asyn_wrapper import AsyncFileSystemWrapper |
| 242 | + |
| 243 | + store = FsspecStore.from_url("https://test/path") |
| 244 | + |
| 245 | + assert not isinstance(store.fs, AsyncFileSystemWrapper) |
| 246 | + assert store.fs.async_impl |
0 commit comments