Skip to content

Using pytest-asyncio fixtures with pytest-twisted functions #188

@wRAR

Description

@wRAR

I've initially asked this at https://stackoverflow.com/questions/79451761/using-pytest-twisted-functions-with-pytest-asyncio-fixtures but I now suspect that this is just not possible with the current pytest-twisted code, but maybe it is? If it isn't possible now, can pytest-twisted be improved to support this?

Basically I want to use @pytest_asyncio.fixture fixtures in test functions that use Twisted with --reactor=asyncio. It seems that for this to work correctly all pieces need to use the same asyncio event loop? And there is no way to either create a loop and pass it to both pytest-twisted and pytest-asyncio or extract the loop used by one of these and pass it to another one? If this line of reasoning is correct (and if I understand how do the pieces work), can it be made possible to modify one or both plugins to be able to share the loop/use the installed one?

I also wonder if there are any workarounds in the mean time.

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions