'Visual Studio Code debugger does not stop at breakpoints with pytest-asyncio
I have a python project that uses pytest. We have some functions that are async and therefore we need to have async tests. In this sense, we added the pytest-asyncio package as a dependency. Now, we can run our tests, but when we try to debug them using Visual Studio Code Test Explorer we came up with the fact that it doesn't stop on breakpoints.
I tried googling older posts bringing up this issue but couldn't find any. Does anyone know if this is a known issue or how I can solve it?
Basically, to replicate this you need to generate a python file with the following test:
import pytest
async def foo():
hello = "123"
print(hello)
return hello
@pytest.mark.asyncio
async def test_foo():
result = await foo()
assert "123" == result
You first need to run pip install pytest asyncio pytest-asyncio, add some breakpoint on the print(hello) line and then run the tests with the VS Code python test explorer.
Thanks in advance!
Solution 1:[1]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Steven-MSFT |

