Skip to content

Error message when debugging Python tests is unhelpful #17150

@jeffwright13

Description

@jeffwright13

'This configuration can only be used by the test debugging commands. `"request": "test"` is deprecated use "purpose" instead.',

The official documentation for debugging Python tests (https://code.visualstudio.com/docs/python/testing#_debug-tests) states: "To customize settings for debugging tests, you can specify "request":"test" in the launch.json file." However, when I configure my launch.json file like that, and then try to run w/ debug (F5), I get an error message: "This configuration can only be used by the test debugging commands. '"request": "test"' is deprecated use "purpose" instead."

I don't mind changing my launch.json file. However, in order to comply with the error message and "use 'purpose' instead," I need to know the precise syntax to use. The phrase "use purpose" doesn't tell me if that should be the key or the value in the json - should it be "purpose": "test" or should it be "request": "purpose"? Actually, neither one of these work. Both throw an error. Either "Attribute 'request' has an unsupported value 'purpose' in the chosen debug configuration", or "This configuration can only be used as defined by purpose."

As a user who is trying to just be able to debug tests in Python, I am left scratching my head.

If it is helpful, here is my launch.json file:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Run Current File (External Terminal)",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "externalTerminal"
        },
        {
            "name": "Python: Debug Tests (Integrated Terminal)",
            "type": "python",
            "request": "test",
            //"request": "purpose",
            //"purpose": "test",
            "console": "integratedTerminal",
            "justMyCode": false,
            "stopOnEntry": false
        }
    ]
}

Metadata

Metadata

Assignees

Labels

area-editor-*User-facing catch-allbugIssue identified by VS Code Team member as probable bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions