summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_ssl.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-05-22 11:22:28 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-05-22 11:22:28 (GMT)
commit2e7f39e889786f826b62fb5a18d75e56267c9c92 (patch)
tree9d3511c9d1bc80ee6bcf2929940bdeff80d74ae0 /Lib/test/test_ssl.py
parente91b305d28f15e2dcbd99ba47ff39808cb2bf4c4 (diff)
downloadcpython-2e7f39e889786f826b62fb5a18d75e56267c9c92.zip
cpython-2e7f39e889786f826b62fb5a18d75e56267c9c92.tar.gz
cpython-2e7f39e889786f826b62fb5a18d75e56267c9c92.tar.bz2
Issue #12012: test_ssl uses test_support.import_module()
Skip the whole file if the SSL module is missing. It was already the case, except that the SkipTest exception was raised in test_main(). This commit fixes an error in test_ssl if the ssl module is missing.
Diffstat (limited to 'Lib/test/test_ssl.py')
-rw-r--r--Lib/test/test_ssl.py10
1 files changed, 1 insertions, 9 deletions
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
index be2f51a..3df4d0c 100644
--- a/Lib/test/test_ssl.py
+++ b/Lib/test/test_ssl.py
@@ -20,12 +20,7 @@ import platform
from BaseHTTPServer import HTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
-# Optionally test SSL support, if we have it in the tested platform
-skip_expected = False
-try:
- import ssl
-except ImportError:
- skip_expected = True
+ssl = test_support.import_module("ssl")
HOST = test_support.HOST
CERTFILE = None
@@ -1334,9 +1329,6 @@ else:
def test_main(verbose=False):
- if skip_expected:
- raise unittest.SkipTest("No SSL support")
-
global CERTFILE, SVN_PYTHON_ORG_ROOT_CERT
CERTFILE = os.path.join(os.path.dirname(__file__) or os.curdir,
"keycert.pem")