File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -879,6 +879,37 @@ def test_create(self):
879
879
with pytest .raises (PermissionError ):
880
880
g .data [:] = 1
881
881
882
+ def test_read_only (self ):
883
+ path = tempfile .mkdtemp ()
884
+ atexit .register (atexit_rmtree , path )
885
+ store = FSStore (path )
886
+ store ['foo' ] = b"bar"
887
+
888
+ store = FSStore (path , mode = 'r' )
889
+
890
+ with pytest .raises (PermissionError ):
891
+ store ['foo' ] = b"hex"
892
+
893
+ with pytest .raises (PermissionError ):
894
+ del store ['foo' ]
895
+
896
+ with pytest .raises (PermissionError ):
897
+ store .clear ()
898
+
899
+ with pytest .raises (PermissionError ):
900
+ store .rmdir ("anydir" )
901
+
902
+ assert store ['foo' ] == b"bar"
903
+
904
+ filepath = os .path .join (path , "foo" )
905
+ with pytest .raises (ValueError ):
906
+ FSStore (filepath , mode = 'r' )
907
+
908
+ def test_eq (self ):
909
+ store1 = FSStore ("anypath" )
910
+ store2 = FSStore ("anypath" )
911
+ assert store1 == store2
912
+
882
913
883
914
class TestNestedDirectoryStore (TestDirectoryStore , unittest .TestCase ):
884
915
You can’t perform that action at this time.
0 commit comments