-
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
Support fixture_ref()
in tuple of parameters
#47
Comments
It seems that if the fixture represents the whole tuple, it works, but it is not possible to use the reference for only one element of the tuple. To investigate, in order to see if this is really desirable. |
To add a more explicit description: the following does not work yet because the fixture reference is only used as a part of the parameters tuple: import pytest
from pytest_cases import pytest_parametrize_plus, fixture_ref, pytest_fixture_plus
@pytest_fixture_plus
@pytest.mark.parametrize('val', ['b', 'c'])
def myfix(val):
return val
@pytest_parametrize_plus('p,q', [('a', 1),
(fixture_ref(myfix), 2)])
def test_prints(p, q):
pass
def test_synthesis(module_results_dct):
assert list(module_results_dct) == ['test_prints[test_prints_p_is_0-a-1]',
'test_prints[test_prints_p_is_myfix-b-2]',
'test_prints[test_prints_p_is_myfix-c-2]',
] |
Please add this feature. Would be of great use in testing different combinations in a complex function. Also, the tests would be more reliable as one will then be able to do:
|
Sorry my example code was wrong. I updated it to reflect what should actually be the behaviour (it uses pytest-harvest to get the synthesis). So your comment does not apply anymore, sorry: I removed the asserts you mention. Can you please confirm that this is actually what you need ? I mean, for each parameter tuple containing at least a
Note: this is not exactly how it works behind the scenes but the perceived result is equivalent, and it is easier to explain ;) |
Yes that is exactly what I am referring to. This will make the test code's syntax (and functionality) similar to how What do you think? |
perfect. I'll see what I can do. |
Done in 1.11.0. But I warn you: the names become hard to follow ! :) Let me know if it works for you. |
No description provided.
The text was updated successfully, but these errors were encountered: