-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 debug single unit test anymore #2241
Comments
I have the same issue when clicking "Run Test" - all tests in the class are executed. This feature used to work correctly. |
Is this with the new language server or Jedi? |
I don't have any Jedi extension installed. In the 'Actual behavior' section I have given the link to the changelist (affected file) and more specifically the file "pythonFiles/PythonTools/visualstudio_py_testlauncher.py". Don't know if that helps. |
@F4h4D-T-Q I was actually asking if you have |
Apologies for the breakage, I'd added that to handle a different problem and had missed some other cases I wasn't focusing on. We'll get a fix for it for the next release. ...and perhaps add some testing for our Python files! |
@brettcannon : "python.jediEnabled": true. Sorry for not understanding your question, I only recently started using Visual Studio Code (and think it's great!) so still a lot to learn and discover. |
I can repro this issue. Using this code file:
...and ensuring that the Wait until the run test code lense appears and click it, and you will note in the Console window (Under the Output->Python Test Log window pane) that it does indeed run the two. Note: I commented out the |
I copied the class above, followed the same steps as mentioned, and could successfully run only the desired test. That is only afer I have the I don't know if this helps but here is my debug configuration: {
"name": "Python Experimental: Current File (Integrated Terminal)",
"type": "pythonExperimental",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
} and here are the workspace settings: {
"python.unitTest.unittestArgs": [
"-v",
"-s",
".",
"-p",
"test_*.py"
],
"python.unitTest.pyTestEnabled": false,
"python.unitTest.nosetestsEnabled": false,
"python.unitTest.unittestEnabled": true
} |
@F4h4D-T-Q "python.unitTest.useExperimentalDebugger": true With this setting in place, the unit tests will be debugged using the |
@DonJayamanne , same result: only the desired test case executes. The only difference I saw was that the Debug Console now shows output in a different color (brownish orange). |
Tried again this morning - you are correct and the behaviour is now correct for me too. 100% I didn't reload my environment before attempting the test last time! |
- do not break after discovering suite, still check for individual tests - fix for issue microsoft#2241
Should be fixed in the next release. |
Environment data
Actual behavior
Clicking on the 'Debug Test' link of a unit test method (not class!) results in all the unit tests of that class to execute.
Quick analysis:
The problem stems from the code change in #2066 on line 300, where a 'break' has been added in the first condition. Removing this makes the code work as before.
It also seems that the second condition (line 301) will never be reached due to this 'break'. This is because the first condition (line 298) is a more lenient check and will always be true when the second more stricter check is true. Unfortunately due to the 'break' the first condition will assign the whole class as the desired tests instead of the single test, which is assigned if he second condition is true.
Expected behavior
Only the selected unit test method should execute, as was the case earlier.
Steps to reproduce:
Logs
Output for
Python
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toPython
)Output from
Console
under theDeveloper Tools
panel (toggle Developer Tools on underHelp
)The text was updated successfully, but these errors were encountered: