Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disabling debugpy.debugJustMyCode in settings.json doesn't apply to the debug-test purpose in launch.json #335

Closed
blakeNaccarato opened this issue May 3, 2024 · 6 comments · Fixed by microsoft/vscode-python#23814
Assignees
Labels
feature-request Request for new features or functionality triage-needed Needs assignment to the proper sub-team verification-needed Verification of issue is requested verified Verification succeeded
Milestone

Comments

@blakeNaccarato
Copy link

blakeNaccarato commented May 3, 2024

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-test purpose 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:

  • 1-debugpy-adapter-settings-justmycode
    • Here we omit justMyCode in launch.json.
    • We specify debug-test in our purpose.
    • 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.

Here's the output of my VSCode Help > About:

Version: 1.88.1 (user setup)
Commit: e170252f762678dec6ca2cc69aba1570769a5d39
Date: 2024-04-10T17:41:02.734Z
Electron: 28.2.8
ElectronBuildId: 27744544
Chromium: 120.0.6099.291
Node.js: 18.18.2
V8: 12.0.267.19-electron.0
OS: Windows_NT x64 10.0.22631
@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label May 3, 2024
@paulacamargo25 paulacamargo25 added feature-request Request for new features or functionality and removed triage-needed Needs assignment to the proper sub-team labels May 30, 2024
@paulacamargo25 paulacamargo25 added this to the June 2024 milestone May 30, 2024
@paulacamargo25 paulacamargo25 modified the milestones: June 2024, July 2024 Jun 20, 2024
@paulacamargo25 paulacamargo25 added the verification-needed Verification of issue is requested label Jul 23, 2024
@rzhao271 rzhao271 added the verified Verification succeeded label Jul 23, 2024
@rzhao271
Copy link
Contributor

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.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.

@rzhao271 rzhao271 reopened this Jul 23, 2024
@rzhao271 rzhao271 added verification-found Issue verification failed and removed verified Verification succeeded labels Jul 23, 2024
@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Jul 23, 2024
@blakeNaccarato
Copy link
Author

I can confirm that Case 1 is still failing for me as well, with the same setup as my original post, but with v2024.9.12041011 (pre-release) of the Python Debugger extension. I've added a VSCode workspace file to my minimal repro repo that demonstrates the cases side-by-side, with cases two and three working, but case one still not working.

I'm using vanilla virtual environments via Python's venv module, though I see conda's also showing the issue. Also there was a test discovery regression in pytest==8.3.1 affecting conda that's already fixed but not in a new release, so be aware of that when working on this issue.

@andreamah
Copy link

@brettcannon did you close this because the issue has been resolved? Otherwise, we would want to keep it open.

@rzhao271 rzhao271 reopened this Jul 24, 2024
@paulacamargo25 paulacamargo25 removed the verification-found Issue verification failed label Jul 25, 2024
@paulacamargo25
Copy link
Contributor

Can someone test again? i am adding verification steps.

Verification Steps:

  1. Create a simple unittest in python that uses an external library.
  2. Add a breakpoint in the function call.
  3. Update debugpy.debugJustMyCode to true
  4. Try to step into the external library.

@DonJayamanne DonJayamanne added the verified Verification succeeded label Jul 25, 2024
@rzhao271
Copy link
Contributor

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
Copy link
Member

@brettcannon did you close this because the issue has been resolved? Otherwise, we would want to keep it open.

It closed because GitHub thought my syncing of the main branch on my fork meant it should re-apply all of the "Closes" comments.

eleanorjboyd pushed a commit to eleanorjboyd/vscode-python that referenced this issue Jul 30, 2024
Set justMyCode only in the python debugger, not in the python extension.
Closed: microsoft/vscode-python-debugger#335
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality triage-needed Needs assignment to the proper sub-team verification-needed Verification of issue is requested verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants