How to Control Passive Test Functions? #11021
Unanswered
Yingqingshan
asked this question in
General
Replies: 1 comment
-
Im under the impression the ask here is for having dependent test cases, which intentionally is not supported as is The recommendation is to have login state as a scoped fixture, so more than one integration test can use it safely |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
`import pytest
class TestUser:
@pytest.mark.parametrize("username, password", [("admin", "123456"), ("admin1", "123456")])
def test_login(self, username, password):
print("login")
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?
Now the execution result is as follows:

Beta Was this translation helpful? Give feedback.
All reactions