2024-09-17 11:53:33.212 [info] Discover tests for workspace name: sherpa - uri: /Users/guenther/code/sherpa
2024-09-17 11:53:33.212 [info] Running discovery for pytest using the new test adapter.
2024-09-17 11:53:33.213 [info] All environment variables set for pytest discovery: {"ADS_API_TOKEN":"WPnK3GVwUCbcUvZzM2JcvKAkngy9lg2DPNS8Ss3A","COMMAND_MODE":"unix2003","CONDA_DEFAULT_ENV":"base","CONDA_EXE":"/Users/guenther/mambaforge/bin/conda","CONDA_PREFIX":"/Users/guenther/mambaforge","CONDA_PROMPT_MODIFIER":"(base) ","CONDA_PYTHON_EXE":"/Users/guenther/mambaforge/bin/python","CONDA_SHLVL":"1","DISPLAY":"/private/tmp/com.apple.launchd.T5UouRP3vi/org.xquartz:0","HOME":"/Users/guenther","LOGNAME":"guenther","MallocNanoZone":"0","OLDPWD":"/","ORIGINAL_XDG_CURRENT_DESKTOP":"undefined","PS1":"(base) %m %~> ","PWD":"/","SHELL":"/bin/zsh","SHLVL":"0","SSH_AUTH_SOCK":"/private/tmp/com.apple.launchd.9lE2FhSB4I/Listeners","TMPDIR":"/var/folders/r7/f0qh27rn207bwwvt3s7v5gh40000gn/T/","USER":"guenther","VSCODE_AMD_ENTRYPOINT":"vs/workbench/api/node/extensionHostProcess","VSCODE_CODE_CACHE_PATH":"/Users/guenther/Library/Application Support/Code/CachedData/38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40","VSCODE_CRASH_REPORTER_PROCESS_TYPE":"extensionHost","VSCODE_CWD":"/","VSCODE_HANDLES_UNCAUGHT_ERRORS":"true","VSCODE_IPC_HOOK":"/Users/guenther/Library/Application Support/Code/1.93-main.sock","VSCODE_NLS_CONFIG":"{\"userLocale\":\"en-us\",\"osLocale\":\"en-us\",\"resolvedLanguage\":\"en\",\"defaultMessagesFile\":\"/Applications/Visual Studio Code.app/Contents/Resources/app/out/nls.messages.json\",\"locale\":\"en-us\",\"availableLanguages\":{}}","VSCODE_PID":"83602","XPC_FLAGS":"0x0","XPC_SERVICE_NAME":"application.com.microsoft.VSCode.82204521.82204529","XUVTOP":"/Users/guenther/data/CHIANTI","_":"/Applications/Visual Studio Code.app/Contents/MacOS/Electron","__CFBundleIdentifier":"com.microsoft.VSCode","__CF_USER_TEXT_ENCODING":"0x1F5:0x0:0x0","ELECTRON_RUN_AS_NODE":"1","VSCODE_L10N_BUNDLE_LOCATION":"","PATH":"/Users/guenther/mambaforge/bin:/Users/guenther/mambaforge/condabin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/X11/bin:/Library/Apple/usr/bin:/Library/TeX/texbin","PYTHONPATH":"/Users/guenther/.vscode/extensions/ms-python.python-2024.14.1-darwin-arm64/python_files","TEST_RUN_PIPE":"/var/folders/r7/f0qh27rn207bwwvt3s7v5gh40000gn/T/python-test-discovery-331c548a6db514ee3062.sock"}
2024-09-17 11:53:33.214 [warning] could not find a pixi interpreter for the interpreter at /Users/guenther/mambaforge/envs/sherpaciao/bin/python
2024-09-17 11:53:33.216 [info] > python -m pytest -p vscode_pytest --collect-only
2024-09-17 11:53:33.216 [info] cwd: .
2024-09-17 11:53:33.272 [error] /Users/guenther/mambaforge/bin/python: No module named pytest
2024-09-17 11:53:33.275 [error] Subprocess exited unsuccessfully with exit code 1 and signal null on workspace /Users/guenther/code/sherpa.
2024-09-17 11:53:33.275 [error] Subprocess exited unsuccessfully with exit code 1 and signal null on workspace /Users/guenther/code/sherpa. Creating and sending error discovery payload
2024-09-17 11:53:33.275 [error] pytest test discovery error for workspace: /Users/guenther/code/sherpa
The python test process was terminated before it could exit on its own, the process errored with: Code: 1, Signal: null for workspace /Users/guenther/code/sherpa
2024-09-17 12:07:41.517 [info] Native locator: Refresh started
2024-09-17 12:07:41.559 [info] Conda environment manager found at: /Users/guenther/mambaforge/bin/conda
2024-09-17 12:07:41.739 [info] Native locator: Refresh finished in 199 ms
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
Pythonin theOutputpanel (View→Output, change the drop-down the upper-right of theOutputpanel 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.languageServersetting: 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