-
Notifications
You must be signed in to change notification settings - Fork 35
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
Remove parametrization when storing dependency results #43
base: develop
Are you sure you want to change the base?
Conversation
Can this please be merged? :( |
Many thanks for your contribution and please apologize for the very late reply! I needed some time to really look into this and didn't got around to do that earlier. Unfortunately, your change breaks documented use cases. Please note that this is not just another artificial example for the documentation. It is modeled after a real application that is used in production. I can also provide an even simpler example to demonstrate the problem. Consider: import pytest
@pytest.mark.parametrize("x", [
pytest.param(0),
pytest.param(1, marks=pytest.mark.xfail(reason="deliberate fail")),
])
@pytest.mark.dependency()
def test_a(x):
assert x == 0
@pytest.mark.parametrize("x", [
pytest.param(0, marks=pytest.mark.dependency(depends=["test_a[0]"])),
pytest.param(1, marks=pytest.mark.dependency(depends=["test_a[1]"])),
])
def test_b(x):
pass I guess the idea is obvious:
When I run the same example with your version, I get:
Now, also The ability to distinguish in the dependencies the individual instances for different parameter values of a test is an important feature of pytest-dependency that must be preserved. |
Is it better now? |
Utilizing the same approach as in #33, but up to date and more efficient. This closes #9.
EDIT: Forgot to add that I replaced
setdefault
with that if statement there on purpose, because that's more efficient than constructing an instance ofDependencyitemStatus()
and then discarding it every time that line runs. Ref: https://stackoverflow.com/questions/22797251/why-does-setdefault-evaluate-default-when-key-is-set