Skip to content

Commit

Permalink
Fix type ignore in SSLContext creation connector test (#8676)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco authored Aug 10, 2024
1 parent c3219bf commit 2915102
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions tests/test_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
Optional,
Sequence,
Tuple,
Type,
)
from unittest import mock

Expand Down Expand Up @@ -1799,16 +1800,14 @@ async def test_ssl_context_once() -> None:


@pytest.mark.parametrize("exception", [OSError, ssl.SSLError, asyncio.CancelledError])
async def test_ssl_context_creation_raises(exception: BaseException) -> None:
async def test_ssl_context_creation_raises(exception: Type[BaseException]) -> None:
"""Test that we try again if SSLContext creation fails the first time."""
conn = aiohttp.TCPConnector()
conn._made_ssl_context.clear()

with mock.patch.object(
conn, "_make_ssl_context", side_effect=exception
), pytest.raises( # type: ignore[call-overload]
exception
):
), pytest.raises(exception):
await conn._make_or_get_ssl_context(True)

assert isinstance(await conn._make_or_get_ssl_context(True), ssl.SSLContext)
Expand Down

0 comments on commit 2915102

Please sign in to comment.