@@ -121,7 +121,7 @@ async def test_store_context_manager(self, open_kwargs: dict[str, Any]) -> None:
121121 with await self .store_cls .open (** open_kwargs ) as store :
122122 assert store ._is_open
123123 # Test trying to open an already open store
124- with pytest .raises (ValueError ):
124+ with pytest .raises (ValueError , match = "store is already open" ):
125125 await store ._open ()
126126 assert not store ._is_open
127127
@@ -131,11 +131,15 @@ async def test_read_only_store_raises(self, open_kwargs: dict[str, Any]) -> None
131131 assert store .read_only
132132
133133 # set
134- with pytest .raises (ValueError ):
134+ with pytest .raises (
135+ ValueError , match = "store was opened in read-only mode and does not support writing"
136+ ):
135137 await store .set ("foo" , self .buffer_cls .from_bytes (b"bar" ))
136138
137139 # delete
138- with pytest .raises (ValueError ):
140+ with pytest .raises (
141+ ValueError , match = "store was opened in read-only mode and does not support writing"
142+ ):
139143 await store .delete ("foo" )
140144
141145 @pytest .mark .parametrize ("key" , ["c/0" , "foo/c/0.0" , "foo/0/0" ])
@@ -171,7 +175,7 @@ async def test_get_raises(self, store: S) -> None:
171175 """
172176 data_buf = self .buffer_cls .from_bytes (b"\x01 \x02 \x03 \x04 " )
173177 await self .set (store , "c/0" , data_buf )
174- with pytest .raises ((ValueError , TypeError )):
178+ with pytest .raises ((ValueError , TypeError ), match = r"Unexpected byte_range, got.*" ):
175179 await store .get ("c/0" , prototype = default_buffer_prototype (), byte_range = (0 , 2 )) # type: ignore[arg-type]
176180
177181 async def test_get_many (self , store : S ) -> None :
@@ -222,7 +226,7 @@ async def test_getsize_prefix(self, store: S) -> None:
222226
223227 async def test_getsize_raises (self , store : S ) -> None :
224228 """
225- Test the result of store. getsize().
229+ Test that getsize() raise a FileNotFoundError if the key doesn't exist .
226230 """
227231 with pytest .raises (FileNotFoundError ):
228232 await store .getsize ("c/1000" )
@@ -266,7 +270,10 @@ async def test_set_invalid_buffer(self, store: S) -> None:
266270 """
267271 Ensure that set raises a Type or Value Error for invalid buffer arguments.
268272 """
269- with pytest .raises ((ValueError , TypeError )):
273+ with pytest .raises (
274+ (ValueError , TypeError ),
275+ match = r"\S+\.set\(\): `value` must be a Buffer instance. Got an instance of <class 'int'> instead." ,
276+ ):
270277 await store .set ("c/0" , 0 ) # type: ignore[arg-type]
271278
272279 @pytest .mark .parametrize (
0 commit comments