From 1979d257f0f1dc4f5eeb3c396a668f4e941923fc Mon Sep 17 00:00:00 2001 From: debugtalk Date: Mon, 15 Jun 2020 18:32:33 +0800 Subject: [PATCH] fix: testcase path handling error when path startswith "./" or ".\\" --- docs/CHANGELOG.md | 1 + httprunner/make.py | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index f3e5444d..72f6656a 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -9,6 +9,7 @@ - fix: missing ${var} handling in overriding config variables - fix: SyntaxError caused by quote in case of headers."Set-Cookie" - fix: FileExistsError when specified project name conflicts with existed file +- fix: testcase path handling error when path startswith "./" or ".\\" ## 3.0.12 (2020-06-14) diff --git a/httprunner/make.py b/httprunner/make.py index fcb848d9..ef4ce731 100644 --- a/httprunner/make.py +++ b/httprunner/make.py @@ -64,6 +64,13 @@ if __name__ == "__main__": def __ensure_absolute(path: Text) -> Text: + if path.startswith("./"): + # Linux/Darwin, hrun ./test.yml + path = path[len("./"):] + elif path.startswith(".\\"): + # Windows, hrun .\\test.yml + path = path[len(".\\"):] + path = ensure_path_sep(path) project_meta = load_project_meta(path)