Reputation: 11
I have a monorepo project built with Bazel and I'm trying to integrate VSCode debuggers directly with Python targets I'm running.
There is a similar question that helps solve the problem here: How to use the vscode python debugger with a project built with bazel?
But I would like to do this without altering the source code and just putting a breakpoint in the code using the Python debugpy
module.
I tried the following command and it waits for me to attach a debugger (using the launch.json configuration below), but then it proceeds with the
bazel run --run_under="debugpy --listen 0.0.0.0:5678 --wait-for-client" //path/to/target/tests:dummy_tests
Here is my launch.json to attach to the debugpy server.
{
"configurations": [
{
"type": "debugpy",
"request": "attach",
"name": "Attach to a running debugpy",
"debugServer": 5678
}
]
}
I was expecting that the breakpoint was hit, but it just continued through the test.
If I add the code snippet from the linked question above, and run without the --run_under
command, everything looks fine and the breakpoint is hit.
import debugpy
debugpy.listen(5678)
debugpy.wait_for_client()
bazel run //path/to/target/tests:dummy_tests
Upvotes: 1
Views: 41