diff options
author | Bastian Venthur <bastian.venthur@flixbus.com> | 2022-11-21 20:29:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-21 13:29:38 -0600 |
commit | fe39ebfb948db43002547b9258273182705b5434 (patch) | |
tree | 12d79a30dcbcecfe6f77d6ed8f64b490cdc207fc /test/with_dummyserver/test_https.py | |
parent | 61ce98512d0956430ca0a9283829a7852068f144 (diff) | |
download | urllib3-fe39ebfb948db43002547b9258273182705b5434.tar.gz |
Use the typing namespace and from __future__ import annotations
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
Diffstat (limited to 'test/with_dummyserver/test_https.py')
-rw-r--r-- | test/with_dummyserver/test_https.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/test/with_dummyserver/test_https.py b/test/with_dummyserver/test_https.py index 6e4c7cef..c386d418 100644 --- a/test/with_dummyserver/test_https.py +++ b/test/with_dummyserver/test_https.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import datetime import logging import os.path @@ -17,7 +19,6 @@ from test import ( resolvesLocalhostFQDN, ) from test.conftest import ServerConfig -from typing import List, Optional from unittest import mock import pytest @@ -77,12 +78,12 @@ CLIENT_CERT = CLIENT_INTERMEDIATE_PEM class TestHTTPS(HTTPSDummyServerTestCase): - tls_protocol_name: Optional[str] = None + tls_protocol_name: str | None = None def tls_protocol_not_default(self) -> bool: return self.tls_protocol_name in {"TLSv1", "TLSv1.1"} - def tls_version(self) -> "ssl.TLSVersion": + def tls_version(self) -> ssl.TLSVersion: if self.tls_protocol_name is None: return pytest.skip("Skipping base test class") try: @@ -735,7 +736,7 @@ class TestHTTPS(HTTPSDummyServerTestCase): def _request_without_resource_warnings( self, method: str, url: str - ) -> List[warnings.WarningMessage]: + ) -> list[warnings.WarningMessage]: with warnings.catch_warnings(record=True) as w: warnings.simplefilter("always") with HTTPSConnectionPool( @@ -839,7 +840,7 @@ class TestHTTPS(HTTPSDummyServerTestCase): "ssl_version", [None, ssl.PROTOCOL_TLS, ssl.PROTOCOL_TLS_CLIENT] ) def test_ssl_version_with_protocol_tls_or_client_not_deprecated( - self, ssl_version: Optional[int] + self, ssl_version: int | None ) -> None: if self.tls_protocol_name is None: pytest.skip("Skipping base test class") @@ -937,7 +938,7 @@ class TestHTTPS(HTTPSDummyServerTestCase): @pytest.mark.parametrize("sslkeylogfile", [None, ""]) def test_sslkeylogfile_empty( - self, monkeypatch: pytest.MonkeyPatch, sslkeylogfile: Optional[str] + self, monkeypatch: pytest.MonkeyPatch, sslkeylogfile: str | None ) -> None: # Assert that an HTTPS connection doesn't error out when given # no SSLKEYLOGFILE or an empty value (ie 'SSLKEYLOGFILE=') @@ -1070,7 +1071,7 @@ class TestHTTPS_Hostname: except AttributeError: pytest.skip("Couldn't set 'SSLContext.hostname_checks_common_name'") - err: Optional[MaxRetryError] + err: MaxRetryError | None try: with HTTPSConnectionPool( no_san_server.host, |