[Python-checkins] r85413 - python/branches/py3k/Lib/test/test_ssl.py

antoine.pitrou python-checkins at python.org
Wed Oct 13 13:38:37 CEST 2010


Author: antoine.pitrou
Date: Wed Oct 13 13:38:36 2010
New Revision: 85413

Log:
Let test_ssl fail gracefully if ssl support is not available



Modified:
   python/branches/py3k/Lib/test/test_ssl.py

Modified: python/branches/py3k/Lib/test/test_ssl.py
==============================================================================
--- python/branches/py3k/Lib/test/test_ssl.py	(original)
+++ python/branches/py3k/Lib/test/test_ssl.py	Wed Oct 13 13:38:36 2010
@@ -18,17 +18,12 @@
 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 @@
 
 
 def test_main(verbose=False):
-    if skip_expected:
-        raise unittest.SkipTest("No SSL support")
-
     if support.verbose:
         plats = {
             'Linux': platform.linux_distribution,


More information about the Python-checkins mailing list