File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -258,7 +258,7 @@ def run_server():
258
258
data = common .to_str (data )
259
259
assert data .startswith ('stat: ' )
260
260
data = data .split ('stat:' )[1 ]
261
- stats = json . loads (data )
261
+ stats = shell . parse_json_in_str (data )
262
262
assert '7001' in stats
263
263
logging .info ('TCP statistics test passed' )
264
264
Original file line number Diff line number Diff line change @@ -148,8 +148,7 @@ def get_config(is_local):
148
148
logging .info ('loading config from %s' % config_path )
149
149
with open (config_path , 'rb' ) as f :
150
150
try :
151
- config = json .loads (f .read ().decode ('utf8' ),
152
- object_hook = _decode_dict )
151
+ config = parse_json_in_str (f .read ().decode ('utf8' ))
153
152
except ValueError as e :
154
153
logging .error ('found an error in config.json: %s' ,
155
154
e .message )
@@ -359,3 +358,8 @@ def _decode_dict(data):
359
358
value = _decode_dict (value )
360
359
rv [key ] = value
361
360
return rv
361
+
362
+
363
+ def parse_json_in_str (data ):
364
+ # parse json and convert everything from unicode to str
365
+ return json .loads (data , object_hook = _decode_dict )
You can’t perform that action at this time.
0 commit comments