Skip to content

"Debug test" unable to attach to subprocesses or or existing processes #461

@rwarren

Description

@rwarren

When using the "Debug Test" functionality in VSCode with Python, I am unable to get the debugger to attach to subprocesses spawned during the tests. I've set "subProcess": true in my launch.json file and included "purpose": ["debug-test"], which seems like what I am suppose dto do to configure "debug test" launches... but this doesn't seem to have any effect -- the debugger still doesn't attach to subprocesses.

Additionally, I have tried to use the "connect" option to attach to an existing process, but VSCode doesn't allow the "connect" attribute at all when "purpose" includes "debug-test".

I've prepared a simple project to demonstrate the issue:

https://github.com/rwarren/DEMO_vscode_subprocess_debug

Details:

  1. The test suite starts a subprocess that needs to be debugged
    • Although I would also like to (and prefer to) be able to attach to an already running subprocess to save startup time when iterating on test code vs application code
  2. The launch.json configuration includes "subProcess": true, but subprocess debugging doesn't work during "Debug Test" runs
  3. vscode does not allow "connect" when "purpose": ["debug-test"] is set, limiting this option as well

What I'm hoping for here:

  1. Guidance on how to enable subprocess debugging when running tests with "Debug Test".
    • i.e. am I just doing this wrong?
  2. Clarification on whether this is a limitation of the current debugger implementation.
    • i.e. is this just not possible?
  3. Suggestions for workarounds to debug subprocesses in tests
    • e.g. I am considering running two vscode instances, one that debugs the server, an da second that debugs the tests... but this is obviously not-ideal

Metadata

Metadata

Assignees

Labels

triage-neededNeeds assignment to the proper sub-team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions