-
Notifications
You must be signed in to change notification settings - Fork 158
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
pytest-asyncio 0.23 doesn't allow class-scoped fixtures outside of class definition #829
Comments
Looks like the root cause of this is #706 |
It's unfortunate that you need boilerplate code to work around this. I expect the issue to resolve itself with #871 . |
As of pytest-asyncio v0.24 async fixtures can have different scopes for caching ( @av223119 Does the separation of fixture caching and event loop scopes address your issue? |
Sorry, we've switched to alt-pytest-asyncio, so I've lost track of this.
…On Mon, 26 Aug 2024 at 08:08, Michael Seifert ***@***.***> wrote:
As of pytest-asyncio v0.24 async fixtures can have different scopes for
caching (scope=…) and for the event loop used to run the fixture (
loop_scope=…). It's still not possible to use loop_scope="class" if the
fixture is not surrounded by a class, though.
@av223119 <https://github.com/av223119> Does the separation of fixture
caching and event loop scopes address your issue?
—
Reply to this email directly, view it on GitHub
<#829 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AJTUOKJ4NI7JEC2SI4W6DFLZTLA6HAVCNFSM6AAAAABHDSQYVWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBZGM4TKNRWHE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@av223119 Thanks for the response. In my opinion, the changes in v0.24 are enough to address this. Therefore, I'll close the issue. Feel free to continue the discussion if you disagree. |
It appears that the pytest-asyncio 0.23 broke class-scoped fixtures defined outside of the class. Namely, I used to have the following setup:
conftest.py:
and then the test classes used
@pytest.mark.usefixtures("run_important_program_in_class")
however with upgrade to 0.23, now the following error being reported:
The error disappears of the fixture is moved to the class definition, like this:
But this approach leads to significant code duplication
The text was updated successfully, but these errors were encountered: