Let test_ssl fail gracefully if ssl support is not available

This commit is contained in:
Antoine Pitrou 2010-10-13 11:38:36 +00:00
parent f26f87ef06
commit 05d936d2ce
1 changed files with 6 additions and 14 deletions

View File

@ -18,13 +18,8 @@ import weakref
import platform import platform
import functools import functools
# Optionally test SSL support, if we have it in the tested platform ssl = support.import_module("ssl")
skip_expected = False
try:
import ssl
except ImportError:
skip_expected = True
else:
PROTOCOLS = [ PROTOCOLS = [
ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv3,
ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_TLSv1 ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_TLSv1
@ -1489,9 +1484,6 @@ else:
def test_main(verbose=False): def test_main(verbose=False):
if skip_expected:
raise unittest.SkipTest("No SSL support")
if support.verbose: if support.verbose:
plats = { plats = {
'Linux': platform.linux_distribution, 'Linux': platform.linux_distribution,