You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
How to make sure debugpy is used for debugging tests? #112
I tried to set the justMyCode setting to true without a launch configuration to check it out. My breakpoint in library code wasn’t respected. That makes me think that either the Python extension used its own debugger or the justMyCode setting doesn’t work reliably.
Is there a way to configure or even see which debugger extension provides the functionality to see which one it is?
I have found a workaround for now, shown in .vscode/launch.json below, as seen in referenced commit from my project template.
Also, here's some possibly useful information for debugging this issue. When I introduce the pytest debug configuration below, of type python (as opposed to debugpy), with purpose debug-test and justMyCode disabled, I can debug inside of third-party code when running test suites through the test adapter (I'm using the preview test adapter).
If I don't have that pytest debug configuration present, or configured exactly as described above, I can't step into third-party code then running via test adapter. I've also tried setting debug-test purpose in the Python: Current file adapter (driven by debugpy), explicitly toggling justMyCode in that, using the debugpy.debugJustMyCode setting, and combinations of all that.
I haven't tried all of that over again while explicitly opting out of the new test adapter, however.
I know it's just my machine, but I tried again with the latest extension version: debugging tests specifically setting the debugpy adapter with the debug-test purpose again, and with the workaround removed altogether (debugpy.debugJustMyCode set to false). It looks like for my machine that the described workaround is still required. Below are system version details from when I tried this again today. Let me know if it would help to try this with minimal extensions enabled or with extension bisect or something like that, or whether you are able to repro on your end. Thanks!
Activity
Workaround for microsoft/vscode-python-debugger#112
blakeNaccarato commentedon Nov 17, 2023
I have found a workaround for now, shown in
.vscode/launch.jsonbelow, as seen in referenced commit from my project template.Also, here's some possibly useful information for debugging this issue. When I introduce the
pytestdebug configuration below, of typepython(as opposed todebugpy), with purposedebug-testandjustMyCodedisabled, I can debug inside of third-party code when running test suites through the test adapter (I'm using the preview test adapter).If I don't have that
pytestdebug configuration present, or configured exactly as described above, I can't step into third-party code then running via test adapter. I've also tried settingdebug-testpurpose in thePython: Current fileadapter (driven bydebugpy), explicitly togglingjustMyCodein that, using thedebugpy.debugJustMyCodesetting, and combinations of all that.I haven't tried all of that over again while explicitly opting out of the new test adapter, however.
Workaround:
.vscode/launch.json{ "version": "0.2.0", "configurations": [ { "name": "Python: Current file", "type": "debugpy", "request": "launch", "program": "${file}", "console": "internalConsole" }, ... { "name": "pytest", "purpose": ["debug-test"], "presentation": { "hidden": true }, "type": "python", "request": "launch", "program": "${file}", "console": "internalConsole", "justMyCode": false } ] }eleanorjboyd commentedon Nov 27, 2023
Paula (@paulacamargo25), do you have any thoughts on this and if the workaround is required?
blakeNaccarato commentedon Nov 28, 2023
I know it's just my machine, but I tried again with the latest extension version: debugging tests specifically setting the
debugpyadapter with thedebug-testpurpose again, and with the workaround removed altogether (debugpy.debugJustMyCodeset tofalse). It looks like for my machine that the described workaround is still required. Below are system version details from when I tried this again today. Let me know if it would help to try this with minimal extensions enabled or with extension bisect or something like that, or whether you are able to repro on your end. Thanks!bersbersbers commentedon Dec 10, 2023
It's not, I have the same issue. Your workaround helps a lot. Happy to help investigate/debug this if anyone has specific instructions.
paulacamargo25 commentedon Jan 29, 2024
Since testing is handled on the python extension side, a change needs to be made to start using the python debugger extension.
paulacamargo25 commentedon Feb 14, 2024
This issue was already solved in insiders, could you try testing again with the last pre-release version on the python extension?
paulacamargo25 commentedon Feb 15, 2024
closed in : #174
andreamah commentedon Feb 22, 2024
Paula (@paulacamargo25) do you have verification steps for this?
bersbersbers commentedon Feb 29, 2024
This is working for me in Python Debugger v2024.2.0. Thanks!