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
{{ message }}
Repository navigation
Getting "pytest test discovery error for workspace" when having multiple projects in workspace #23828
I typically have several projects open in VS Code, i.e. in the current workspace. They can be Python (hatch), Java (Maven), GitLab CI/CD Components etc. VS Code Python sometimes have issues with pytest discovery in non-Python projects which results in me not being able to use Test Explorer to run/debug tests.
A typical error message looks like this:
2024-07-17 14:18:20.859 [error] pytest test discovery error for workspace: /home/u30576/dev/clones/sysdev/devops/cicd-components/python
What logs do you want? Python Test Log provided below.
I would not be surprised if there is an issue with environments (which I filed an issue for as well) due to the error message
2024-07-22 20:02:04.963 [error] /home/u30576/.local/share/hatch/env/virtual/reqstool/Fuhv_cEo/reqstool/bin/python: No module named pytest
2024-07-22 20:02:04.939 [info] Discover tests for workspace name: reqstool-java-annotations - uri: /home/u30576/dev/clones/sysdev/devops/documentation/requirements-tool/reqstool-java-annotations
2024-07-22 20:02:04.940 [info] Running discovery for pytest using the new test adapter.
2024-07-22 20:02:04.940 [info] Discover tests for workspace name: reqstool-client - uri: /home/u30576/dev/clones/github/Luftfartsverket/reqstool-client
2024-07-22 20:02:04.940 [info] Running discovery for pytest using the new test adapter.
2024-07-22 20:02:04.941 [info] All environment variables set for pytest discovery: ...
2024-07-22 20:02:04.942 [warning] could not find a pixi interpreter for the interpreter at /home/u30576/.pyenv/versions/3.12.2/bin/python
2024-07-22 20:02:04.942 [info] All environment variables set for pytest discovery: ...
2024-07-22 20:02:04.943 [warning] could not find a pixi interpreter for the interpreter at /home/u30576/.local/share/hatch/env/virtual/reqstool/Fuhv_cEo/reqstool/bin/python
2024-07-22 20:02:04.949 [info] > ~/.pyenv/versions/3.12.2/bin/python -m pytest -p vscode_pytest --collect-only tests --color=yes
2024-07-22 20:02:04.949 [info] cwd: ~/dev/clones/sysdev/devops/documentation/requirements-tool/reqstool-java-annotations
2024-07-22 20:02:04.953 [info] > ~/.local/share/hatch/env/virtual/reqstool/Fuhv_cEo/reqstool/bin/python -m pytest -p vscode_pytest --collect-only tests --color=yes
2024-07-22 20:02:04.953 [info] cwd: ~/dev/clones/github/Luftfartsverket/reqstool-client
2024-07-22 20:02:04.963 [error] /home/u30576/.local/share/hatch/env/virtual/reqstool/Fuhv_cEo/reqstool/bin/python: No module named pytest
2024-07-22 20:02:04.965 [error] Subprocess exited unsuccessfully with exit code 1 and signal null on workspace /home/u30576/dev/clones/github/Luftfartsverket/reqstool-client.
2024-07-22 20:02:04.966 [error] Subprocess exited unsuccessfully with exit code 1 and signal null on workspace /home/u30576/dev/clones/github/Luftfartsverket/reqstool-client. Creating and sending error discovery payload
2024-07-22 20:02:04.966 [error] pytest test discovery error for workspace: /home/u30576/dev/clones/github/Luftfartsverket/reqstool-client
The python test process was terminated before it could exit on its own, the process errored with: Code: 1, Signal: null for workspace /home/u30576/dev/clones/github/Luftfartsverket/reqstool-client
2024-07-22 20:02:05.080 [info] �[1m============================= test session starts ==============================�[0m
platform linux -- Python 3.12.2, pytest-8.3.1, pluggy-1.5.0
2024-07-22 20:02:05.080 [info] rootdir: /home/u30576/dev/clones/sysdev/devops/documentation/requirements-tool/reqstool-java-annotations
collected 0 items
2024-07-22 20:02:05.081 [info]
�[33m========================= �[33mno tests collected�[0m�[33m in 0.00s�[0m�[33m ==========================�[0m
2024-07-22 20:02:05.082 [error] ERROR: file or directory not found: tests
2024-07-22 20:02:05.097 [error] Subprocess exited unsuccessfully with exit code 4 and signal null on workspace /home/u30576/dev/clones/sysdev/devops/documentation/requirements-tool/reqstool-java-annotations.
2024-07-22 20:02:05.098 [error] Subprocess exited unsuccessfully with exit code 4 and signal null on workspace /home/u30576/dev/clones/sysdev/devops/documentation/requirements-tool/reqstool-java-annotations. Creating and sending error discovery payload
2024-07-22 20:02:05.098 [error] pytest test discovery error for workspace: /home/u30576/dev/clones/sysdev/devops/documentation/requirements-tool/reqstool-java-annotations
The python test process was terminated before it could exit on its own, the process errored with: Code: 4, Signal: null for workspace /home/u30576/dev/clones/sysdev/devops/documentation/requirements-tool/reqstool-java-annotations
Because we have not heard back with the information we requested, we are closing this issue for now. If you are able to provide the info later on, then we will be happy to re-open this issue to pick up where we left off.
🤖 Thanks for the detailed reproduction, and apologies that this remained pending after it was reopened. Testing and environment selection have changed substantially since the 2024 report; could you confirm whether the same two-repository workspace still fails on the latest Python and Python Environments extensions, and attach the current Python Test Log plus Python: Report Issue output if it does? In particular, please note whether the non-Python folder's failure still prevents tests from the Python project appearing or running. We use the info-needed label for this confirmation, and issues with that label automatically close after 30 days without a reply.
Activity
eleanorjboyd commentedon Jul 22, 2024
Can you include more logs and either an example smaller project or the structure of your project where you are experiencing this issue with. Thanks
lfvjimisola commentedon Jul 22, 2024
Sure.
To reproduce what I have below:
What logs do you want? Python Test Log provided below.
I would not be surprised if there is an issue with environments (which I filed an issue for as well) due to the error message
2024-07-22 20:02:04.963 [error] /home/u30576/.local/share/hatch/env/virtual/reqstool/Fuhv_cEo/reqstool/bin/python: No module named pytestgithub-actions commentedon Aug 29, 2024
Hey Eleanor Boyd (@eleanorjboyd), this issue might need further attention.
Jimisola Laursen (@jimisola), you can help us out by closing this issue if the problem no longer exists, or adding more information.
github-actions commentedon Sep 29, 2024
Because we have not heard back with the information we requested, we are closing this issue for now. If you are able to provide the info later on, then we will be happy to re-open this issue to pick up where we left off.
Happy Coding!
jimisola commentedon Sep 29, 2024
Eleanor Boyd (@eleanorjboyd) Would be nice if you can reopen this and advise me if the supplied information is enough.
eleanorjboyd commentedon Sep 30, 2024
yes this should not have been closed- I will review sorry!
eleanorjboyd commentedon Sep 23, 2026
🤖 Thanks for the detailed reproduction, and apologies that this remained pending after it was reopened. Testing and environment selection have changed substantially since the 2024 report; could you confirm whether the same two-repository workspace still fails on the latest Python and Python Environments extensions, and attach the current Python Test Log plus
Python: Report Issueoutput if it does? In particular, please note whether the non-Python folder's failure still prevents tests from the Python project appearing or running. We use theinfo-neededlabel for this confirmation, and issues with that label automatically close after 30 days without a reply.