Visitar URL original
No test discovery functionality when using unittest on macOS · Issue #14962 · microsoft/vscode-python · GitHub
The Wayback Machine - https://web.archive.org/web/20210923063335/https://github.com/Microsoft/vscode-python/issues/14962
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

No test discovery functionality when using unittest on macOS #14962

Closed
jdwestbrook opened this issue Dec 14, 2020 · 16 comments
Closed

No test discovery functionality when using unittest on macOS #14962

jdwestbrook opened this issue Dec 14, 2020 · 16 comments

Comments

@jdwestbrook
Copy link

@jdwestbrook jdwestbrook commented Dec 14, 2020 •

The latest insiders build has lost test discover functionality. The bottom window bar has no "run tests" item displayed. No controls are available to discover tests and provide run/debug options in test scripts. This is the second bulld recently with this issue.

settings.json

{
    "python.pythonPath": "/usr/local/pyenv-root/versions/3.9.0/bin/python",
    "python.formatting.provider": "black",
    "python.testing.unittestArgs": [
        "-v",
        "-s",
        ".",
        "-p",
        "test*.py"
    ],
    "python.testing.pytestEnabled": false,
    "python.testing.nosetestsEnabled": false,
    "python.testing.unittestEnabled": true
}
@ghost ghost added the classify label Dec 14, 2020
@ghost ghost removed the classify label Dec 14, 2020
@kimadeline
Copy link

@kimadeline kimadeline commented Dec 14, 2020 •

Hi @jdwestbrook, thank you for reporting this issue!

I could replicate your issue in these cases:

  • VS Code stable and Insiders, Python extension 2021.1.421891062-dev
  • unittest only (works with pytest or nose)
  • macOS 10.15.6

Where triggering test-related commands from the command palette (Discover Tests, Run Tests...) doesn't do anything.

Feel free to upvote your comment to help us prioritize this issue.

Thanks!

@kimadeline kimadeline removed their assignment Dec 14, 2020
@kimadeline kimadeline changed the title Lost test discovery functionality No test discovery functionality when using unittest Dec 14, 2020
@kimadeline kimadeline added the P1 label Dec 14, 2020
@kimadeline
Copy link

@kimadeline kimadeline commented Dec 15, 2020

@jdwestbrook which operating system are you using?

@jdwestbrook
Copy link
Author

@jdwestbrook jdwestbrook commented Dec 15, 2020

macOS Big Sur on a mac book pro 2018 -

@kimadeline
Copy link

@kimadeline kimadeline commented Dec 15, 2020

Hmmm others couldn't repro the issue on Windows, seems to be a Mac-specific issue so far. I'll update the title.

Thanks!

@kimadeline kimadeline changed the title No test discovery functionality when using unittest No test discovery functionality when using unittest on macOS Dec 15, 2020
@jdwestbrook
Copy link
Author

@jdwestbrook jdwestbrook commented Dec 19, 2020

Not fixed in the latest insiders update.
Version: 1.53.0-insider
Commit: c927a8015b9e26bd454d6e293bb0384aa1975d06
Date: 2020-12-18T05:27:22.865Z
Electron: 11.0.5
Chrome: 87.0.4280.88
Node.js: 12.18.3
V8: 8.7.220.29-electron.0
OS: Darwin x64 20.2.0

@kimadeline
Copy link

@kimadeline kimadeline commented Dec 21, 2020

Hi @jdwestbrook, we haven't fixed the issue yet. It has a "needs spike" label, which means that we'll have to investigate it first, to see what causes it to happen. It's on the table though, we have plans to get to it soon 🙂

@kimadeline kimadeline self-assigned this Dec 22, 2020
@kimadeline
Copy link

@kimadeline kimadeline commented Dec 22, 2020

Update: The problem happens in

this.cachedTestManagers.set(preferredTestManager, factory(testProvider, this.wkspace, testDirectory));

at the factory function that creates the UnitTestTestManager instance:

case UNITTEST_PROVIDER: {
return new UnitTestTestManager(workspaceFolder, rootDirectory, serviceContainer);
}

Error: The number of constructor arguments in the derived class UnitTestSocketServer must be >= than the number of constructor arguments of its base class.

UnitTestSocketServer is one of the dependencies of TestManagerRunner which is a dependency of UnitTestTestManager.

UnitTestSocketServer extends from EventEmitter, which is a Node class, and since this only happens in VS Code Insiders, not stable there might be something else going on (see microsoft/vscode#109728).

@kimadeline
Copy link

@kimadeline kimadeline commented Jan 4, 2021

Hi @jdwestbrook, this should be fixed with 4d1037b, feel free to give the next Insiders build a try! You can also download the VSIX directly from this page.

Thanks!

@kimadeline kimadeline closed this Jan 4, 2021
@ghost ghost removed the needs spike label Jan 4, 2021
@jdwestbrook
Copy link
Author

@jdwestbrook jdwestbrook commented Jan 7, 2021

No, I am afraid this is still broken in for the latest insiders build of Jan 6.

@kimadeline kimadeline reopened this Jan 7, 2021
@ghost ghost added the classify label Jan 7, 2021
@kimadeline
Copy link

@kimadeline kimadeline commented Jan 7, 2021

Do you have a sample repo I can use to try and replicate the issue?

@jdwestbrook
Copy link
Author

@jdwestbrook jdwestbrook commented Jan 8, 2021 •

Here is a link to a public repo -

https://github.com/rcsb/py-rcsb_utils_io.git

If you open any test the path rcsb/utils/tests-io/test*.py. you will note that the "run tests" item in
the bottom window bar is not displayed and I can find no way to access the menu with the "discover tests" option.

Thanks for your help with this -- As an aside the latest update does fix the problem with automatic restart after
a software update on macos. I am running py3.9.1 on macos 11.1 on a mac book pro 15in 2018

My settings.json file is inline below -

{
    "python.pythonPath": "/usr/local/pyenv-root/versions/3.9.0/bin/python",
    "python.formatting.provider": "black",
    "python.testing.unittestArgs": [
        "-v",
        "-s",
        ".",
        "-p",
        "test*.py"
    ],
    "python.testing.pytestEnabled": false,
    "python.testing.nosetestsEnabled": false,
    "python.testing.unittestEnabled": true
}

@kimadeline
Copy link

@kimadeline kimadeline commented Jan 8, 2021

Thank you for the repo link!

Sadly I couldn't reproduce the issue, tests were discovered whether I was using VS Code stable or Insiders:

image

I used version 2021.1.464638477-dev of the Python extension, and this version of VS Code Insiders:

Version: 1.53.0-insider
Commit: ed6c343edb720d91ee0859e566c84b5687f5a9d5
Date: 2021-01-08T10:44:29.135Z

I can find no way to access the menu with the "discover tests" option.

It it available if you use the command palette (cmd + shift + p):

image

@jdwestbrook
Copy link
Author

@jdwestbrook jdwestbrook commented Jan 11, 2021

Screen Shot 2021-01-11 at 1 49 45 PM

I continue to have issues with tests and test discovery. I attach the test window. Activating the discover test button on the top menu results in the warning message below but now other indication in the logs that it tried to run some
python test discovery. Running discover tests from the command palette gives the same warning.
The lower menu item to run tests is still missing -

[2021-01-11 13:48:55.565] [exthost] [warning] DiagnosticCollection with name 'unittest' does already exist.

If I try to run all tests from the test menu in the attached figure, I get the stack trace shown in the image and no tests are run. It appears that that testing is completely broken for my install on BigSur 11.1 and several versions of python ranging from 3.8.2-6 to 3.9.1.

@kimadeline
Copy link

@kimadeline kimadeline commented Jan 11, 2021

In this screenshot you are using version 2020.12.424452561 of the Python extension, which does not have the fix from 4d1037b. Can you try installing the Insiders version of the extension instead?

Set the python.insidersChannel setting to weekly or daily, you can also do it from the settings UI:

image

@jdwestbrook
Copy link
Author

@jdwestbrook jdwestbrook commented Jan 11, 2021

Brilliant!! That has resolved my issue.... Thanks very much for your help with this!

@kimadeline
Copy link

@kimadeline kimadeline commented Jan 11, 2021

Glad to hear it works now 🙂 If you don't want to stay on our insiders builds, the fix will also be included in the next stable release of the extension later this month.

@kimadeline kimadeline closed this Jan 11, 2021
@ghost ghost removed the needs spike label Jan 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants