From 7dc80c9c81cbde5f48ddfdfdbd218229479b4b7c Mon Sep 17 00:00:00 2001 From: debugtalk Date: Thu, 2 Jan 2020 15:29:37 +0800 Subject: [PATCH 1/6] fix: RefResolutionError on Windows platform --- docs/CHANGELOG.md | 6 ++++++ httprunner/loader/check.py | 9 ++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index e2a1294b..5de875a4 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -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** diff --git a/httprunner/loader/check.py b/httprunner/loader/check.py index b011be1a..ce8ec494 100644 --- a/httprunner/loader/check.py +++ b/httprunner/loader/check.py @@ -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) From 5eaec0ded291d27e35590c9055d27900e8691953 Mon Sep 17 00:00:00 2001 From: debugtalk Date: Thu, 2 Jan 2020 15:31:23 +0800 Subject: [PATCH 2/6] update version --- httprunner/__init__.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/httprunner/__init__.py b/httprunner/__init__.py index 08dc03ae..b11684b6 100644 --- a/httprunner/__init__.py +++ b/httprunner/__init__.py @@ -1,4 +1,4 @@ -__version__ = "2.5.0" +__version__ = "2.5.1" __description__ = "One-stop solution for HTTP(S) testing." __all__ = ["__version__", "__description__"] diff --git a/pyproject.toml b/pyproject.toml index e107f6be..8a3e70a2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "httprunner" -version = "2.5.0" +version = "2.5.1" description = "One-stop solution for HTTP(S) testing." license = "Apache-2.0" readme = "README.md" From 794b267fea391ad6fd4689fe44b18b8215af5061 Mon Sep 17 00:00:00 2001 From: debugtalk Date: Thu, 2 Jan 2020 15:38:35 +0800 Subject: [PATCH 3/6] test: run tests on windows --- .github/workflows/integration_test.yml | 2 +- .github/workflows/unittest.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration_test.yml b/.github/workflows/integration_test.yml index c81d9c3d..07fb921b 100644 --- a/.github/workflows/integration_test.yml +++ b/.github/workflows/integration_test.yml @@ -11,7 +11,7 @@ jobs: max-parallel: 6 matrix: python-version: [2.7, 3.5, 3.6, 3.7, 3.8] - os: [ubuntu-latest, macos-latest] # TODO: windows-latest + os: [ubuntu-latest, macos-latest, windows-latest] steps: - uses: actions/checkout@v1 diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index 9f17e242..2a4fcde6 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -11,7 +11,7 @@ jobs: max-parallel: 12 matrix: python-version: [2.7, 3.5, 3.6, 3.7] # TODO: 3.8 - os: [ubuntu-latest, macos-latest] # TODO: windows-latest + os: [ubuntu-latest, macos-latest, windows-latest] steps: - uses: actions/checkout@v1 From 36bd0bb3469376693fa73c99c2cf8733dd50b6a6 Mon Sep 17 00:00:00 2001 From: debugtalk Date: Thu, 2 Jan 2020 15:47:34 +0800 Subject: [PATCH 4/6] tmp: run tests only on windows --- .github/workflows/integration_test.yml | 2 +- .github/workflows/unittest.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration_test.yml b/.github/workflows/integration_test.yml index 07fb921b..ffa8f255 100644 --- a/.github/workflows/integration_test.yml +++ b/.github/workflows/integration_test.yml @@ -11,7 +11,7 @@ jobs: max-parallel: 6 matrix: python-version: [2.7, 3.5, 3.6, 3.7, 3.8] - os: [ubuntu-latest, macos-latest, windows-latest] + os: [windows-latest] steps: - uses: actions/checkout@v1 diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index 2a4fcde6..728017c3 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -11,7 +11,7 @@ jobs: max-parallel: 12 matrix: python-version: [2.7, 3.5, 3.6, 3.7] # TODO: 3.8 - os: [ubuntu-latest, macos-latest, windows-latest] + os: [windows-latest] steps: - uses: actions/checkout@v1 From 72c3f7aacfc728b693677936e4a2ca3138d0167f Mon Sep 17 00:00:00 2001 From: debugtalk Date: Thu, 2 Jan 2020 16:05:48 +0800 Subject: [PATCH 5/6] tmp: remove tests on windows --- .github/workflows/integration_test.yml | 2 +- .github/workflows/unittest.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration_test.yml b/.github/workflows/integration_test.yml index ffa8f255..c81d9c3d 100644 --- a/.github/workflows/integration_test.yml +++ b/.github/workflows/integration_test.yml @@ -11,7 +11,7 @@ jobs: max-parallel: 6 matrix: python-version: [2.7, 3.5, 3.6, 3.7, 3.8] - os: [windows-latest] + os: [ubuntu-latest, macos-latest] # TODO: windows-latest steps: - uses: actions/checkout@v1 diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index 728017c3..9f17e242 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -11,7 +11,7 @@ jobs: max-parallel: 12 matrix: python-version: [2.7, 3.5, 3.6, 3.7] # TODO: 3.8 - os: [windows-latest] + os: [ubuntu-latest, macos-latest] # TODO: windows-latest steps: - uses: actions/checkout@v1 From 270bf97e4c0118ea045b4f1340704a99c3749ee4 Mon Sep 17 00:00:00 2001 From: debugtalk Date: Thu, 2 Jan 2020 16:06:04 +0800 Subject: [PATCH 6/6] doc: update cli help --- httprunner/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/httprunner/cli.py b/httprunner/cli.py index 1314cb8a..0ffb17d6 100644 --- a/httprunner/cli.py +++ b/httprunner/cli.py @@ -56,7 +56,7 @@ def main(): help="Specify new project name.") parser.add_argument( '--validate', nargs='*', - help="Validate JSON testcase format.") + help="Validate YAML/JSON api/testcase/testsuite format.") parser.add_argument( '--prettify', nargs='*', help="Prettify JSON testcase format.")