I know how to configure the VS Code debugger's launch.json to debug the current python file:
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"cwd": "${fileDirname}",
"env": {
"PYTHONPATH": "${workspaceFolder}${pathSeparator}${env:PYTHONPATH}"
}
},
}
But How to configure launch.json to debug the current python test file with pytest?
This is what works for me in the context of Django and Pytest:
{
"name": "Python: Debug test file",
"type": "python",
"request": "launch",
"module": "pytest",
"args": [
"${file}"
],
"django": true
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With