Skip to content

Instantly share code, notes, and snippets.

@gustavz
Created February 28, 2024 09:58
Show Gist options
  • Save gustavz/d49251be196a21338d23068a0200d811 to your computer and use it in GitHub Desktop.
Save gustavz/d49251be196a21338d23068a0200d811 to your computer and use it in GitHub Desktop.
VS Code debug pytest current file and test
{
"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}"
}
},
{
"name": "Pytest: Current File",
"type": "python",
"request": "launch",
"module": "pytest",
"args": [
"${file}"
],
"env": {
"PYTHONPATH": "${workspaceFolder}${pathSeparator}${env:PYTHONPATH}"
},
"console": "integratedTerminal"
},
{
"name": "Pytest: Current Test",
"type": "python",
"request": "launch",
"module": "pytest",
"args": [
"${file}::${selectedText}"
],
"env": {
"PYTHONPATH": "${workspaceFolder}${pathSeparator}${env:PYTHONPATH}"
},
"console": "integratedTerminal"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment