-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Description
`import pytest
class TestUser:
@pytest.mark.parametrize("username, password", [("admin", "123456"), ("admin1", "123456")])
def test_login(self, username, password):
print("login")
@pytest.mark.parametrize("username, password", [("admin", "123456"), ("admin1", "123456")])
def test_logout(self, username, password):
print("logout")
@pytest.mark.parametrize("username, password", [("admin", "123456"), ("admin1", "123456")])
def test_register(self, username, password):
print("register")
class TestExample:
@pytest.mark.parametrize("username, password", [("admin", "123456"), ("admin1", "123456")])
def test_order(self, username, password):
TestUser().test_login(username, password)
if name == 'main':
pytest.main()
`
How to control that when test_order calls the TestUser test class, only the called test_login test function is executed, and not all test functions under TestUser are executed? Is it possible to use the pytest_collection_modifyitems hook provided by pytest to control the test functions that do not need to execute all test classes?
Metadata
Metadata
Assignees
Labels
No labels
