-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Test discovery fails when virtualenv name starts with 'python' #22932
Comments
@karrtikr any thoughts here on the environment selection? Seems like it is selecting the wrong environment as the interpreter. |
I think the issue is here: vscode-python/src/client/testing/testController/pytest/pytestDiscoveryAdapter.ts Line 112 in 27783ce
When we call into that, we're using a deprecated API
Instead we should call into |
Hey @eleanorjboyd, this issue might need further attention. @aitorciki, you can help us out by closing this issue if the problem no longer exists, or adding more information. |
FWIW I'm experiencing the same issue with the use of
instead of
|
I can also still reproduce on latest versions of VSCode and the Python extension, yes. |
I think I have the same problem but I don't have a venv name with same string. python 3.12.3 on the system, python 3.11.11 for virtual environment. |
Type: Bug
Behaviour
Expected vs. Actual
When the active virtualenv's name starts with python (e.g.
./.venv/python-3.12/{bin,include,lib}
), test discovery will fail trying to execute the discovery command using the venv directory as the binary:instead of
If the virtualenv is manually re-selected (it's already active and working except for test discovery) before navigating to the
Testing
tab, discovery will complete successfully. IfTesting
is selected before explicit venv re-selection, discovery will never complete though:Filtering out directories named
python*
from binary selection was proposed in #21711, but was discarded due to the slow nature ofstatSync
.Output without explicit venv re-selection:
After setting virtualenv manually:
Output with explicit venv re-selection:
Steps to reproduce:
python -m venv .venv/python-3.12
source .venv/python-3.12/bin/activate
pip install pytest
echo "def test_foo():\n assert True == True" > test_stuff.py
code .
Diagnostic data
python.languageServer
setting: DefaultOutput for
Python
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toPython
)Pasted in issue description.
User Settings
Extension version: 2024.0.1
VS Code version: Code 1.86.2 (903b1e9d8990623e3d7da1df3d33db3e42d80eda, 2024-02-13T19:42:12.210Z)
OS version: Darwin arm64 23.3.0
Modes:
System Info
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
A/B Experiments
The text was updated successfully, but these errors were encountered: