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

Getting "pytest test discovery error for workspace" when having multiple projects in workspace #23828

Open
jimisola opened this issue Jul 17, 2024 · 3 comments
Assignees
Labels
area-testing info-needed Issue requires more information from poster triage-needed Needs assignment to the proper sub-team

Comments

@jimisola
Copy link

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

Version: 1.91.1
Commit: f1e16e1e6214d7c44d078b1f0607b2388f29d729
Date: 2024-07-09T22:08:12.169Z
Electron: 29.4.0
ElectronBuildId: 9728852
Chromium: 122.0.6261.156
Node.js: 20.9.0
V8: 12.2.281.27-electron.0
OS: Linux x64 6.5.0-41-generic
@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Jul 17, 2024
@eleanorjboyd
Copy link
Member

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

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Jul 22, 2024
@lfvjimisola
Copy link

Sure.

To reproduce what I have below:

  1. start code without any projects
  2. https://github.com/luftfartsverket/reqstool-java-annotations.git
  3. add https://github.com/luftfartsverket/reqstool-client.git

image

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

Copy link

Hey @eleanorjboyd, this issue might need further attention.

@jimisola, you can help us out by closing this issue if the problem no longer exists, or adding more information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-testing info-needed Issue requires more information from poster triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

3 participants