-
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 with pytest fails, because pytest is run in the base conda env #24122
Comments
Hi! So to confirm, If you run |
Yes.
Yes. |
besides "CONDA_PREFIX":"/Users/guenther/mambaforge","CONDA_PROMPT_MODIFIER":"(base) any other notable settings? @anthonykim1 I am using the createActiveEnvironment command like this, any thoughts on how to produce more logging or what else could be going wrong? If not I can make a change to add additional logging to look at this |
Except for conda, there should be nothing special going in that session. I should not that it's also not the first time that I see this, but I finally got annoyed enough to file an issue. |
Don't think
is related to this issue. @eleanorjboyd It may be the ordering of: vscode-python/src/client/common/process/pythonExecutionFactory.ts Lines 130 to 135 in c314bab
where createActivatedEnvironment just returns on the conda conditional without getting to the desired
in this scneario. This seem the closest to what is "forcing" the use of conda rather than a desired venv?? in this case. |
To the best of my knowledge (from googling all parts of this error message) |
Type: Bug
Behaviour
Test discovery with pytest fails.
From looking at the output, it seems that pytest is run in my base conda environment, not in the environment for this particular project. My base conda environment has an old, no longer supported Python version and no pytest installed; however, a recent version of python and pytest are installed in the environment that I use for this project and that I want to run the tests in.
I verified that "Python: Select Interpreter ..." is set to the correct environment and this is confirmed by the little icon on the status bar at the bottom right that displays "Python 3.11.7 ('sherpaciao')", where "sherpaciao" is a conda env with pytest. Running pytest in the terminal in that conda env works as extected.
Note that the condo env in the Python output (see full output below) is set to
"CONDA_PREFIX":"/Users/guenther/mambaforge","CONDA_PROMPT_MODIFIER":"(base)
while the warning a few lines down from that addresses the correct conda env:[warning] could not find a pixi interpreter for the interpreter at /Users/guenther/mambaforge/envs/sherpaciao/bin/python
.Steps to reproduce:
I hope that this can be debugged from the console/setting output since it's probably related to some setting that is wrong; I suspect that it's not easy to reproduce.
Diagnostic data
Output for
Python
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toPython
)Extension version: 2024.14.1
VS Code version: Code 1.93.1 (Universal) (38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40, 2024-09-11T17:20:05.685Z)
OS version: Darwin arm64 23.6.0
Modes:
python.languageServer
setting: DefaultUser Settings
Installed Extensions
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
webnn: disabled_off
A/B Experiments
The text was updated successfully, but these errors were encountered: