diff options
author | Jack Lloyd <[email protected]> | 2019-05-30 20:14:08 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2019-05-30 20:14:08 -0400 |
commit | f6d6942a3e5f3883f419433d8701edf1397c652c (patch) | |
tree | b629fca0f4923d8d19e8d793d8c06a91d9ea9a31 /src/scripts | |
parent | d664ed58ea752d8ad5c828c70d45500d4ccb6b1f (diff) |
Fixes for Python2
Diffstat (limited to 'src/scripts')
-rwxr-xr-x | src/scripts/test_cli.py | 26 |
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 |