Skip to content

Make azure-storage-blob optional for testing #420

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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