Replies: 1 comment
|
Hi @blokje The first thing to verify is that the coroutine is actually being executed. pytest core does not itself provide an asyncio event-loop runner for arbitrary For example with pytest-asyncio: @pytest.mark.asyncio
async def test_something():
api_v1_for_async()Warnings emitted while that body genuinely executes are handled by pytest's normal warning capture. Given the versions in the post ( A simple diagnostic is: @pytest.mark.asyncio
async def test_something():
assert FalseIf that does not fail, the coroutine body is not being run by the async plugin/configuration you expect. I would reproduce this on current pytest plus a current async plugin before investigating warning capture itself. Please mark this answer as accepted if it helped, thank you. |
Uh oh!
There was an error while loading. Please reload this page.
Hi All,
I have the following code and I'm curious about what I'm doing wrong. It seems that for async functions the warnings are not captured.
The code is as following
And when running the test I would assume that both warnings are captured. Unfortunately only the sync warnings shows.
When I change the async test to run synchrounous both warnings show up.
Is this expected behaviour, is async not (well) supported for pytest or am I missing something.
All reactions