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

Notification about missing python test suite on non-python projects #14840

Closed
aexvir opened this issue Nov 28, 2020 · 10 comments
Closed

Notification about missing python test suite on non-python projects #14840

aexvir opened this issue Nov 28, 2020 · 10 comments
Assignees
Labels
area-testing feature-request Request for new features or functionality info-needed Issue requires more information from poster

Comments

@aexvir
Copy link

aexvir commented Nov 28, 2020

Environment data

  • VS Code version: 1.51.1
  • Extension version: v2020.11.371526539
  • OS and version: macOS 10.15.7 (19H2) | Darwin x64 19.6.0
  • Python version: 3.8.5
  • Type of virtual environment used: venv
  • Value of the python.languageServer setting: Pylance

Expected behaviour

If I open a project that doesn't have any python file, I shouldn't be getting any annoying popup about pytest not being installed, as it's not relevant at all. Even for python project seems a bit annoying to get this toast notifications, but I believe this should be addressed at vs code level

Actual behaviour

Opening a project that doesn't have any python file results in a toast notification prompting to install pytest
Screenshot 2020-11-28 at 21 27 02
Screenshot 2020-11-28 at 21 26 02

Steps to reproduce:

  1. Have the "python.testing.pytestEnabled": true setting
  2. Open any non python project (or python projects without pytest installed)

Logs

Output for Python in the Output panel

Starting Pylance language server.
Python interpreter path: /usr/local/bin/python3
> /usr/local/bin/python3 ~/.vscode/extensions/ms-python.python-2020.11.371526539/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/Projects/smth -s --cache-clear
cwd: ~/Projects/smth
> /usr/local/bin/python3 ~/.vscode/extensions/ms-python.python-2020.11.371526539/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/Projects/smth -s --cache-clear
cwd: ~/Projects/smth
> conda --version
Error 2020-11-28 21:25:45: Failed to parse discovered Test r [Error]: Traceback (most recent call last):
  File "/Users/alexviscreanu/.vscode/extensions/ms-python.python-2020.11.371526539/pythonFiles/testing_tools/run_adapter.py", line 17, in <module>
    from testing_tools.adapter.__main__ import parse_args, main
  File "/Users/alexviscreanu/.vscode/extensions/ms-python.python-2020.11.371526539/pythonFiles/testing_tools/adapter/__main__.py", line 9, in <module>
    from . import pytest, report
  File "/Users/alexviscreanu/.vscode/extensions/ms-python.python-2020.11.371526539/pythonFiles/testing_tools/adapter/pytest/__init__.py", line 7, in <module>
    from ._discovery import discover
  File "/Users/alexviscreanu/.vscode/extensions/ms-python.python-2020.11.371526539/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 8, in <module>
    import pytest
ModuleNotFoundError: No module named 'pytest'

    at ChildProcess.<anonymous> (/Users/alexviscreanu/.vscode/extensions/ms-python.python-2020.11.371526539/out/client/extension.js:9:456869)
    at Object.onceWrapper (events.js:313:26)
    at ChildProcess.emit (events.js:223:5)
    at ChildProcess.EventEmitter.emit (domain.js:475:20)
    at maybeClose (internal/child_process.js:1021:16)
    at Socket.<anonymous> (internal/child_process.js:430:11)
    at Socket.emit (events.js:223:5)
    at Socket.EventEmitter.emit (domain.js:475:20)
    at Pipe.<anonymous> (net.js:664:12)
> /usr/local/bin/python3 ~/.vscode/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import pytest"

@aexvir aexvir added triage-needed Needs assignment to the proper sub-team bug Issue identified by VS Code Team member as probable bug labels Nov 28, 2020
@karthiknadig karthiknadig self-assigned this Nov 30, 2020
@brettcannon
Copy link
Member

We are going to treat this as a feature request to have the settings that enable features be treated more like hints instead of a signal that you specifically want something to be turned on. We have marked this issue as "needs decision" to make sure we have a conversation about your idea. We plan to leave this feature request open for at least a month to see how many 👍 votes the opening comment gets to help us make our decision.

In the meantime, you can set python.testing.pytestEnabled at the workspace level instead of at the user setting level so that it isn't activated for workspaces that lack pytest files.

@brettcannon brettcannon added area-testing needs decision feature-request Request for new features or functionality and removed triage-needed Needs assignment to the proper sub-team bug Issue identified by VS Code Team member as probable bug labels Nov 30, 2020
@aexvir
Copy link
Author

aexvir commented Dec 2, 2020

Hmm... alright
I assumed this was definitely not an expected behaviour, as I'd never expect such notifications on non-python projects

For now I'm using custom css to disable all popup notifications, as the situation of vscode and third party plugins that send annoying notifications is kind of out of control. I don't want to have vscode flashing notifications every time I open it just because the plugins don't want to be friendly with environments different from the ones they are configured for

Thanks!

@clebio
Copy link

clebio commented Dec 31, 2020

Thanks for reporting this. It's happening for me as well and is incredibly annoying.

@luabud
Copy link
Member

luabud commented Feb 10, 2021

Thanks for bringing this up, would it help if we added a "do not show again" button in this notification?

FWIW the Python extension shouldn't be activating without a Python related file open, so if you are seeing this notification when you are not doing anything Python related, please let us know as it could be a different bug.

@luabud luabud added info-needed Issue requires more information from poster and removed needs decision labels Feb 10, 2021
@luabud luabud self-assigned this Feb 10, 2021
@ghost ghost added the triage-needed Needs assignment to the proper sub-team label Feb 10, 2021
@karthiknadig karthiknadig added triage and removed triage-needed Needs assignment to the proper sub-team labels Feb 11, 2021
@aexvir
Copy link
Author

aexvir commented Mar 19, 2021

@luabud it does happen with projects without python at all, as I showed on the initial message of this issue. I didn't have any .py, .pyc nor .pyo file and the message did pop up

and yep... personally, for me a permanent dismiss button would be enough

tried again just to verify that still happens on the latest version and indeed... still there

Screenshot 2021-03-19 at 17 34 13

@karthiknadig
Copy link
Member

@aexvir Can you share the list of installed extensions? We know now that some extensions that use python some times activate it even when there is no python file in the project. Just do a ls in ~/.vscode/extensions/ dir.

@aexvir
Copy link
Author

aexvir commented Mar 19, 2021

sure thing
there you go

Installed vscode extensions
  • alefragnani.project-manager-12.0.1
  • ardenivanov.svelte-intellisense-0.7.1
  • arrterian.nix-env-selector-1.0.6
  • batisteo.vscode-django-1.3.0
  • britesnow.vscode-toggle-quotes-0.3.4
  • bungcip.better-toml-0.3.2
  • byi8220.indented-block-highlighting-1.0.7
  • coenraads.bracket-pair-colorizer-2-0.2.0
  • connorshea.vscode-test-explorer-status-bar-1.1.2
  • dbaeumer.vscode-eslint-2.1.17
  • dbaeumer.vscode-eslint-2.1.19
  • dracula-theme.theme-dracula-2.22.3
  • eamodio.gitlens-11.3.0
  • eg2.vscode-npm-script-0.3.17
  • formulahendry.code-runner-0.11.3
  • foxundermoon.shell-format-7.0.1
  • github.vscode-pull-request-github-0.24.0
  • golang.go-0.23.2
  • hbenl.vscode-test-explorer-2.19.5
  • hbenl.vscode-test-explorer-2.19.6
  • ibm.output-colorizer-0.1.2
  • iocave.customize-ui-0.1.51
  • iocave.monkey-patch-0.1.12
  • ipedrazas.kubernetes-snippets-0.1.9
  • jakebecker.elixir-ls-0.6.5
  • jamesbirtles.svelte-vscode-0.9.3
  • keyring.lua-0.0.9
  • kisstkondoros.vscode-gutter-preview-0.27.1
  • kumar-harsh.graphql-for-vscode-1.15.3
  • littlefoxteam.vscode-python-test-adapter-0.6.6
  • littlefoxteam.vscode-python-test-adapter-0.6.7
  • lunuan.kubernetes-templates-1.1.2
  • me-dutour-mathieu.vscode-github-actions-3.0.1
  • mechatroner.rainbow-csv-1.8.1
  • michelemelluso.gitignore-1.0.1
  • mikestead.dotenv-1.0.1
  • mrmlnc.vscode-jade-snippets-1.0.1
  • ms-azuretools.vscode-docker-1.10.0
  • ms-azuretools.vscode-docker-1.11.0
  • ms-kubernetes-tools.vscode-kubernetes-tools-1.3.0
  • ms-python.python-2021.2.636928669
  • ms-python.python-2021.3.658691958
  • ms-python.vscode-pylance-2021.3.1
  • ms-python.vscode-pylance-2021.3.2
  • ms-toolsai.jupyter-2021.3.619093157
  • ms-vscode-remote.remote-containers-0.163.2
  • ms-vscode-remote.remote-wsl-0.54.3
  • ms-vscode-remote.remote-wsl-0.54.5
  • ms-vscode-remote.remote-wsl-0.54.6
  • ms-vscode.typescript-javascript-grammar-0.0.55
  • ms-vscode.vscode-typescript-tslint-plugin-1.3.3
  • ms-vsliveshare.vsliveshare-1.0.3968
  • msjsdiag.debugger-for-chrome-4.12.12
  • mtxr.sqltools-0.23.0
  • octref.vetur-0.33.1
  • pkief.material-icon-theme-4.5.0
  • pnp.polacode-0.3.4
  • quicktype.quicktype-12.0.46
  • rebornix.ruby-0.28.1
  • redhat.vscode-yaml-0.16.0
  • rescuetime.rescuetime-1.0.1
  • robbowen.synthwave-vscode-0.1.8
  • rust-lang.rust-0.7.8
  • shan.code-settings-sync-3.4.3
  • shd101wyy.markdown-preview-enhanced-0.5.16
  • sourcery.sourcery-0.8.8
  • spmeesseman.vscode-taskexplorer-2.0.7
  • streetsidesoftware.code-spell-checker-1.10.2
  • stylelint.vscode-stylelint-0.86.0
  • sysoev.language-stylus-1.11.0
  • tyriar.sort-lines-1.9.0
  • visualstudioexptteam.vscodeintellicode-1.2.11
  • visualstudioexptteam.vscodeintellicode-1.2.12
  • wakatime.vscode-wakatime-5.0.1
  • whizkydee.material-palenight-theme-2.0.1
  • wholroyd.jinja-0.0.8
  • wingrunr21.vscode-ruby-0.28.0
  • wyattferguson.jinja2-snippet-kit-2.0.0
  • xabikos.javascriptsnippets-1.8.0
  • zhuangtongfa.material-theme-3.9.15
  • zignd.html-css-class-completion-1.20.0

@karthiknadig
Copy link
Member

Looks like this is caused by microsoft/vscode-jupyter#5193

@ghost ghost removed the triage label Mar 19, 2021
@aexvir
Copy link
Author

aexvir commented Mar 19, 2021

Oh, nice catch, thanks for linking it 🙂️

although this will still mean popping up this notification when opening any python project... so the suggestion for only showing it once still sounds reasonable to me

will there be a follow up issue to this one for adding the "do not show again" button then?
or this isn't something that you want to change?

@karthiknadig
Copy link
Member

@aexvir I created #15729 to track that request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-testing feature-request Request for new features or functionality info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

5 participants