Skip to content
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

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

Closed
mgoyder opened this issue Sep 21, 2018 · 20 comments · Fixed by #16769
Closed
Labels
area-testing bug Issue identified by VS Code Team member as probable bug verified Verification succeeded
Milestone

Comments

@mgoyder
Copy link

mgoyder commented Sep 21, 2018

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 (ViewOutput, 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
@brettcannon
Copy link
Member

Can you verify this, @d3r3kk ?

@d3r3kk
Copy link

d3r3kk commented Sep 28, 2018

Related to #2692 and #2666.

Wrong tabs open, getting the comments straight now.

@d3r3kk d3r3kk closed this as completed Sep 28, 2018
@d3r3kk d3r3kk reopened this Sep 28, 2018
@d3r3kk
Copy link

d3r3kk commented 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, 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).

@brettcannon
Copy link
Member

@d3r3kk so does this still need to be verified?

@dmytrol
Copy link

dmytrol commented 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

@d3r3kk
Copy link

d3r3kk commented Oct 17, 2018

Thanks for the info @dmytrol, I will look into this further today.

@Kurara
Copy link

Kurara commented Oct 29, 2018

I used to have the run test "button" on the function. But now it dissapeared and it says "No tests discovered, please check...." It's for months that I'm waiting if it's a bug that will be fixed. I really can't understand what I did wrong. I can run test from command with this configuration:

    {
            "name": "test bugs",
            "type": "python",
            "request": "launch",
            "stopOnEntry": false,
            "program": "${workspaceRoot}/project/test/test_file.py",
            "cwd": "${workspaceRoot}",
            "args": [
                "Test.test_bugs"
            ],
            "env": {
                "PYTHONPATH" : "${workspaceRoot}"
            },
            "debugOptions": [
                "WaitOnAbnormalExit",
                "WaitOnNormalExit",
                "RedirectOutput"
            ]
    }

So the test must be OK if I can run it from launch.json

@Casyfill

This comment has been minimized.

@d3r3kk

This comment has been minimized.

@eraoul
Copy link

eraoul commented Mar 19, 2019

I just verified that this still happens in the latest version, VS Code 1.32.3, on Windows. Python extension 2019.2.5558. As above, it happens sporadically. I had to press "Run Test" many times and then it started happening, and then it stopped appearing on its own again as well. It's really flaky.

@ToanQHo-KMS

This comment has been minimized.

@brettcannon
Copy link
Member

@ToanQHo-KMS please 👍 the issue, otherwise your vote won't count for bugfix prioritization.

@sammo
Copy link

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

@amulb
Copy link

amulb commented Nov 12, 2019

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

@microsoft microsoft locked as too heated and limited conversation to collaborators Nov 12, 2019
@brettcannon
Copy link
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.

@microsoft microsoft unlocked this conversation Nov 12, 2019
@bushnerd
Copy link

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
Copy link

karrtikr commented 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
Copy link

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
Copy link

Habbi95 commented 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
Copy link

Fixed by #16769.

@kimadeline kimadeline added the verified Verification succeeded label Jul 29, 2021
@karthiknadig karthiknadig added this to the August 2021 milestone Aug 5, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-testing bug Issue identified by VS Code Team member as probable bug verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.