Skip to content

Commit c46db87

Browse files
Ensure cached filesystems' protocol is preserved (#1897)
Co-authored-by: Martin Durant <[email protected]>
1 parent d0b1729 commit c46db87

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

fsspec/implementations/cached.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ def __getattribute__(self, item):
478478
if item in ["transaction"]:
479479
# property
480480
return type(self).transaction.__get__(self)
481-
if item in ["_cache", "transaction_type"]:
481+
if item in {"_cache", "transaction_type", "protocol"}:
482482
# class attributes
483483
return getattr(type(self), item)
484484
if item == "__class__":

fsspec/implementations/tests/test_cached.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1337,3 +1337,8 @@ def test_filecache_write(tmpdir, m):
13371337

13381338
assert m.cat(fn) == data.encode()
13391339
assert fs.cat(fn) == data.encode()
1340+
1341+
1342+
def test_cache_protocol_is_preserved():
1343+
fs = fsspec.filesystem("filecache", target_protocol="file")
1344+
assert fs.protocol == "filecache"

0 commit comments

Comments
 (0)