diff options
author | Benjamin Peterson <benjamin@python.org> | 2014-11-25 21:16:55 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2014-11-25 21:16:55 (GMT) |
commit | 2615e9e29309bae509d70039f08b452cd3281700 (patch) | |
tree | 041952eb80f85a9920fb3d506a563e31ec162626 /Lib/test/support | |
parent | 5ef586f25a6d5128a15341e849d7dca4fe882d22 (diff) | |
download | cpython-2615e9e29309bae509d70039f08b452cd3281700.zip cpython-2615e9e29309bae509d70039f08b452cd3281700.tar.gz cpython-2615e9e29309bae509d70039f08b452cd3281700.tar.bz2 |
don't fail tests when www.python.org can't be validated by the system
Diffstat (limited to 'Lib/test/support')
-rw-r--r-- | Lib/test/support/__init__.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index e6db70f..253f319 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 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. |