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

How to make sure debugpy is used for debugging tests? #112

Closed
flying-sheep opened this issue Oct 19, 2023 · 9 comments
Closed

How to make sure debugpy is used for debugging tests? #112

flying-sheep opened this issue Oct 19, 2023 · 9 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug *duplicate Issue identified as a duplicate of another issue(s)
Milestone

Comments

@flying-sheep
Copy link

flying-sheep commented Oct 19, 2023

@brettcannon said in microsoft/vscode-python#21748 (comment) that pressing the “debug test” button in the Python extension’s test view should use this extension if available.

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?

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Oct 19, 2023
blakeNaccarato added a commit to softboiler/copier-pipeline that referenced this issue Nov 17, 2023
@blakeNaccarato
Copy link

blakeNaccarato commented Nov 17, 2023

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.

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

@paulacamargo25, do you have any thoughts on this and if the workaround is required?

@blakeNaccarato
Copy link

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!

Python Debugger extension version: v2023.3.13271006
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

@bersbersbers
Copy link
Contributor

I know it's just my machine

It's not, I have the same issue. Your workaround helps a lot. Happy to help investigate/debug this if anyone has specific instructions.

@eleanorjboyd eleanorjboyd removed their assignment Dec 18, 2023
@paulacamargo25 paulacamargo25 added feature-request Request for new features or functionality and removed triage-needed Needs assignment to the proper sub-team labels Jan 25, 2024
@paulacamargo25
Copy link
Contributor

Since testing is handled on the python extension side, a change needs to be made to start using the python debugger extension.

@paulacamargo25
Copy link
Contributor

This issue was already solved in insiders, could you try testing again with the last pre-release version on the python extension?

@paulacamargo25
Copy link
Contributor

closed in : #174

@paulacamargo25 paulacamargo25 added bug Issue identified by VS Code Team member as probable bug and removed feature-request Request for new features or functionality labels Feb 15, 2024
@andreamah
Copy link

@paulacamargo25 do you have verification steps for this?

@andreamah andreamah added the verification-steps-needed Steps to verify are needed for verification label Feb 22, 2024
@paulacamargo25 paulacamargo25 removed the verification-steps-needed Steps to verify are needed for verification label Feb 23, 2024
@rzhao271 rzhao271 added the *duplicate Issue identified as a duplicate of another issue(s) label Feb 23, 2024
@bersbersbers
Copy link
Contributor

This is working for me in Python Debugger v2024.2.0. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug *duplicate Issue identified as a duplicate of another issue(s)
Projects
None yet
Development

No branches or pull requests

8 participants