You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Python version (& distribution if applicable, e.g. Anaconda): 3.9
Type of virtual environment used (N/A | venv | virtualenv | conda | ...): venv
Relevant/affected Python packages and their versions: pytest
Value of the python.languageServer setting: Default
Expected behaviour
pytest is installed globally, not in the .venv of the project, and its path is added to python.testing.pytestPath.
When calling pytest in a VSCode terminal, with .venv activated, the tests run correctly.
Using the Testing menu should call pytest from the path entered in python.testing.pytestPath and return a similar result to what I obtain from terminal.
Actual behaviour
The Testing tool says Error discovering pytest tests (see Output > Python).
Output shows:
Error 2021-09-08 17:22:58: Error discovering pytest tests:
[r [Error]: Traceback (most recent call last):
File "c:\Users\xxx\.vscode\extensions\ms-python.python-2021.9.1191016588\pythonFiles\testing_tools\run_adapter.py", line 17, in <module>
from testing_tools.adapter.__main__ import parse_args, main
File "c:\Users\xxx\.vscode\extensions\ms-python.python-2021.9.1191016588\pythonFiles\testing_tools\adapter\__main__.py", line 9, in <module>
from . import pytest, report
File "c:\Users\xxx\.vscode\extensions\ms-python.python-2021.9.1191016588\pythonFiles\testing_tools\adapter\pytest\__init__.py", line 7, in <module>
from ._discovery import discover
File "c:\Users\xxx\.vscode\extensions\ms-python.python-2021.9.1191016588\pythonFiles\testing_tools\adapter\pytest\_discovery.py", line 8, in <module>
import pytest
ModuleNotFoundError: No module named 'pytest'
at ChildProcess.<anonymous> (c:\Users\xxx\.vscode\extensions\ms-python.python-2021.9.1191016588\out\client\extension.js:9:380706)
at Object.onceWrapper (events.js:422:26)
at ChildProcess.emit (events.js:315:20)
at maybeClose (internal/child_process.js:1048:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)]
The text was updated successfully, but these errors were encountered:
ghost
added
bug
Issue identified by VS Code Team member as probable bug
triage-needed
Needs assignment to the proper sub-team
labels
Sep 8, 2021
Looks like pytestPath was only honored when running tests. But not always when discovering tests, it may work sometimes but that was not by design. We are currently working on re-writing the test adapter, and we will handle these scenarios there.
Environment data
python.languageServer
setting: DefaultExpected behaviour
pytest is installed globally, not in the .venv of the project, and its path is added to python.testing.pytestPath.
When calling pytest in a VSCode terminal, with .venv activated, the tests run correctly.
Using the Testing menu should call pytest from the path entered in python.testing.pytestPath and return a similar result to what I obtain from terminal.
Actual behaviour
The Testing tool says
Error discovering pytest tests (see Output > Python)
.Output shows:
The text was updated successfully, but these errors were encountered: