-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
"fixture is being applied more than once to the same function" in 3.6.0, not in 3.2.1 #3518
Comments
GitMate.io thinks possibly related issues are #616 ((2.6.3) Conftest is ran, but fixtures not brought in.), #2782 (PyTest won't inject fixtures into decorated functions in Python 2.7), #1627 (Drop Python 3.0/3.1/3.2/2.6?), #1909 (Monkeypatch docs lost method reference between 3.0.1 and 3.0.2), and #1875 (Cannot create two fixtures based on the same function). |
Hi @simonw, That's by design, we added this check intentionally in #2334, here's the relevant changelog entry:
The solution is to not apply the I'm closing this for now, feel free to follow up with any other questions you have. |
Thanks - now that I understand the underlying issue I've fixed it in my code by moving my calls to |
@simonw also please note that its problematic to import fixtures, in particular if they have a scope as pytest detects each import location as distinct fixture |
This is now required in pytest >= 3.6 See pytest-dev/pytest#3518 Fixes kevin1024#49
This is now required in pytest >= 3.6 We define our own autoused fixtue not to change the API See pytest-dev/pytest#3518 Fixes kevin1024#49
I'm getting the following test failure in my test suite running against pytest 3.6.0:
The exact same test suite runs without any errors under pytest 3.2.1:
This is the exact checkout of the code I ran the above tests against: https://github.com/simonw/datasette/tree/76d11eb768e2f05f593c4d37a25280c0fcdf8fd6
This appears to be a regression in 3.6.0.
The underlying issue is that in my
test_html.py
I have the following:https://github.com/simonw/datasette/blob/76d11eb768e2f05f593c4d37a25280c0fcdf8fd6/tests/test_html.py#L1-L7
And in my
test_api.py
file I have this:https://github.com/simonw/datasette/blob/76d11eb768e2f05f593c4d37a25280c0fcdf8fd6/tests/test_api.py#L1-L14
The
pytest.fixture(scope='module')(app_client)
lines in the two modules seem to be conflicting with each other in 3.6.0 even though they worked fine together in 3.2.1The text was updated successfully, but these errors were encountered: