@@ -297,7 +297,9 @@ async def test_no_retry_with_proper_connection_close(
297
297
298
298
299
299
@pytest .mark .asyncio
300
- async def test_post_xml_without_retry_decorator_fails (mock_etree_to_string ) -> None :
300
+ async def test_post_xml_without_retry_decorator_fails (
301
+ mock_etree_to_string : MagicMock ,
302
+ ) -> None :
301
303
"""Test that without the retry decorator on post_xml, ServerDisconnectedError propagates."""
302
304
303
305
# Create a mock session
@@ -325,7 +327,9 @@ async def test_post_xml_without_retry_decorator_fails(mock_etree_to_string) -> N
325
327
326
328
327
329
@pytest .mark .asyncio
328
- async def test_post_xml_with_retry_decorator_succeeds (mock_etree_to_string ) -> None :
330
+ async def test_post_xml_with_retry_decorator_succeeds (
331
+ mock_etree_to_string : MagicMock ,
332
+ ) -> None :
329
333
"""Test that with the retry decorator on post_xml, ServerDisconnectedError is retried."""
330
334
331
335
# Create a mock session
@@ -404,7 +408,9 @@ async def test_post_xml_decorator_is_applied(mock_etree_to_string: MagicMock) ->
404
408
405
409
406
410
@pytest .mark .asyncio
407
- async def test_retry_only_for_server_disconnected () -> None :
411
+ async def test_retry_only_for_server_disconnected (
412
+ mock_etree_to_string : MagicMock ,
413
+ ) -> None :
408
414
"""Test that retry only happens for ServerDisconnectedError, not other exceptions."""
409
415
410
416
mock_session = Mock (spec = ClientSession )
@@ -417,14 +423,11 @@ async def test_retry_only_for_server_disconnected() -> None:
417
423
mock_envelope = Mock ()
418
424
mock_envelope .tag = "TestEnvelope"
419
425
420
- with patch ("onvif.zeep_aiohttp.etree_to_string" , return_value = b"<test/>" ):
421
- # Different error type should not retry
422
- mock_session .post = AsyncMock (
423
- side_effect = aiohttp .ClientError ("Different error" )
424
- )
426
+ # Different error type should not retry
427
+ mock_session .post = AsyncMock (side_effect = aiohttp .ClientError ("Different error" ))
425
428
426
- with pytest .raises (aiohttp .ClientError , match = "Different error" ):
427
- await transport .post_xml ("http://example.com/onvif" , mock_envelope , {})
429
+ with pytest .raises (aiohttp .ClientError , match = "Different error" ):
430
+ await transport .post_xml ("http://example.com/onvif" , mock_envelope , {})
428
431
429
- # Should only be called once (no retry for other errors)
430
- assert mock_session .post .call_count == 1
432
+ # Should only be called once (no retry for other errors)
433
+ assert mock_session .post .call_count == 1
0 commit comments