mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 11:29:48 +08:00
fix: compatibility with testcase file path includes minus sign
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
**Fixed**
|
||||
|
||||
- fix: compatibility with testcase file path includes dots and space
|
||||
- fix: compatibility with testcase file path includes dots, space and minus sign
|
||||
- fix: testcase generator, validate content.xxx => body.xxx
|
||||
- fix: scaffold for v3
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ def convert_testcase_path(testcase_path: Text) -> Tuple[Text, Text]:
|
||||
if file_suffix not in [".json", ".yml", ".yaml"]:
|
||||
raise exceptions.ParamsError("")
|
||||
|
||||
file_name = raw_file_name.replace(" ", "_").replace(".", "_")
|
||||
file_name = raw_file_name.replace(" ", "_").replace(".", "_").replace("-", "_")
|
||||
testcase_dir = os.path.dirname(testcase_path)
|
||||
testcase_python_path = os.path.join(testcase_dir, f"{file_name}_test.py")
|
||||
|
||||
|
||||
@@ -24,10 +24,6 @@ class TestLoader(unittest.TestCase):
|
||||
convert_testcase_path("mubu.login.yml")[0],
|
||||
"mubu_login_test.py"
|
||||
)
|
||||
self.assertEqual(
|
||||
convert_testcase_path("mubu login.yml")[0],
|
||||
"mubu_login_test.py"
|
||||
)
|
||||
self.assertEqual(
|
||||
convert_testcase_path("/path/to/mubu.login.yml")[0],
|
||||
"/path/to/mubu_login_test.py"
|
||||
@@ -40,7 +36,27 @@ class TestLoader(unittest.TestCase):
|
||||
convert_testcase_path("/path/to 2/mubu.login.yml")[1],
|
||||
"MubuLogin"
|
||||
)
|
||||
self.assertEqual(
|
||||
convert_testcase_path("mubu login.yml")[0],
|
||||
"mubu_login_test.py"
|
||||
)
|
||||
self.assertEqual(
|
||||
convert_testcase_path("/path/to 2/mubu login.yml")[1],
|
||||
"MubuLogin"
|
||||
)
|
||||
self.assertEqual(
|
||||
convert_testcase_path("/path/to 2/mubu-login.yml")[0],
|
||||
"/path/to 2/mubu_login_test.py"
|
||||
)
|
||||
self.assertEqual(
|
||||
convert_testcase_path("/path/to 2/mubu-login.yml")[1],
|
||||
"MubuLogin"
|
||||
)
|
||||
self.assertEqual(
|
||||
convert_testcase_path("/path/to 2/幕布login.yml")[0],
|
||||
"/path/to 2/幕布login_test.py"
|
||||
)
|
||||
self.assertEqual(
|
||||
convert_testcase_path("/path/to/幕布login.yml")[1],
|
||||
"幕布Login"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user