Skip to content

Commit

Permalink
Make azure-storage-blob optional for testing (#420)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
jakirkham authored Mar 25, 2019
1 parent 3759d76 commit 46516de
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 8 deletions.
16 changes: 14 additions & 2 deletions docs/release.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
Release notes
=============

.. _release_2.3.1:

2.3.1
-----

Bug fixes
~~~~~~~~~

* Makes ``azure-storage-blob`` optional for testing.
By :user:`John Kirkham <jakirkham>`; :issue:`419`, :issue:`420`


.. _release_2.3.0:

2.3.0 (Work in Progress)
------------------------
2.3.0
-----

Enhancements
~~~~~~~~~~~~
Expand Down
10 changes: 8 additions & 2 deletions zarr/tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
import numpy as np
from numpy.testing import assert_array_equal, assert_array_almost_equal
import pytest
from azure.storage.blob import BlockBlobService

try:
import azure.storage.blob as asb
except ImportError: # pragma: no cover
asb = None


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


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

@staticmethod
def absstore():
blob_client = BlockBlobService(is_emulated=True)
blob_client = asb.BlockBlobService(is_emulated=True)
blob_client.delete_container('test')
blob_client.create_container('test')
store = ABSStore(container='test', prefix='zarrtesting/', account_name='foo',
Expand Down
10 changes: 8 additions & 2 deletions zarr/tests/test_hierarchy.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
import numpy as np
from numpy.testing import assert_array_equal
import pytest
from azure.storage.blob import BlockBlobService

try:
import azure.storage.blob as asb
except ImportError: # pragma: no cover
asb = None


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


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

@staticmethod
def create_store():
blob_client = BlockBlobService(is_emulated=True)
blob_client = asb.BlockBlobService(is_emulated=True)
blob_client.delete_container('test')
blob_client.create_container('test')
store = ABSStore(container='test', prefix='zarrtesting/', account_name='foo',
Expand Down
10 changes: 8 additions & 2 deletions zarr/tests/test_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
import numpy as np
from numpy.testing import assert_array_equal, assert_array_almost_equal
import pytest
from azure.storage.blob import BlockBlobService

try:
import azure.storage.blob as asb
except ImportError: # pragma: no cover
asb = None


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


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

def create_store(self):
blob_client = BlockBlobService(is_emulated=True)
blob_client = asb.BlockBlobService(is_emulated=True)
blob_client.delete_container('test')
blob_client.create_container('test')
store = ABSStore(container='test', prefix='zarrtesting/', account_name='foo',
Expand Down

0 comments on commit 46516de

Please sign in to comment.