Repository navigation
Description
Environment data
Version: 1.43.1 (user setup)
Commit: fe22a9645b44368865c0ba92e2fb881ff1afce94
Date: 2020-03-18T07:01:20.184Z
Electron: 7.1.11
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Windows_NT x64 10.0.18363
- Python version (& distribution if applicable, e.g. Anaconda): Python Anaconda 3.7.6 64-bit
- Type of virtual environment used (N/A | venv | virtualenv | conda | ...): Anaconda 1.9.12
- Relevant/affected Python packages and their versions: Python 2020.3.69010
- Relevant/affected Python-related VS Code extensions and their versions: Python 2020.3.69010
Expected behaviour
Debugging test should work.
Actual behaviour
Debugging test does not work. VS code shows error dialog. See in reproduction steps for more details. If I run the test without debugger the tests runs as expected.
Steps to reproduce:
Try to debug tests using unit test library, Click on the small bug icon for an individual test to debug.
I get a dialog box error saying Invalid message: Duplicate entries in "env". The two options i get are Open launch.json and Cancel.
I have checked my lauch.json and I do not have duplicate entries for any env variable.
Logs
ERR timeout after 500 ms: Error: timeout after 500 ms
at t.RawDebugSession.handleErrorResponse (file:///C:/Users/AP/AppData/Local/Programs/Microsoft VS Code/resources/app/out/vs/workbench/workbench.desktop.main.js:2954:952)
at file:///C:/Users/AP/AppData/Local/Programs/Microsoft VS Code/resources/app/out/vs/workbench/workbench.desktop.main.js:2954:250
at async t.RawDebugSession.shutdown (file:///C:/Users/AP/AppData/Local/Programs/Microsoft VS Code/resources/app/out/vs/workbench/workbench.desktop.main.js:2952:336)
### Settings.json
{
"python.testing.pytestArgs": [
"tests"
],
"python.testing.unittestEnabled": false,
"python.testing.nosetestsEnabled": false,
"python.testing.pytestEnabled": true
}
Activity
lorenzo-cavazzi commentedon Mar 24, 2020
kimadeline commentedon Mar 24, 2020
Hello Asif (@asipras) and Lorenzo Cavazzi (@lorenzo-cavazzi), thank you for reaching out.
Can I ask you both to provide the following:
.vscode/settings.jsonis sadly not enough for me to replicate this issue, I can debug tests correctly);Pythonoutput panel (View→Output, change the drop-down the upper-right of theOutputpanel toPython).Can you also confirm that if you downgrade to the previous release of the extension (
2020.2.64397) you can debug tests correctly:Lorenzo Cavazzi (@lorenzo-cavazzi) what do you mean by that:
Thanks!
asipras commentedon Mar 24, 2020
Kim-Adeline Miguel (@kimadeline) thanks for looking into this. I did downgrade to the previous version of python extension 2020.2.64397 and now i am able to debug the tests.
I also did some debugging with the latest version of python extension 2020.3.69010. I was able to debug a simple test (does not reference any 3rd party modules numpy, scipy, etc.) by invoking VS code from normal command prompt. However when I invoked VS code using Anaconda prompt/terminal I got the error message mentioned above.
The log from the python output panel.
lorenzo-cavazzi commentedon Mar 24, 2020
lorenzo-cavazzi commentedon Mar 24, 2020
kimadeline commentedon Mar 24, 2020
Asif (@asipras) Can you add the following configuration to your
launch.json:{ "name": "Python: Test debug config", "type": "python", "request": "test", "console": "integratedTerminal", "logToFile": true }Try debugging your tests, and copy here the content of the
debugpy*.logfile from the extension folder.Lorenzo Cavazzi (@lorenzo-cavazzi) are you getting the same
Duplicate entries in "env"message? If that's the case, there is something else going on in your setup that's not related to the extension, because it's a Windows-specific error message from the debugger:https://github.com/microsoft/debugpy/blob/69db68a5f9aff6c1dfd955c8934c753212f94633/src/debugpy/launcher/handlers.py#L110-L119
lorenzo-cavazzi commentedon Mar 25, 2020
lorenzo-cavazzi commentedon Mar 25, 2020
lorenzo-cavazzi commentedon Mar 25, 2020
55 remaining items
chore: add basic conf for pytest debug in VS Code
plaa commentedon Aug 22, 2023
I just hit the same problem, running tests works fine but debugging a test fails with
ModuleNotFoundError: No module named 'my_main_module'I tested older versions and v2023.8.0 and older work:
v2023.14.0 Debugging tests fail ❌
v2023.12.0 Debugging tests fail ❌
v2023.10.1 Unittest discovery fails with ModuleNotFoundError: No module named 'my_main_module' ❌
v2023.10.0 Unittest discovery fails with ModuleNotFoundError: No module named 'my_main_module' ❌
v2023.8.0 (and older) work as expected ✅
karrtikr commentedon Sep 12, 2023
Activation issues related to debugging tests were recently fixed, try using the latest version of VS Code and Python extension. cc/ Sampo Juustila (@plaa)
eleanorjboyd commentedon Oct 30, 2023
Hello! I have reviewed this issue and given the architectural changes of the testing rewrite, this issue should no longer exist on the rewrite. Therefore I am going to close this issue but please comment or open a new issue if you are still seeing a problem when you try this yourself!
To use the rewrite yourself just add
”python.experiments.optInto": ["pythonTestAdapter"]to your user settings. You can confirm you have the rewrite enabled by setting your log level to trace, via theDeveloper: Set Log Levelcommand in the command palette. Then check to see ifExperiment 'pythonTestAdapter' is activeis in your python logs.Thanks!
immanuelazn commentedon Nov 20, 2023
Hi, I've noticed a separate issue when interfacing with Azure credentials now.
Debugging appears to work, however it appears that the behavior is now different than how a traditional "run" in a test would work. In my case,
DefaultAzureCredentials()does not function correctly and throws an error, but works in run mode within the tests window. I have also used with and without”python.experiments.optInto": ["pythonTestAdapter"], confirmed with the new test adapter.The following versions have been tested
eleanorjboyd commentedon Nov 27, 2023
hello Immanuel Abdi (@immanuelazn), would you be able to create a new issue with the information so we can triage it and better understand the issue? Thanks!
schwaerz commentedon Dec 19, 2023
To me this issue does not seem to be fixed.
I am currently running v2023.22.1 of the plugin together with behave.
Error message is exaclty the same one as reported initially.
When I downgrade to 2023.8.0 it will work again.
The following did not help:
eleanorjboyd commentedon Jan 25, 2024
Jörg Schwärzler (@schwaerz) are you still experiencing this issue? Could you describe your project structure and include your logs so we can take a closer look? Thanks
eleanorjboyd commentedon Dec 10, 2024
closing as stale