summaryrefslogtreecommitdiffstats
path: root/Lib/test/support
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/support')
-rw-r--r--Lib/test/support/__init__.py12
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.