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
(cherry picked from commit 2915102)
  • Loading branch information
bdraco committed Aug 10, 2024
1 parent adf4dea commit fdc51e7
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions tests/test_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import uuid
from collections import deque
from contextlib import closing
from typing import Any, List, Optional
from typing import Any, List, Optional, Type
from unittest import mock

import pytest
Expand Down Expand Up @@ -1630,16 +1630,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 fdc51e7

Please sign in to comment.