Skip to content

Commit 2580908

Browse files
authored
Fix hdfs tests and touch (#68)
* tests: improve cleanup in htcluster fixture * tests: restore broken hdfs test in test_core.py * upath.implementations.hdfs: fix touch
1 parent 5cd2c36 commit 2580908

File tree

3 files changed

+18
-17
lines changed

3 files changed

+18
-17
lines changed

upath/implementations/hdfs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ def __init__(self, parsed_url, *args, **kwargs):
66
super().__init__(parsed_url, *args, **kwargs)
77
self._fs.root_marker = "/"
88

9-
def touch(self, **kwargs):
9+
def touch(self, path, **kwargs):
1010
kwargs.pop("truncate", None)
11-
super().touch(self, **kwargs)
11+
super().touch(path, **kwargs)
1212

1313

1414
class HDFSPath(upath.core.UPath):

upath/tests/conftest.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -98,21 +98,22 @@ def htcluster():
9898
except FileNotFoundError as err:
9999
if err.errno == 2 and "htcluster" == err.filename:
100100
pytest.skip("htcluster not installed")
101-
else:
102-
raise
101+
raise
103102

104103
time.sleep(30)
105-
yield
106-
proc.terminate()
107-
proc.wait()
108-
proc1 = subprocess.Popen(
109-
shlex.split("htcluster shutdown"),
110-
stderr=subprocess.DEVNULL,
111-
stdout=subprocess.DEVNULL,
112-
)
113-
proc1.terminate()
114-
proc1.wait()
115-
time.sleep(10)
104+
try:
105+
yield
106+
finally:
107+
proc.terminate()
108+
proc.wait()
109+
proc1 = subprocess.Popen(
110+
shlex.split("htcluster shutdown"),
111+
stderr=subprocess.DEVNULL,
112+
stdout=subprocess.DEVNULL,
113+
)
114+
proc1.terminate()
115+
proc1.wait()
116+
time.sleep(10)
116117

117118

118119
@pytest.fixture()

upath/tests/test_core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ def test_fsspec_compat(self):
4545

4646

4747
@pytest.mark.hdfs
48-
def test_multiple_backend_paths(local_testdir, s3, hdfs):
49-
anon, s3so = s3
48+
def test_multiple_backend_paths(local_testdir, s3_fixture, hdfs):
49+
_, anon, s3so = s3_fixture
5050
path = f"s3:{local_testdir}"
5151
s3_path = UPath(path, anon=anon, **s3so)
5252
assert s3_path.joinpath("text.txt")._url.scheme == "s3"

0 commit comments

Comments
 (0)