summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-10-13 11:38:36 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2010-10-13 11:38:36 (GMT)
commit05d936d2cece5ac9dc31a9477c6849e499d2bd5b (patch)
treeb57b3f9e8b7646f77e9c45934669454f485f1b4a
parentf26f87ef068f012da92f0e5985fe3b7773f1d403 (diff)
downloadcpython-05d936d2cece5ac9dc31a9477c6849e499d2bd5b.zip
cpython-05d936d2cece5ac9dc31a9477c6849e499d2bd5b.tar.gz
cpython-05d936d2cece5ac9dc31a9477c6849e499d2bd5b.tar.bz2
Let test_ssl fail gracefully if ssl support is not available
-rw-r--r--Lib/test/test_ssl.py20
1 files changed, 6 insertions, 14 deletions
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
index ca74e71..0c8a8e6 100644
--- a/Lib/test/test_ssl.py
+++ b/Lib/test/test_ssl.py
@@ -18,17 +18,12 @@ import weakref
import platform
import functools
-# Optionally test SSL support, if we have it in the tested platform
-skip_expected = False
-try:
- import ssl
-except ImportError:
- skip_expected = True
-else:
- PROTOCOLS = [
- ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv3,
- ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_TLSv1
- ]
+ssl = support.import_module("ssl")
+
+PROTOCOLS = [
+ ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv3,
+ ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_TLSv1
+]
HOST = support.HOST
@@ -1489,9 +1484,6 @@ else:
def test_main(verbose=False):
- if skip_expected:
- raise unittest.SkipTest("No SSL support")
-
if support.verbose:
plats = {
'Linux': platform.linux_distribution,