mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-13 00:11:28 +08:00
fix #835: UnicodeDecodeError when loading json schema files
This commit is contained in:
@@ -1,5 +1,12 @@
|
|||||||
# Release History
|
# Release History
|
||||||
|
|
||||||
|
## 2.5.4 (2020-01-03)
|
||||||
|
|
||||||
|
**Fixed**
|
||||||
|
|
||||||
|
- fix #835: UnicodeDecodeError when loading json schema files
|
||||||
|
|
||||||
|
|
||||||
## 2.5.3 (2020-01-03)
|
## 2.5.3 (2020-01-03)
|
||||||
|
|
||||||
**Fixed**
|
**Fixed**
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import io
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import platform
|
import platform
|
||||||
@@ -14,10 +15,10 @@ testcase_schema_v2_path = os.path.join(schemas_root_dir, "testcase.schema.v2.jso
|
|||||||
testsuite_schema_v1_path = os.path.join(schemas_root_dir, "testsuite.schema.v1.json")
|
testsuite_schema_v1_path = os.path.join(schemas_root_dir, "testsuite.schema.v1.json")
|
||||||
testsuite_schema_v2_path = os.path.join(schemas_root_dir, "testsuite.schema.v2.json")
|
testsuite_schema_v2_path = os.path.join(schemas_root_dir, "testsuite.schema.v2.json")
|
||||||
|
|
||||||
with open(api_schema_path) as f:
|
with io.open(api_schema_path, encoding='utf-8') as f:
|
||||||
api_schema = json.load(f)
|
api_schema = json.load(f)
|
||||||
|
|
||||||
with open(common_schema_path) as f:
|
with io.open(common_schema_path, encoding='utf-8') as f:
|
||||||
if platform.system() == "Windows":
|
if platform.system() == "Windows":
|
||||||
absolute_base_path = 'file:///' + os.path.abspath(schemas_root_dir).replace("\\", "/") + '/'
|
absolute_base_path = 'file:///' + os.path.abspath(schemas_root_dir).replace("\\", "/") + '/'
|
||||||
else:
|
else:
|
||||||
@@ -27,16 +28,16 @@ with open(common_schema_path) as f:
|
|||||||
common_schema = json.load(f)
|
common_schema = json.load(f)
|
||||||
resolver = jsonschema.RefResolver(absolute_base_path, common_schema)
|
resolver = jsonschema.RefResolver(absolute_base_path, common_schema)
|
||||||
|
|
||||||
with open(testcase_schema_v1_path) as f:
|
with io.open(testcase_schema_v1_path, encoding='utf-8') as f:
|
||||||
testcase_schema_v1 = json.load(f)
|
testcase_schema_v1 = json.load(f)
|
||||||
|
|
||||||
with open(testcase_schema_v2_path) as f:
|
with io.open(testcase_schema_v2_path, encoding='utf-8') as f:
|
||||||
testcase_schema_v2 = json.load(f)
|
testcase_schema_v2 = json.load(f)
|
||||||
|
|
||||||
with open(testsuite_schema_v1_path) as f:
|
with io.open(testsuite_schema_v1_path, encoding='utf-8') as f:
|
||||||
testsuite_schema_v1 = json.load(f)
|
testsuite_schema_v1 = json.load(f)
|
||||||
|
|
||||||
with open(testsuite_schema_v2_path) as f:
|
with io.open(testsuite_schema_v2_path, encoding='utf-8') as f:
|
||||||
testsuite_schema_v2 = json.load(f)
|
testsuite_schema_v2 = json.load(f)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user