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

pytest discover installs pytest successfully, but errors #22939

Closed
roblourens opened this issue Feb 20, 2024 · 5 comments
Closed

pytest discover installs pytest successfully, but errors #22939

roblourens opened this issue Feb 20, 2024 · 5 comments
Assignees
Labels
area-testing info-needed Issue requires more information from poster triage-needed Needs assignment to the proper sub-team

Comments

@roblourens
Copy link
Member

Testing #22936

I tried configuring python tests without first installing pytest. It opened a terminal installed pytest into my environment for me, which was cool. But it seemingly didn't wait for that process to complete, and showed an error that discovery failed. Here's the log from that process

2024-02-20 10:31:51.956 [info] > . ~/Downloads/pythontests/target_folder/.venv/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode-insiders/extensions/ms-python.python-2024.1.10511008/pythonFiles/printEnvVariables.py
2024-02-20 10:31:51.956 [info] shell: bash
2024-02-20 10:31:52.033 [info] > ~/Downloads/pythontests/target_folder/.venv/bin/python -c "import pytest"
2024-02-20 10:31:52.072 [info] > ~/Downloads/pythontests/target_folder/.venv/bin/python -c "import pip"
2024-02-20 10:31:52.160 [info] > ~/Downloads/pythontests/target_folder/.venv/bin/python -c "import pytest"
2024-02-20 10:31:52.264 [info] Send text to terminal: /Users/roblou/Downloads/pythontests/target_folder/.venv/bin/python -m pip install -U pytest
2024-02-20 10:31:53.064 [info] Discover tests for workspace name: symlink_to_target_folder - uri: /Users/roblou/Downloads/pythontests/symlink_to_target_folder/.vscode/settings.json
2024-02-20 10:31:53.064 [info] Running discovery for pytest using the new test adapter.
2024-02-20 10:31:53.064 [warning] The cwd is a symbolic link, adding '--rootdir' to pytestArgsMap only if it doesn't already exist.
2024-02-20 10:31:53.065 [info] All environment variables set for pytest discovery for workspace /Users/roblou/Downloads/pythontests/symlink_to_target_folder: {"BROWSER":"open","COLORFGBG":"7;0","COLORTERM":"truecolor","COMMAND_MODE":"unix2003","DISPLAY":"/private/tmp/com.apple.launchd.wv1qFoVUdM/org.xquartz:0","EDITOR":"nano","ELECTRON_NO_ATTACH_CONSOLE":"1","ENVSH":"1","GIT_ASKPASS":"/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/git/dist/askpass.sh","GOPATH":"/Users/roblou/code/go","GPG_TTY":"/dev/ttys024","GREP_COLOR":"37;45","GREP_COLORS":"mt=37;45","HOME":"/Users/roblou","ITERM_PROFILE":"Default","ITERM_SESSION_ID":"w0t0p0:F7974FE8-911E-47E3-BEEF-A533B7F298E5","LANG":"en_US.UTF-8","LC_TERMINAL":"iTerm2","LC_TERMINAL_VERSION":"3.4.8","LESS":"-F -g -i -M -R -S -w -X -z-4","LESS_TERMCAP_mb":"\u001b[01;31m","LESS_TERMCAP_md":"\u001b[01;31m","LESS_TERMCAP_me":"\u001b[0m","LESS_TERMCAP_se":"\u001b[0m","LESS_TERMCAP_so":"\u001b[00;47;30m","LESS_TERMCAP_ue":"\u001b[0m","LESS_TERMCAP_us":"\u001b[01;32m","LOGNAME":"roblou","LSCOLORS":"exfxcxdxbxGxDxabagacad","LS_COLORS":"di=34:ln=35:so=32:pi=33:ex=31:bd=36;01:cd=33;01:su=31;40;07:sg=36;40;07:tw=32;40;07:ow=33;40;07:","MallocNanoZone":"0","NVM_DIR":"/Users/roblou/.nvm","ORIGINAL_XDG_CURRENT_DESKTOP":"undefined","PAGER":"less","PWD":"/Users/roblou/Downloads/pythontests","SHELL":"/bin/zsh","SHLVL":"4","SSH_AUTH_SOCK":"/private/tmp/com.apple.launchd.KwoWZM7kuU/Listeners","TERM":"xterm-256color","TERM_PROGRAM":"vscode","TERM_PROGRAM_VERSION":"1.87.0-insider","TERM_SESSION_ID":"w0t0p0:F7974FE8-911E-47E3-BEEF-A533B7F298E5","TMPDIR":"/var/folders/tx/p0ycbfpj37786p760wwdg6y80000gn/T/","USER":"roblou","USER_ZDOTDIR":"/Users/roblou","VIRTUAL_ENV":"/private/tmp/parent/target_folder/.venv","VISUAL":"nano","VSCODE_AMD_ENTRYPOINT":"vs/workbench/api/node/extensionHostProcess","VSCODE_CLI":"1","VSCODE_CODE_CACHE_PATH":"/Users/roblou/Library/Application Support/Code - Insiders/CachedData/01ce8d869e4220577e194b2dd57bfa12437dfcf5","VSCODE_CRASH_REPORTER_PROCESS_TYPE":"extensionHost","VSCODE_CWD":"/Users/roblou/Downloads/pythontests","VSCODE_GIT_ASKPASS_MAIN":"/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/git/dist/askpass-main.js","VSCODE_GIT_ASKPASS_NODE":"/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Code - Insiders Helper (Plugin).app/Contents/MacOS/Code - Insiders Helper (Plugin)","VSCODE_GIT_IPC_HANDLE":"/var/folders/tx/p0ycbfpj37786p760wwdg6y80000gn/T/vscode-git-da160bd933.sock","VSCODE_HANDLES_UNCAUGHT_ERRORS":"true","VSCODE_INJECTION":"1","VSCODE_IPC_HOOK":"/Users/roblou/Library/Application Support/Code - Insiders/1.87-main.sock","VSCODE_NLS_CONFIG":"{\"locale\":\"en\",\"osLocale\":\"en\",\"availableLanguages\":{},\"_languagePackSupport\":true}","VSCODE_PID":"70428","XPC_FLAGS":"0x0","XPC_SERVICE_NAME":"application.com.microsoft.VSCodeInsiders.293592996.293593002.21EC79D5-E236-4047-8029-2752C39ED80C","ZDOTDIR":"/Users/roblou","__CFBundleIdentifier":"com.microsoft.VSCodeInsiders","__CF_USER_TEXT_ENCODING":"0x1F5:0x0:0x0","ELECTRON_RUN_AS_NODE":"1","VSCODE_L10N_BUNDLE_LOCATION":"","VIPSHOME":"/Users/runner/work/sharp-libvips/sharp-libvips/target","PATH":"/Users/roblou/.vscode-insiders/extensions/ms-python.python-2024.1.10501007/pythonFiles/deactivate/zsh:/private/tmp/parent/target_folder/.venv/bin:/Users/roblou/.cargo/bin:/Users/roblou/.nvm/versions/node/v18.15.0/bin:/Users/roblou/.vscode-insiders/extensions/ms-python.python-2024.1.10501007/pythonFiles/deactivate/zsh:/private/tmp/parent/target_folder/.venv/bin:/Library/Frameworks/Python.framework/Versions/3.9/bin:/usr/local/bin:/usr/local/sbin:/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:/usr/local/MacGPG2/bin:/Applications/Wireshark.app/Contents/MacOS:/usr/local/share/dotnet:~/.dotnet/tools:/usr/local/go/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Users/roblou/.vscode-insiders/extensions/ms-python.python-2024.1.10501007/pythonFiles/deactivate/zsh:/private/tmp/parent/target_folder/.venv/bin:/Users/roblou/.cargo/bin:/Users/roblou/.nvm/versions/node/v18.15.0/bin:/Library/Frameworks/Python.framework/Versions/3.9/bin:/Users/roblou/.local/bin:/usr/local/opt/fzf/bin:/Users/roblou/.local/bin:/Users/roblou/.local/bin","PYTHONPATH":"/Users/roblou/.vscode-insiders/extensions/ms-python.python-2024.1.10511008/pythonFiles","TEST_UUID":"ca82046d-6c7e-4e16-abad-92146c76a6c0","TEST_PORT":"61707"} 

2024-02-20 10:31:53.067 [info] > ~/Downloads/pythontests/target_folder/.venv/bin/python -m pytest -p vscode_pytest --collect-only . --rootdir=.
2024-02-20 10:31:53.067 [info] cwd: .
2024-02-20 10:31:53.143 [error] /Users/roblou/Downloads/pythontests/target_folder/.venv/bin/python: No module named pytest

2024-02-20 10:31:53.165 [error] Subprocess exited unsuccessfully with exit code 1 and signal null on workspace /Users/roblou/Downloads/pythontests/symlink_to_target_folder.
2024-02-20 10:31:53.165 [error] Subprocess exited unsuccessfully with exit code 1 and signal null on workspace /Users/roblou/Downloads/pythontests/symlink_to_target_folder. Creating and sending error discovery payload
2024-02-20 10:31:53.165 [error] pytest test discovery error for workspace:  /Users/roblou/Downloads/pythontests/symlink_to_target_folder 
  
 The python test process was terminated before it could exit on its own, the process errored with: Code: 1, Signal: null for workspace /Users/roblou/Downloads/pythontests/symlink_to_target_folder
2024-02-20 10:31:53.165 [info] ResultResolver EOT received for discovery.
2024-02-20 10:31:53.165 [info] Disposing data receiver for /Users/roblou/Downloads/pythontests/symlink_to_target_folder and deleting UUID; pytest discovery.
2024-02-20 10:31:53.593 [info] Discover tests for workspace name: symlink_to_target_folder - uri: /Users/roblou/Downloads/pythontests/symlink_to_target_folder
2024-02-20 10:31:53.593 [info] Running discovery for pytest using the new test adapter.
2024-02-20 10:31:53.593 [warning] The cwd is a symbolic link, adding '--rootdir' to pytestArgsMap only if it doesn't already exist.
2024-02-20 10:31:53.594 [info] All environment variables set for pytest discovery for workspace /Users/roblou/Downloads/pythontests/symlink_to_target_folder: {"BROWSER":"open","COLORFGBG":"7;0","COLORTERM":"truecolor","COMMAND_MODE":"unix2003","DISPLAY":"/private/tmp/com.apple.launchd.wv1qFoVUdM/org.xquartz:0","EDITOR":"nano","ELECTRON_NO_ATTACH_CONSOLE":"1","ENVSH":"1","GIT_ASKPASS":"/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/git/dist/askpass.sh","GOPATH":"/Users/roblou/code/go","GPG_TTY":"/dev/ttys024","GREP_COLOR":"37;45","GREP_COLORS":"mt=37;45","HOME":"/Users/roblou","ITERM_PROFILE":"Default","ITERM_SESSION_ID":"w0t0p0:F7974FE8-911E-47E3-BEEF-A533B7F298E5","LANG":"en_US.UTF-8","LC_TERMINAL":"iTerm2","LC_TERMINAL_VERSION":"3.4.8","LESS":"-F -g -i -M -R -S -w -X -z-4","LESS_TERMCAP_mb":"\u001b[01;31m","LESS_TERMCAP_md":"\u001b[01;31m","LESS_TERMCAP_me":"\u001b[0m","LESS_TERMCAP_se":"\u001b[0m","LESS_TERMCAP_so":"\u001b[00;47;30m","LESS_TERMCAP_ue":"\u001b[0m","LESS_TERMCAP_us":"\u001b[01;32m","LOGNAME":"roblou","LSCOLORS":"exfxcxdxbxGxDxabagacad","LS_COLORS":"di=34:ln=35:so=32:pi=33:ex=31:bd=36;01:cd=33;01:su=31;40;07:sg=36;40;07:tw=32;40;07:ow=33;40;07:","MallocNanoZone":"0","NVM_DIR":"/Users/roblou/.nvm","ORIGINAL_XDG_CURRENT_DESKTOP":"undefined","PAGER":"less","PWD":"/Users/roblou/Downloads/pythontests","SHELL":"/bin/zsh","SHLVL":"4","SSH_AUTH_SOCK":"/private/tmp/com.apple.launchd.KwoWZM7kuU/Listeners","TERM":"xterm-256color","TERM_PROGRAM":"vscode","TERM_PROGRAM_VERSION":"1.87.0-insider","TERM_SESSION_ID":"w0t0p0:F7974FE8-911E-47E3-BEEF-A533B7F298E5","TMPDIR":"/var/folders/tx/p0ycbfpj37786p760wwdg6y80000gn/T/","USER":"roblou","USER_ZDOTDIR":"/Users/roblou","VIRTUAL_ENV":"/private/tmp/parent/target_folder/.venv","VISUAL":"nano","VSCODE_AMD_ENTRYPOINT":"vs/workbench/api/node/extensionHostProcess","VSCODE_CLI":"1","VSCODE_CODE_CACHE_PATH":"/Users/roblou/Library/Application Support/Code - Insiders/CachedData/01ce8d869e4220577e194b2dd57bfa12437dfcf5","VSCODE_CRASH_REPORTER_PROCESS_TYPE":"extensionHost","VSCODE_CWD":"/Users/roblou/Downloads/pythontests","VSCODE_GIT_ASKPASS_MAIN":"/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/git/dist/askpass-main.js","VSCODE_GIT_ASKPASS_NODE":"/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Code - Insiders Helper (Plugin).app/Contents/MacOS/Code - Insiders Helper (Plugin)","VSCODE_GIT_IPC_HANDLE":"/var/folders/tx/p0ycbfpj37786p760wwdg6y80000gn/T/vscode-git-da160bd933.sock","VSCODE_HANDLES_UNCAUGHT_ERRORS":"true","VSCODE_INJECTION":"1","VSCODE_IPC_HOOK":"/Users/roblou/Library/Application Support/Code - Insiders/1.87-main.sock","VSCODE_NLS_CONFIG":"{\"locale\":\"en\",\"osLocale\":\"en\",\"availableLanguages\":{},\"_languagePackSupport\":true}","VSCODE_PID":"70428","XPC_FLAGS":"0x0","XPC_SERVICE_NAME":"application.com.microsoft.VSCodeInsiders.293592996.293593002.21EC79D5-E236-4047-8029-2752C39ED80C","ZDOTDIR":"/Users/roblou","__CFBundleIdentifier":"com.microsoft.VSCodeInsiders","__CF_USER_TEXT_ENCODING":"0x1F5:0x0:0x0","ELECTRON_RUN_AS_NODE":"1","VSCODE_L10N_BUNDLE_LOCATION":"","VIPSHOME":"/Users/runner/work/sharp-libvips/sharp-libvips/target","PATH":"/Users/roblou/.vscode-insiders/extensions/ms-python.python-2024.1.10501007/pythonFiles/deactivate/zsh:/private/tmp/parent/target_folder/.venv/bin:/Users/roblou/.cargo/bin:/Users/roblou/.nvm/versions/node/v18.15.0/bin:/Users/roblou/.vscode-insiders/extensions/ms-python.python-2024.1.10501007/pythonFiles/deactivate/zsh:/private/tmp/parent/target_folder/.venv/bin:/Library/Frameworks/Python.framework/Versions/3.9/bin:/usr/local/bin:/usr/local/sbin:/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:/usr/local/MacGPG2/bin:/Applications/Wireshark.app/Contents/MacOS:/usr/local/share/dotnet:~/.dotnet/tools:/usr/local/go/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Users/roblou/.vscode-insiders/extensions/ms-python.python-2024.1.10501007/pythonFiles/deactivate/zsh:/private/tmp/parent/target_folder/.venv/bin:/Users/roblou/.cargo/bin:/Users/roblou/.nvm/versions/node/v18.15.0/bin:/Library/Frameworks/Python.framework/Versions/3.9/bin:/Users/roblou/.local/bin:/usr/local/opt/fzf/bin:/Users/roblou/.local/bin:/Users/roblou/.local/bin","PYTHONPATH":"/Users/roblou/.vscode-insiders/extensions/ms-python.python-2024.1.10511008/pythonFiles","TEST_UUID":"84281e05-b853-41b8-8fee-9b7e86916874","TEST_PORT":"61707"} 

2024-02-20 10:31:53.596 [info] > ~/Downloads/pythontests/target_folder/.venv/bin/python -m pytest -p vscode_pytest --collect-only . --rootdir=.
2024-02-20 10:31:53.596 [info] cwd: .
2024-02-20 10:31:53.669 [error] /Users/roblou/Downloads/pythontests/target_folder/.venv/bin/python: No module named pytest

2024-02-20 10:31:53.674 [error] Subprocess exited unsuccessfully with exit code 1 and signal null on workspace /Users/roblou/Downloads/pythontests/symlink_to_target_folder.
2024-02-20 10:31:53.674 [error] Subprocess exited unsuccessfully with exit code 1 and signal null on workspace /Users/roblou/Downloads/pythontests/symlink_to_target_folder. Creating and sending error discovery payload
2024-02-20 10:31:53.674 [error] pytest test discovery error for workspace:  /Users/roblou/Downloads/pythontests/symlink_to_target_folder 
  
 The python test process was terminated before it could exit on its own, the process errored with: Code: 1, Signal: null for workspace /Users/roblou/Downloads/pythontests/symlink_to_target_folder
2024-02-20 10:31:53.674 [info] ResultResolver EOT received for discovery.
2024-02-20 10:31:53.674 [info] Disposing data receiver for /Users/roblou/Downloads/pythontests/symlink_to_target_folder and deleting UUID; pytest discovery.
@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Feb 20, 2024
@eleanorjboyd
Copy link
Member

Right now this is expected behavior as the logs describe the problem here "2024-02-20 10:31:53.143 [error] /Users/roblou/Downloads/pythontests/target_folder/.venv/bin/python: No module named pytest". We don't install pytest, what do you mean by "opened a terminal installed pytest into my environment for me, which was cool"?

We have not seen the workflow of not having pytest first as usual for python developers as they usually install pytest to write the tests before attempting to discover them which is why we haven't invested in automating this flow.

@eleanorjboyd eleanorjboyd closed this as not planned Won't fix, can't repro, duplicate, stale Feb 20, 2024
@github-actions github-actions bot added the info-needed Issue requires more information from poster label Feb 20, 2024
@roblourens
Copy link
Member Author

A terminal opened and something ran the pip install command, and I assumed it was you since the pytest log says this:

2024-02-20 10:31:52.264 [info] Send text to terminal: /Users/roblou/Downloads/pythontests/target_folder/.venv/bin/python -m pip install -U pytest

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

@karthiknadig has there been changes here? I have not seen this before

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Feb 20, 2024
@karthiknadig
Copy link
Member

There have been no changes, but this happens when the test discovery is triggered with pytest, and we detect that pytest is not installed.

@eleanorjboyd
Copy link
Member

hm I will investigate why it isn't working- thanks

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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