@@ -221,12 +221,9 @@ def test_sync_extension_create_rejects_invalid_params_type():
221221 manager .create ({"name" : "bad" , "filePath" : "/tmp/ext.zip" }) # type: ignore[arg-type]
222222
223223
224- def test_sync_extension_create_wraps_invalid_params_file_path_state (tmp_path ):
224+ def test_sync_extension_create_rejects_subclass_params (tmp_path ):
225225 class _BrokenParams (CreateExtensionParams ):
226- def __getattribute__ (self , item : str ):
227- if item == "file_path" :
228- raise RuntimeError ("broken file_path state" )
229- return super ().__getattribute__ (item )
226+ pass
230227
231228 manager = SyncExtensionManager (_FakeClient (_SyncTransport ()))
232229 params = _BrokenParams (
@@ -235,28 +232,7 @@ def __getattribute__(self, item: str):
235232 )
236233
237234 with pytest .raises (
238- HyperbrowserError , match = "params.file_path is invalid"
239- ) as exc_info :
240- manager .create (params )
241-
242- assert isinstance (exc_info .value .original_error , RuntimeError )
243-
244-
245- def test_sync_extension_create_preserves_hyperbrowser_file_path_state_errors (tmp_path ):
246- class _BrokenParams (CreateExtensionParams ):
247- def __getattribute__ (self , item : str ):
248- if item == "file_path" :
249- raise HyperbrowserError ("custom file_path state failure" )
250- return super ().__getattribute__ (item )
251-
252- manager = SyncExtensionManager (_FakeClient (_SyncTransport ()))
253- params = _BrokenParams (
254- name = "bad-extension" ,
255- file_path = _create_test_extension_zip (tmp_path ),
256- )
257-
258- with pytest .raises (
259- HyperbrowserError , match = "custom file_path state failure"
235+ HyperbrowserError , match = "params must be CreateExtensionParams"
260236 ) as exc_info :
261237 manager .create (params )
262238
@@ -293,12 +269,9 @@ async def run():
293269 asyncio .run (run ())
294270
295271
296- def test_async_extension_create_wraps_invalid_params_file_path_state (tmp_path ):
272+ def test_async_extension_create_rejects_subclass_params (tmp_path ):
297273 class _BrokenParams (CreateExtensionParams ):
298- def __getattribute__ (self , item : str ):
299- if item == "file_path" :
300- raise RuntimeError ("broken file_path state" )
301- return super ().__getattribute__ (item )
274+ pass
302275
303276 manager = AsyncExtensionManager (_FakeClient (_AsyncTransport ()))
304277 params = _BrokenParams (
@@ -308,30 +281,7 @@ def __getattribute__(self, item: str):
308281
309282 async def run ():
310283 with pytest .raises (
311- HyperbrowserError , match = "params.file_path is invalid"
312- ) as exc_info :
313- await manager .create (params )
314- assert isinstance (exc_info .value .original_error , RuntimeError )
315-
316- asyncio .run (run ())
317-
318-
319- def test_async_extension_create_preserves_hyperbrowser_file_path_state_errors (tmp_path ):
320- class _BrokenParams (CreateExtensionParams ):
321- def __getattribute__ (self , item : str ):
322- if item == "file_path" :
323- raise HyperbrowserError ("custom file_path state failure" )
324- return super ().__getattribute__ (item )
325-
326- manager = AsyncExtensionManager (_FakeClient (_AsyncTransport ()))
327- params = _BrokenParams (
328- name = "bad-extension" ,
329- file_path = _create_test_extension_zip (tmp_path ),
330- )
331-
332- async def run ():
333- with pytest .raises (
334- HyperbrowserError , match = "custom file_path state failure"
284+ HyperbrowserError , match = "params must be CreateExtensionParams"
335285 ) as exc_info :
336286 await manager .create (params )
337287 assert exc_info .value .original_error is None
0 commit comments