7373)
7474from zarr .tests .test_storage_v3 import DummyStorageTransfomer
7575from zarr .util import buffer_size
76- from zarr .tests .util import abs_container , skip_test_env_var , have_fsspec , mktemp
76+ from zarr .tests .util import (
77+ abs_container ,
78+ have_bsddb3 ,
79+ have_fsspec ,
80+ have_lmdb ,
81+ have_sqlite3 ,
82+ mktemp ,
83+ skip_test_env_var ,
84+ )
7785from zarr .types import DIMENSION_SEPARATOR
7886
7987# noinspection PyMethodMayBeStatic
@@ -2038,9 +2046,11 @@ def test_nbytes_stored(self):
20382046 pass # not implemented
20392047
20402048
2049+ @pytest .mark .skipif (have_bsddb3 is False , reason = "needs bsddb3" )
20412050class TestArrayWithDBMStoreBerkeleyDB (TestArray ):
20422051 def create_store (self ):
2043- bsddb3 = pytest .importorskip ("bsddb3" )
2052+ import bsddb3
2053+
20442054 path = mktemp (suffix = ".dbm" )
20452055 atexit .register (os .remove , path )
20462056 store = DBMStore (path , flag = "n" , open = bsddb3 .btopen )
@@ -2050,9 +2060,9 @@ def test_nbytes_stored(self):
20502060 pass # not implemented
20512061
20522062
2063+ @pytest .mark .skipif (have_lmdb is False , reason = "needs lmdb" )
20532064class TestArrayWithLMDBStore (TestArray ):
20542065 def create_store (self ):
2055- pytest .importorskip ("lmdb" )
20562066 path = mktemp (suffix = ".lmdb" )
20572067 atexit .register (atexit_rmtree , path )
20582068 store = LMDBStore (path , buffers = True )
@@ -2065,9 +2075,9 @@ def test_nbytes_stored(self):
20652075 pass # not implemented
20662076
20672077
2078+ @pytest .mark .skipif (have_lmdb is False , reason = "needs lmdb" )
20682079class TestArrayWithLMDBStoreNoBuffers (TestArray ):
20692080 def create_store (self ):
2070- pytest .importorskip ("lmdb" )
20712081 path = mktemp (suffix = ".lmdb" )
20722082 atexit .register (atexit_rmtree , path )
20732083 store = LMDBStore (path , buffers = False )
@@ -2077,9 +2087,9 @@ def test_nbytes_stored(self):
20772087 pass # not implemented
20782088
20792089
2090+ @pytest .mark .skipif (have_sqlite3 is False , reason = "needs sqlite3" )
20802091class TestArrayWithSQLiteStore (TestArray ):
20812092 def create_store (self ):
2082- pytest .importorskip ("sqlite3" )
20832093 path = mktemp (suffix = ".db" )
20842094 atexit .register (atexit_rmtree , path )
20852095 store = SQLiteStore (path )
@@ -2758,9 +2768,11 @@ def test_nbytes_stored(self):
27582768
27592769
27602770@pytest .mark .skipif (not v3_api_available , reason = "V3 is disabled" )
2771+ @pytest .mark .skipif (have_bsddb3 is False , reason = "needs bsddb3" )
27612772class TestArrayWithDBMStoreV3BerkeleyDB (TestArrayV3 ):
27622773 def create_store (self ) -> DBMStoreV3 :
2763- bsddb3 = pytest .importorskip ("bsddb3" )
2774+ import bsddb3
2775+
27642776 path = mktemp (suffix = ".dbm" )
27652777 atexit .register (os .remove , path )
27662778 store = DBMStoreV3 (path , flag = "n" , open = bsddb3 .btopen )
@@ -2771,11 +2783,11 @@ def test_nbytes_stored(self):
27712783
27722784
27732785@pytest .mark .skipif (not v3_api_available , reason = "V3 is disabled" )
2786+ @pytest .mark .skipif (have_lmdb is False , reason = "needs lmdb" )
27742787class TestArrayWithLMDBStoreV3 (TestArrayV3 ):
27752788 lmdb_buffers = True
27762789
27772790 def create_store (self ) -> LMDBStoreV3 :
2778- pytest .importorskip ("lmdb" )
27792791 path = mktemp (suffix = ".lmdb" )
27802792 atexit .register (atexit_rmtree , path )
27812793 store = LMDBStoreV3 (path , buffers = self .lmdb_buffers )
@@ -2797,9 +2809,9 @@ def test_nbytes_stored(self):
27972809
27982810
27992811@pytest .mark .skipif (not v3_api_available , reason = "V3 is disabled" )
2812+ @pytest .mark .skipif (have_sqlite3 is False , reason = "needs sqlite3" )
28002813class TestArrayWithSQLiteStoreV3 (TestArrayV3 ):
28012814 def create_store (self ):
2802- pytest .importorskip ("sqlite3" )
28032815 path = mktemp (suffix = ".db" )
28042816 atexit .register (atexit_rmtree , path )
28052817 store = SQLiteStoreV3 (path )
0 commit comments