File tree Expand file tree Collapse file tree 3 files changed +18
-2
lines changed Expand file tree Collapse file tree 3 files changed +18
-2
lines changed Original file line number Diff line number Diff line change
1
+ from pathlib import Path
2
+
3
+ import pytest
4
+
5
+
6
+ @pytest .fixture (params = [str , Path ])
7
+ def path_type (request ):
8
+ return request .param
Original file line number Diff line number Diff line change 27
27
atexit_rmtree , getsize )
28
28
29
29
30
- def test_open_array ():
30
+ def test_open_array (path_type ):
31
31
32
32
store = tempfile .mkdtemp ()
33
33
atexit .register (atexit_rmtree , store )
34
+ store = path_type (store )
34
35
35
36
# open array, create if doesn't exist
36
37
z = open (store , mode = 'a' , shape = 100 )
@@ -53,10 +54,11 @@ def test_open_array():
53
54
open ('doesnotexist' , mode = 'r' )
54
55
55
56
56
- def test_open_group ():
57
+ def test_open_group (path_type ):
57
58
58
59
store = tempfile .mkdtemp ()
59
60
atexit .register (atexit_rmtree , store )
61
+ store = path_type (store )
60
62
61
63
# open group, create if doesn't exist
62
64
g = open (store , mode = 'a' )
Original file line number Diff line number Diff line change 2
2
import atexit
3
3
import json
4
4
import os
5
+ from pathlib import Path
5
6
import sys
6
7
import pickle
7
8
import shutil
@@ -836,6 +837,11 @@ def test_filesystem_path(self):
836
837
with pytest .raises (ValueError ):
837
838
DirectoryStore (f .name )
838
839
840
+ def test_init_pathlib (self ):
841
+ path = tempfile .mkdtemp ()
842
+ atexit .register (atexit_rmtree , path )
843
+ DirectoryStore (Path (path ))
844
+
839
845
def test_pickle_ext (self ):
840
846
store = self .create_store ()
841
847
store2 = pickle .loads (pickle .dumps (store ))
You can’t perform that action at this time.
0 commit comments