Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions sshfs/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,8 @@ async def _rmdir(
else:
await channel.rmdir(path)

rmdir = sync_wrapper(_rmdir)

async def _rm(self, path, recursive=False, **kwargs):
path = self._strip_protocol(path)
if isinstance(path, (str, bytes)):
Expand Down
19 changes: 19 additions & 0 deletions tests/test_oss_regression_38.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import pytest
from test_sshfs import fs, plain_remote_dir, remote_dir, ssh_server


def test_rmdir_removes_directory(fs, remote_dir):
path = remote_dir + "/empty"
fs.mkdir(path)
assert fs.isdir(path)

fs.rmdir(path)
assert not fs.exists(path)

with pytest.raises(FileNotFoundError):
fs.rmdir(path)

fs.makedirs(path + "/child")
fs.touch(path + "/child/file")
fs.rmdir(path, recursive=True)
assert not fs.exists(path)
Loading