@@ -110,6 +110,7 @@ def setUpMocked(test):
110110local = '127.0.0.1'
111111crate_host = "{host}:{port}" .format (host = local , port = crate_port )
112112crate_uri = "http://%s" % crate_host
113+ crate_layer = None
113114
114115
115116def ensure_cratedb_layer ():
@@ -213,7 +214,7 @@ class Location(Base):
213214 test .globs ['CrateDialect' ] = CrateDialect
214215
215216
216- class HttpsTestServerLayer ( object ) :
217+ class HttpsTestServerLayer :
217218 PORT = 65534
218219 HOST = "localhost"
219220 CERT_FILE = os .path .abspath (os .path .join (os .path .dirname (__file__ ),
@@ -238,11 +239,11 @@ class HttpsHandler(BaseHTTPRequestHandler):
238239
239240 def do_GET (self ):
240241 self .send_response (200 )
241- self .send_header ("Content-Length" , len (self .payload ))
242+ payload = self .payload .encode ('UTF-8' )
243+ self .send_header ("Content-Length" , len (payload ))
242244 self .send_header ("Content-Type" , "application/json; charset=UTF-8" )
243245 self .end_headers ()
244- self .wfile .write (self .payload .encode ('UTF-8' ))
245- return
246+ self .wfile .write (payload )
246247
247248 def __init__ (self ):
248249 self .server = self .HttpsServer (
@@ -254,7 +255,7 @@ def setUp(self):
254255 thread = threading .Thread (target = self .serve_forever )
255256 thread .daemon = True # quit interpreter when only thread exists
256257 thread .start ()
257- time .sleep (1 )
258+ time .sleep (0.5 )
258259
259260 def serve_forever (self ):
260261 print ("listening on" , self .HOST , self .PORT )
0 commit comments