-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Using yield_fixture as function causes fixtures to run twice #1481
Comments
From #1480 it seems you are using pytest 2.6... could you try upgrading and see if you still have this problem? |
the fixture decorator does indeed modify the function in-place by adding a new attribute |
I can reproduce this on pytest 2.9.1 too. |
the current implementation cannot support usage as non-decorator, since it modifies the function on passtrough |
Should we close this? |
No, its still "broken" as far as I can tell |
I understand, I was asking more in the sense of "closing as not supported" |
well, we should issue a pytest warning in case more than one active fixture has the same identity |
This is fixed by #2849 |
@nicoddemus nope, #2849 fixes double use of the decorator this is about naming the decorator result and the original function differently |
@RonnyPfannschmidt OK, thanks for the clarification |
This has been fixed,
|
Running
pytest -s foo.py
gives:It seems that py.test is erroneously thinking that
inner_function
is a fixture. Sometimes (because I want to use my function in other contexts too) I want to use yield_fixture as a function and pass my target function directly. When this happens, py.test tries to run my fixture twice.The text was updated successfully, but these errors were encountered: