pytest-mimesis
pytest-mimesis copied to clipboard
Support fixture parametrization
Imagine I have the following fixture:
@pytest.fixture(scope='function')
def gitlab_merge_request(mimesis):
return {
'user': {
'username': mimesis('username'),
},
'object_attributes': {
'id': mimesis('between', minimum=1),
'state': 'opened'
},
}
What I want to achieve is something like:
import pytest
@pytest.mark.parametrize(
'gitlab_merge_request__object_attributes__state', ['closed'],
)
def test_is_closed(gitlab_merge_request):
assert gitlab_merge_request['object_attributes']['state'] == 'closed'
We can use https://docs.pytest.org/en/latest/fixture.html#override-a-fixture-with-direct-test-parametrization
Looks useful. I'm all for it :+1:.
@lk-geimfari do you have free time to help me with this one?
@sobolevn I can try to do it this weekend.
@lk-geimfari counting on you! I am using this library in production.
Soon to be open-sourced.