mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-13 08:59:44 +08:00
fix: RefResolutionError on Windows platform
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
# Release History
|
||||
|
||||
## 2.5.1 (2020-01-02)
|
||||
|
||||
**Fixed**
|
||||
|
||||
- fix: RefResolutionError on Windows platform
|
||||
|
||||
## 2.5.0 (2020-01-01)
|
||||
|
||||
**Added**
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import json
|
||||
import os
|
||||
import platform
|
||||
|
||||
import jsonschema
|
||||
|
||||
@@ -17,8 +18,14 @@ with open(api_schema_path) as f:
|
||||
api_schema = json.load(f)
|
||||
|
||||
with open(common_schema_path) as f:
|
||||
if platform.system() == "Windows":
|
||||
absolute_base_path = 'file:///' + os.path.abspath(schemas_root_dir).replace("\\", "/") + '/'
|
||||
else:
|
||||
# Linux, Darwin
|
||||
absolute_base_path = "file://" + os.path.abspath(schemas_root_dir) + "/"
|
||||
|
||||
common_schema = json.load(f)
|
||||
resolver = jsonschema.RefResolver("file://{}/".format(os.path.abspath(schemas_root_dir)), common_schema)
|
||||
resolver = jsonschema.RefResolver(absolute_base_path, common_schema)
|
||||
|
||||
with open(testcase_schema_v1_path) as f:
|
||||
testcase_schema_v1 = json.load(f)
|
||||
|
||||
Reference in New Issue
Block a user