diff options
author | Benjamin Peterson <benjamin@python.org> | 2014-11-26 00:05:40 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2014-11-26 00:05:40 (GMT) |
commit | 8dcaa4b1c6d98797120ce0a96d458f923505418d (patch) | |
tree | ebb8628db718d57007177916a4a63338ab697f21 | |
parent | 87f6c2212edf14a8e485aac073584ce779da578c (diff) | |
parent | 6150804397cca2dbd5408e4cbb1fa2e3d224f51c (diff) | |
download | cpython-8dcaa4b1c6d98797120ce0a96d458f923505418d.zip cpython-8dcaa4b1c6d98797120ce0a96d458f923505418d.tar.gz cpython-8dcaa4b1c6d98797120ce0a96d458f923505418d.tar.bz2 |
merge 3.4
-rw-r--r-- | Lib/test/support/__init__.py | 12 | ||||
-rw-r--r-- | Lib/test/test_httplib.py | 1 |
2 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index e6db70f..d98068c 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -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 "CERTIFICATE_VERIFY_FAILED" in str(e): + 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. diff --git a/Lib/test/test_httplib.py b/Lib/test/test_httplib.py index 93c2212..e693f8c 100644 --- a/Lib/test/test_httplib.py +++ b/Lib/test/test_httplib.py @@ -1028,6 +1028,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') |