mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-30 21:09:36 +08:00
fix: clear project_meta before each test
This commit is contained in:
@@ -40,9 +40,10 @@ class TestCli(unittest.TestCase):
|
||||
self.assertIn(__description__, self.captured_output.getvalue().strip())
|
||||
|
||||
def test_debug_pytest(self):
|
||||
pytest.main(
|
||||
exit_code = pytest.main(
|
||||
[
|
||||
"-s",
|
||||
"examples/postman_echo/request_methods/request_with_testcase_reference_test.py",
|
||||
]
|
||||
)
|
||||
self.assertEqual(exit_code, 0)
|
||||
|
||||
@@ -9,9 +9,15 @@ from httprunner.make import (
|
||||
make_teststep_chain_style,
|
||||
pytest_files_run_set,
|
||||
)
|
||||
from httprunner import loader
|
||||
|
||||
|
||||
class TestMake(unittest.TestCase):
|
||||
def setUp(self) -> None:
|
||||
pytest_files_made_cache_mapping.clear()
|
||||
pytest_files_run_set.clear()
|
||||
loader.project_meta = None
|
||||
|
||||
def test_make_testcase(self):
|
||||
path = ["examples/postman-echo/request.methods/request_with_variables.yml"]
|
||||
testcase_python_list = main_make(path)
|
||||
@@ -27,8 +33,6 @@ class TestMake(unittest.TestCase):
|
||||
path = [
|
||||
"examples/postman-echo/request.methods/request_with_testcase_reference.yml"
|
||||
]
|
||||
pytest_files_made_cache_mapping.clear()
|
||||
pytest_files_run_set.clear()
|
||||
testcase_python_list = main_make(path)
|
||||
self.assertEqual(len(testcase_python_list), 1)
|
||||
self.assertIn(
|
||||
@@ -90,8 +94,6 @@ 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"]
|
||||
pytest_files_made_cache_mapping.clear()
|
||||
pytest_files_run_set.clear()
|
||||
testcase_python_list = main_make(path)
|
||||
self.assertEqual(len(testcase_python_list), 2)
|
||||
self.assertIn(
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import unittest
|
||||
|
||||
from httprunner import loader
|
||||
from httprunner.runner import HttpRunner
|
||||
|
||||
|
||||
class TestHttpRunner(unittest.TestCase):
|
||||
def setUp(self):
|
||||
loader.project_meta = None
|
||||
self.runner = HttpRunner()
|
||||
|
||||
def test_run_testcase_by_path_request_only(self):
|
||||
|
||||
Reference in New Issue
Block a user