Skip to content

Commit 59f98d7

Browse files
authored
Forward ls kwargs from cached filesystems (#2068)
1 parent 5e266e0 commit 59f98d7

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

‎fsspec/implementations/cached.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,8 +436,8 @@ def close_and_update(self, f, close):
436436
close()
437437
f.closed = True
438438

439-
def ls(self, path, detail=True):
440-
return self.fs.ls(path, detail)
439+
def ls(self, path, detail=True, **kwargs):
440+
return self.fs.ls(path, detail, **kwargs)
441441

442442
def __getattribute__(self, item):
443443
if item in {

‎fsspec/implementations/tests/test_cached.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,14 @@ def test_constructor_kwargs(tmpdir):
172172
)
173173

174174

175+
def test_whole_file_cache_ls_forwards_kwargs(tmp_path, m, mocker):
176+
fs = WholeFileCacheFileSystem(fs=m, cache_storage=str(tmp_path))
177+
backend_ls = mocker.spy(m, "ls")
178+
179+
assert fs.ls("/", detail=False, refresh=True) == []
180+
backend_ls.assert_called_once_with("/", False, refresh=True)
181+
182+
175183
@pytest.mark.skipif(win, reason="POSIX file permissions")
176184
@pytest.mark.parametrize("protocol", ["filecache", "simplecache", "blockcache"])
177185
def test_cache_storage_mode(tmp_path, protocol):

0 commit comments

Comments
 (0)