aboutsummaryrefslogtreecommitdiffstats
path: root/src/scripts
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2019-05-30 20:14:08 -0400
committerJack Lloyd <[email protected]>2019-05-30 20:14:08 -0400
commitf6d6942a3e5f3883f419433d8701edf1397c652c (patch)
treeb629fca0f4923d8d19e8d793d8c06a91d9ea9a31 /src/scripts
parentd664ed58ea752d8ad5c828c70d45500d4ccb6b1f (diff)
Fixes for Python2
Diffstat (limited to 'src/scripts')
-rwxr-xr-xsrc/scripts/test_cli.py26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/scripts/test_cli.py b/src/scripts/test_cli.py
index 5c51f9083..baeb1d542 100755
--- a/src/scripts/test_cli.py
+++ b/src/scripts/test_cli.py
@@ -619,7 +619,13 @@ def cli_tls_http_server_tests(tmp_dir):
if not check_for_command("tls_http_server"):
return
- from http.client import HTTPSConnection
+ try:
+ from http.client import HTTPSConnection
+ except ImportError:
+ try:
+ from httplib import HTTPSConnection
+ except ImportError:
+ return
import ssl
server_port = random_port_number()
@@ -666,8 +672,22 @@ def cli_tls_proxy_tests(tmp_dir):
if not check_for_command("tls_proxy"):
return
- from http.client import HTTPSConnection
- from http.server import HTTPServer, BaseHTTPRequestHandler
+ try:
+ from http.client import HTTPSConnection
+ except ImportError:
+ try:
+ from httplib import HTTPSConnection
+ except ImportError:
+ return
+
+ try:
+ from httpx.server import HTTPServer, BaseHTTPRequestHandler
+ except ImportError:
+ try:
+ from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
+ except ImportError:
+ return
+
import ssl
import threading