@@ -110,6 +110,7 @@ def setUpMocked(test):
110
110
local = '127.0.0.1'
111
111
crate_host = "{host}:{port}" .format (host = local , port = crate_port )
112
112
crate_uri = "http://%s" % crate_host
113
+ crate_layer = None
113
114
114
115
115
116
def ensure_cratedb_layer ():
@@ -213,7 +214,7 @@ class Location(Base):
213
214
test .globs ['CrateDialect' ] = CrateDialect
214
215
215
216
216
- class HttpsTestServerLayer ( object ) :
217
+ class HttpsTestServerLayer :
217
218
PORT = 65534
218
219
HOST = "localhost"
219
220
CERT_FILE = os .path .abspath (os .path .join (os .path .dirname (__file__ ),
@@ -238,11 +239,11 @@ class HttpsHandler(BaseHTTPRequestHandler):
238
239
239
240
def do_GET (self ):
240
241
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 ))
242
244
self .send_header ("Content-Type" , "application/json; charset=UTF-8" )
243
245
self .end_headers ()
244
- self .wfile .write (self .payload .encode ('UTF-8' ))
245
- return
246
+ self .wfile .write (payload )
246
247
247
248
def __init__ (self ):
248
249
self .server = self .HttpsServer (
@@ -254,7 +255,7 @@ def setUp(self):
254
255
thread = threading .Thread (target = self .serve_forever )
255
256
thread .daemon = True # quit interpreter when only thread exists
256
257
thread .start ()
257
- time .sleep (1 )
258
+ time .sleep (0.5 )
258
259
259
260
def serve_forever (self ):
260
261
print ("listening on" , self .HOST , self .PORT )
0 commit comments