@@ -218,30 +218,30 @@ def create_volume(w, catalog, schema, volume):
218218 return ResourceWithCleanup (lambda : w .volumes .delete (res .full_name ))
219219
220220
221- def test_files_api_upload_download (ucws , random ):
221+ def test_files_api_upload_download (ucws , files_api , random ):
222222 w = ucws
223223 schema = "filesit-" + random ()
224224 volume = "filesit-" + random ()
225225 with ResourceWithCleanup .create_schema (w , "main" , schema ):
226226 with ResourceWithCleanup .create_volume (w , "main" , schema , volume ):
227227 f = io .BytesIO (b"some text data" )
228228 target_file = f"/Volumes/main/{ schema } /{ volume } /filesit-with-?-and-#-{ random ()} .txt"
229- w . files .upload (target_file , f )
230- with w . files .download (target_file ).contents as f :
229+ files_api .upload (target_file , f )
230+ with files_api .download (target_file ).contents as f :
231231 assert f .read () == b"some text data"
232232
233233
234- def test_files_api_read_twice_from_one_download (ucws , random ):
234+ def test_files_api_read_twice_from_one_download (ucws , files_api , random ):
235235 w = ucws
236236 schema = "filesit-" + random ()
237237 volume = "filesit-" + random ()
238238 with ResourceWithCleanup .create_schema (w , "main" , schema ):
239239 with ResourceWithCleanup .create_volume (w , "main" , schema , volume ):
240240 f = io .BytesIO (b"some text data" )
241241 target_file = f"/Volumes/main/{ schema } /{ volume } /filesit-{ random ()} .txt"
242- w . files .upload (target_file , f )
242+ files_api .upload (target_file , f )
243243
244- res = w . files .download (target_file ).contents
244+ res = files_api .download (target_file ).contents
245245
246246 with res :
247247 assert res .read () == b"some text data"
@@ -251,82 +251,82 @@ def test_files_api_read_twice_from_one_download(ucws, random):
251251 res .read ()
252252
253253
254- def test_files_api_delete_file (ucws , random ):
254+ def test_files_api_delete_file (ucws , files_api , random ):
255255 w = ucws
256256 schema = "filesit-" + random ()
257257 volume = "filesit-" + random ()
258258 with ResourceWithCleanup .create_schema (w , "main" , schema ):
259259 with ResourceWithCleanup .create_volume (w , "main" , schema , volume ):
260260 f = io .BytesIO (b"some text data" )
261261 target_file = f"/Volumes/main/{ schema } /{ volume } /filesit-{ random ()} .txt"
262- w . files .upload (target_file , f )
263- w . files .delete (target_file )
262+ files_api .upload (target_file , f )
263+ files_api .delete (target_file )
264264
265265
266- def test_files_api_get_metadata (ucws , random ):
266+ def test_files_api_get_metadata (ucws , files_api , random ):
267267 w = ucws
268268 schema = "filesit-" + random ()
269269 volume = "filesit-" + random ()
270270 with ResourceWithCleanup .create_schema (w , "main" , schema ):
271271 with ResourceWithCleanup .create_volume (w , "main" , schema , volume ):
272272 f = io .BytesIO (b"some text data" )
273273 target_file = f"/Volumes/main/{ schema } /{ volume } /filesit-{ random ()} .txt"
274- w . files .upload (target_file , f )
275- m = w . files .get_metadata (target_file )
274+ files_api .upload (target_file , f )
275+ m = files_api .get_metadata (target_file )
276276 assert m .content_type == "application/octet-stream"
277277 assert m .content_length == 14
278278 assert m .last_modified is not None
279279
280280
281- def test_files_api_create_directory (ucws , random ):
281+ def test_files_api_create_directory (ucws , files_api , random ):
282282 w = ucws
283283 schema = "filesit-" + random ()
284284 volume = "filesit-" + random ()
285285 with ResourceWithCleanup .create_schema (w , "main" , schema ):
286286 with ResourceWithCleanup .create_volume (w , "main" , schema , volume ):
287287 target_directory = f"/Volumes/main/{ schema } /{ volume } /filesit-{ random ()} /"
288- w . files .create_directory (target_directory )
288+ files_api .create_directory (target_directory )
289289
290290
291- def test_files_api_list_directory_contents (ucws , random ):
291+ def test_files_api_list_directory_contents (ucws , files_api , random ):
292292 w = ucws
293293 schema = "filesit-" + random ()
294294 volume = "filesit-" + random ()
295295 with ResourceWithCleanup .create_schema (w , "main" , schema ):
296296 with ResourceWithCleanup .create_volume (w , "main" , schema , volume ):
297297 target_directory = f"/Volumes/main/{ schema } /{ volume } /filesit-{ random ()} "
298- w . files .upload (target_directory + "/file1.txt" , io .BytesIO (b"some text data" ))
299- w . files .upload (target_directory + "/file2.txt" , io .BytesIO (b"some text data" ))
300- w . files .upload (target_directory + "/file3.txt" , io .BytesIO (b"some text data" ))
298+ files_api .upload (target_directory + "/file1.txt" , io .BytesIO (b"some text data" ))
299+ files_api .upload (target_directory + "/file2.txt" , io .BytesIO (b"some text data" ))
300+ files_api .upload (target_directory + "/file3.txt" , io .BytesIO (b"some text data" ))
301301
302- result = list (w . files .list_directory_contents (target_directory ))
302+ result = list (files_api .list_directory_contents (target_directory ))
303303 assert len (result ) == 3
304304
305305
306- def test_files_api_delete_directory (ucws , random ):
306+ def test_files_api_delete_directory (ucws , files_api , random ):
307307 w = ucws
308308 schema = "filesit-" + random ()
309309 volume = "filesit-" + random ()
310310 with ResourceWithCleanup .create_schema (w , "main" , schema ):
311311 with ResourceWithCleanup .create_volume (w , "main" , schema , volume ):
312312 target_directory = f"/Volumes/main/{ schema } /{ volume } /filesit-{ random ()} /"
313- w . files .create_directory (target_directory )
314- w . files .delete_directory (target_directory )
313+ files_api .create_directory (target_directory )
314+ files_api .delete_directory (target_directory )
315315
316316
317- def test_files_api_get_directory_metadata (ucws , random ):
317+ def test_files_api_get_directory_metadata (ucws , files_api , random ):
318318 w = ucws
319319 schema = "filesit-" + random ()
320320 volume = "filesit-" + random ()
321321 with ResourceWithCleanup .create_schema (w , "main" , schema ):
322322 with ResourceWithCleanup .create_volume (w , "main" , schema , volume ):
323323 target_directory = f"/Volumes/main/{ schema } /{ volume } /filesit-{ random ()} /"
324- w . files .create_directory (target_directory )
325- w . files .get_directory_metadata (target_directory )
324+ files_api .create_directory (target_directory )
325+ files_api .get_directory_metadata (target_directory )
326326
327327
328328@pytest .mark .benchmark
329- def test_files_api_download_benchmark (ucws , random ):
329+ def test_files_api_download_benchmark (ucws , files_api , random ):
330330 w = ucws
331331 schema = "filesit-" + random ()
332332 volume = "filesit-" + random ()
@@ -335,7 +335,7 @@ def test_files_api_download_benchmark(ucws, random):
335335 # Create a 50 MB file
336336 f = io .BytesIO (bytes (range (256 )) * 200000 )
337337 target_file = f"/Volumes/main/{ schema } /{ volume } /filesit-benchmark-{ random ()} .txt"
338- w . files .upload (target_file , f )
338+ files_api .upload (target_file , f )
339339
340340 totals = {}
341341 for chunk_size_kb in [
@@ -357,7 +357,7 @@ def test_files_api_download_benchmark(ucws, random):
357357 count = 10
358358 for i in range (count ):
359359 start = time .time ()
360- f = w . files .download (target_file ).contents
360+ f = files_api .download (target_file ).contents
361361 f .set_chunk_size (chunk_size )
362362 with f as vf :
363363 vf .read ()
0 commit comments