@@ -14,11 +14,11 @@ def fs():
14
14
return ArrowFSWrapper (fs )
15
15
16
16
17
- @pytest .fixture (scope = "function" )
18
- def remote_dir (fs ):
17
+ @pytest .fixture (scope = "function" , params = [ False , True ] )
18
+ def remote_dir (fs , request ):
19
19
directory = secrets .token_hex (16 )
20
20
fs .makedirs (directory )
21
- yield directory
21
+ yield ( "hdfs://" if request . param else "" ) + directory
22
22
fs .rm (directory , recursive = True )
23
23
24
24
@@ -30,18 +30,19 @@ def strip_keys(original_entry):
30
30
31
31
def test_info (fs , remote_dir ):
32
32
fs .touch (remote_dir + "/a.txt" )
33
+ remote_dir_strip_protocol = fs ._strip_protocol (remote_dir )
33
34
details = fs .info (remote_dir + "/a.txt" )
34
35
assert details ["type" ] == "file"
35
- assert details ["name" ] == remote_dir + "/a.txt"
36
+ assert details ["name" ] == remote_dir_strip_protocol + "/a.txt"
36
37
assert details ["size" ] == 0
37
38
38
39
fs .mkdir (remote_dir + "/dir" )
39
40
details = fs .info (remote_dir + "/dir" )
40
41
assert details ["type" ] == "directory"
41
- assert details ["name" ] == remote_dir + "/dir"
42
+ assert details ["name" ] == remote_dir_strip_protocol + "/dir"
42
43
43
44
details = fs .info (remote_dir + "/dir/" )
44
- assert details ["name" ] == remote_dir + "/dir/"
45
+ assert details ["name" ] == remote_dir_strip_protocol + "/dir/"
45
46
46
47
47
48
def test_move (fs , remote_dir ):
@@ -114,12 +115,14 @@ def test_rm(fs, remote_dir):
114
115
115
116
116
117
def test_ls (fs , remote_dir ):
118
+ remote_dir_strip_protocol = fs ._strip_protocol (remote_dir )
117
119
fs .mkdir (remote_dir + "dir/" )
118
120
files = set ()
119
121
for no in range (8 ):
120
122
file = remote_dir + f"dir/test_{ no } "
123
+ # we also want to make sure `fs.touch` works with protocol
121
124
fs .touch (file )
122
- files .add (file )
125
+ files .add (remote_dir_strip_protocol + f"dir/test_ { no } " )
123
126
124
127
assert set (fs .ls (remote_dir + "dir/" )) == files
125
128
0 commit comments