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

Pytest doesn't work with python workspaces #1209

Open
glenclayton opened this issue Oct 21, 2023 · 0 comments
Open

Pytest doesn't work with python workspaces #1209

glenclayton opened this issue Oct 21, 2023 · 0 comments
Labels
bug Something isn't working team: team-experience Belonging to the Experience team

Comments

@glenclayton
Copy link

Bug description

When using the workspace-python-3.12 image, pytest discovery doesn't work as the pytest module isn't found

2023-10-21 14:26:43.442 [error] Error discovering pytest tests:
[n [Error]: Traceback (most recent call last):
File "/workspace/.vscode-remote/extensions/ms-python.python-2023.18.0-universal/pythonFiles/testing_tools/run_adapter.py", line 17, in
from testing_tools.adapter.main import parse_args, main
File "/workspace/.vscode-remote/extensions/ms-python.python-2023.18.0-universal/pythonFiles/testing_tools/adapter/main.py", line 9, in
from . import pytest, report
File "/workspace/.vscode-remote/extensions/ms-python.python-2023.18.0-universal/pythonFiles/testing_tools/adapter/pytest/init.py", line 7, in
from ._discovery import discover # noqa: F401
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/.vscode-remote/extensions/ms-python.python-2023.18.0-universal/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 8, in
import pytest
ModuleNotFoundError: No module named 'pytest'

Steps to reproduce

  1. https://gitpod.io/new#https://github.com/glenclayton/gitpod_pytest/tree/python_workspace
  2. Click on Testing
  3. Observe discovery fails and the error message above in Output->Python

Expected behavior

Using the workspace-full or default images works

  1. https://gitpod.io/new#https://github.com/glenclayton/gitpod_pytest
  2. Click on Testing
  3. Observe test is discovered and can be run

Example repository

  1. https://github.com/glenclayton/gitpod_pytest - works as expected
  2. https://github.com/glenclayton/gitpod_pytest/tree/python_workspace - fails test disovery

Anything else?

No response

@glenclayton glenclayton added the bug Something isn't working label Oct 21, 2023
@gitpod-community gitpod-community bot added the team: team-experience Belonging to the Experience team label Oct 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working team: team-experience Belonging to the Experience team
Projects
None yet
Development

No branches or pull requests

1 participant