Skip to content

Commit

Permalink
upath.implementations.hdfs: more iterdir fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ap-- committed Sep 24, 2023
1 parent d5bea63 commit 6e57f66
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
11 changes: 11 additions & 0 deletions upath/implementations/hdfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,19 @@ def mkdir(self, path, create_parents=True, **kwargs):
else:
if not kwargs.get("exist_ok", False) and self._fs.exists(pth):
raise FileExistsError(pth)
print(kwargs, self._fs.exists(pth), pth)
return self._fs.mkdir(pth, create_parents=create_parents, **kwargs)

def listdir(self, path, **kwargs):
try:
yield from super().listdir(path, **kwargs)
except OSError as err:
if err.args and err.args[0].startswith(
"GetFileInfo expects base_dir of selector to be a directory"
):
raise NotADirectoryError(path)
raise


class HDFSPath(upath.core.UPath):
_default_accessor = _HDFSAccessor
7 changes: 2 additions & 5 deletions upath/tests/implementations/test_hdfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ def path(self, local_testdir, hdfs):
def test_is_HDFSPath(self):
assert isinstance(self.path, HDFSPath)

def test_chmod(self):
# todo
pass

def test_fsspec_compat(self):
@pytest.mark.skip
def test_makedirs_exist_ok_false(self):
pass

0 comments on commit 6e57f66

Please sign in to comment.