def setUp(self): self.container = generate_guid() self.subfolder = generate_guid(5) self.blob_name = generate_guid(10) try: warnings.simplefilter("ignore", ResourceWarning) except: pass
def _open(self): self.tmp_dir = tempfile.mkdtemp(generate_guid()) self.tmp_path = os.path.join(self.tmp_dir, self.blob_path.replace("/", "-")) self.connection.get_blob_to_path(self.container, self.blob_path, self.tmp_path) self.fid = open(self.tmp_path, "rb") self.fid.seek(0)
def test_touch_mv_cp_rm(self): folder_name = "test_touch_mv_cp_rm" self.fs.mkdir(self.container, folder_name) src_file_name = "{folder_name}/{file}".format(folder_name=folder_name, file=generate_guid()) dst_file_name = "{folder_name}/{file}".format(folder_name=folder_name, file=generate_guid()) try: self.assertEqual(self.fs.touch(self.container, src_file_name), src_file_name) self.assertIn(src_file_name, self.fs.ls(self.container)) self.assertTrue( self.fs.mv(self.container, src_file_name, dst_file_name)) self.assertNotIn(src_file_name, self.fs.ls(self.container)) self.assertIn(dst_file_name, self.fs.ls(self.container)) self.fs.cp(self.container, dst_file_name, src_file_name) self.assertIn(src_file_name, self.fs.ls(self.container)) self.assertIn(dst_file_name, self.fs.ls(self.container)) finally: self.fs.rm(self.container, src_file_name) self.fs.rm(self.container, dst_file_name)
def setUp(self): self.account_name = self.account_name or os.environ.get( "AZURE_BLOB_ACCOUNT_NAME") self.account_key = os.environ.get("AZURE_BLOB_ACCOUNT_KEY") try: warnings.simplefilter("ignore", ResourceWarning) except: pass self.dask_fs = DaskAzureBlobFileSystem(self.account_name, self.account_key) self.azure_map = AzureBlobMap( "{}/{}".format(self.container, generate_guid()), self.dask_fs) self.azure_map.clear()
def test_touch_rm(self): file_name = "test_touch_rm/{file}.txt".format(file=generate_guid()) self.assertEqual(self.fs.touch(self.container, file_name), file_name) self.fs.rm(self.container, file_name)