Skip to content

Commit 46516de

Browse files
authored
Make azure-storage-blob optional for testing (#420)
* Make azure-storage-blob optional for testing * Update 2.3.0 release title * Note azure-storage-blob is optional for testing * Skip covering the azure-storage-blob missing case
1 parent 3759d76 commit 46516de

File tree

4 files changed

+38
-8
lines changed

4 files changed

+38
-8
lines changed

docs/release.rst

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,22 @@
11
Release notes
22
=============
33

4+
.. _release_2.3.1:
5+
6+
2.3.1
7+
-----
8+
9+
Bug fixes
10+
~~~~~~~~~
11+
12+
* Makes ``azure-storage-blob`` optional for testing.
13+
By :user:`John Kirkham <jakirkham>`; :issue:`419`, :issue:`420`
14+
15+
416
.. _release_2.3.0:
517

6-
2.3.0 (Work in Progress)
7-
------------------------
18+
2.3.0
19+
-----
820

921
Enhancements
1022
~~~~~~~~~~~~

zarr/tests/test_core.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@
1313
import numpy as np
1414
from numpy.testing import assert_array_equal, assert_array_almost_equal
1515
import pytest
16-
from azure.storage.blob import BlockBlobService
16+
17+
try:
18+
import azure.storage.blob as asb
19+
except ImportError: # pragma: no cover
20+
asb = None
1721

1822

1923
from zarr.storage import (DirectoryStore, init_array, init_group, NestedDirectoryStore,
@@ -1409,11 +1413,13 @@ def test_nbytes_stored(self):
14091413
assert expect_nbytes_stored == z.nbytes_stored
14101414

14111415

1416+
@pytest.mark.skipif(asb is None,
1417+
reason="azure-blob-storage could not be imported")
14121418
class TestArrayWithABSStore(TestArray):
14131419

14141420
@staticmethod
14151421
def absstore():
1416-
blob_client = BlockBlobService(is_emulated=True)
1422+
blob_client = asb.BlockBlobService(is_emulated=True)
14171423
blob_client.delete_container('test')
14181424
blob_client.create_container('test')
14191425
store = ABSStore(container='test', prefix='zarrtesting/', account_name='foo',

zarr/tests/test_hierarchy.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@
1313
import numpy as np
1414
from numpy.testing import assert_array_equal
1515
import pytest
16-
from azure.storage.blob import BlockBlobService
16+
17+
try:
18+
import azure.storage.blob as asb
19+
except ImportError: # pragma: no cover
20+
asb = None
1721

1822

1923
from zarr.storage import (DictStore, DirectoryStore, ZipStore, init_group, init_array,
@@ -865,11 +869,13 @@ def create_store():
865869
return store, None
866870

867871

872+
@pytest.mark.skipif(asb is None,
873+
reason="azure-blob-storage could not be imported")
868874
class TestGroupWithABSStore(TestGroup):
869875

870876
@staticmethod
871877
def create_store():
872-
blob_client = BlockBlobService(is_emulated=True)
878+
blob_client = asb.BlockBlobService(is_emulated=True)
873879
blob_client.delete_container('test')
874880
blob_client.create_container('test')
875881
store = ABSStore(container='test', prefix='zarrtesting/', account_name='foo',

zarr/tests/test_storage.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@
1515
import numpy as np
1616
from numpy.testing import assert_array_equal, assert_array_almost_equal
1717
import pytest
18-
from azure.storage.blob import BlockBlobService
18+
19+
try:
20+
import azure.storage.blob as asb
21+
except ImportError: # pragma: no cover
22+
asb = None
1923

2024

2125
from zarr.storage import (init_array, array_meta_key, attrs_key, DictStore,
@@ -1514,10 +1518,12 @@ def test_format_compatibility():
15141518
assert compressor.get_config() == z.compressor.get_config()
15151519

15161520

1521+
@pytest.mark.skipif(asb is None,
1522+
reason="azure-blob-storage could not be imported")
15171523
class TestABSStore(StoreTests, unittest.TestCase):
15181524

15191525
def create_store(self):
1520-
blob_client = BlockBlobService(is_emulated=True)
1526+
blob_client = asb.BlockBlobService(is_emulated=True)
15211527
blob_client.delete_container('test')
15221528
blob_client.create_container('test')
15231529
store = ABSStore(container='test', prefix='zarrtesting/', account_name='foo',

0 commit comments

Comments
 (0)