diff options
| author | Benjamin Peterson <benjamin@python.org> | 2014-11-25 18:05:40 -0600 |
|---|---|---|
| committer | Benjamin Peterson <benjamin@python.org> | 2014-11-25 18:05:40 -0600 |
| commit | 8dcaa4b1c6d98797120ce0a96d458f923505418d (patch) | |
| tree | ebb8628db718d57007177916a4a63338ab697f21 | |
| parent | 87f6c2212edf14a8e485aac073584ce779da578c (diff) | |
| parent | 6150804397cca2dbd5408e4cbb1fa2e3d224f51c (diff) | |
| download | cpython-git-8dcaa4b1c6d98797120ce0a96d458f923505418d.tar.gz | |
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 e6db70ff5c..d98068cac8 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 93c2212b6e..e693f8c8b3 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') |
