You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pytest-steps is not compatible with async functions (pytest.mark.asyncio) #33
I found the pytest-steps and I'm trying to use it my code,
but some functions in my code is async function, so I'm curious about that this module is compatible with pytest.mark.asyncio or other async functions!
Thanks for reaching out ! Any feedback is always great
I have not tested this plugin with async functions. However I do not see any reason why this would not be compliant, as long as the test functions are normal functions (or generators if you use the new syntax with yield statements, ).
Let me know if it does not work for you - in that case please send a "minimum reproducible example" of the errors you are facing.
good point @VernadskyDanya : I guess that pytest.mark.asyncio makes pytest run this async directly in the event loop, so the pytest-steps decorator which creates a sync function wrapper, is not compliant. Thanks for the precision!
changed the title [-]Is pytest-steps compatible with async function?[/-][+]pytest-steps is not compatible with async functions (pytest.mark.asyncio)[/+]on Nov 25, 2022
Activity
smarie commentedon Oct 4, 2019
Thanks for reaching out ! Any feedback is always great
I have not tested this plugin with async functions. However I do not see any reason why this would not be compliant, as long as the test functions are normal functions (or generators if you use the new syntax with
yieldstatements, ).Let me know if it does not work for you - in that case please send a "minimum reproducible example" of the errors you are facing.
smarie commentedon Nov 5, 2019
Closing this issue as it seems solved. Please reopen if this is not the case.
Vernadskii commentedon Oct 28, 2022
There is no way to run async functions in sync function. As I see your decorators type on default is sync. I guess it's not compatible at all :c
smarie commentedon Nov 25, 2022
good point @VernadskyDanya : I guess that
pytest.mark.asynciomakes pytest run this async directly in the event loop, so the pytest-steps decorator which creates a sync function wrapper, is not compliant. Thanks for the precision![-]Is pytest-steps compatible with async function?[/-][+]pytest-steps is not compatible with async functions (pytest.mark.asyncio)[/+]