Commit 2e7f39e8 authored by Victor Stinner's avatar Victor Stinner

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.
parent e91b305d
...@@ -20,12 +20,7 @@ import platform ...@@ -20,12 +20,7 @@ import platform
from BaseHTTPServer import HTTPServer from BaseHTTPServer import HTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler from SimpleHTTPServer import SimpleHTTPRequestHandler
# Optionally test SSL support, if we have it in the tested platform ssl = test_support.import_module("ssl")
skip_expected = False
try:
import ssl
except ImportError:
skip_expected = True
HOST = test_support.HOST HOST = test_support.HOST
CERTFILE = None CERTFILE = None
...@@ -1334,9 +1329,6 @@ else: ...@@ -1334,9 +1329,6 @@ else:
def test_main(verbose=False): def test_main(verbose=False):
if skip_expected:
raise unittest.SkipTest("No SSL support")
global CERTFILE, SVN_PYTHON_ORG_ROOT_CERT global CERTFILE, SVN_PYTHON_ORG_ROOT_CERT
CERTFILE = os.path.join(os.path.dirname(__file__) or os.curdir, CERTFILE = os.path.join(os.path.dirname(__file__) or os.curdir,
"keycert.pem") "keycert.pem")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment