Skip to content

Commit 8f41329

Browse files
committed
Install Azurite for Azure Blob Storage tests.
This should increase coverage.
1 parent 6352b76 commit 8f41329

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

.github/workflows/python-package.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ jobs:
4747
- name: Create Conda environment with the rights deps
4848
shell: "bash -l {0}"
4949
run: |
50-
conda create -n zarr-env python==${{matrix.python-version}} bsddb3 numcodecs==0.6.4 lmdb pip
50+
conda create -n zarr-env python==${{matrix.python-version}} bsddb3 numcodecs==0.6.4 lmdb pip nodejs
51+
conda activate zarr-env
52+
npm install -g azurite
5153
- name: Install dependencies
5254
shell: "bash -l {0}"
5355
run: |
@@ -61,12 +63,14 @@ jobs:
6163
shell: "bash -l {0}"
6264
env:
6365
COVERAGE_FILE: .coverage.${{matrix.python-version}}.${{matrix.numpy_version}}
64-
ZARR_TEST_ABS: 0
66+
ZARR_TEST_ABS: 1
6567
ZARR_TEST_MONGO: 1
6668
ZARR_TEST_REDIS: 1
6769
run: |
6870
conda activate zarr-env
69-
pytest --cov=zarr --cov-config=.coveragerc --doctest-plus --cov-report xml --cov=./
71+
mkdir ~/blob_emulator
72+
azurite -l ~/blob_emulator --debug debug.log 2>&1 > stdouterr.log &
73+
pytest --cov=zarr --cov-config=.coveragerc --doctest-plus --cov-report xml --cov=./
7074
- uses: codecov/codecov-action@v1
7175
with:
7276
#token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos

zarr/tests/test_storage.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1801,11 +1801,16 @@ class TestABSStore(StoreTests, unittest.TestCase):
18011801

18021802
def create_store(self, prefix=None):
18031803
asb = pytest.importorskip("azure.storage.blob")
1804-
blob_client = asb.BlockBlobService(is_emulated=True)
1805-
blob_client.delete_container('test')
1806-
blob_client.create_container('test')
1807-
store = ABSStore(container='test', prefix=prefix, account_name='foo',
1808-
account_key='bar', blob_service_kwargs={'is_emulated': True})
1804+
blob_client = asb.BlockBlobService(is_emulated=True, socket_timeout=10)
1805+
blob_client.delete_container("test")
1806+
blob_client.create_container("test")
1807+
store = ABSStore(
1808+
container="test",
1809+
prefix=prefix,
1810+
account_name="foo",
1811+
account_key="bar",
1812+
blob_service_kwargs={"is_emulated": True, "socket_timeout": 10},
1813+
)
18091814
store.rmdir()
18101815
return store
18111816

0 commit comments

Comments
 (0)