Merge branch 'bugfix/relative_import_error' into 'release/v3.3'

bugfix: import error in example tests

See merge request espressif/esp-idf!11003
This commit is contained in:
He Yin Ling 2020-10-29 10:42:51 +08:00
commit 66d3783c89
6 changed files with 37 additions and 13 deletions

View file

@ -20,9 +20,13 @@ import sys
import re
import threading
import traceback
import Queue
import subprocess
try:
import Queue
except ImportError:
import queue as Queue
try:
# This environment variable is expected on the host machine
test_fw_path = os.getenv("TEST_FW_PATH")

View file

@ -2,11 +2,16 @@ import re
import os
import sys
import socket
import BaseHTTPServer
import SimpleHTTPServer
from threading import Thread
import ssl
try:
import BaseHTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
except ImportError:
import http.server as BaseHTTPServer
from http.server import SimpleHTTPRequestHandler
try:
import IDF
except ImportError:
@ -110,7 +115,7 @@ def get_ca_cert(ota_image_dir):
def start_https_server(ota_image_dir, server_ip, server_port):
server_file, key_file = get_ca_cert(ota_image_dir)
httpd = BaseHTTPServer.HTTPServer((server_ip, server_port),
SimpleHTTPServer.SimpleHTTPRequestHandler)
SimpleHTTPRequestHandler)
httpd.socket = ssl.wrap_socket(httpd.socket,
keyfile=key_file,
@ -128,7 +133,7 @@ def redirect_handler_factory(url):
"""
Returns a request handler class that redirects to supplied `url`
"""
class RedirectHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
class RedirectHandler(SimpleHTTPRequestHandler):
def do_GET(self):
print("Sending resp, URL: " + url)
self.send_response(301)

View file

@ -2,11 +2,16 @@ import re
import os
import sys
import socket
import BaseHTTPServer
import SimpleHTTPServer
from threading import Thread
import ssl
try:
import BaseHTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
except ImportError:
import http.server as BaseHTTPServer
from http.server import SimpleHTTPRequestHandler
try:
import IDF
except ImportError:
@ -110,7 +115,7 @@ def get_ca_cert(ota_image_dir):
def start_https_server(ota_image_dir, server_ip, server_port):
server_file, key_file = get_ca_cert(ota_image_dir)
httpd = BaseHTTPServer.HTTPServer((server_ip, server_port),
SimpleHTTPServer.SimpleHTTPRequestHandler)
SimpleHTTPRequestHandler)
httpd.socket = ssl.wrap_socket(httpd.socket,
keyfile=key_file,

View file

@ -2,11 +2,16 @@ import re
import os
import sys
import socket
import BaseHTTPServer
import SimpleHTTPServer
from threading import Thread
import ssl
try:
import BaseHTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
except ImportError:
import http.server as BaseHTTPServer
from http.server import SimpleHTTPRequestHandler
try:
import IDF
except ImportError:
@ -99,7 +104,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,

0
tools/ble/__init__.py Normal file
View file

View file

@ -35,8 +35,13 @@ except ImportError as e:
print("Run `pip install -r $IDF_PATH/tools/ble/requirements.txt` for resolving the issue")
raise
from . import lib_gatt
from . import lib_gap
try:
import lib_gatt
import lib_gap
except ImportError:
# for python3 assign_test
from . import lib_gatt
from . import lib_gap
srv_added_old_cnt = 0
srv_added_new_cnt = 0