@@ -14,11 +14,11 @@ def fs():
1414 return ArrowFSWrapper (fs )
1515
1616
17- @pytest .fixture (scope = "function" )
18- def remote_dir (fs ):
17+ @pytest .fixture (scope = "function" , params = [ False , True ] )
18+ def remote_dir (fs , request ):
1919 directory = secrets .token_hex (16 )
2020 fs .makedirs (directory )
21- yield directory
21+ yield ( "hdfs://" if request . param else "" ) + directory
2222 fs .rm (directory , recursive = True )
2323
2424
@@ -30,18 +30,19 @@ def strip_keys(original_entry):
3030
3131def test_info (fs , remote_dir ):
3232 fs .touch (remote_dir + "/a.txt" )
33+ remote_dir_strip_protocol = fs ._strip_protocol (remote_dir )
3334 details = fs .info (remote_dir + "/a.txt" )
3435 assert details ["type" ] == "file"
35- assert details ["name" ] == remote_dir + "/a.txt"
36+ assert details ["name" ] == remote_dir_strip_protocol + "/a.txt"
3637 assert details ["size" ] == 0
3738
3839 fs .mkdir (remote_dir + "/dir" )
3940 details = fs .info (remote_dir + "/dir" )
4041 assert details ["type" ] == "directory"
41- assert details ["name" ] == remote_dir + "/dir"
42+ assert details ["name" ] == remote_dir_strip_protocol + "/dir"
4243
4344 details = fs .info (remote_dir + "/dir/" )
44- assert details ["name" ] == remote_dir + "/dir/"
45+ assert details ["name" ] == remote_dir_strip_protocol + "/dir/"
4546
4647
4748def test_move (fs , remote_dir ):
@@ -114,12 +115,14 @@ def test_rm(fs, remote_dir):
114115
115116
116117def test_ls (fs , remote_dir ):
118+ remote_dir_strip_protocol = fs ._strip_protocol (remote_dir )
117119 fs .mkdir (remote_dir + "dir/" )
118120 files = set ()
119121 for no in range (8 ):
120122 file = remote_dir + f"dir/test_{ no } "
123+ # we also want to make sure `fs.touch` works with protocol
121124 fs .touch (file )
122- files .add (file )
125+ files .add (remote_dir_strip_protocol + f"dir/test_ { no } " )
123126
124127 assert set (fs .ls (remote_dir + "dir/" )) == files
125128
0 commit comments