Fix CI for TLSv1.3
MODIFY
.travis.yml
.travis.yml
@@ -105,7 +105,6 @@ matrix:
- ./_travis/deploy.sh
allow_failures:
- - python: 3.8-dev
- python: pypy3.5-6.0
- python: pypy2.7-6.0

MODIFY
test/contrib/test_securetransport.py
test/contrib/test_securetransport.py
@@ -29,12 +29,14 @@ def teardown_module():
pass
+# Currently TLSv1.3 doesn't work with SecureTransport despite
+# Apple previously documenting support. See:
+# https://github.com/python-trio/trio/issues/1165#issuecomment-526563135
from ..with_dummyserver.test_https import ( # noqa: F401
TestHTTPS,
TestHTTPS_TLSv1,
TestHTTPS_TLSv1_1,
TestHTTPS_TLSv1_2,
- TestHTTPS_TLSv1_3,
)
from ..with_dummyserver.test_socketlevel import ( # noqa: F401
TestSNI,

MODIFY
test/with_dummyserver/test_connectionpool.py
test/with_dummyserver/test_connectionpool.py
@@ -738,7 +738,6 @@ class TestConnectionPool(HTTPDummyServerTestCase):
with HTTPConnectionPool(
self.host, self.port, source_address=addr, retries=False
) as pool:
- # FIXME: This assert flakes sometimes. Not sure why.
with pytest.raises(NewConnectionError):
pool.request("GET", "/source_address?{0}".format(addr))

MODIFY
test/with_dummyserver/test_https.py
test/with_dummyserver/test_https.py
@@ -75,6 +75,9 @@ TLSv1_1_CERTS["ssl_version"] = getattr(ssl, "PROTOCOL_TLSv1_1", None)
TLSv1_2_CERTS = DEFAULT_CERTS.copy()
TLSv1_2_CERTS["ssl_version"] = getattr(ssl, "PROTOCOL_TLSv1_2", None)
+TLSv1_3_CERTS = DEFAULT_CERTS.copy()
+TLSv1_3_CERTS["ssl_version"] = getattr(ssl, "PROTOCOL_TLS", None)
+
class TestHTTPS(HTTPSDummyServerTestCase):
tls_protocol_name = None
@@ -136,10 +139,12 @@ class TestHTTPS(HTTPSDummyServerTestCase):
):
raise
except ProtocolError as e:
- # https://github.com/urllib3/urllib3/issues/1422
if not (
"An existing connection was forcibly closed by the remote host"
in str(e)
+ # Python 3.7.4+
+ or "WSAECONNRESET" in str(e) # Windows
+ or "EPIPE" in str(e) # macOS
):
raise
@@ -721,6 +726,7 @@ class TestHTTPS_TLSv1_2(TestHTTPS):
@requiresTLSv1_3()
class TestHTTPS_TLSv1_3(TestHTTPS):
tls_protocol_name = "TLSv1.3"
+ certs = TLSv1_3_CERTS
class TestHTTPS_NoSAN(HTTPSDummyServerTestCase):

Fix CI for TLSv1.3 (#1671)