Skip to content

Commit 13a6d30

Browse files
committed
Remove more GCSStore code
1 parent de5bb9c commit 13a6d30

File tree

3 files changed

+3
-60
lines changed

3 files changed

+3
-60
lines changed

zarr/storage.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1903,13 +1903,6 @@ def _append_path_to_prefix(path, prefix):
19031903
normalize_storage_path(path)])
19041904

19051905

1906-
def atexit_rmgcspath(bucket, path):
1907-
from google.cloud import storage
1908-
client = storage.Client()
1909-
bucket = client.get_bucket(bucket)
1910-
bucket.delete_blobs(bucket.list_blobs(prefix=path))
1911-
1912-
19131906
class ABSStore(MutableMapping):
19141907
"""Storage class using Azure Blob Storage (ABS).
19151908

zarr/tests/test_core.py

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import pickle
88
import os
99
import warnings
10-
import uuid
10+
1111

1212
import numpy as np
1313
from numpy.testing import assert_array_equal, assert_array_almost_equal
@@ -16,7 +16,7 @@
1616

1717
from zarr.storage import (DirectoryStore, init_array, init_group, NestedDirectoryStore,
1818
DBMStore, LMDBStore, atexit_rmtree, atexit_rmglob,
19-
LRUStoreCache, GCSStore, atexit_rmgcspath)
19+
LRUStoreCache)
2020
from zarr.core import Array
2121
from zarr.errors import PermissionError
2222
from zarr.compat import PY2, text_type, binary_type
@@ -1698,25 +1698,3 @@ def create_array(read_only=False, **kwargs):
16981698
init_array(store, **kwargs)
16991699
return Array(store, read_only=read_only, cache_metadata=cache_metadata,
17001700
cache_attrs=cache_attrs)
1701-
1702-
1703-
try:
1704-
from google.cloud import storage as gcstorage
1705-
except ImportError: # pragma: no cover
1706-
gcstorage = None
1707-
1708-
1709-
@unittest.skipIf(gcstorage is None, 'google-cloud-storage is not installed')
1710-
class TestGCSArray(TestArray):
1711-
1712-
def create_array(self, read_only=False, **kwargs):
1713-
bucket = 'zarr-test'
1714-
prefix = uuid.uuid4()
1715-
atexit.register(atexit_rmgcspath, bucket, prefix)
1716-
store = GCSStore(bucket, prefix)
1717-
cache_metadata = kwargs.pop('cache_metadata', True)
1718-
cache_attrs = kwargs.pop('cache_attrs', True)
1719-
kwargs.setdefault('compressor', Zlib(1))
1720-
init_array(store, **kwargs)
1721-
return Array(store, read_only=read_only, cache_metadata=cache_metadata,
1722-
cache_attrs=cache_attrs)

zarr/tests/test_storage.py

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import array
99
import shutil
1010
import os
11-
import uuid
1211

1312

1413
import numpy as np
@@ -20,8 +19,7 @@
2019
DirectoryStore, ZipStore, init_group, group_meta_key,
2120
getsize, migrate_1to2, TempStore, atexit_rmtree,
2221
NestedDirectoryStore, default_compressor, DBMStore,
23-
LMDBStore, atexit_rmglob, LRUStoreCache, GCSStore,
24-
atexit_rmgcspath)
22+
LMDBStore, atexit_rmglob, LRUStoreCache)
2523
from zarr.meta import (decode_array_metadata, encode_array_metadata, ZARR_FORMAT,
2624
decode_group_metadata, encode_group_metadata)
2725
from zarr.compat import PY2
@@ -1237,29 +1235,3 @@ def test_format_compatibility():
12371235
else:
12381236
assert compressor.codec_id == z.compressor.codec_id
12391237
assert compressor.get_config() == z.compressor.get_config()
1240-
1241-
1242-
try:
1243-
from google.cloud import storage as gcstorage
1244-
# cleanup function
1245-
1246-
except ImportError: # pragma: no cover
1247-
gcstorage = None
1248-
1249-
1250-
@unittest.skipIf(gcstorage is None, 'google-cloud-storage is not installed')
1251-
class TestGCSStore(StoreTests, unittest.TestCase):
1252-
1253-
def create_store(self):
1254-
# would need to be replaced with a dedicated test bucket
1255-
bucket = 'zarr-test'
1256-
prefix = uuid.uuid4()
1257-
atexit.register(atexit_rmgcspath, bucket, prefix)
1258-
store = GCSStore(bucket, prefix)
1259-
return store
1260-
1261-
def test_context_manager(self):
1262-
with self.create_store() as store:
1263-
store['foo'] = b'bar'
1264-
store['baz'] = b'qux'
1265-
assert 2 == len(store)

0 commit comments

Comments
 (0)