VS Code Pytest/Unittest debugger doesn't stop on breakpoints

Viewed 38
1 Answers

According to what has been explained here, when we use "--cov" option for pytest, the VSCode doesn't stop at breakpoints. So the solution is to disable cov while debugging according to this in your VSCode launch.json add the followings:

   // your other settings are here
   {
    "name": "Debug Unit Test",
    "type": "python",
    "request": "launch",
    "justMyCode": true,
    "program": "${file}",
    "purpose": ["debug-test"],
    "console": "integratedTerminal",
    "env": {
        "PYTEST_ADDOPTS": "--no-cov"
    },
}
Related