Skip to content

With unittest Enabled: No tests ran, please check the configuration settings for the tests. #2660

Closed

Description

@mgoyder

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.":

image

Expected behavior

Tests to execute, no Warning, status to appear in the appropriate bar:

image
(I know it says Anaconda here, I was trying other stuff to debug this, but I'm using Vanilla python distro)

Steps to reproduce:

  1. 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.
  2. If you then open your test file and run the test cases individually by cliking in the editor:
    image
    then "after a while" (sorry... try maybe 10 times?) of doing that, you will start to see the Warning appear.
  3. 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

Activity

  1. brettcannon commented on Sep 24, 2018

    @brettcannon
    Member

    Can you verify this, Derek Keeler (@d3r3kk) ?

  2. d3r3kk commented on Sep 28, 2018

    @d3r3kk

    Related to #2692 and #2666.

    Wrong tabs open, getting the comments straight now.

  3. d3r3kk commented on Sep 28, 2018

    @d3r3kk

    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, runTest method registers listeners, removeListenersAfter removes 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).

  4. removed their assignment
    on Sep 28, 2018
  5. brettcannon commented on Oct 1, 2018

    @brettcannon
    Member

    Derek Keeler (@d3r3kk) so does this still need to be verified?

  6. dmytrol commented on Oct 17, 2018

    @dmytrol

    JFYI still happens (and quite frequently) on VS Code 1.28.1, Python extension 2018.9, and Python 3.6.3 64bit virtualenv

  7. 8 remaining items

  8. sammo commented on Oct 2, 2019

    @sammo

    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 cwd configuration set. If the project folder is root in vscode the tests run fine with no issue displayed.

  9. amulb commented on Nov 12, 2019

    @amulb

    Found this issue after running into this w/ v1.40.0 and Python 2019.10.44104 on Windows 10.

  10. locked as too heated and limited conversation to collaborators on Nov 12, 2019
  11. brettcannon commented on Nov 12, 2019

    @brettcannon
    Member

    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.

  12. unlocked this conversation on Nov 12, 2019
  13. bushnerd commented on Jan 17, 2020

    @bushnerd

    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.

  14. karrtikr commented on Feb 13, 2020

    @karrtikr

    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.

  15. A-UNDERSCORE-D commented on Nov 20, 2020

    @A-UNDERSCORE-D

    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.

  16. Habbi95 commented on Jan 7, 2021

    @Habbi95

    Same problem here. All the .py are pass but the last test remains with a question mark and then the warning pop ups

  17. kimadeline commented on Jul 29, 2021

    @kimadeline

    Fixed by #16769.

  18. locked as resolved and limited conversation to collaborators on Sep 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-testingbugIssue identified by VS Code Team member as probable bugverifiedVerification succeeded

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions