Skip to content

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

@aexvir

Description

@aexvir

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"

Metadata

Metadata

Assignees

Labels

area-testingfeature-requestRequest for new features or functionalityinfo-neededIssue requires more information from poster

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions