Skip to content

Commit

Permalink
[PR #8676/2915102 backport][3.10] Fix type ignore in SSLContext creat…
Browse files Browse the repository at this point in the history
…ion connector test (#8677)
  • Loading branch information
bdraco authored Aug 10, 2024
1 parent f3fcba4 commit 73d17d4
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 73d17d4

Please sign in to comment.