From 187dfc2bc83b6e64ac9b394810402bfd55c4a7ac Mon Sep 17 00:00:00 2001 From: hodbn Date: Wed, 24 Jun 2020 12:38:17 -0700 Subject: [PATCH] [1.25] Fix testing of SSLKEYLOGFILE on AppVeyor --- test/with_dummyserver/test_https.py | 10 ++-------- test/with_dummyserver/test_socketlevel.py | 5 +++-- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/test/with_dummyserver/test_https.py b/test/with_dummyserver/test_https.py index e0b2504b84..414aea49f0 100644 --- a/test/with_dummyserver/test_https.py +++ b/test/with_dummyserver/test_https.py @@ -698,16 +698,10 @@ def test_tls_protocol_name_of_socket(self): finally: conn.close() - @pytest.mark.skipif( - not hasattr(ssl.SSLContext, "keylog_filename"), - reason="requires OpenSSL 1.1.1+", - ) @pytest.mark.skipif(sys.version_info < (3, 8), reason="requires python 3.8+") - @pytest.mark.skipif( - sys.platform == "win32", - reason="does not work reliably in Appveyor test enviroment for not yet known reasons", - ) def test_sslkeylogfile(self, tmpdir, monkeypatch): + if not hasattr(util.SSLContext, "keylog_filename"): + pytest.skip("requires OpenSSL 1.1.1+") keylog_file = tmpdir.join("keylogfile.txt") monkeypatch.setenv("SSLKEYLOGFILE", str(keylog_file)) with HTTPSConnectionPool( diff --git a/test/with_dummyserver/test_socketlevel.py b/test/with_dummyserver/test_socketlevel.py index 2c3ba47d4b..9b49cdd590 100644 --- a/test/with_dummyserver/test_socketlevel.py +++ b/test/with_dummyserver/test_socketlevel.py @@ -10,8 +10,8 @@ ProtocolError, ) from urllib3.response import httplib +from urllib3 import util from urllib3.util import ssl_wrap_socket -from urllib3.util.ssl_ import HAS_SNI from urllib3.util import ssl_ from urllib3.util.timeout import Timeout from urllib3.util.retry import Retry @@ -87,8 +87,9 @@ def multicookie_response_handler(listener): class TestSNI(SocketDummyServerTestCase): - @pytest.mark.skipif(not HAS_SNI, reason="SNI-support not available") def test_hostname_in_first_request_packet(self): + if not util.HAS_SNI: + pytest.skip("SNI-support not available") done_receiving = Event() self.buf = b""