File tree Expand file tree Collapse file tree 3 files changed +17
-7
lines changed Expand file tree Collapse file tree 3 files changed +17
-7
lines changed Original file line number Diff line number Diff line change
1
+ Removed an unnecessary check from ``_fsspec._make_async `` that would raise an exception when
2
+ creating a read-only store backed by a local file system with ``auto_mkdir `` set to ``False ``.
Original file line number Diff line number Diff line change @@ -56,18 +56,12 @@ def _make_async(fs: AbstractFileSystem) -> AsyncFileSystem:
56
56
fs_dict ["asynchronous" ] = True
57
57
return fsspec .AbstractFileSystem .from_json (json .dumps (fs_dict ))
58
58
59
- # Wrap sync filesystems with the async wrapper
60
- if type (fs ) is fsspec .implementations .local .LocalFileSystem and not fs .auto_mkdir :
61
- raise ValueError (
62
- f"LocalFilesystem { fs } was created with auto_mkdir=False but Zarr requires the filesystem to automatically create directories"
63
- )
64
59
if fsspec_version < parse_version ("2024.12.0" ):
65
60
raise ImportError (
66
61
f"The filesystem '{ fs } ' is synchronous, and the required "
67
62
"AsyncFileSystemWrapper is not available. Upgrade fsspec to version "
68
63
"2024.12.0 or later to enable this functionality."
69
64
)
70
-
71
65
from fsspec .implementations .asyn_wrapper import AsyncFileSystemWrapper
72
66
73
67
return AsyncFileSystemWrapper (fs , asynchronous = True )
Original file line number Diff line number Diff line change @@ -365,7 +365,7 @@ def test_open_fsmap_file_raises(tmp_path: pathlib.Path) -> None:
365
365
fsspec = pytest .importorskip ("fsspec.implementations.local" )
366
366
fs = fsspec .LocalFileSystem (auto_mkdir = False )
367
367
mapper = fs .get_mapper (tmp_path )
368
- with pytest .raises (ValueError , match = "LocalFilesystem .*" ):
368
+ with pytest .raises (FileNotFoundError , match = "No such file or directory: .*" ):
369
369
array_roundtrip (mapper )
370
370
371
371
@@ -426,3 +426,17 @@ async def test_delete_dir_wrapped_filesystem(tmp_path: Path) -> None:
426
426
assert await store .exists ("foo-bar/zarr.json" )
427
427
assert not await store .exists ("foo/zarr.json" )
428
428
assert not await store .exists ("foo/c/0" )
429
+
430
+
431
+ @pytest .mark .skipif (
432
+ parse_version (fsspec .__version__ ) < parse_version ("2024.12.0" ),
433
+ reason = "No AsyncFileSystemWrapper" ,
434
+ )
435
+ async def test_with_read_only_auto_mkdir (tmp_path : Path ) -> None :
436
+ """
437
+ Test that creating a read-only copy of a store backed by the local file system does not error
438
+ if auto_mkdir is False.
439
+ """
440
+
441
+ store_w = FsspecStore .from_url (f"file://{ tmp_path } " , storage_options = {"auto_mkdir" : False })
442
+ _ = store_w .with_read_only ()
You can’t perform that action at this time.
0 commit comments