forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Labels
area-debuggingbugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bugneeds PRReady to be worked onReady to be worked on
Description
I put this as the only configuration in my launch.json (taken from your docs)
{
"name": "Python: Debug Tests",
"type": "python",
"request": "launch",
"program": "${file}",
"purpose": ["debug-test"],
"console": "integratedTerminal",
"justMyCode": false
}
I write a simple test and put a breakpoint in it. When the breakpoint is hit, I click on the restart debugging button:

Debugging stops but the debugger that is started is not the one that runs unit tests; maybe related to #22530.
In the terminal, the first debug run puts out this command:
& 'c:\Users\1\repo\venv\Scripts\python.exe'
'c:\Users\1\.vscode\extensions\ms-python.python-2023.4.1\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher' '51632'
'--'
'c:\Users\1\.vscode\extensions\ms-python.python-2023.4.1\pythonFiles\testlauncher.py'
'c:\Users\1\repo' 'pytest' '--rootdir' 'c:\Users\1\repo' '--override-ini' 'junit_family=xunit1' '--junit-xml=C:\Users\1\AppData\Local\Temp\tmp-30092H3SpqtSp80pj.xml' '-vv' '--capture' 'no' './tests/test_file.py::test_foo'
The restart does this:
c:; cd 'c:\Users\1\repo';
& 'c:\Users\1\repo\venv\Scripts\python.exe'
'c:\Users\1\.vscode\extensions\ms-python.python-2023.4.1\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher' '51716'
'--'
'C:\Users\1\repo\tests\test_file.py'
The difference is the actual command being run.
Version: 1.84.2 (user setup)
Commit: 1a5daa3a0231a0fbba4f14db7ec463cf99d7768e
Date: 2023-11-09T10:51:52.184Z
Electron: 25.9.2
ElectronBuildId: 24603566
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Windows_NT x64 10.0.19045
Python extension version v2023.20.0
ajoga, RLThomaz, DetachHead, Wyko, E5presso and 1 more
Metadata
Metadata
Assignees
Labels
area-debuggingbugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bugneeds PRReady to be worked onReady to be worked on