bugfix: import error in example tests

This commit is contained in:
Chen Yu Dong
2020-10-29 15:44:28 +08:00
parent 25813ebe2b
commit 5a218fa9c6
4 changed files with 30 additions and 11 deletions

View File

@@ -1,8 +1,6 @@
import re
import os
import socket
import BaseHTTPServer
import SimpleHTTPServer
from threading import Thread
import ssl
@@ -11,6 +9,13 @@ import ttfw_idf
import random
import subprocess
try:
import BaseHTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
except ImportError:
import http.server as BaseHTTPServer
from http.server import SimpleHTTPRequestHandler
server_cert = "-----BEGIN CERTIFICATE-----\n" \
"MIIDXTCCAkWgAwIBAgIJAP4LF7E72HakMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV\n"\
"BAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRlcm5ldCBX\n"\
@@ -85,7 +90,7 @@ def start_https_server(ota_image_dir, server_ip, server_port):
key_file_handle.close()
httpd = BaseHTTPServer.HTTPServer((server_ip, server_port),
SimpleHTTPServer.SimpleHTTPRequestHandler)
SimpleHTTPRequestHandler)
httpd.socket = ssl.wrap_socket(httpd.socket,
keyfile=key_file,