73
73
)
74
74
from zarr .tests .test_storage_v3 import DummyStorageTransfomer
75
75
from 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
+ )
77
85
from zarr .types import DIMENSION_SEPARATOR
78
86
79
87
# noinspection PyMethodMayBeStatic
@@ -2038,9 +2046,11 @@ def test_nbytes_stored(self):
2038
2046
pass # not implemented
2039
2047
2040
2048
2049
+ @pytest .mark .skipif (have_bsddb3 is False , reason = "needs bsddb3" )
2041
2050
class TestArrayWithDBMStoreBerkeleyDB (TestArray ):
2042
2051
def create_store (self ):
2043
- bsddb3 = pytest .importorskip ("bsddb3" )
2052
+ import bsddb3
2053
+
2044
2054
path = mktemp (suffix = ".dbm" )
2045
2055
atexit .register (os .remove , path )
2046
2056
store = DBMStore (path , flag = "n" , open = bsddb3 .btopen )
@@ -2050,9 +2060,9 @@ def test_nbytes_stored(self):
2050
2060
pass # not implemented
2051
2061
2052
2062
2063
+ @pytest .mark .skipif (have_lmdb is False , reason = "needs lmdb" )
2053
2064
class TestArrayWithLMDBStore (TestArray ):
2054
2065
def create_store (self ):
2055
- pytest .importorskip ("lmdb" )
2056
2066
path = mktemp (suffix = ".lmdb" )
2057
2067
atexit .register (atexit_rmtree , path )
2058
2068
store = LMDBStore (path , buffers = True )
@@ -2065,9 +2075,9 @@ def test_nbytes_stored(self):
2065
2075
pass # not implemented
2066
2076
2067
2077
2078
+ @pytest .mark .skipif (have_lmdb is False , reason = "needs lmdb" )
2068
2079
class TestArrayWithLMDBStoreNoBuffers (TestArray ):
2069
2080
def create_store (self ):
2070
- pytest .importorskip ("lmdb" )
2071
2081
path = mktemp (suffix = ".lmdb" )
2072
2082
atexit .register (atexit_rmtree , path )
2073
2083
store = LMDBStore (path , buffers = False )
@@ -2077,9 +2087,9 @@ def test_nbytes_stored(self):
2077
2087
pass # not implemented
2078
2088
2079
2089
2090
+ @pytest .mark .skipif (have_sqlite3 is False , reason = "needs sqlite3" )
2080
2091
class TestArrayWithSQLiteStore (TestArray ):
2081
2092
def create_store (self ):
2082
- pytest .importorskip ("sqlite3" )
2083
2093
path = mktemp (suffix = ".db" )
2084
2094
atexit .register (atexit_rmtree , path )
2085
2095
store = SQLiteStore (path )
@@ -2758,9 +2768,11 @@ def test_nbytes_stored(self):
2758
2768
2759
2769
2760
2770
@pytest .mark .skipif (not v3_api_available , reason = "V3 is disabled" )
2771
+ @pytest .mark .skipif (have_bsddb3 is False , reason = "needs bsddb3" )
2761
2772
class TestArrayWithDBMStoreV3BerkeleyDB (TestArrayV3 ):
2762
2773
def create_store (self ) -> DBMStoreV3 :
2763
- bsddb3 = pytest .importorskip ("bsddb3" )
2774
+ import bsddb3
2775
+
2764
2776
path = mktemp (suffix = ".dbm" )
2765
2777
atexit .register (os .remove , path )
2766
2778
store = DBMStoreV3 (path , flag = "n" , open = bsddb3 .btopen )
@@ -2771,11 +2783,11 @@ def test_nbytes_stored(self):
2771
2783
2772
2784
2773
2785
@pytest .mark .skipif (not v3_api_available , reason = "V3 is disabled" )
2786
+ @pytest .mark .skipif (have_lmdb is False , reason = "needs lmdb" )
2774
2787
class TestArrayWithLMDBStoreV3 (TestArrayV3 ):
2775
2788
lmdb_buffers = True
2776
2789
2777
2790
def create_store (self ) -> LMDBStoreV3 :
2778
- pytest .importorskip ("lmdb" )
2779
2791
path = mktemp (suffix = ".lmdb" )
2780
2792
atexit .register (atexit_rmtree , path )
2781
2793
store = LMDBStoreV3 (path , buffers = self .lmdb_buffers )
@@ -2797,9 +2809,9 @@ def test_nbytes_stored(self):
2797
2809
2798
2810
2799
2811
@pytest .mark .skipif (not v3_api_available , reason = "V3 is disabled" )
2812
+ @pytest .mark .skipif (have_sqlite3 is False , reason = "needs sqlite3" )
2800
2813
class TestArrayWithSQLiteStoreV3 (TestArrayV3 ):
2801
2814
def create_store (self ):
2802
- pytest .importorskip ("sqlite3" )
2803
2815
path = mktemp (suffix = ".db" )
2804
2816
atexit .register (atexit_rmtree , path )
2805
2817
store = SQLiteStoreV3 (path )
0 commit comments