Skip to content

Commit 31dc872

Browse files
committed
Add missing open_async() to DirFileSystem (fixes #1698)
1 parent b842cf4 commit 31dc872

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

fsspec/implementations/dirfs.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,3 +370,15 @@ def open(
370370
*args,
371371
**kwargs,
372372
)
373+
374+
async def open_async(
375+
self,
376+
path,
377+
*args,
378+
**kwargs,
379+
):
380+
return await self.fs.open_async(
381+
self._join(path),
382+
*args,
383+
**kwargs,
384+
)

fsspec/implementations/tests/test_dirfs.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,13 @@ def test_sign(mocker, dirfs):
589589
dirfs.fs.sign.assert_called_once_with(f"{PATH}/file", *ARGS, **KWARGS)
590590

591591

592+
@pytest.mark.asyncio
593+
async def test_open_async(mocker, adirfs):
594+
adirfs.fs.open_async = mocker.AsyncMock()
595+
assert await adirfs.open_async("file", *ARGS, **KWARGS) == adirfs.fs.open_async.return_value
596+
adirfs.fs.open_async.assert_called_once_with(f"{PATH}/file", *ARGS, **KWARGS)
597+
598+
592599
def test_open(mocker, dirfs):
593600
dirfs.fs.open = mocker.Mock()
594601
assert dirfs.open("file", *ARGS, **KWARGS) == dirfs.fs.open.return_value

0 commit comments

Comments
 (0)