Commit ef0b40d8 authored by Benjamin Peterson's avatar Benjamin Peterson

don't fail tests when www.python.org can't be validated by the system

parent 2afb8771
......@@ -691,6 +691,18 @@ def _is_ipv6_enabled():
IPV6_ENABLED = _is_ipv6_enabled()
def system_must_validate_cert(f):
"""Skip the test on TLS certificate validation failures."""
@functools.wraps(f)
def dec(*args, **kwargs):
try:
f(*args, **kwargs)
except IOError as e:
if e.reason == "CERTIFICATE_VERIFY_FAILED":
raise unittest.SkipTest("system does not contain "
"necessary certificates")
raise
return dec
# A constant likely larger than the underlying OS pipe buffer size, to
# make writes blocking.
......
......@@ -794,6 +794,7 @@ class HTTPSTest(TestCase):
resp = h.getresponse()
self.assertIn('nginx', resp.getheader('server'))
@support.system_must_validate_cert
def test_networked_trusted_by_default_cert(self):
# Default settings: requires a valid cert from a trusted CA
support.requires('network')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment