Am working on a django reusable package that am planning to use with multiple project. I've used pytest to build test suite, I've used parametrized helped in pytest to run a single test with multiple configuration.
Yet, I would like to run all my tests using different settings combinations
available_backends = [
'django_profile.auth_backends.drf.RestFramework',
'django_profile.auth_backends.kong.Kong',
]
def pytest_generate_tests(metafunc):
# if 'stringinput' in metafunc.fixturenames:
if 'auth_backend' in metafunc.fixturenames:
metafunc.parametrize(
'auth_backend',
available_backends
)
@pytest.fixture(params=['auth_backend', ])
def auth_backend(request, settings):
settings.DJANGO_PROFILE_AUTH_BACKEND = request.auth_backend
return settings
I experimented with the above approach, but this also means I have to add auth_backend to each test case, I don't believe this is ideal. Any one can recommend a way for me to run all my tests using different setting combinations?
Regards