-
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
unittest "unhandled exception in thread" after running tests #78
Comments
From @tomhunter-gh on February 5, 2017 22:38 I am getting the same or very similar. On the first go I am able to debug tests but I can't debug a second time without restarting VSCode. Not much of an error, just
The status bar has the exclamation mark and "Running Tests" and spinner spinning forever..
VSCode Python extension version 0.5.8 |
From @dosentmatter on February 6, 2017 6:36 I also tested the debug all/single test(s) but this was a couple days back so I don't remember the specifics. It always worked on the first go and I was able to get to a breakpoint. On the next tries, it would be stuck on running tests, never get to the breakpoint, and does not show the debug buttons (continue, step into, step over, etc.). This is similar to what @tomhunter-gh said. If I keep trying to cancel the currently debug test that is running by starting another debug, it would eventually work sometimes. Though it's not clear when and why it would sometimes work. |
From @tomhunter-gh on February 6, 2017 20:36 I noticed that if I debug a test (using the hyperlink above method name) and then when I'm stopped on a breakpoint hit the restart button, I get the following error message:
I also noticed that the test / debug hyperlinks don't appear when you open VSCode if the test file is open (due to file being open in last session and restored) - you have to close the file and re-open to get the hyperlinks to appear. Update: actually you can just switch to another editor and then back again and the hyperlinks appear, but they don't appear if the file is re-opened automatically on startup from previous session. |
From @tomhunter-gh on February 6, 2017 21:6 I also noticed that I get the following error in the Python Test Log on startup after it lists out the tests in my project:
|
From @RAbraham on May 13, 2017 17:28 What I have discovered from trial and error is:
"python.unitTest.unittestArgs": [
"-v",
"-s",
".",
"-p",
"*test*.py"
] When I changed the It would be nice if I could just specify And.. thank you for your work on this plugin :) |
From @BlacKCaT27 on June 16, 2017 3:45 Is there any update on this? I'm seeing this same issue and it's making it rather hard to use VS Code to manage unit tests. What I've observed is that whatever is breaking, is breaking part of the UI in VS Code involving the "At a glance" test results in the status bar on the bottom of the screen. For example, in my project I have 50 unit tests. If all of them pass, I see the green "✔ 50" in the status bar, but nothing else. If one of my tests fails, I only see the green checkmark and some value representing all the tests that passed before that test failed. It does not appear to run additional tests even though I have fail-fast turned off. But I don't see anything in the status bar relating to the number of failed or un-run tests. In the "Python Test Log" output window, I see: Ran 50 tests in 0.335s OK At the end of my test results when all tests pass. On a failure, I see: test_assert () ... FAIL If I check the developer tools console output, I see: [Extension Host] Error: read ECONNRESET extensionHost.ts:293 Which in viewing the source, shows me this statement erroring in the logExtensionHostMessage method:
Really hope there's a simple fix here somewhere. I don't know VS Code extension code well enough to have time to make a PR, but if you need any more information please let me know. |
Apologies for never getting back on this. |
@BlacKCaT27 please let me know if this has been resolved. |
From @dosentmatter on October 31, 2017 5:47 @DonJayamanne, I still have the same problem. In the image, see "Unhandled exception in thread started by". |
I have the same issue when I press "Run Test", the test runs but the same error is showed "Unhandled exception in thread started by". On the other hand when I try to debug a test, no debug session starts. |
It seems specific to the mac version. On |
Same issue on Windows 10.
My project structure:
Workspace settings for unittest: "python.unitTest.unittestEnabled": true,
"python.unitTest.unittestArgs": [
"-v",
"-t",
"."
] Python: Run All Unit Tests works. The Run Test and Debug Test inline hyperlinks above the test functions just says "No tests ran, please check configuration settings for the tests." From the developer tools console:
Works fine when invoking unittest from the command-line as: I do not have this problem when using the PyTest module instead. |
Same problem on Mac OS X 10.11.6 and VS Code 1.20.1 and Python Ext 2018.2.1 |
I managed to fix this on my box. Turns out vscode configured a "python.unitTest.pyTestEnabled": false,
"python.unitTest.unittestEnabled": true,
"python.unitTest.nosetestsEnabled": false,
"python.pythonPath": "${workspaceFolder}\\venv\\Scripts\\python.exe",
"python.unitTest.unittestArgs": [
"-v",
"-s",
"./server",
"-p",
"test_*.py"
] when I unittest from the command line with these arguments: python -m unittest -v -s "./server" -p "test_*.py" I get the following error: usage: python.exe -m unittest [-h] [-v] [-q] [--locals] [-f] [-c] [-b]
[tests [tests ...]]
python.exe -m unittest: error: unrecognized arguments: -s It looks like the default command line arguments configured by vscode are invalid. You should try deleting any values set for "python.unitTest.pyTestEnabled": false,
"python.unitTest.unittestEnabled": true,
"python.unitTest.nosetestsEnabled": false,
"python.pythonPath": "${workspaceFolder}\\venv\\Scripts\\python.exe",
"python.unitTest.unittestArgs": [
] After deleting the command line arguments in |
@ayrtonmassey that's because the |
Then vscode shouldn't be including When I include the default arguments as above, I get both the:
errors. When I removed the arguments in Not sure what the purpose of #1341 is since my response is directly related to this issue (#74). |
For the "Unhandled exception in thread started by" problem, can someone upload a sample project? I'm unable to reproduce based on the descriptions people have provided. For all other issues, please open a separate issue as some people have asked about test discovery which is separate (and |
For my case of "Unhandled exception in thread started by" - seems to be happening when running in VSCode only for me? test_sample.py:
.vscode/settings.json:
I get that error when running tests from VSCode but not when running this in commandline: |
I've labeled this as a macOS issue since I can't reproduce on Windows. |
Closing as a duplicate of #1529 |
From @dosentmatter on January 26, 2017 19:30
Environment data
VS Code version: 1.8.1
Python Extension version: 0.5.6
Python Version: 3.5.2 and 3.6.0
OS and version: macOS Sierra Version 10.12.3
Actual behavior
I am using the standard unit testing framework, unittest. After running my tests, whether they pass or not and whether I run a single test or multiple tests, I get "Unhandled exception in thread started by" after the OK or FAILED. There is nothing after the "by" it is started "by". It does not seem like a big problem though since tests are still run.
Expected behavior
I should not get the "Unhandled exception in thread started by" message.
Steps to reproduce:
Settings
Your launch.json (if dealing with debugger issues):
none
Your settings.json:
Logs
Output from
Python
output panelOutput from
Console window
(Help->Developer Tools menu)none
Copied from original issue: DonJayamanne/pythonVSCode#674
The text was updated successfully, but these errors were encountered: