Generating multiple suites with different configurations #12920
Unanswered
WisdomPill
asked this question in
Q&A
Replies: 1 comment
-
Can an automatically running and parameterized fixture help you? @pytest.fixture(autouse=True, scope="function", params=["settings.sqlite", "settings.sqlite_herd"])
def django(request) -> None:
environ["DJANGO_SETTINGS_MODULE"] = request.param
setup() More info:https://docs.pytest.org/en/stable/how-to/fixtures.html#fixture-parametrize |
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
-
I was looking for a way to launch all tests multiple times with different
DJANGO_SETTINGS_MODULE
is that possible?specifically running all of these tests,
if I am able to generate multiple tests were I can configure django on a function basis then it would be easier for me to parallelise it.
I tried using
pytest_configure
and it works for setting up django, but I would like to setup a differentDJANGO_SETTINGS_MODULE
and configure django for each different settings I have. At the moment the following works.So I started digging and trying out
pytest_generate_tests
since it looked like I could parametrize tests but I don't want to add the parameter to all of them,would be nice to use a fixture on function scope with autouse and configure it from there.
So I tried it like the following but it looks like it is not used.
I am thinking it is not called early enough.
Could you help me understand how to implement it such solution if it's possible at all?
Beta Was this translation helpful? Give feedback.
All reactions