Skip to content

Commit 616e9b2

Browse files
committed
Move imports, skip tests on old fsspec and add changes note
1 parent ad38c05 commit 616e9b2

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

changes/2533.bigfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Wrap sync fsspec filesystems with AsyncFileSystemWrapper in xarray.to_zarr

tests/test_store/test_fsspec.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import pytest
88
from botocore.session import Session
9-
from fsspec.implementations.asyn_wrapper import AsyncFileSystemWrapper
9+
from packaging.version import parse as parse_version
1010

1111
import zarr.api.asynchronous
1212
from zarr.abc.store import OffsetByteRequest
@@ -218,16 +218,28 @@ async def test_empty_nonexistent_path(self, store_kwargs) -> None:
218218
assert await store.is_empty("")
219219

220220

221+
@pytest.mark.skipif(
222+
parse_version(fsspec.__version__) < parse_version("2024.12.0"),
223+
reason="No AsyncFileSystemWrapper",
224+
)
221225
def test_wrap_sync_filesystem():
222226
"""The local fs is not async so we should expect it to be wrapped automatically"""
227+
from fsspec.implementations.asyn_wrapper import AsyncFileSystemWrapper
228+
223229
store = FsspecStore.from_url("local://test/path")
224230

225231
assert isinstance(store.fs, AsyncFileSystemWrapper)
226232
assert store.fs.async_impl
227233

228234

235+
@pytest.mark.skipif(
236+
parse_version(fsspec.__version__) < parse_version("2024.12.0"),
237+
reason="No AsyncFileSystemWrapper",
238+
)
229239
def test_no_wrap_async_filesystem():
230240
"""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+
231243
store = FsspecStore.from_url("https://test/path")
232244

233245
assert not isinstance(store.fs, AsyncFileSystemWrapper)

0 commit comments

Comments
 (0)