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
Disabling debugpy.debugJustMyCode in settings.json doesn't apply to the debug-testpurpose in launch.json #335
I'm using "Python Debugger" extension v2024.6.0. It looks like microsoft/vscode-python#22903 closed related issues #174 and #112, but this is not exactly the same issue. Basically, disabling debugpy.debugJustMyCode in settings.json doesn't apply to the debug-testpurpose in launch.json. See https://github.com/blakeNaccarato/vscode-python-debugger-335 for a minimal repro of three behaviors. The subfolders represent three different debug configurations:
We do explicitly disable the global setting debugpy.debugJustMyCode in settings.json.
We cannot stop at breakpoints in standard library code here.
✅ 2-debugpy-adapter: Here we explicitly disable justMyCode in launch.json and specify debug-test in our purpose. We successfully stop at breakpoints in standard library code here.
✅ 3-vscode-python-debug-adapter: Here we use the soon-to-be-deprecated python debug adapter, explicitly disable justMyCode in launch.json, and specify debug-test in our purpose. We successfully stop at breakpoints in standard library code here.
Could debugpy.debugJustMyCode global toggle in settings.json be extended to cover test debugging as well?
It's nice to have a global toggle for this, so that a launch.json config checked into the repo doesn't have a merge-conflict-prone justMyCode toggle embedded in it.
Case 1 is still failing for me above. When I set a breakpoint for json.dumps in .conda\Lib\json\__init__.py and run the "Python Debugger: Current File" launch config on test_sample.py, the debugger does not stop at the breakpoint.
It looks like running the launch config on sample.py works, and that running the launch config on test_sample.py works after explicitly adding a call to the test_answer() test function. I'm unsure whether the launch config could directly run a test for you.
and fail to step any 3rd party (library code) through the test debugging. I have used the repository and code provided by Blake Naccarato (@blakeNaccarato) but none of the versions (neither 2 or 3 that should work) give me an option to debug the simple test code
Hi Pasieka Manuel (@mapa17), I gave these a try with debugging the test and 2 and 3 work (1 is not working for me right now which I need to investigate). Can you outline how exactly you ran 2 and 3 that caused them to not work? Did you use pytest? Can you include a video or gif? Did you add any other settings?
When I start debugging (F5) of the test file, i can step into the json.dumps code. When I use the Testing menu and start debugging there, the dumps() is stepped over.
Activity
Fix debug arg error (#23814)
rzhao271 commentedon Jul 23, 2024
Python Debugger: v2024.9.2024072301 (pre-release)
Python: v2024.11.2024072302 (pre-release)
Case 1 is still failing for me above. When I set a breakpoint for
json.dumpsin.conda\Lib\json\__init__.pyand run the "Python Debugger: Current File" launch config ontest_sample.py, the debugger does not stop at the breakpoint.4 remaining items
paulacamargo25 commentedon Jul 25, 2024
Can someone test again? i am adding verification steps.
Verification Steps:
debugpy.debugJustMyCodetotruerzhao271 commentedon Jul 25, 2024
Re-verified and LGTM.
It looks like running the launch config on sample.py works, and that running the launch config on test_sample.py works after explicitly adding a call to the
test_answer()test function. I'm unsure whether the launch config could directly run a test for you.brettcannon commentedon Jul 25, 2024
It closed because GitHub thought my syncing of the
mainbranch on my fork meant it should re-apply all of the "Closes" comments.Fix debug arg error (microsoft#23814)
Squashed commit of the following:
mapa17 commentedon Dec 13, 2024
Hi,
I am running vscode
and fail to step any 3rd party (library code) through the test debugging. I have used the repository and code provided by Blake Naccarato (@blakeNaccarato) but none of the versions (neither 2 or 3 that should work) give me an option to debug the simple test code
I am able to step into the code using the "normal" debugging functionality.
eleanorjboyd commentedon Dec 13, 2024
Hi Pasieka Manuel (@mapa17), I gave these a try with debugging the test and 2 and 3 work (1 is not working for me right now which I need to investigate). Can you outline how exactly you ran 2 and 3 that caused them to not work? Did you use pytest? Can you include a video or gif? Did you add any other settings?
mapa17 commentedon Dec 14, 2024
Hello, thank you for investigating. I have in my .venv
and the whole test project consist of
(.venv) [mapa17@Bucephalus test]$ cat .vscode/settings.json { "workbench.colorCustomizations": { "activityBar.background": "#2A2367", "titleBar.activeBackground": "#3B3190", "titleBar.activeForeground": "#FAFAFD" }, "python.testing.pytestEnabled": true } (.venv) [mapa17@Bucephalus test]$ cat .vscode/launch.json { "version": "0.2.0", "configurations": [ { "name": "Python Debugger: Current File", "type": "debugpy", "request": "launch", "program": "${file}", "console": "integratedTerminal", "purpose": ["debug-test", "debug-in-terminal"], "justMyCode": false } ] } (.venv) [mapa17@Bucephalus test]$ cat tests/test_json.py import json def test_answer(): assert json.dumps({'toto': 'tata'}) == '{"toto": "tata"}'When I start debugging (F5) of the test file, i can step into the json.dumps code. When I use the Testing menu and start debugging there, the dumps() is stepped over.
Modify `launch.json` now that microsoft/vscode-python-debugger#335 is…