-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Debugging unittest tests doesn't work #89
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
Comments
From @syagev on March 14, 2017 8:56 Same exact symptoms here. EDIT: "reload window" VSC command seems to solve this every time this happens |
From @yRefl3x on March 14, 2017 9:56 @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". |
From @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. |
From @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.
|
From @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. |
From @xqliu on April 18, 2017 16:55 @alexwhittemore How did you run "discover unit tests"? method? I can not find this command on the command panel nor any place ... Thanks :) |
From @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. |
@alexwhittemore Sorry, please run the command |
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 |
From @MattMorgis on July 22, 2017 0:56 I am having the same issue with both the I created a sample project to help identify the issue: https://github.com/MattMorgis/python-tests Each time I hit
I am using a conda environment and have my Python path set both in |
Will look into this over the weekend |
From @samiraguiar on October 18, 2017 1:26 This issue still persists, at least for me on Fedora 26. Maybe this is some kind of concurrency issue? |
@MattMorgis @samiraguiar can you try changing the port to something different such as "python.unitTest.debugPort": 3000 |
@yRefl3x how about your self, are you still experiencing the same issue |
@MattMorgis found a problem with your code, class MetamapAPITest(unittest.TestCase):
def test_one(self):
self.assertEqual(true, false) |
From @MattMorgis on October 30, 2017 12:50 @DonJayamanne I committed both changes to my project: adding Looks like it lead to a new error:
|
From @samiraguiar on October 31, 2017 0:46 @DonJayamanne changing the port didn't help, the issue persisted (though no errors similar to that of @MattMorgis happened). I'm now also getting {
"python.linting.pylintEnabled": false,
"python.unitTest.unittestEnabled": true,
"python.unitTest.debugPort": 3000,
"python.pythonPath": "/bin/python3",
"python.unitTest.unittestArgs": [
"-v",
"-f",
"-s",
"./tests",
"-p",
"test_*.py"
]
} Edit: managed to get a stack trace:
Edit 2: sometimes when clicking |
@samiraguiar Hmm, seems to work at my end in the dev version. Will check the current released version. |
From @yRefl3x on November 2, 2017 11:46 My experience got better, I can debug unittests now, but it will only work on the first or second tries (kind of inconsistent). Meaning I click the code lens (both class and method lenses work here) for debugging the first time, everything works as expected. If I click a second time after stopping debugging, "Running Tests" is displayed at the bottom indefinitely but nothing happens. To be able to debug again, I have to reload the window. |
Fixes #89 - Get a random port if the one prescribed is not available - Perform handshake with support for data being streamed
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.
|
I have the same issue and same versions as @thomsavage lists (except my Python extension = Edit: although I use
But the same problem persist if I only enable |
@veuncent so you're saying that your example config is fine but it becomes an issue if you set |
@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 |
P.s. When I add
to the bottom of the file I can use the |
@veuncent Please could you create a separate issue with a sample code that we can use to replicate this at our end.
|
Done: #1009 |
From @yRefl3x on March 6, 2017 11:11
Environment data
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:
cool_module.py
test_cool_module.py
res = foo(1, 2)
Settings
settings.json:
Logs
Output from
Python Test Log
output panelCopied from original issue: DonJayamanne/pythonVSCode#797
The text was updated successfully, but these errors were encountered: