mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-07 08:49:37 +08:00
change: testsuite pytest dirname
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
# NOTICE: Generated By HttpRunner. DO'NOT EDIT!
|
# NOTICE: Generated By HttpRunner. DO'NOT EDIT!
|
||||||
# FROM: examples/postman_echo/request_methods/demo_testsuite/request_with_functions.yml
|
# FROM: examples/postman_echo/request_methods/demo_testsuite_yml/request_with_functions.yml
|
||||||
from httprunner import HttpRunner, TConfig, TStep
|
from httprunner import HttpRunner, TConfig, TStep
|
||||||
|
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@ class TestCaseRequestWithFunctions(HttpRunner):
|
|||||||
"variables": {"foo1": "session_bar1", "var1": "testsuite_val1"},
|
"variables": {"foo1": "session_bar1", "var1": "testsuite_val1"},
|
||||||
"base_url": "https://postman-echo.com",
|
"base_url": "https://postman-echo.com",
|
||||||
"verify": False,
|
"verify": False,
|
||||||
"path": "examples/postman_echo/request_methods/demo_testsuite/request_with_functions_test.py",
|
"path": "examples/postman_echo/request_methods/demo_testsuite_yml/request_with_functions_test.py",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
# NOTICE: Generated By HttpRunner. DO'NOT EDIT!
|
# NOTICE: Generated By HttpRunner. DO'NOT EDIT!
|
||||||
# FROM: examples/postman_echo/request_methods/demo_testsuite/request_with_testcase_reference.yml
|
# FROM: examples/postman_echo/request_methods/demo_testsuite_yml/request_with_testcase_reference.yml
|
||||||
from httprunner import HttpRunner, TConfig, TStep
|
from httprunner import HttpRunner, TConfig, TStep
|
||||||
|
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@ class TestCaseRequestWithTestcaseReference(HttpRunner):
|
|||||||
"variables": {"foo1": "session_bar1", "var2": "testsuite_val2"},
|
"variables": {"foo1": "session_bar1", "var2": "testsuite_val2"},
|
||||||
"base_url": "https://postman-echo.com",
|
"base_url": "https://postman-echo.com",
|
||||||
"verify": False,
|
"verify": False,
|
||||||
"path": "examples/postman_echo/request_methods/demo_testsuite/request_with_testcase_reference_test.py",
|
"path": "examples/postman_echo/request_methods/demo_testsuite_yml/request_with_testcase_reference_test.py",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -134,7 +134,8 @@ def make_testsuite(testsuite: Dict) -> List[Text]:
|
|||||||
logger.info(f"start to make testsuite: {testsuite_path}")
|
logger.info(f"start to make testsuite: {testsuite_path}")
|
||||||
|
|
||||||
# create directory with testsuite file name, put its testcases under this directory
|
# create directory with testsuite file name, put its testcases under this directory
|
||||||
os.makedirs(os.path.dirname(os.path.splitext(testsuite_path)[0]), exist_ok=True)
|
testsuite_dir = testsuite_path.replace(".", "_")
|
||||||
|
os.makedirs(testsuite_dir, exist_ok=True)
|
||||||
|
|
||||||
testcase_files = []
|
testcase_files = []
|
||||||
|
|
||||||
@@ -145,7 +146,7 @@ def make_testsuite(testsuite: Dict) -> List[Text]:
|
|||||||
testcase_dict = load_test_file(testcase_path)
|
testcase_dict = load_test_file(testcase_path)
|
||||||
testcase_dict.setdefault("config", {})
|
testcase_dict.setdefault("config", {})
|
||||||
testcase_dict["config"]["path"] = os.path.join(
|
testcase_dict["config"]["path"] = os.path.join(
|
||||||
os.path.splitext(testsuite_path)[0], os.path.basename(testcase_path)
|
testsuite_dir, os.path.basename(testcase_path)
|
||||||
)
|
)
|
||||||
|
|
||||||
# override testcase name
|
# override testcase name
|
||||||
|
|||||||
@@ -59,10 +59,10 @@ class TestLoader(unittest.TestCase):
|
|||||||
testcase_python_list = main_make(path)
|
testcase_python_list = main_make(path)
|
||||||
self.assertEqual(len(testcase_python_list), 2)
|
self.assertEqual(len(testcase_python_list), 2)
|
||||||
self.assertIn(
|
self.assertIn(
|
||||||
"examples/postman_echo/request_methods/demo_testsuite/request_with_functions_test.py",
|
"examples/postman_echo/request_methods/demo_testsuite_yml/request_with_functions_test.py",
|
||||||
testcase_python_list,
|
testcase_python_list,
|
||||||
)
|
)
|
||||||
self.assertIn(
|
self.assertIn(
|
||||||
"examples/postman_echo/request_methods/demo_testsuite/request_with_testcase_reference_test.py",
|
"examples/postman_echo/request_methods/demo_testsuite_yml/request_with_testcase_reference_test.py",
|
||||||
testcase_python_list,
|
testcase_python_list,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user