@@ -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__ ),
@@ -241,11 +242,11 @@ class HttpsHandler(BaseHTTPRequestHandler):
241
242
242
243
def do_GET (self ):
243
244
self .send_response (200 )
244
- self .send_header ("Content-Length" , len (self .payload ))
245
+ payload = self .payload .encode ('UTF-8' )
246
+ self .send_header ("Content-Length" , len (payload ))
245
247
self .send_header ("Content-Type" , "application/json; charset=UTF-8" )
246
248
self .end_headers ()
247
- self .wfile .write (self .payload .encode ('UTF-8' ))
248
- return
249
+ self .wfile .write (payload )
249
250
250
251
def __init__ (self ):
251
252
self .server = self .HttpsServer (
@@ -257,7 +258,7 @@ def setUp(self):
257
258
thread = threading .Thread (target = self .serve_forever )
258
259
thread .daemon = True # quit interpreter when only thread exists
259
260
thread .start ()
260
- time .sleep (1 )
261
+ time .sleep (0.5 )
261
262
262
263
def serve_forever (self ):
263
264
print ("listening on" , self .HOST , self .PORT )
0 commit comments