mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-05 23:51:25 +08:00
fix: duplicate running referenced testcase
This commit is contained in:
+2
-1
@@ -1,6 +1,6 @@
|
|||||||
# Release History
|
# Release History
|
||||||
|
|
||||||
## 3.0.6 (2020-05-25)
|
## 3.0.6 (2020-05-27)
|
||||||
|
|
||||||
**Added**
|
**Added**
|
||||||
|
|
||||||
@@ -9,6 +9,7 @@
|
|||||||
**Fixed**
|
**Fixed**
|
||||||
|
|
||||||
- fix: ensure converted python file in utf-8 encoding
|
- fix: ensure converted python file in utf-8 encoding
|
||||||
|
- fix: duplicate running referenced testcase
|
||||||
|
|
||||||
## 3.0.5 (2020-05-22)
|
## 3.0.5 (2020-05-22)
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,4 @@ def sum_two(m, n):
|
|||||||
|
|
||||||
|
|
||||||
def get_variables():
|
def get_variables():
|
||||||
return {
|
return {"foo1": "session_bar1"}
|
||||||
"foo1": "session_bar1"
|
|
||||||
}
|
|
||||||
|
|||||||
+2
-2
@@ -9,7 +9,7 @@ sys.path.insert(0, os.getcwd())
|
|||||||
from httprunner import HttpRunner, TConfig, TStep
|
from httprunner import HttpRunner, TConfig, TStep
|
||||||
|
|
||||||
from examples.postman_echo.request_methods.request_with_functions_test import (
|
from examples.postman_echo.request_methods.request_with_functions_test import (
|
||||||
TestCaseRequestWithFunctions,
|
TestCaseRequestWithFunctions as RequestWithFunctions,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ class TestCaseRequestWithTestcaseReference(HttpRunner):
|
|||||||
**{
|
**{
|
||||||
"name": "request with functions",
|
"name": "request with functions",
|
||||||
"variables": {"foo1": "override_bar1"},
|
"variables": {"foo1": "override_bar1"},
|
||||||
"testcase": TestCaseRequestWithFunctions,
|
"testcase": RequestWithFunctions,
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ sys.path.insert(0, os.getcwd())
|
|||||||
from httprunner import HttpRunner, TConfig, TStep
|
from httprunner import HttpRunner, TConfig, TStep
|
||||||
|
|
||||||
from examples.postman_echo.request_methods.request_with_functions_test import (
|
from examples.postman_echo.request_methods.request_with_functions_test import (
|
||||||
TestCaseRequestWithFunctions,
|
TestCaseRequestWithFunctions as RequestWithFunctions,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ class TestCaseRequestWithTestcaseReference(HttpRunner):
|
|||||||
**{
|
**{
|
||||||
"name": "request with functions",
|
"name": "request with functions",
|
||||||
"variables": {"foo1": "override_bar1"},
|
"variables": {"foo1": "override_bar1"},
|
||||||
"testcase": TestCaseRequestWithFunctions,
|
"testcase": RequestWithFunctions,
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -95,9 +95,8 @@ def convert_testcase_path(testcase_path: Text) -> Tuple[Text, Text]:
|
|||||||
|
|
||||||
# convert title case, e.g. request_with_variables => RequestWithVariables
|
# convert title case, e.g. request_with_variables => RequestWithVariables
|
||||||
name_in_title_case = file_name.title().replace("_", "")
|
name_in_title_case = file_name.title().replace("_", "")
|
||||||
testcase_cls_name = f"TestCase{name_in_title_case}"
|
|
||||||
|
|
||||||
return testcase_python_path, testcase_cls_name
|
return testcase_python_path, name_in_title_case
|
||||||
|
|
||||||
|
|
||||||
def __format_pytest_with_black(python_paths: List[Text]) -> NoReturn:
|
def __format_pytest_with_black(python_paths: List[Text]) -> NoReturn:
|
||||||
@@ -163,11 +162,13 @@ def __make_testcase(testcase: Dict, dir_path: Text = None) -> NoReturn:
|
|||||||
ref_testcase_python_path = ref_testcase_python_path[len(os.getcwd()) + 1 :]
|
ref_testcase_python_path = ref_testcase_python_path[len(os.getcwd()) + 1 :]
|
||||||
ref_module_name, _ = os.path.splitext(ref_testcase_python_path)
|
ref_module_name, _ = os.path.splitext(ref_testcase_python_path)
|
||||||
ref_module_name = ref_module_name.replace(os.sep, ".")
|
ref_module_name = ref_module_name.replace(os.sep, ".")
|
||||||
imports_list.append(f"from {ref_module_name} import {ref_testcase_cls_name}")
|
imports_list.append(
|
||||||
|
f"from {ref_module_name} import TestCase{ref_testcase_cls_name} as {ref_testcase_cls_name}"
|
||||||
|
)
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
"testcase_path": __ensure_cwd_relative(testcase_path),
|
"testcase_path": __ensure_cwd_relative(testcase_path),
|
||||||
"class_name": testcase_cls_name,
|
"class_name": f"TestCase{testcase_cls_name}",
|
||||||
"config": config,
|
"config": config,
|
||||||
"teststeps": teststeps,
|
"teststeps": teststeps,
|
||||||
"imports_list": imports_list,
|
"imports_list": imports_list,
|
||||||
|
|||||||
Reference in New Issue
Block a user