mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-06 20:32:44 +08:00
fix: unittests for convert_testcase_path
This commit is contained in:
@@ -162,9 +162,9 @@ def __ensure_project_meta_files(tests_path: Text) -> NoReturn:
|
||||
copyfile(dot_csv_path, dot_csv_new_path)
|
||||
|
||||
|
||||
def convert_testcase_path(testcase_path: Text) -> Tuple[Text, Text]:
|
||||
def convert_testcase_path(testcase_abs_path: Text) -> Tuple[Text, Text]:
|
||||
"""convert single YAML/JSON testcase path to python file"""
|
||||
testcase_new_path = ensure_file_abs_path_valid(testcase_path)
|
||||
testcase_new_path = ensure_file_abs_path_valid(testcase_abs_path)
|
||||
|
||||
dir_path = os.path.dirname(testcase_new_path)
|
||||
file_name, _ = os.path.splitext(os.path.basename(testcase_new_path))
|
||||
|
||||
@@ -92,7 +92,7 @@ from examples.postman_echo.request_methods.request_with_functions_test import (
|
||||
|
||||
def test_convert_testcase_path(self):
|
||||
self.assertEqual(
|
||||
convert_testcase_path("mubu.login.yml"),
|
||||
convert_testcase_path(os.path.join(os.getcwd(), "mubu.login.yml")),
|
||||
(os.path.join(os.getcwd(), "mubu_login_test.py"), "MubuLogin"),
|
||||
)
|
||||
self.assertEqual(
|
||||
@@ -107,7 +107,9 @@ from examples.postman_echo.request_methods.request_with_functions_test import (
|
||||
),
|
||||
)
|
||||
self.assertEqual(
|
||||
convert_testcase_path(os.path.join("path", "to 2", "mubu.login.yml")),
|
||||
convert_testcase_path(
|
||||
os.path.join(os.getcwd(), "path", "to 2", "mubu.login.yml")
|
||||
),
|
||||
(
|
||||
os.path.join(
|
||||
os.getcwd(), os.path.join("path", "to_2", "mubu_login_test.py")
|
||||
@@ -116,7 +118,9 @@ from examples.postman_echo.request_methods.request_with_functions_test import (
|
||||
),
|
||||
)
|
||||
self.assertEqual(
|
||||
convert_testcase_path(os.path.join("path", "to-2", "mubu login.yml")),
|
||||
convert_testcase_path(
|
||||
os.path.join(os.getcwd(), "path", "to-2", "mubu login.yml")
|
||||
),
|
||||
(
|
||||
os.path.join(
|
||||
os.getcwd(), os.path.join("path", "to_2", "mubu_login_test.py")
|
||||
@@ -125,7 +129,9 @@ from examples.postman_echo.request_methods.request_with_functions_test import (
|
||||
),
|
||||
)
|
||||
self.assertEqual(
|
||||
convert_testcase_path(os.path.join("path", "to.2", "幕布login.yml")),
|
||||
convert_testcase_path(
|
||||
os.path.join(os.getcwd(), "path", "to.2", "幕布login.yml")
|
||||
),
|
||||
(
|
||||
os.path.join(
|
||||
os.getcwd(), os.path.join("path", "to_2", "幕布login_test.py")
|
||||
|
||||
Reference in New Issue
Block a user