-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow usage of pytest.param in parametrize_plus #79
Comments
Thanks for the suggestion @pehala ! It should work out of the box, as |
@smarie I have created PoC tests to see if it works and it sadly seems like it doesn't. |
Thanks for the PR ! This is a bit strange since Maybe it is the interaction with If you are ok to investigate a bit, I would be very glad to see a "minimal" version of this issue. In other words could you find the minimal piece of code that reproduces the issue (for example starting from your PoC and reducing it down to the smallest possible size), and post it here together with the exception or wrong behaviour that appears ? (do not post it in the PR please, as by experience when regression problems appear in the future it is easier to find well documented issues than PRs) Then, I'll check that this minimal code reproduces the issue on my side and I'll be able to either fix or guide you to do the fix in your PR. Thanks a lot for your help! |
I had an afterthought though. Which behaviour shall we adopt with each option provided by EDIT : reading the doc from |
I think it is reasonable to allow it only for non-parametrized fixtures, there are just too many edge cases to cover. |
I have minimalized it into 2 smaller issues.
@pytest.fixture
def a():
return 'a'
@pytest.fixture
def b():
return 'b'
@parametrize_plus('arg', [pytest.param(fixture_ref(a)),
fixture_ref(b)])
def test_fixture_ref(arg):
assert arg in ['a', 'b']
@pytest.fixture
def a():
return 'a'
@pytest.fixture
def b():
return 'b'
@parametrize_plus('arg', [pytest.param("a", marks=pytest.mark.skipif("5>4")),
fixture_ref(b)])
def test_mark(arg):
assert arg in ['a', 'b']
@parametrize_plus('arg', [pytest.param("a", id="testID"),
fixture_ref(b)])
def test_id(arg):
assert arg in ['a', 'b'] |
This is great, thanks @pehala ! sorry for answering so late, I'll have a look. |
…mproved corresponding ids. Fixed #86
It took me much more time than I expected, but it was worth it: the ids and marks are now properly managed in all of the API, consistently with pytest behaviour. Users can use Thanks a lot @pehala for spotting the issue and triggering the process |
Thanks a lot for fixing it @smarie! |
Version |
Pure
parametrize
can be given arguments wrapped inpytest.param
to for example pass additional mark for that specific case (https://docs.pytest.org/en/latest/example/parametrize.html). I think it would be a good idea to support it (if it isn't already working) also forparametrize_plus
.The text was updated successfully, but these errors were encountered: