@@ -118,32 +118,46 @@ def test_copy(self):
118118 with self .assertRaises (tiledb .TileDBError ):
119119 vfs .copy_dir (self .path ("foo/baz" ), self .path ("do_not_exist/baz" ))
120120
121+ # Note: Azure tests are intermittently failing.
122+ # Seemingly mostly azure->azure, but also test teardown.
123+ # I think it's an Azurite bucket storage thing, actually.
121124 @pytest .mark .skipif (
122125 sys .platform == "win32" ,
123126 reason = "Windows paths are difficult; Posix is sufficient for testing." ,
124127 )
125- @pytest .mark .parametrize ("src" , ["file" ])
126- @pytest .mark .parametrize ("dst" , ["file" ])
127- # @pytest.mark.parametrize("src", ["file", "s3", "azure", "gcs"])
128- # @pytest.mark.parametrize("dst", ["file", "s3", "azure", "gcs"])
129- def test_copy_across (self , src : str , dst : str ):
128+ @pytest .mark .parametrize ("src" , ["file" , "s3" , "azure" , "gcs" ])
129+ @pytest .mark .parametrize ("dst" , ["file" , "s3" , "azure" , "gcs" ])
130+ def test_copy_across (self , src : str , dst : str , vfs_config ):
130131 # Currently, skip if both FSes are the same. This is covered above.
131132 # However, this test might ought to replace the above.
132- # if src == dst:
133- # return
133+ if src == dst :
134+ return
134135
135- vfs = tiledb .VFS ()
136+ # Set configuration options
137+ if (src == "s3" or dst == "s3" ) and not vfs_config .get (
138+ "vfs.s3.aws_access_key_id"
139+ ):
140+ return
141+ if (src == "azure" or dst == "azure" ) and not any (
142+ x .startswith ("vfs.azure" ) for x in vfs_config .keys ()
143+ ):
144+ return
145+ if (src == "gcs" or dst == "gcs" ) and not vfs_config .get ("vfs.gcs.endpoint" ):
146+ return
147+ vfs = tiledb .VFS (vfs_config )
136148
137149 # Return if neither filesystem is supported.
138150 if not vfs .supports (src ) or not vfs .supports (dst ):
139151 return
140152
141153 # Create source file, and write to it.
142- srcdir : str = vfs_path (src , prefix = "tiledb-copy-src" )
154+ srcdir : str = vfs_path (src )
143155 if src == "file" :
144156 vfs .create_dir (srcdir )
157+ self .assertTrue (vfs .is_dir (srcdir ))
145158 else :
146159 vfs .create_bucket (srcdir )
160+ self .assertTrue (vfs .is_bucket (srcdir ))
147161 srcfile : str = f"{ srcdir } /testfile"
148162 vfs .touch (srcfile )
149163 self .assertTrue (vfs .isfile (srcfile ))
@@ -154,23 +168,18 @@ def test_copy_across(self, src: str, dst: str):
154168 self .assertEqual (handle .read (), contents )
155169
156170 # Copy src -> dst and assert the file contents are unchanged.
157- dstdir : str = vfs_path (dst , prefix = "tiledb-copy-dst" )
171+ dstdir : str = vfs_path (dst )
158172 if dst == "file" :
159173 vfs .create_dir (dstdir )
174+ self .assertTrue (vfs .is_dir (dstdir ))
160175 else :
161176 vfs .create_bucket (dstdir )
177+ self .assertTrue (vfs .is_bucket (dstdir ))
162178 dstfile : str = f"{ dstdir } /testfile"
163- vfs .copy_file ( srcfile , dstfile )
179+ vfs .copy_dir ( srcdir , dstdir )
164180 with vfs .open (dstfile ) as handle :
165181 self .assertEqual (handle .read (), contents )
166182
167- # Copy back dst -> src and assert the file contents are unchanged.
168- vfs .remove_file (srcfile )
169- self .assertFalse (vfs .isfile (srcfile ))
170- vfs .copy_file (dstfile , srcfile )
171- with vfs .open (srcfile ) as handle :
172- self .assertEqual (handle .read (), contents )
173-
174183 # Clean up
175184 if src == "file" :
176185 vfs .remove_dir (srcdir )
0 commit comments