feat: hrun supports run pytest files

This commit is contained in:
debugtalk
2020-06-03 21:08:45 +08:00
parent 0e9513afa0
commit f03f9003f9
5 changed files with 20 additions and 7 deletions

View File

@@ -34,7 +34,7 @@ class TestHar(TestHar2CaseUtils):
self.assertIn("validate", teststeps[0])
def test_gen_testcase_yaml(self):
yaml_file = os.path.join(os.path.dirname(__file__), "data", "demo.yaml")
yaml_file = os.path.join(os.path.dirname(__file__), "data", "demo.yml")
self.har_parser.gen_testcase(file_type="YAML")
self.assertTrue(os.path.isfile(yaml_file))

View File

@@ -6,10 +6,11 @@ from httprunner.make import (
make_files_cache_set,
make_config_chain_style,
make_teststep_chain_style,
pytest_files_set,
)
class TestLoader(unittest.TestCase):
class TestMake(unittest.TestCase):
def test_make_testcase(self):
path = ["examples/postman_echo/request_methods/request_with_variables.yml"]
testcase_python_list = main_make(path)
@@ -23,6 +24,7 @@ class TestLoader(unittest.TestCase):
"examples/postman_echo/request_methods/request_with_testcase_reference.yml"
]
make_files_cache_set.clear()
pytest_files_set.clear()
testcase_python_list = main_make(path)
self.assertEqual(len(testcase_python_list), 1)
self.assertIn(
@@ -91,6 +93,7 @@ from examples.postman_echo.request_methods.request_with_functions_test import (
def test_make_testsuite(self):
path = ["examples/postman_echo/request_methods/demo_testsuite.yml"]
make_files_cache_set.clear()
pytest_files_set.clear()
testcase_python_list = main_make(path)
self.assertEqual(len(testcase_python_list), 2)
self.assertIn(