Skip to content

Cannot restart unittest while its running #18248

@james10424

Description

@james10424

VS Code version

1.64.0-insider

Extension version

v2021.12.1559732655

OS type

macOS

OS version

11.6

Python distribution

python.org

Python version

3.7

Language server

Pylance

Expected behaviour

When debugging unittest via the testing tab, hitting the Restart button in the debug toolbar should restart my test

Actual behaviour

An error message poped up without restarting

This configuration can only be used as defined by purpose.

Steps to reproduce

Have this in launch.json

{
            "name": "unittest",
            "presentation": {
                "hidden": true,
                "group": "",
                "order": 1
            },
            "type": "python",
            "request": "launch",
            "purpose": ["debug-test", "debug-in-terminal"],
}

Go to the testing tab, start debugging a test, hit a breakpoint, then hit restart

Logs

No log is produced when hitting restart

} else if (
debugConfiguration.request === 'launch' &&
((debugConfiguration as LaunchRequestArguments).purpose ?? []).length > 0
) {
// We reach here only if people try to use debug-test or debug-in-terminal purpose for
// launching a file via F5 or "start with debugging".
// debug-test : is not allowed to be launched via (F5 or "start with debugging") since it
// requires test framework specific configuration that is done in the test
// debug launcher.
// debug-in-terminal : is not allowed because we may update the configuration based on
// editor context where it was triggered.
throw Error('This configuration can only be used as defined by `purpose`.');

VSCode might be confused by the restart command according to this code.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

Labels

area-debuggingbugIssue identified by VS Code Team member as probable bugverifiedVerification succeeded

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions