Pytest-asyncio currently allows requesting fixtures that have a different loop_scope than the requesting test or fixture. Since fixtures with different loop scopes use different asyncio event loops, this can lead to unexpected errors., e.g. trying to access a task that was created on a different loop.
This can happen when:
- a test requests a fixture, but the loop_scopes don't match
- a fixture requests another fixture, but the loop_scopes don't match
Mixing fixtures with different loop scopes is almost certainly a user error and should result in a warning.
Work on this issue was done during the pytest sprint 2026, sponsored by Omicron.
Pytest-asyncio currently allows requesting fixtures that have a different loop_scope than the requesting test or fixture. Since fixtures with different loop scopes use different asyncio event loops, this can lead to unexpected errors., e.g. trying to access a task that was created on a different loop.
This can happen when:
Mixing fixtures with different loop scopes is almost certainly a user error and should result in a warning.
Work on this issue was done during the pytest sprint 2026, sponsored by Omicron.