Skip to content

Commit 4a99145

Browse files
committed
Update reference FS tests for async wrapper
1 parent 77d4eeb commit 4a99145

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

fsspec/implementations/asyn_wrapper.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,27 +45,27 @@ class AsyncFileSystemWrapper(AsyncFileSystem):
4545
def __init__(self, sync_fs, *args, **kwargs):
4646
super().__init__(*args, **kwargs)
4747
self.asynchronous = True
48-
self.fs = sync_fs
49-
self.protocol = self.fs.protocol
48+
self.sync_fs = sync_fs
49+
self.protocol = self.sync_fs.protocol
5050
self._wrap_all_sync_methods()
5151

5252
@property
5353
def fsid(self):
54-
return f"async_{self.fs.fsid}"
54+
return f"async_{self.sync_fs.fsid}"
5555

5656
def _wrap_all_sync_methods(self):
5757
"""
5858
Wrap all synchronous methods of the underlying filesystem with asynchronous versions.
5959
"""
60-
for method_name in dir(self.fs):
60+
for method_name in dir(self.sync_fs):
6161
if method_name.startswith("_"):
6262
continue
6363

64-
attr = inspect.getattr_static(self.fs, method_name)
64+
attr = inspect.getattr_static(self.sync_fs, method_name)
6565
if isinstance(attr, property):
6666
continue
6767

68-
method = getattr(self.fs, method_name)
68+
method = getattr(self.sync_fs, method_name)
6969
if callable(method) and not asyncio.iscoroutinefunction(method):
7070
async_method = async_wrapper(method, obj=self)
7171
setattr(self, f"_{method_name}", async_method)

fsspec/implementations/tests/test_reference.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,8 @@ def test_fss_has_defaults(m):
458458
assert fs.fss["memory"].protocol == "memory"
459459

460460
fs = fsspec.filesystem("reference", fs=m, fo={})
461-
assert fs.fss[None] is m
461+
# Default behavior here wraps synchronous filesystems to enable the async API
462+
assert fs.fss[None].sync_fs is m
462463

463464
fs = fsspec.filesystem("reference", fs={"memory": m}, fo={})
464465
assert fs.fss["memory"] is m

0 commit comments

Comments
 (0)