I ran into similar issue, debugger misses all brea...
# general
g
I ran into similar issue, debugger misses all breakpoints in
pants test --debug-adapter ...
, if I run
pants run --debug-adapter ...
, top level code is executed but not test body. I put more context here - https://github.com/pantsbuild/pants/discussions/22788 is this a bug or have I missed some setting in
launch.json
or
pants.toml
?
w
I'll be taking a quick look at this, this morning - as I'm going to be updating some of the related dependencies. I'll see if there is anything obvious I can find
g
thanks! 🙂
w
This seems to work for me?
Copy code
pants test --debug-adapter src/python/pants/backend/cc/lint/clangformat/rules_integration_test.py
Copy code
{
  "configurations": [
    {
      "name": "Python Debugger: Remote Attach",
      "type": "debugpy",
      "request": "attach",
      "connect": {
        "host": "localhost",
        "port": 5678
      },
      "pathMappings": [
        {
          "localRoot": "${workspaceFolder}",
          "remoteRoot": "."
        }
      ]
    }
  ]
}
Similar in the
example-python
hello-world
cc @thousands-plumber-33255 ^^ Did you get your issue solved?
t
No actually not
w
Is it not letting you debug at all, are are you trying to pass that flag (for other/related reasons?)
g
what I got was that the breakpoints were missed entirely. later today I might have time to replicate this issue from my repo in my test repo
thanks for looking into this 🙂
ok I did have a test for this in the test repo, and it worked, however in my main project (closed source) it did not. comparing pants and pytest configs now
update: I added a simple test
Copy code
def test_math():
    qweert = 123
    print(qweert)
    assert 1 + 1 == 2
with a breakpoint on the print line, this still did not catch - it must be something about the repo setup. The pants version is 2.29.0 in both repos, looking for differences between the setups
w
Is your closed repo running the same python version, or same constraints?
Also, what OS/environment are you on?
I'm wondering if one of the recent changes might be relevant: https://github.com/microsoft/debugpy/releases
g
thanks for the pointers, checking now
👍 1
both constraint lines are: • interpreter_constraints = ["==3.12.*"] the os is wsl2 with Ubuntu 24.0.4.3 LTS, so pretty standard debugpy is at 1.8.16 in bth - checking the microsoft link now
that reported attach bug is for 3.11 checking more in depth now
hmm that doesn't seem to be similar enough
w
Yeah, so I was asking about the OS, because I wondered if this is a WSL thing
But you said your test repo works in wsl?
g
yeah, both in wsl
vscode logs do not say much, just the followign in both cases: 2025-10-27 112327.895 [info] Connecting to DAP Server at: 127.0.0.1:5678 2025-10-27 112335.711 [info] Resolving attach configuration with substituted variables 2025-10-27 112335.719 [info] Connecting to DAP Server at: 127.0.0.1:5678 2025-10-27 115825.336 [info] Resolving attach configuration with substituted variables 2025-10-27 115825.344 [info] Connecting to DAP Server at: 127.0.0.1:5678
hmm, that was theoretically fixed, here - https://github.com/pantsbuild/pants/pull/17566/files - but maybe a regression, I'm trying to turn off the sandbox - but why did it work in one repo and not in another one?
w
Yeah, I'm not sure if that's the issue here. If I could reproduce the problem, I think it could be fixable. Did you try running with debugpy in verbose mode? Also, are you running in a devcontainer?
g
no devcontainer this time
how do I run debugpy in verbose mode?
some argument inside launch.json?
w
I think Josh mentioned it in one of those slack threads. --debugpy-args or something? https://www.pantsbuild.org/stable/reference/subsystems/debugpy#args I don't know the correct debugpy args offhand
✅ 1
g
do you know where to put them in launch.json?
ah wait so it goes to the server, not the cvscode client
w
Yeah, passed in to pants
g
ok if I do
--debugpy-args="--log-to /tmp/mylogs"
I get
breakpoint in file that does not exist
only in the failing repo which is a new point of difference
w
Is there any way to boost the verbosity?
g
hmm, those are 1500ish line files, pretty verbose to me
now looking to parse it to find the information how to fix it
okay it's just directly not dectecting the breakpoints on the server side (the pants process), bbreakpoint in file that does ont exist
• https://github.com/microsoft/PTVS/issues/7236 • https://github.com/microsoft/PTVS/issues/6610#issuecomment-1692724477 - here it's recommended to setup localRoot as devcontainer path and remotePath the debugging container - however I am not using a devcontainer, trying options how to set it up right
w
I’m still confused why one example repo works, but this one doesn’t
g
I still am
well, will try tomorrow
👍 1
good morning, returning to testing this
one new idea - to start from a known working state and just add things to get the final functionality - maybe all will align well, some odd path-dependance specific to that other repo?
okay, fixed on my end by moving into a new repo. how to set the debugpy server from the IDE, not through the CLI? or how to specify a specific test within a file rather than all tests in a file?
w
fixed on my end by moving into a new repo.
How did that change anything?
g
no idea, maybe some kind of caching issue