Skip to content

Commit 5aad680

Browse files
committed
Add tests for automatic syncfs wrapping
1 parent 38a841c commit 5aad680

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/test_store/test_fsspec.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import pytest
88
from botocore.session import Session
9+
from fsspec.implementations.asyn_wrapper import AsyncFileSystemWrapper
910

1011
import zarr.api.asynchronous
1112
from zarr.core.buffer import Buffer, cpu, default_buffer_prototype
@@ -214,3 +215,20 @@ async def test_empty_nonexistent_path(self, store_kwargs) -> None:
214215
store_kwargs["path"] += "/abc"
215216
store = await self.store_cls.open(**store_kwargs)
216217
assert await store.is_empty("")
218+
219+
220+
221+
def test_wrap_sync_filesystem():
222+
"""The local fs is not async so we should expect it to be wrapped automatically"""
223+
store = FsspecStore.from_url("local://test/path")
224+
225+
assert isinstance(store.fs, AsyncFileSystemWrapper)
226+
assert store.fs.async_impl
227+
228+
229+
def test_no_wrap_async_filesystem():
230+
"""An async fs should not be wrapped automatically; fsspec's https filesystem is such an fs"""
231+
store = FsspecStore.from_url("https://test/path")
232+
233+
assert not isinstance(store.fs, AsyncFileSystemWrapper)
234+
assert store.fs.async_impl

0 commit comments

Comments
 (0)