Cannot debug single unit test anymore
See original GitHub issueEnvironment data
- VS Code version: 1.25.1
- Extension version (available under the Extensions sidebar): 2018.7.1
- OS and version: Windows 7 (also tried on Windows 10)
- Python version (& distribution if applicable, e.g. Anaconda): Python 3.6
- Type of virtual environment used (N/A | venv | virtualenv | conda | …): N/A
- Relevant/affected Python packages and their versions: Unit Testing
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:
- Create a unit test class (derived from unittest.TestCase)
- Create a couple of unit test methods.
- Assuming that the unit tests are discovered and the ‘Run Test| Debug Test’ links are visible, click on the Debug Test link of a method. --> All the Unit tests execute instead of only the desired test.
Logs
Output for Python
in the Output
panel (View
→Output
, change the drop-down the upper-right of the Output
panel to Python
)
N/A, please see issue above
Output from Console
under the Developer Tools
panel (toggle Developer Tools on under Help
)
N/A, please see issue above
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:12 (2 by maintainers)
Top GitHub Comments
@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.
Should be fixed in the next release.