You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
VS Code version: 1.10.1
Python Extension version: 0.5.9
Python Version: 2.7.5
OS and version: Windows 10
Actual behavior
After clicking on the "Debug Test" lens of a test method, debugging doesn't start. "Running Tests" is displayed at the bottom of the VSCode window indefinitely.
Expected behavior
Debugging starts.
Steps to reproduce:
I have the following folder structure:
Issue
cool_package
__init__.py
cool_module.py
test
__init__.py
test_cool_module.py
cool_module.py
def foo(a, b):
return a + b
test_cool_module.py
import unittest
from cool_package.cool_module import foo
class TestCoolModule(unittest.TestCase):
def test_foo(self):
res = foo(1, 2)
self.assertEquals(res, 3)
Stav (@syagev) I just tried reloading the window before debugging as you suggested. The test actually runs, but it doesn't debug. The breakpoint just changes to a grey circle for a short time but execution isn't stopped. The test just runs like when choosing "Run Tests".
Update: I can get unit tests to discover if I run "discover unit tests," then, while it works, run "run all tests," which causes discovery to alert failure. At this point, I can "run unit tests", which will trigger discovery successfully. At least, I think that's the flow. Will verify back at a computer.
In the bottom bar, bottom left, where it usually says "run tests" - I think it'll say "discovery failed" when such is the case, and clicking it will bring up the command palette with an option to discover.
I have a similar issue where when you click "Debug test" the running tests never stop and breakpoints do not matter. When trying to implement the if __name__ == '__main__': unittest.main(), seems to be a temporary fix.
Similar issue, my workaround.. keep clicking "debug test" over and over.. first time gets READY, second time generates an error.. but maybe 1 out of 10 times instead of just getting READY, things turn orange and debugging works fine
I am having the same issue with both the unittest and pytest options, both generate the same error. If you can point me in the right direction, I can get a fix merged in.
Each time I hit Debug Test inline in VS Code, I get this output:
FAILED (errors=1)
Traceback (most recent call last):
File "/Users/morgism/.vscode/extensions/donjayamanne.python-0.6.9/pythonFiles/PythonTools/visualstudio_py_testlauncher.py", line 343, in <module>
main()
File "/Users/morgism/.vscode/extensions/donjayamanne.python-0.6.9/pythonFiles/PythonTools/visualstudio_py_testlauncher.py", line 238, in main
enable_attach(opts.secret, ('127.0.0.1', getattr(opts, 'port', DEFAULT_PORT)), redirect_output = True)
File "/Users/morgism/.vscode/extensions/donjayamanne.python-0.6.9/pythonFiles/PythonTools/ptvsd/attach_server.py", line 167, in enable_attach
server.bind(address)
File "/Users/morgism/anaconda/envs/py2Env/lib/python2.7/socket.py", line 228, in meth
return getattr(self._sock,name)(*args)
socket.error: [Errno 48] Address already in use
I am using a conda environment and have my Python path set both in settings.json and as an ENV variable. pytest is installed there when trying to run that configuration.
I think I'm still seeing this issue. Trying to use the inline "Debug Tests" within a unit test module shows "Running Tests" in the status bar, but nothing happens.
Vincent Meijer (@veuncent) so you're saying that your example config is fine but it becomes an issue if you set "python.unitTest.unittestEnabled": true" while having "python.unitTest.nosetestsEnabled": true` as well? IOW what is the exact setting you have which consistently triggers the problem?
Brett Cannon (@brettcannon) No that's not what I mean. Under no circumstances debugging works. I tried having only one of the testing frameworks enabled at a time (as well as having multiple enabled, which obviously shouldn't work).
Clicking Debug Test above a test class or method does nothing, besides showing the Running Tests throbber at the bottom of the window.
Vincent Meijer (@veuncent) Please could you create a separate issue with a sample code that we can use to replicate this at our end.
If you can point us to a git repo that would be great.
Please provide the following info in the new issue:
Activity
DonJayamanne commentedon Nov 13, 2017
From Stav (@syagev) on March 14, 2017 8:56
Same exact symptoms here.
win10, python ext 0.6.0, VSC 1.10.2, Python 3.5.3
EDIT: "reload window" VSC command seems to solve this every time this happens
DonJayamanne commentedon Nov 13, 2017
From @yRefl3x on March 14, 2017 9:56
Stav (@syagev) I just tried reloading the window before debugging as you suggested. The test actually runs, but it doesn't debug. The breakpoint just changes to a grey circle for a short time but execution isn't stopped. The test just runs like when choosing "Run Tests".
DonJayamanne commentedon Nov 13, 2017
From Alex Whittemore (@alexwhittemore) on March 29, 2017 17:14
Confirmed, but I can't try "reload window" to solve it, because "discovering tests" has stopped completing for me.
DonJayamanne commentedon Nov 13, 2017
From Guilherme Passero (@gpassero) on April 1, 2017 14:5
I can debug tests when I run them with the following command line (in the end of the test file script). It may be a temporary solution for you.
DonJayamanne commentedon Nov 13, 2017
From Alex Whittemore (@alexwhittemore) on April 1, 2017 15:59
Update: I can get unit tests to discover if I run "discover unit tests," then, while it works, run "run all tests," which causes discovery to alert failure. At this point, I can "run unit tests", which will trigger discovery successfully. At least, I think that's the flow. Will verify back at a computer.
DonJayamanne commentedon Nov 13, 2017
From Larry & Leo (@xqliu) on April 18, 2017 16:55
Alex Whittemore (@alexwhittemore) How did you run "discover unit tests"? method?
I can not find this command on the command panel nor any place ...
Thanks :)
DonJayamanne commentedon Nov 13, 2017
From Alex Whittemore (@alexwhittemore) on April 18, 2017 18:25
In the bottom bar, bottom left, where it usually says "run tests" - I think it'll say "discovery failed" when such is the case, and clicking it will bring up the command palette with an option to discover.

DonJayamanne commentedon Nov 13, 2017
Alex Whittemore (@alexwhittemore) Sorry, please run the command
Run All UnittestsDonJayamanne commentedon Nov 13, 2017
From @VicLiang621 on May 28, 2017 7:38
I have a similar issue where when you click "Debug test" the running tests never stop and breakpoints do not matter. When trying to implement the

if __name__ == '__main__': unittest.main(), seems to be a temporary fix.DonJayamanne commentedon Nov 13, 2017
From sdtom on June 19, 2017 15:6
Similar issue, my workaround.. keep clicking "debug test" over and over.. first time gets READY, second time generates an error.. but maybe 1 out of 10 times instead of just getting READY, things turn orange and debugging works fine
DonJayamanne commentedon Nov 13, 2017
From Matt Morgis (@mattmorgis) on July 22, 2017 0:56
I am having the same issue with both the
unittestandpytestoptions, both generate the same error. If you can point me in the right direction, I can get a fix merged in.I created a sample project to help identify the issue: https://github.com/MattMorgis/python-tests
Each time I hit
Debug Testinline in VS Code, I get this output:I am using a conda environment and have my Python path set both in
settings.jsonand as an ENV variable.pytestis installed there when trying to run that configuration.19 remaining items
thomsavage commentedon Feb 16, 2018
I think I'm still seeing this issue. Trying to use the inline "Debug Tests" within a unit test module shows "Running Tests" in the status bar, but nothing happens.
veuncent commentedon Mar 9, 2018
I have the same issue and same versions as Thom Savage (@thomsavage) lists (except my Python extension =
2018.2.0).Edit: although I use
noseinstead ofunittest:But the same problem persist if I only enable
unittestEnabled.brettcannon commentedon Mar 9, 2018
Vincent Meijer (@veuncent) so you're saying that your example config is fine but it becomes an issue if you set
"python.unitTest.unittestEnabled": true" while having"python.unitTest.nosetestsEnabled": true` as well? IOW what is the exact setting you have which consistently triggers the problem?veuncent commentedon Mar 9, 2018
Brett Cannon (@brettcannon) No that's not what I mean. Under no circumstances debugging works. I tried having only one of the testing frameworks enabled at a time (as well as having multiple enabled, which obviously shouldn't work).
Clicking
Debug Testabove a test class or method does nothing, besides showing theRunning Teststhrobber at the bottom of the window.veuncent commentedon Mar 9, 2018
P.s. When I add
to the bottom of the file I can use the
Start Debuggingbutton in VSC to run the unit tests, but it does not pause at break points or anything.DonJayamanne commentedon Mar 9, 2018
Vincent Meijer (@veuncent) Please could you create a separate issue with a sample code that we can use to replicate this at our end.
If you can point us to a git repo that would be great.
Please provide the following info in the new issue:
veuncent commentedon Mar 9, 2018
Done: #1009