Skip to content
Merged
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 @@ -385,6 +385,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
17 changes: 17 additions & 0 deletions tests/test_sshfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,23 @@ def test_rm(fs, remote_dir):
assert not fs.exists(remote_dir + "/dir")


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)


@pytest.mark.parametrize("name", ["back\\slash", "new\nline"])
def test_checksum_escaped_name(fs, plain_remote_dir, name):
# GNU md5sum escapes these names in its output
Expand Down
Loading