-
Notifications
You must be signed in to change notification settings - Fork 161
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
async pytest-bdd step definitions #195
Comments
My understanding is that there are two questions in the room:
pytest-asyncio basically works like this: If an asynchronous test case is marked with the keyword Therefore, the decorated function cannot be executed in an event loop. In other words: No, I don't think pytest-bdd and pytest-asyncio can work together without modifications. Here is the code that wraps the async function: pytest-asyncio/pytest_asyncio/plugin.py Lines 166 to 184 in 1bb7f30
But it should be possible to make both plugins work together. For example, there is already a custom integration for Hypothesis: pytest-asyncio/pytest_asyncio/plugin.py Lines 153 to 157 in 1bb7f30
This solution relies on markers provided by Hypothesis. We could create a similar mechanism with the following steps:
I personally don't like the approach, though, as we would implement pytest-bdd support as another special case. It would be much nicer to find a more general way for pytest-asyncio to play with other plugins. But I'm also not in the position to decide :) |
Thanks @seifertm. Really appreciate the response. Saw this PR which still remains in review in pytest-bdd. Maybe if a similar handling is done in their side the issue can be addressed better. |
At the time of writing pytest-asyncio is compatible with |
@seifertm Added the 'feature' label! |
Has this been done or is it still open ? |
@KelvinSan There has been no progress on this from the pytest-asyncio side. In the meantime, the pytest-bdd issue linked by the OP received some attention. One comment presents a "comaptibility decorator" for using pytest-bdd steps with pytest-asyncio. |
Just shooting this question with reference to pytest-dev/pytest-bdd#223
Is there any way the same can be handled with pytest-asyncio? Hope someone will please help if you have worked on something similar.
The text was updated successfully, but these errors were encountered: