Skip to content

Commit cc198b2

Browse files
committed
cover
1 parent fac77ed commit cc198b2

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

tests/test_server_disconnected_retry.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ async def test_post_xml_without_retry_decorator_fails() -> None:
292292
"""Test that without the retry decorator on post_xml, ServerDisconnectedError propagates."""
293293

294294
# Create a mock session
295-
mock_session: Mock = Mock(spec=ClientSession)
295+
mock_session = Mock(spec=ClientSession)
296296
mock_session.timeout = Mock(total=30, sock_read=10)
297297

298298
# Create the base transport (without retry decorator)
@@ -318,7 +318,7 @@ async def test_post_xml_without_retry_decorator_fails() -> None:
318318

319319

320320
@pytest.mark.asyncio
321-
async def test_post_xml_with_retry_decorator_succeeds():
321+
async def test_post_xml_with_retry_decorator_succeeds() -> None:
322322
"""Test that with the retry decorator on post_xml, ServerDisconnectedError is retried."""
323323

324324
# Create a mock session
@@ -360,7 +360,7 @@ async def test_post_xml_with_retry_decorator_succeeds():
360360

361361

362362
@pytest.mark.asyncio
363-
async def test_post_xml_decorator_is_applied():
363+
async def test_post_xml_decorator_is_applied() -> None:
364364
"""Verify that the post_xml method has the retry decorator applied."""
365365

366366
# Check that AsyncTransportProtocolErrorHandler.post_xml has the decorator
@@ -401,7 +401,7 @@ async def test_post_xml_decorator_is_applied():
401401

402402

403403
@pytest.mark.asyncio
404-
async def test_retry_only_for_server_disconnected():
404+
async def test_retry_only_for_server_disconnected() -> None:
405405
"""Test that retry only happens for ServerDisconnectedError, not other exceptions."""
406406

407407
mock_session = Mock(spec=ClientSession)
@@ -420,9 +420,8 @@ async def test_retry_only_for_server_disconnected():
420420
side_effect=aiohttp.ClientError("Different error")
421421
)
422422

423-
with pytest.raises(aiohttp.ClientError) as exc_info:
423+
with pytest.raises(aiohttp.ClientError, match="Different error"):
424424
await transport.post_xml("http://example.com/onvif", mock_envelope, {})
425425

426-
assert str(exc_info.value) == "Different error"
427426
# Should only be called once (no retry for other errors)
428427
assert mock_session.post.call_count == 1

0 commit comments

Comments
 (0)