Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot restart test debugger (i.e. shift-cmd-F5) with "purpose"==["debug-test"] #17636

Closed
tclose opened this issue Oct 5, 2021 · 8 comments
Closed
Assignees
Labels
area-testing bug Issue identified by VS Code Team member as probable bug verification-needed Verification of issue is requested verified Verification succeeded
Milestone

Comments

@tclose
Copy link

tclose commented Oct 5, 2021

Sorry, not sure whether this is a bug report or feature request

Environment data

  • debugpy version: 1.4.3
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.9.5 (default, May 4 2021, 03:33:11)
    [Clang 12.0.0 (clang-1200.0.32.29)] on darwin, built by Homebrew

Version: 1.60.2
Commit: 7f6ab5485bbc008386c4386d08766667e155244e
Date: 2021-09-22T11:59:27.195Z (1 wk ago)
Electron: 13.1.8
Chrome: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Darwin x64 19.6.0

Actual behavior

When debugging a pytest unit test in the test explorer with the following launch configuration

        {
            "name": "Test Config",
            "type": "python",
            "request": "launch",
            "purpose": ["debug-test"],
            "justMyCode": true,
            "console": "integratedTerminal",
            "env": {
                "_PYTEST_RAISE": "1"
            },
        }

I am not able to restart the debugger using the debug controls (e.g. shift-cmd-F5) and receive the following message

This configuration can only be used as defined by `purpose`

Expected behavior

The debugging session is refreshed and the test run again

Steps to reproduce:

  1. Debug a unit test from test explorer
  2. Break at a breakpoint
  3. Click the "restart" button or press shift-cmd-F5
@int19h
Copy link

int19h commented Oct 6, 2021

"purpose" is something that's handled entirely by the VSCode Python extension, including the validation logic that gets tripped here; moving the issue accordingly.

@int19h int19h transferred this issue from microsoft/debugpy Oct 6, 2021
@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Oct 6, 2021
@karthiknadig karthiknadig self-assigned this Oct 6, 2021
@karthiknadig karthiknadig added area-testing bug Issue identified by VS Code Team member as probable bug triage and removed triage-needed Needs assignment to the proper sub-team labels Oct 6, 2021
@karthiknadig
Copy link
Member

@tclose "purpose": ["debug-test"] only works with the test explorer or with the debug command pallet commands.. You cannot use that with F5, if you want to say run pytest test using F5 you will have to create a module debug configuration and set it up to run using pytest and the required args.

I will leave this item open to clarify that bit in the description for "debug-test"

@int19h
Copy link

int19h commented Oct 6, 2021

I think the scenario here is that the session is started via the Test Explorer, but then restarted (while it's still running) via Run -> Restart Debugging.

@tclose
Copy link
Author

tclose commented Oct 6, 2021

@karthiknadig thanks for the response but I am referring to the case that @int19h suggested.

With the old test explorer plugin I was using and the deprecated "request": "test" launch configuration it was possible to restart a running test (i.e. using the green "recycle" arrow in the debugging controls)

@karthiknadig
Copy link
Member

I see. Thanks for clarifying.

@MrNeocore
Copy link

Has anyone found a way to make this work again ?

@karthiknadig karthiknadig added this to the January 2022 milestone Jan 13, 2022
@karthiknadig
Copy link
Member

Fixed via #18290

@karthiknadig karthiknadig added the verification-needed Verification of issue is requested label Jan 24, 2022
@rchiodo rchiodo added the verified Verification succeeded label Jan 26, 2022
@rchiodo
Copy link

rchiodo commented Jan 27, 2022

/verified

Works for me as long as I don't have a launch.json with a test config in it. Although maybe I just setup the test config incorrectly.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-testing bug Issue identified by VS Code Team member as probable bug verification-needed Verification of issue is requested verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

5 participants