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 launch pytest debugger #21505

Closed
lramos15 opened this issue Jun 27, 2023 · 10 comments
Closed

Cannot launch pytest debugger #21505

lramos15 opened this issue Jun 27, 2023 · 10 comments
Assignees
Labels
area-testing info-needed Issue requires more information from poster triage-needed Needs assignment to the proper sub-team

Comments

@lramos15
Copy link
Member

Testing #21495

I receive this error when trying to debug

2023-06-27 08:12:45.590 [error] Pytest test execution error
 TypeError: Cannot read properties of undefined (reading 'launchDebugger')
    at t.PytestTestExecutionAdapter.runTestsNew (/Users/lramos15/.vscode-insiders/extensions/ms-python.python-2023.11.11781018/out/client/extension.js:2:859042)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at t.PytestTestExecutionAdapter.runTests (/Users/lramos15/.vscode-insiders/extensions/ms-python.python-2023.11.11781018/out/client/extension.js:2:857588)
    at t.WorkspaceTestAdapter.executeTests (/Users/lramos15/.vscode-insiders/extensions/ms-python.python-2023.11.11781018/out/client/extension.js:2:879594)
    at async Promise.all (index 0)
    at D.runTests (/Users/lramos15/.vscode-insiders/extensions/ms-python.python-2023.11.11781018/out/client/extension.js:2:842000)
    at e.$A_b.k (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:103:6852)
    at async Promise.all (index 0)
@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Jun 27, 2023
@rzhao271
Copy link

rzhao271 commented Jun 27, 2023

I encountered the same error, but I noticed after refreshing the tests or reloading the window that fewer test cases showed up? When I placed a breakpoint in one of the remaining test cases, I was able to debug it.
I tested the pytest TPI first, so maybe that picked up more test cases than were actually supported by unittest even when I reconfigured the tests to be run by unittest?

Edit: Got some repro steps.

  1. Configure the tests to be run with pytest on the root directory .. All tests should show up.
  2. Configure the tests to be run with unittest on the root directory . and only for test files of form test_*.py. 🐛 All tests still show up.
  3. Refresh the tests. 🐛 All tests still show up.
  4. Attempt to debug a test in test_two_classes.py. 🐛 The error above shows up.

@eleanorjboyd
Copy link
Member

@karthiknadig, thoughts on this? When we talked last it seemed semi-impossible for this to happen but we continue to get reports on it.

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Jun 28, 2023
@karthiknadig
Copy link
Member

@eleanorjboyd We have to see if we can repro this. I can't really say what is going on. unless we are somehow setting it to undefined.

@eleanorjboyd
Copy link
Member

@lramos15 do you remember the steps you took when you saw this error? Trying to find similarities with @rzhao271 comment as I have tried to repro this issue and have been unsuccessful in the past. Thanks

@lramos15
Copy link
Member Author

lramos15 commented Jun 29, 2023

@lramos15 do you remember the steps you took when you saw this error? Trying to find similarities with @rzhao271 comment as I have tried to repro this issue and have been unsuccessful in the past. Thanks

I just clicked the little debug icon next to the test in the test UI. Then it didn't work. I don't recall anything really special about it.

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label Jun 29, 2023
@michaelgonnella
Copy link

Hello, I'm running into the same issue while running from within a dev container in VS Code. VSCode is on version 1.81.1, and Python extension version v2023.14.0.

2023-08-23 13:53:31.022 [error] Pytest test execution error
 [TypeError: Cannot read properties of undefined (reading 'launchDebugger')
	at t.PytestTestExecutionAdapter.runTestsNew (/root/.vscode-server/extensions/ms-python.python-2023.14.0/out/client/extension.js:2:860683)
	at processTicksAndRejections (node:internal/process/task_queues:96:5)
	at async t.PytestTestExecutionAdapter.runTests (/root/.vscode-server/extensions/ms-python.python-2023.14.0/out/client/extension.js:2:859184)
	at async t.WorkspaceTestAdapter.executeTests (/root/.vscode-server/extensions/ms-python.python-2023.14.0/out/client/extension.js:2:881277)
	at async Promise.all (index 0)
	at async D.runTests (/root/.vscode-server/extensions/ms-python.python-2023.14.0/out/client/extension.js:2:843548)
	at async C.k (/vscode/vscode-server/bin/linux-x64/6c3e3dba23e8fadc360aed75ce363ba185c49794/out/vs/workbench/api/node/extensionHostProcess.js:107:6002)
	at async Promise.all (index 0)]

@eleanorjboyd
Copy link
Member

@connor4312 do you have any thoughts on this? We are using inversify to inject the debugLauncher into a control class which then handles creating the test adapters and calling run/discover on them. Not sure if you have seen a similar problem in core ever or if you do anything specific with the launchDebugger. Thanks

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Aug 23, 2023
@connor4312
Copy link
Member

While I do use inversify in js-debug, I'm not at all familiar with the internals of the python extension.

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label Aug 23, 2023
@michaelgonnella
Copy link

I actually was to able to (temporarily) get past this by uninstalling the Python extension from my running container, and then reinstalling the same version. Since then I have been able to debug.

@eleanorjboyd
Copy link
Member

still unable to repro this issue so since it has been a month I am going to close this. Please comment if you are running into this issue and I can reopen. Thanks

@eleanorjboyd eleanorjboyd closed this as not planned Won't fix, can't repro, duplicate, stale Oct 4, 2023
@github-actions github-actions bot added the info-needed Issue requires more information from poster label Oct 4, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-testing info-needed Issue requires more information from poster triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

6 participants