Created
February 6, 2024 12:51
-
-
Save alexbol93/fa9c927ed5461cff9f900b5c7abde853 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#conftest.py | |
from accounts import Accounts | |
def pytest_addoption(parser): | |
parser.addoption("--my-opt", action="store", default="") | |
def pytest_generate_tests(metafunc): | |
if 'user' in metafunc.fixturenames: | |
users = metafunc.config.getoption("--my-opt") | |
if users == "ind_user": | |
metafunc.parametrize("user", Accounts.USERS.values()) | |
elif users == "vendor": | |
metafunc.parametrize("user", Accounts.VENDORS.values()) | |
else: | |
user_accounts = [*Accounts.USERS.values(), *Accounts.VENDORS.values()] | |
metafunc.parametrize("user", user_accounts) | |
#пример теста | |
def test(user): | |
print(user) | |
assert True | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment