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

Test discovery with pytest fails, because pytest is run in the base conda env #24122

Closed
hamogu opened this issue Sep 17, 2024 · 23 comments · Fixed by #24250
Closed

Test discovery with pytest fails, because pytest is run in the base conda env #24122

hamogu opened this issue Sep 17, 2024 · 23 comments · Fixed by #24250
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster triage-needed Needs assignment to the proper sub-team

Comments

@hamogu
Copy link

hamogu commented Sep 17, 2024

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 the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

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

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 version (& distribution if applicable, e.g. Anaconda): 3.11.7
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Conda
  • Value of the python.languageServer setting: Default
User Settings


languageServer: "Pylance"

testing
• pytestEnabled: true

Installed Extensions
Extension Name Extension Id Version
Code Spell Checker streetsidesoftware.code-spell-checker 3.0.1
GitHub Actions github.vscode-github-actions 0.26.5
GitHub Copilot GitHub.copilot 1.229.0
GitHub Copilot Chat GitHub.copilot-chat 0.20.1
GitHub Pull Requests GitHub.vscode-pull-request-github 0.96.0
GitLens — Git supercharged eamodio.gitlens 15.5.1
JavaScript Debugger ms-vscode.js-debug 1.93.0
JavaScript Debugger Companion Extension ms-vscode.js-debug-companion 1.1.3
Jupyter ms-toolsai.jupyter 2024.8.1
Jupyter Cell Tags ms-toolsai.vscode-jupyter-cell-tags 0.1.9
Jupyter Keymap ms-toolsai.jupyter-keymap 1.1.2
Jupyter Notebook Renderers ms-toolsai.jupyter-renderers 1.0.19
LaTeX Workshop James-Yu.latex-workshop 10.3.2
Live Server ritwickdey.LiveServer 5.7.9
LTeX – LanguageTool grammar/spell checking valentjn.vscode-ltex 13.1.0
Makefile Tools ms-vscode.makefile-tools 0.11.13
Pylance ms-python.vscode-pylance 2024.9.1
Python ms-python.python 2024.14.1
Python Debugger ms-python.debugpy 2024.10.0
Table Visualizer for JavaScript Profiles ms-vscode.vscode-js-profile-table 1.0.9
Trailing Whitespace jkiviluoto.tws 1.0.1
System Info
Item Value
CPUs Apple M1 (8 x 2400)
GPU Status 2d_canvas: enabled
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
Load (avg) 4, 3, 3
Memory (System) 16.00GB (0.09GB free)
Process Argv --crash-reporter-id e2a97932-7d55-44e5-bb05-555f7819c1cd
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805cf:30301675
binariesv615:30325510
vsaa593:30376534
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30959799
pythongtdpath:30769146
welcomedialogc:30910334
pythonnoceb:30805159
asynctok:30898717
pythonmypyd1:30879173
h48ei257:31000450
pythontbext0:30879054
accentitlementsc:30995553
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
dsvsc021:30996838
bdiig495:31013172
a69g1124:31058053
dvdeprecation:31068756
dwnewjupytercf:31046870
newcmakeconfigv2:31071590
impr_priority:31102340
nativerepl1:31139838
refactort:31108082
pythonrstrctxt:31112756
flightc:31134773
wkspc-onlycs-t:31132770
nativeloc1:31134641
wkspc-ranged-c:31125598
cf971741:31134768
pme_test_t:31118333
defaultse:31133495
ei213698:31121563
iacca1:31138162

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Sep 17, 2024
@karthiknadig karthiknadig added the bug Issue identified by VS Code Team member as probable bug label Sep 18, 2024
@eleanorjboyd
Copy link
Member

Hi! So to confirm, If you run python -m pytest --collect-only from your command line it works fine bc it has the right interpreter selected? Then secondly this path is the old one? Where it is looking for the pytest module: /Users/guenther/mambaforge/bin/python: No module named pytest. Thanks

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Sep 23, 2024
@hamogu
Copy link
Author

hamogu commented Sep 23, 2024

Hi! So to confirm, If you run python -m pytest --collect-only from your command line it works fine bc it has the right interpreter selected?

Yes.

Then secondly this path is the old one? Where it is looking for the pytest module: /Users/guenther/mambaforge/bin/python: No module named pytest.

Yes.

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label Sep 23, 2024
@eleanorjboyd
Copy link
Member

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

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Sep 23, 2024
@hamogu
Copy link
Author

hamogu commented Sep 23, 2024

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.
That means it's not something that is special to this conda environment: VSCode always tries to run purest in my base environment.

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label Sep 23, 2024
@anthonykim1
Copy link

anthonykim1 commented Sep 23, 2024

Don't think

[warning] could not find a pixi interpreter for the interpreter at /Users/guenther/mambaforge/envs/sherpaciao/bin/python

is related to this issue.

@eleanorjboyd It may be the ordering of:

const condaExecutionService = await this.createCondaExecutionService(pythonPath, processService);
if (condaExecutionService) {
return condaExecutionService;
}
const env = createPythonEnv(pythonPath, processService, this.fileSystem);
return createPythonService(processService, env);

where createActivatedEnvironment just returns on the conda conditional without getting to the desired

const env = createPythonEnv(pythonPath, processService, this.fileSystem);

in this scneario. This seem the closest to what is "forcing" the use of conda rather than a desired venv?? in this case.

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Sep 23, 2024
@hamogu
Copy link
Author

hamogu commented Sep 23, 2024

To the best of my knowledge (from googling all parts of this error message) [warning] could not find a pixi interpreter for the interpreter at /Users/guenther/mambaforge/envs/sherpaciao/bin/python is unrelated (I think from the IPython notebook extension). It's only relevant here in that it shows that at least some extensions are looking in the right place for the Python interpreter.

@anthonykim1
Copy link

@hamogu Thanks for all the info.

I've created plan item for October to further investigate this. #24190
Will let you know once I make some changes so you can test it out.

Bit lost on what purest means in:

VSCode always tries to run purest in my base environment.

I have a feeling it may be a typo for pytest, but just wanted to make sure :)

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Sep 25, 2024
@hamogu
Copy link
Author

hamogu commented Sep 26, 2024

Yes, that's a typo for "pytest" (or maybe my autocorrect on my phone that knows about "purest" but not about "pytest").

Sorry!

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label Sep 26, 2024
@l3point
Copy link

l3point commented Sep 26, 2024

I am experiencing a similar problem where the test discovery fails.

I am working on a project at two locations, on two different machines. In one location the test discovery works, and in other it does not. In both locations, running pytest --collect-only from the vscode terminal works. pytest also works from a command prompt in both cases.

On the machine where test discovery fails, I have:

  • Reinstalled vscode
  • Reinstalled anaconda, and the virtual environments
  • Reset the state.vscdb (renamed and recreated)
  • Reset the ~/.vscode directory (renamed and recreated)
  • Reset %APPDATA%\Code\User\globalStorage\ms-python.python (renamed and recreated)
  • verified ~/AppData/Roaming/Code/User/settings.json is the same on both machines

The one thing that seems different in vscode python log when opening the tests panel is where the working machine has the command:

2024-09-26 19:19:48.235 [info] > ~\Anaconda3\Scripts\conda.exe run -n order-management --no-capture-output python ~\.vscode\extensions\ms-python.python-2024.14.1-win32-x64\python_files\get_output_via_markers.py -m pytest -p vscode_pytest --collect-only python/tests

The machine which fails has the command:

2024-09-26 22:33:45.519 [info] > python -m pytest -p vscode_pytest --collect-only python/tests

I have also run sysinternals procmon on both machines when opening the tests window. Both machines launch the python executable in the correct virtual environment, however, the command line parameters and cwd are different. On the machine that works, this command is used:

22:57:17.0068751	python.exe	39216	Process Start		SUCCESS	Parent PID: 42828, Command line: python  c:\Users\jmoore\.vscode\extensions\ms-python.python-2024.14.1-win32-x64\python_files\get_output_via_markers.py -m pytest -p vscode_pytest --collect-only python/tests, Current directory: c:\Users\jmoore\source\repos\order-management\, Environment: 

whereas in the failing case, the venv python.exe is invoked with:

22:33:45.2223824	python.exe	4952	Process Start		SUCCESS	Parent PID: 16988, Command line: python  c:\Users\John\.vscode\extensions\ms-python.python-2024.14.1-win32-x64\python_files\get_output_via_markers.py c:/Users/John/.vscode/extensions/ms-python.python-2024.14.1-win32-x64/python_files/printEnvVariables.py, Current directory: C:\Users\John\AppData\Local\Programs\Microsoft VS Code\, Environment:

The VSCode version on the working machine is:

[Window Title]
Visual Studio Code

[Main Instruction]
Visual Studio Code

[Content]

Version: 1.93.1 (system setup)
Commit: 38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40
Date: 2024-09-11T17:20:05.685Z (2 wks ago)
Electron: 30.4.0
ElectronBuildId: 10073054
Chromium: 124.0.6367.243
Node.js: 20.15.1
V8: 12.4.254.20-electron.0
OS: Windows_NT x64 10.0.19045

And the machine which is failing is:

Version: 1.93.1 (user setup)
Commit: 38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40
Date: 2024-09-11T17:20:05.685Z
Electron: 30.4.0
ElectronBuildId: 10073054
Chromium: 124.0.6367.243
Node.js: 20.15.1
V8: 12.4.254.20-electron.0
OS: Windows_NT x64 10.0.19045

@anthonykim1
Copy link

Just merged: #24250
Could folks try the latest pre-release of Python extension, starting TOMORROW and see if the problem is resolved? Thanks.

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Oct 4, 2024
karthiknadig pushed a commit that referenced this issue Oct 7, 2024
…4250)

Resolves: #24122
Related: #24190,
#24127

I think the culprit was we were not passing in interpreter when we call
createActivatedEnvironment.
karthiknadig pushed a commit that referenced this issue Oct 7, 2024
…4250)

Resolves: #24122
Related: #24190,
#24127

I think the culprit was we were not passing in interpreter when we call
createActivatedEnvironment.
@hamogu
Copy link
Author

hamogu commented Oct 8, 2024

It still doesn't work, error output below. Note that the Python interpreter path is set correctly (Python interpreter path: ~/mambaforge/envs/sherpaciao/bin/python), but the condo-prefix for the text collection is still wrong ("CONDA_PREFIX":"/Users/guenther/mambaforge") pointing to the base environment that does not have pytest installed.
This is with the Python extension pre-release version v2024.17.2024100801

2024-10-08 07:10:44.839 [info] Native locator: Refresh started
2024-10-08 07:10:44.867 [info] Conda environment manager found at: /Users/guenther/mambaforge/bin/conda
2024-10-08 07:10:44.994 [info] Native locator: Refresh finished in 130 ms
2024-10-08 07:10:55.970 [info] Discover tests for workspace name: sherpa - uri: /Users/guenther/code/sherpa
2024-10-08 07:10:55.971 [info] Running discovery for pytest using the new test adapter.
2024-10-08 07:10:55.971 [info] Python interpreter path: ~/mambaforge/envs/sherpaciao/bin/python
2024-10-08 07:10:55.978 [info] Setting environment variable ASCDS_PROP_DATE_DATA in collection to /Users/guenther/mambaforge/envs/sherpaciao/config/jcm_data {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-10-08 07:10:55.979 [info] Setting environment variable LOCPFILES in collection to /Users/guenther/cxcds_param4 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-10-08 07:10:55.979 [info] Setting environment variable CONDA_SHLVL in collection to 2 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-10-08 07:10:55.979 [info] Setting environment variable HEADAS in collection to /Users/guenther/mambaforge/envs/sherpaciao/spectral {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-10-08 07:10:55.979 [info] Setting environment variable CONDA_PROMPT_MODIFIER in collection to (sherpaciao)  {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-10-08 07:10:55.979 [info] Setting environment variable GSETTINGS_SCHEMA_DIR_CONDA_BACKUP in collection to  {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-10-08 07:10:55.979 [info] Setting environment variable ASCDS_WORK_PATH in collection to /var/folders/r7/f0qh27rn207bwwvt3s7v5gh40000gn/T/ {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-10-08 07:10:55.979 [info] Setting environment variable ASCDS_OTS in collection to /Users/guenther/mambaforge/envs/sherpaciao {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-10-08 07:10:55.979 [info] Setting environment variable ASCDS_PROP_PREC_DATA in collection to /Users/guenther/mambaforge/envs/sherpaciao/config/jcm_data {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-10-08 07:10:55.979 [info] Setting environment variable ASCDS_INSTALL in collection to /Users/guenther/mambaforge/envs/sherpaciao {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-10-08 07:10:55.979 [info] Setting environment variable PFILES in collection to /Users/guenther/cxcds_param4;/Users/guenther/mambaforge/envs/sherpaciao/param {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-10-08 07:10:55.979 [info] Setting environment variable ASCDS_BIN in collection to /Users/guenther/mambaforge/envs/sherpaciao/bin {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-10-08 07:10:55.979 [info] Setting environment variable _CE_CONDA in collection to  {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-10-08 07:10:55.979 [info] Setting environment variable ASCDS_CALIB in collection to /Users/guenther/mambaforge/envs/sherpaciao/data {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-10-08 07:10:55.979 [info] Setting environment variable CONDA_PREFIX_1 in collection to /Users/guenther/mambaforge {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-10-08 07:10:55.979 [info] Setting environment variable CONDA_ROOT in collection to /Users/guenther/mambaforge {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-10-08 07:10:55.979 [info] Prepending environment variable PATH in collection to /Users/guenther/mambaforge/envs/sherpaciao/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: {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-10-08 07:10:55.979 [info] Setting environment variable GSETTINGS_SCHEMA_DIR in collection to /Users/guenther/mambaforge/envs/sherpaciao/share/glib-2.0/schemas {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-10-08 07:10:55.979 [info] Setting environment variable ASCDS_IMAGER_PATH in collection to /Users/guenther/mambaforge/envs/sherpaciao/imager {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-10-08 07:10:55.979 [info] Setting environment variable ASCDS_TMP in collection to /var/folders/r7/f0qh27rn207bwwvt3s7v5gh40000gn/T/ {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-10-08 07:10:55.980 [info] Setting environment variable XML_CATALOG_FILES in collection to file:///Users/guenther/mambaforge/envs/sherpaciao/etc/xml/catalog file:///etc/xml/catalog {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-10-08 07:10:55.980 [info] Setting environment variable CONDA_PREFIX in collection to /Users/guenther/mambaforge/envs/sherpaciao {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-10-08 07:10:55.980 [info] Setting environment variable IPYTHONDIR in collection to /Users/guenther/.ipython-ciao {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-10-08 07:10:55.980 [info] Setting environment variable _CE_M in collection to  {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-10-08 07:10:55.980 [info] Setting environment variable XPC_SERVICE_NAME in collection to 0 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-10-08 07:10:55.980 [info] Setting environment variable ASCDS_LIB in collection to /Users/guenther/mambaforge/envs/sherpaciao/lib {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-10-08 07:10:55.980 [info] Setting environment variable XPA_METHOD in collection to local {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-10-08 07:10:55.980 [info] Setting environment variable OBSVIS_PKG_PATH in collection to /Users/guenther/mambaforge/envs/sherpaciao/lib/tcltk/packages/obsvis {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-10-08 07:10:55.980 [info] Setting environment variable CONDA_DEFAULT_ENV in collection to sherpaciao {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-10-08 07:10:55.980 [info] Setting environment variable ASCDS_SYS_PARAM in collection to /Users/guenther/mambaforge/envs/sherpaciao/param {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-10-08 07:10:55.981 [info] Prepending environment variable PS1 in collection with (sherpaciao)  {"applyAtShellIntegration":true,"applyAtProcessCreation":false}
2024-10-08 07:10:55.994 [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/d78a74bcdfad14d5d3b1b782f87255d802b57511","VSCODE_CRASH_REPORTER_PROCESS_TYPE":"extensionHost","VSCODE_CWD":"/","VSCODE_HANDLES_UNCAUGHT_ERRORS":"true","VSCODE_IPC_HOOK":"/Users/guenther/Library/Application Support/Code/1.94-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":"62448","XPC_FLAGS":"0x0","XPC_SERVICE_NAME":"application.com.microsoft.VSCode.84206031.84206038","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","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.17.2024100801-darwin-arm64/python_files","TEST_RUN_PIPE":"/var/folders/r7/f0qh27rn207bwwvt3s7v5gh40000gn/T/python-test-discovery-1b6bd02372a78dfc05aa.sock"}
2024-10-08 07:10:55.998 [info] > python -m pytest -p vscode_pytest --collect-only
2024-10-08 07:10:55.998 [info] cwd: .
2024-10-08 07:10:56.064 [error] /Users/guenther/mambaforge/bin/python: No module named pytest

2024-10-08 07:10:56.067 [error] Subprocess exited unsuccessfully with exit code 1 and signal null on workspace /Users/guenther/code/sherpa.
2024-10-08 07:10:56.068 [error] Subprocess exited unsuccessfully with exit code 1 and signal null on workspace /Users/guenther/code/sherpa. Creating and sending error discovery payload
2024-10-08 07:10:56.068 [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

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label Oct 8, 2024
@wohenbushuang
Copy link

not work for v2024.17.2024101101 (pre-release) @anthonykim1

@zljubisic
Copy link

I can confirm presence of the problem. I tried to use different python extension versions (including prelease too) with no luck.
I have just installed latest vscode (1.94.2) and pytest 8.3.3 and vscode tries to find pytest in default conda environment instead of project environment that is properly selected.
I can execute pytest from the same environment with no problem, everything works.

@zljubisic
Copy link

@anthonykim1 please open this issue because it is not closed at all

@zljubisic
Copy link

@eleanorjboyd let's continue on this.

@jcharlet
Copy link

jcharlet commented Oct 14, 2024

Hi all,
I confirm I have this issue :( and this isn't very pleasant.

@zljubisic @hamogu, do you guys have a workaround for running the tests in VS Code? Is there anything better than running it from the terminal?

@ktmud
Copy link

ktmud commented Oct 14, 2024

Still seeing this issue, too, after upgrading the python in my python env from py3.9 to py3.10

Fixed this by re-installing vscode.

@wohenbushuang
Copy link

Seems it has been fixed in v2024.17.2024101501 (pre-release)

@jcharlet
Copy link

Argh, I tried reinstalling, even tried the Insiders version, but I had no luck, this is still happening.

@wohenbushuang
Copy link

@jcharlet It is irrelevant with vscode insider. You should switch the python extension to pre-release version.

@tvatter
Copy link

tvatter commented Oct 17, 2024

Same issue, super annoying

@anthonykim1
Copy link

Hi folks, please give the latest pre-release of Python extension (or v2024.17.2024101501 or higher) a try.
This is unrelated to insider or vs code version itself.

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Oct 17, 2024
@zljubisic
Copy link

Yes, there is a solution for it. I am using wsl, so I opened settings and looked for wsl python locator option and set it to "js".
Default "native" doesn't work.

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster triage-needed Needs assignment to the proper sub-team
Projects
None yet
10 participants