@@ -2495,14 +2495,49 @@ def test_store_has_bytes_values(self):
2495
2495
pass
2496
2496
2497
2497
2498
+ fsspec_mapper_kwargs = {
2499
+ "check" : True ,
2500
+ "create" : True ,
2501
+ "missing_exceptions" : None
2502
+ }
2503
+
2504
+
2498
2505
@pytest .mark .skipif (have_fsspec is False , reason = "needs fsspec" )
2499
2506
class TestArrayWithFSStore (TestArray ):
2500
2507
@staticmethod
2501
2508
def create_array (read_only = False , ** kwargs ):
2502
2509
path = mkdtemp ()
2503
2510
atexit .register (shutil .rmtree , path )
2504
2511
key_separator = kwargs .pop ('key_separator' , "." )
2505
- store = FSStore (path , key_separator = key_separator , auto_mkdir = True )
2512
+ store = FSStore (path , key_separator = key_separator , auto_mkdir = True , ** fsspec_mapper_kwargs )
2513
+ cache_metadata = kwargs .pop ('cache_metadata' , True )
2514
+ cache_attrs = kwargs .pop ('cache_attrs' , True )
2515
+ write_empty_chunks = kwargs .pop ('write_empty_chunks' , True )
2516
+ kwargs .setdefault ('compressor' , Blosc ())
2517
+ init_array (store , ** kwargs )
2518
+ return Array (store , read_only = read_only , cache_metadata = cache_metadata ,
2519
+ cache_attrs = cache_attrs , write_empty_chunks = write_empty_chunks )
2520
+
2521
+ def expected (self ):
2522
+ return [
2523
+ "ab753fc81df0878589535ca9bad2816ba88d91bc" ,
2524
+ "c16261446f9436b1e9f962e57ce3e8f6074abe8a" ,
2525
+ "c2ef3b2fb2bc9dcace99cd6dad1a7b66cc1ea058" ,
2526
+ "6e52f95ac15b164a8e96843a230fcee0e610729b" ,
2527
+ "091fa99bc60706095c9ce30b56ce2503e0223f56" ,
2528
+ ]
2529
+
2530
+
2531
+ @pytest .mark .skipif (have_fsspec is False , reason = "needs fsspec" )
2532
+ class TestArrayWithFSStoreFromFilesystem (TestArray ):
2533
+ @staticmethod
2534
+ def create_array (read_only = False , ** kwargs ):
2535
+ from fsspec .implementations .local import LocalFileSystem
2536
+ fs = LocalFileSystem (auto_mkdir = True )
2537
+ path = mkdtemp ()
2538
+ atexit .register (shutil .rmtree , path )
2539
+ key_separator = kwargs .pop ('key_separator' , "." )
2540
+ store = FSStore (path , fs = fs , key_separator = key_separator , ** fsspec_mapper_kwargs )
2506
2541
cache_metadata = kwargs .pop ('cache_metadata' , True )
2507
2542
cache_attrs = kwargs .pop ('cache_attrs' , True )
2508
2543
write_empty_chunks = kwargs .pop ('write_empty_chunks' , True )
@@ -3148,7 +3183,40 @@ def create_array(array_path='arr1', read_only=False, **kwargs):
3148
3183
path = mkdtemp ()
3149
3184
atexit .register (shutil .rmtree , path )
3150
3185
key_separator = kwargs .pop ('key_separator' , "." )
3151
- store = FSStoreV3 (path , key_separator = key_separator , auto_mkdir = True )
3186
+ store = FSStoreV3 (
3187
+ path ,
3188
+ key_separator = key_separator ,
3189
+ auto_mkdir = True ,
3190
+ ** fsspec_mapper_kwargs
3191
+ )
3192
+ cache_metadata = kwargs .pop ('cache_metadata' , True )
3193
+ cache_attrs = kwargs .pop ('cache_attrs' , True )
3194
+ write_empty_chunks = kwargs .pop ('write_empty_chunks' , True )
3195
+ kwargs .setdefault ('compressor' , Blosc ())
3196
+ init_array (store , path = array_path , ** kwargs )
3197
+ return Array (store , path = array_path , read_only = read_only , cache_metadata = cache_metadata ,
3198
+ cache_attrs = cache_attrs , write_empty_chunks = write_empty_chunks )
3199
+
3200
+ def expected (self ):
3201
+ return [
3202
+ "1509abec4285494b61cd3e8d21f44adc3cf8ddf6" ,
3203
+ "7cfb82ec88f7ecb7ab20ae3cb169736bc76332b8" ,
3204
+ "b663857bb89a8ab648390454954a9cdd453aa24b" ,
3205
+ "21e90fa927d09cbaf0e3b773130e2dc05d18ff9b" ,
3206
+ "e8c1fdd18b5c2ee050b59d0c8c95d07db642459c" ,
3207
+ ]
3208
+
3209
+
3210
+ @pytest .mark .skipif (have_fsspec is False , reason = "needs fsspec" )
3211
+ class TestArrayWithFSStoreV3FromFilesystem (TestArrayWithPathV3 , TestArrayWithFSStore ):
3212
+ @staticmethod
3213
+ def create_array (array_path = 'arr1' , read_only = False , ** kwargs ):
3214
+ from fsspec .implementations .local import LocalFileSystem
3215
+ fs = LocalFileSystem (auto_mkdir = True )
3216
+ path = mkdtemp ()
3217
+ atexit .register (shutil .rmtree , path )
3218
+ key_separator = kwargs .pop ('key_separator' , "." )
3219
+ store = FSStoreV3 (path , fs = fs , key_separator = key_separator , ** fsspec_mapper_kwargs )
3152
3220
cache_metadata = kwargs .pop ('cache_metadata' , True )
3153
3221
cache_attrs = kwargs .pop ('cache_attrs' , True )
3154
3222
write_empty_chunks = kwargs .pop ('write_empty_chunks' , True )
0 commit comments