Skip to content

pytest not installed but selected for configuration updates #25251

Open
@eleanorjboyd

Description

@eleanorjboyd

steps to reproduce:

  1. create venv
  2. have file with pytest
  3. configure pytest
  4. see error because pytest is not installed but user selected it as the testing framework

a few things I want to fix:

  • the extension attempts to install pytest if the user doesn't have it. I want to update this so it checks to see if the user has the python environments extension, if it does then introduce a popup which says something like "pytest selected but not installed, would you you like to install pytest?" "yes" "ignore". Then "yes" will call install package in the current environment with pytest as the package.
  • better error handling so if pytest isn't installed, and is either attempted to run or attempted to install and doesn't work, the error node in the test panel tree says something more specific like "pytest not installed". Here are the logs related to when that errors:
2025-07-08 09:09:42.617 [info] > ./.venv/bin/python -c "import pip"
2025-07-08 09:09:42.652 [debug] could not find a pixi interpreter for the interpreter at /opt/homebrew/bin/python3
2025-07-08 09:09:42.653 [debug] Activation Commands received undefined for shell bash, resource undefined and interpreter /opt/homebrew/bin/python3
2025-07-08 09:09:42.654 [info] > ./.venv/bin/python -c "import pytest"
2025-07-08 09:09:42.685 [debug] Error when checking if module is installed pytest n [Error]: Traceback (most recent call last):
  File "<string>", line 1, in <module>
    import pytest
ModuleNotFoundError: No module named 'pytest'

Metadata

Metadata

Labels

feature-requestRequest for new features or functionalitytriage-neededNeeds assignment to the proper sub-team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions