Skip to content

How to use mixed-scoped fixtures in an async test? #837

Closed Answered by seifertm
nmacholl asked this question in Q&A
Discussion options

You must be logged in to vote

Pytest-asyncio v0.23 wrongly assumes that the fixture caching scope (defined with scope=…) is the same as the event loop scope in which the async fixture should run. Your example requires both fixtures and the test to run in a module-scope event loop, but fixture_function_scoped should be reevaluated for every function. This is currently unavailable, but is hopefully fixed in the next version. See #871

Your solution of staying on pytest-asycnio v0.21 is the right choice in your case.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@nmacholl
Comment options

Answer selected by nmacholl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants