mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-11 23:41:44 +08:00
refactor: replace loader
This commit is contained in:
@@ -7,7 +7,7 @@ from loguru import logger
|
||||
|
||||
from httprunner import exceptions
|
||||
from httprunner.exceptions import TestCaseFormatError
|
||||
from httprunner.new_loader import load_testcase_file, load_folder_files
|
||||
from httprunner.loader import load_testcase_file, load_folder_files
|
||||
|
||||
__TMPL__ = """# NOTICE: Generated By HttpRunner. DO'NOT EDIT!
|
||||
import unittest
|
||||
@@ -96,9 +96,10 @@ def init_make_parser(subparsers):
|
||||
""" make testcases: parse command line options and run commands.
|
||||
"""
|
||||
parser = subparsers.add_parser(
|
||||
"make",
|
||||
help="Convert YAML/JSON testcases to Python unittests.",
|
||||
"make", help="Convert YAML/JSON testcases to Python unittests.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"testcase_path", nargs="?", help="Specify YAML/JSON testcase path"
|
||||
)
|
||||
parser.add_argument("testcase_path", nargs="?", help="Specify YAML/JSON testcase path")
|
||||
|
||||
return parser
|
||||
|
||||
@@ -3,13 +3,12 @@ from httprunner.ext.make import make_testcase, main_make
|
||||
|
||||
|
||||
class TestLoader(unittest.TestCase):
|
||||
|
||||
def test_make_testcase(self):
|
||||
path = "examples/postman_echo/request_methods/request_with_variables.yml"
|
||||
testcase_python_path = make_testcase(path)
|
||||
self.assertEqual(
|
||||
testcase_python_path,
|
||||
"examples/postman_echo/request_methods/request_with_variables_test.py"
|
||||
"examples/postman_echo/request_methods/request_with_variables_test.py",
|
||||
)
|
||||
|
||||
def test_make_testcase_folder(self):
|
||||
@@ -17,5 +16,5 @@ class TestLoader(unittest.TestCase):
|
||||
testcase_python_list = main_make(path)
|
||||
self.assertIn(
|
||||
"examples/postman_echo/request_methods/request_with_functions_test.py",
|
||||
testcase_python_list
|
||||
testcase_python_list,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user