Repository navigation
With unittest Enabled: No tests ran, please check the configuration settings for the tests. #2660
Copy link
Copy link
Closed
Labels
area-testingbugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bugverifiedVerification succeededVerification succeeded
Milestone
Description
Environment data
- VS Code version: Code 1.27.2 (f46c4c469d6e6d8c46f268d1553c5dc4b475840f, 2018-09-12T16:17:45.060Z)
- Extension version (available under the Extensions sidebar): 2018.8.0
- OS and version: Windows_NT x64 10.0.16299
- Python version (& distribution if applicable, e.g. Anaconda): Python 3.5
- Type of virtual environment used (N/A | venv | virtualenv | conda | ...): N/A
I enabled Unit tests for my Python project using these Microsoft instructions: https://code.visualstudio.com/docs/python/unit-testing I'm using unittest and have explicitly disabled PyTest and Nose.
Actual behavior
Even though tests are passing, there is the Warning "No tests ran, please check the configuration settings for the tests.":
Expected behavior
Tests to execute, no Warning, status to appear in the appropriate bar:

(I know it says Anaconda here, I was trying other stuff to debug this, but I'm using Vanilla python distro)
Steps to reproduce:
- This is tricky. I've disabled all extensions except vscode-python. The first time you run tests (select Run All Unit Tests) it seems to work.
- If you then open your test file and run the test cases individually by cliking in the editor:

then "after a while" (sorry... try maybe 10 times?) of doing that, you will start to see the Warning appear. - From that point on, no matter how many tests you execute, or how you execute them, the output will show that they ran but the bar will say otherwise.
Logs
Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)
Blank
Output from Console under the Developer Tools panel (toggle Developer Tools on under Help)
console.ts:136 [Extension Host] Python Extension: Error: read ECONNRESET
t.log @ console.ts:136
t._logExtensionHostMessage @ extensionHost.ts:412
(anonymous) @ extensionHost.ts:224
emitTwo @ events.js:126
emit @ events.js:214
emit @ internal/child_process.js:772
_combinedTickCallback @ internal/process/next_tick.js:141
_tickCallback @ internal/process/next_tick.js:180
log.ts:171 ERR Unexpected token C in JSON at position 101: SyntaxError: Unexpected token C in JSON at position 101
at JSON.parse (<anonymous>)
at Socket.socket.on (C:\Users\mgoyder\.vscode\extensions\ms-python.python-2018.8.0\out\client\unittests\unittest\socketServer.js:77:38)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:246:13)
at Socket.Readable.push (_stream_readable.js:208:10)
at TCP.onread (net.js:594:20)
console.ts:136 [Extension Host] ApplicationInsights:Sender [{…}]0: {code: "ETIMEDOUT", errno: "ETIMEDOUT", syscall: "connect", address: "64.4.54.254", port: 443}length: 1__proto__: Array(0)
t.log @ console.ts:136
t._logExtensionHostMessage @ extensionHost.ts:412
(anonymous) @ extensionHost.ts:224
emitTwo @ events.js:126
emit @ events.js:214
emit @ internal/child_process.js:772
_combinedTickCallback @ internal/process/next_tick.js:141
_tickCallback @ internal/process/next_tick.js:180
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-testingbugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bugverifiedVerification succeededVerification succeeded

Activity
brettcannon commentedon Sep 24, 2018
Can you verify this, Derek Keeler (@d3r3kk) ?
d3r3kk commentedon Sep 28, 2018
Related to #2692 and #2666.
d3r3kk commentedon Sep 28, 2018
Yes, this does appear to be happening on Windows, I can sometimes get it to reproduce in Linux but it is far more infrequent (I had to remap keyboard controls to make re-running tests go fast enough to trip up the test runner).
My current hypothesis is that this is related to the test failures here in #2692, I believe the re-registration of listeners needs to be revisited and corrected.
Files affected:
src/client/unittests/unittest/runner.ts,runTestmethod registers listeners,removeListenersAfterremoves them afterwards -> I think this pattern is what is causing the trouble. Odd that it is more pronouned in Windows! (And would explain why the tests all passed in macOS and Linux).brettcannon commentedon Oct 1, 2018
Derek Keeler (@d3r3kk) so does this still need to be verified?
dmytrol commentedon Oct 17, 2018
JFYI still happens (and quite frequently) on VS Code 1.28.1, Python extension 2018.9, and Python 3.6.3 64bit virtualenv
8 remaining items
sammo commentedon Oct 2, 2019
I'm getting the same error on a Mac. Tests don't run. I only see it when the project folder is a children of my vscode project and I have a
cwdconfiguration set. If the project folder is root in vscode the tests run fine with no issue displayed.amulb commentedon Nov 12, 2019
Found this issue after running into this w/ v1.40.0 and Python 2019.10.44104 on Windows 10.
brettcannon commentedon Nov 12, 2019
As this is a recognized bug, the most useful thing people can do at this point is to give 👍 to the original comment to help us prioritize our work.
bushnerd commentedon Jan 17, 2020
I also have this issue. But i found the reason is the module imported in .py file was not installed. After i install the module, it's resolved. But i am confused by the notice.
karrtikr commentedon Feb 13, 2020
Results from the spike:
The root cause of the issue is hard to spot. The issue arises from the fact that we use socket communications to discover/run tests in the unittest framework.
My suspicion is that it happens when the button is repeatedly pressed, the previous socket is not disposed before creating a new connection due to which the communication fails.
Using sockets also leads to other issues like #5597
Suggestion: Use the stdout to scrape output rather than sockets, as is done with other frameworks. I've verified that results are correctly sent to the stdout, even in the cases where socket communication fails.
A-UNDERSCORE-D commentedon Nov 20, 2020
Adding a "Me too" here. I've got tests that get run and fail, but vscode shows "No tests ran". Looking in the output for python tests show my failures.
Habbi95 commentedon Jan 7, 2021
Same problem here. All the .py are pass but the last test remains with a question mark and then the warning pop ups
kimadeline commentedon Jul 29, 2021
Fixed by #16769.