def test_du(azure): with azure_teardown(azure): with azure.open(a, 'wb') as f: f.write(b'123') with azure.open(b, 'wb') as f: f.write(b'4567') assert azure.du(test_dir) == {a: 3, b: 4} assert azure.du(test_dir, total=True) == 3 + 4
def test_upload_many(local_files, azure): with azure_teardown(azure): bigfile, littlefile, emptyfile, a, b, c = local_files root = os.path.dirname(bigfile) # single thread up = ADLUploader(azure, test_dir, root, nthreads=1, overwrite=True) assert azure.info(test_dir / 'littlefile')['length'] == 10 assert azure.cat(test_dir / 'nested1/nested2/a') == b'0123456789' assert len(azure.du(test_dir, deep=True)) == 6 assert azure.du(test_dir, deep=True, total=True) == 10000 + 40
def test_write_blocks(azure): with azure_teardown(azure): with azure.open(a, mode='wb', blocksize=5) as f: f.write(b'000') assert f.buffer.tell() == 3 f.write(b'000') # forces flush assert f.buffer.tell() == 1 f.write(b'000') assert f.tell() == 9 assert azure.du(a)[a] == 9