forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Labels
area-testinginfo-neededIssue requires more information from posterIssue requires more information from postertriage-neededNeeds assignment to the proper sub-teamNeeds assignment to the proper sub-team
Description
Behaviour
As the title suggests, test execution hangs when using a fixture to skip tests in pytest. The circle icon keeps spinning indefinitely, and the test never completes.
Steps to reproduce:
- Create a fixture code that might be skipped under certain conditions.
- Create a test function code that uses the fixture.
- Run the target test function from the "Testing" panel.
- The test execution hangs. While it occasionally succeeds, repeated runs usually result in a hang.
Here's the minimal code to reproduce the issue:
import pytest
@pytest.fixture
def docker_client() -> object:
try:
# NOTE: Actually connect with the docker sdk
raise Exception("Docker client not available")
except Exception:
pytest.skip("Docker client not available")
return object()
def test_docker_client(docker_client):
# Running the test in VS Code will hang.
assert ...You can find the same code in my reproduction repository. If you'd like, you can easily reproduce the issue by creating a codespace from here: https://github.com/MtkN1/vscode-pytest-skip-hang
Diagnostic data
Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)
2024-12-05 06:09:07.496 [info] Experiment 'pythonRecommendTensorboardExt' is active
2024-12-05 06:09:07.496 [info] Experiment 'pythonTerminalEnvVarActivation' is active
2024-12-05 06:09:07.496 [info] Experiment 'pythonTestAdapter' is active
2024-12-05 06:09:07.496 [info] Native locator: Refresh started
2024-12-05 06:09:07.496 [info] Native locator: Refresh started
2024-12-05 06:09:07.539 [info] Conda environment manager found at: /opt/conda/bin/conda
2024-12-05 06:09:07.719 [info] > pyenv which python
2024-12-05 06:09:07.719 [info] cwd: .
2024-12-05 06:09:08.012 [info] Native locator: Refresh finished in 1803 ms
2024-12-05 06:09:08.015 [info] Python interpreter path: ~/.python/current/bin/python
2024-12-05 06:09:09.075 [warning] Shell integration may not be active, environment activated may be overridden by the shell.
2024-12-05 06:09:09.102 [info] Discover tests for workspace name: vscode-pytest-skip-hang - uri: /workspaces/vscode-pytest-skip-hang
2024-12-05 06:09:09.102 [info] Running discovery for pytest using the new test adapter.
2024-12-05 06:09:09.112 [info] All environment variables set for pytest discovery: {"DOCKER_BUILDKIT":"1","ENABLE_DYNAMIC_INSTALL":"true","LESSOPEN":"| /usr/bin/lesspipe %s","GITHUB_TOKEN":"ghu_kETMfIxtmoP6wHqJorJRm76fSaWkkM3lFmY5","GIT_COMMITTER_NAME":"GitHub","PYTHONIOENCODING":"UTF-8","GITHUB_CODESPACE_TOKEN":"AMHJ22AEGTXSROPXLYJRMT3HKHUENANCNFSM4AKYDNKQ","USER":"codespace","RVM_PATH":"/usr/local/rvm","NVS_ROOT":"/usr/local/nvs","HOSTNAME":"codespaces-464917","DOTNET_USE_POLLING_FILE_WATCHER":"true","CONDA_SCRIPT":"/opt/conda/etc/profile.d/conda.sh","PIPX_HOME":"/usr/local/py-utils","SHLVL":"1","GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN":"app.github.dev","HUGO_ROOT":"/home/codespace/.hugo","HOME":"/home/codespace","OLDPWD":"/vscode/bin/linux-x64/f1a4fb101478ce6ec82fe9627c43efbf9e98c813","ORYX_ENV_TYPE":"vsonline-present","NVM_BIN":"/usr/local/share/nvm/versions/node/v20.17.0/bin","CODESPACES":"true","DOTNET_RUNNING_IN_CONTAINER":"true","NVM_SYMLINK_CURRENT":"true","DYNAMIC_INSTALL_ROOT_DIR":"/opt","PIPX_BIN_DIR":"/usr/local/py-utils/bin","NVM_INC":"/usr/local/share/nvm/versions/node/v20.17.0/include/node","rvm_stored_umask":"0022","ORYX_DIR":"/usr/local/oryx","GRADLE_HOME":"/usr/local/sdkman/candidates/gradle/current","JUPYTERLAB_PATH":"/home/codespace/.local/bin","rvm_user_install_flag":"0","MAVEN_HOME":"/usr/local/sdkman/candidates/maven/current","GOROOT":"/usr/local/go","NODE_ROOT":"/home/codespace/nvm","GITHUB_GRAPHQL_URL":"https://api.github.com/graphql","GITHUB_USER":"MtkN1","NVM_DIR":"/usr/local/share/nvm","PYTHON_PATH":"/usr/local/python/current","DOTNET_SKIP_FIRST_TIME_EXPERIENCE":"1","ContainerVersion":"13","NVS_HOME":"/usr/local/nvs","GITHUB_API_URL":"https://api.github.com","rvm_bin_path":"/usr/local/rvm/bin","SDKMAN_CANDIDATES_API":"https://api.sdkman.io/2","_":"/usr/bin/cat","RUBY_VERSION":"ruby-3.3.4","PROMPT_DIRTRIM":"4","IRBRC":"/usr/local/rvm/rubies/ruby-3.3.4/.irbrc","CLOUDENV_ENVIRONMENT_ID":"08b2dd41-2e13-4799-af58-e15b9d981e58","DOTNET_ROOT":"/usr/share/dotnet","NVS_DIR":"/usr/local/nvs","PHP_ROOT":"/home/codespace/.php","JAVA_ROOT":"/home/codespace/java","VSCODE_AGENT_FOLDER":"/home/codespace/.vscode-remote","SDKMAN_CANDIDATES_DIR":"/usr/local/sdkman/candidates","HUGO_DIR":"/usr/local/hugo/bin","NPM_GLOBAL":"/home/codespace/.npm-global","SHELL_LOGGED_IN":"true","MY_RUBY_HOME":"/usr/local/rvm/rubies/ruby-3.3.4","LANG":"C.UTF-8","SDKMAN_DIR":"/usr/local/sdkman","RUBY_ROOT":"/home/codespace/.ruby","LS_COLORS":"","SDKMAN_PLATFORM":"linuxx64","GITHUB_REPOSITORY":"MtkN1/vscode-pytest-skip-hang","SHELL":"/bin/bash","GOPATH":"/go","rvm_prefix":"/usr/local","rvm_loaded_flag":"1","GEM_HOME":"/usr/local/rvm/gems/ruby-3.3.4","ORYX_PREFER_USER_INSTALLED_SDKS":"true","LESSCLOSE":"/usr/bin/lesspipe %s %s","ORYX_SDK_STORAGE_BASE_URL":"https://oryx-cdn.microsoft.io","CONDA_DIR":"/opt/conda","rvm_version":"1.29.12 (latest)","DEBIAN_FLAVOR":"focal-scm","GIT_COMMITTER_EMAIL":"[email protected]","GEM_PATH":"/usr/local/rvm/gems/ruby-3.3.4:/usr/local/rvm/gems/ruby-3.3.4@global","JAVA_HOME":"/usr/local/sdkman/candidates/java/current","NVS_USE_XZ":"1","INTERNAL_VSCS_TARGET_URL":"https://southeastasia.online.visualstudio.com","PWD":"/vscode/bin/linux-x64/f1a4fb101478ce6ec82fe9627c43efbf9e98c813","NVM_CD_FLAGS":"","GITHUB_SERVER_URL":"https://github.com","PHP_PATH":"/usr/local/php/current","PYTHON_ROOT":"/home/codespace/.python","RAILS_DEVELOPMENT_HOSTS":".githubpreview.dev,.preview.app.github.dev,.app.github.dev","NVS_OS":"linux","CODESPACE_NAME":"animated-meme-64q64j59j9r2r9x","RUBY_HOME":"/usr/local/rvm/rubies/default","MAVEN_ROOT":"/home/codespace/.maven","rvm_path":"/usr/local/rvm","NUGET_XMLDOC_MODE":"skip","VSCODE_CWD":"/vscode/bin/linux-x64/f1a4fb101478ce6ec82fe9627c43efbf9e98c813","VSCODE_NLS_CONFIG":"{\"userLocale\":\"en\",\"osLocale\":\"en\",\"resolvedLanguage\":\"en\",\"defaultMessagesFile\":\"/vscode/bin/linux-x64/f1a4fb101478ce6ec82fe9627c43efbf9e98c813/out/nls.messages.json\",\"locale\":\"en\",\"availableLanguages\":{}}","VSCODE_HANDLES_SIGPIPE":"true","VSCODE_ESM_ENTRYPOINT":"vs/workbench/api/node/extensionHostProcess","VSCODE_HANDLES_UNCAUGHT_ERRORS":"true","BROWSER":"/vscode/bin/linux-x64/f1a4fb101478ce6ec82fe9627c43efbf9e98c813/bin/helpers/browser.sh","ELECTRON_RUN_AS_NODE":"1","VSCODE_IPC_HOOK_CLI":"/tmp/vscode-ipc-b434babb-d6d2-41df-aec5-8cdfc5433a0a.sock","PATH":"/vscode/bin/linux-x64/f1a4fb101478ce6ec82fe9627c43efbf9e98c813/bin/remote-cli:/home/codespace/.local/bin:/home/codespace/.dotnet:/home/codespace/nvm/current/bin:/home/codespace/.php/current/bin:/home/codespace/.python/current/bin:/home/codespace/java/current/bin:/home/codespace/.ruby/current/bin:/home/codespace/.local/bin:/usr/local/python/current/bin:/usr/local/py-utils/bin:/usr/local/oryx:/usr/local/go/bin:/go/bin:/usr/local/sdkman/bin:/usr/local/sdkman/candidates/java/current/bin:/usr/local/sdkman/candidates/gradle/current/bin:/usr/local/sdkman/candidates/maven/current/bin:/usr/local/sdkman/candidates/ant/current/bin:/usr/local/rvm/gems/default/bin:/usr/local/rvm/gems/default@global/bin:/usr/local/rvm/rubies/default/bin:/usr/local/share/rbenv/bin:/usr/local/php/current/bin:/opt/conda/bin:/usr/local/nvs:/usr/local/share/nvm/current/bin:/usr/local/hugo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/share/dotnet:/home/codespace/.dotnet/tools:/usr/local/rvm/bin","PYTHONPATH":"/home/codespace/.vscode-remote/extensions/ms-python.python-2024.20.0-linux-x64/python_files","TEST_RUN_PIPE":"/tmp/python-test-discovery-545a8778dea8e958f3ae.sock"}
2024-12-05 06:09:09.556 [info] Shell integration status changed, can confirm it's working.
2024-12-05 06:09:09.566 [info] Starting Pylance language server.
2024-12-05 06:09:09.642 [info] > ~/.python/current/bin/python -m pytest -p vscode_pytest --collect-only tests
2024-12-05 06:09:09.643 [info] cwd: .
2024-12-05 06:09:12.112 [info] ============================= test session starts ==============================
platform linux -- Python 3.12.1, pytest-8.3.4, pluggy-1.5.0
rootdir: /workspaces/vscode-pytest-skip-hang
plugins: cov-6.0.0, anyio-4.6.0
collected 1 item
<Dir vscode-pytest-skip-hang>
<Package tests>
<Module test_skip.py>
<Function test_hang>
========================== 1 test collected in 0.03s ===========================
2024-12-05 06:09:17.370 [info] Attempting to use temp directory for test ids file, file name: test-ids-d0b8ce21c9feea6a0b73.txt
2024-12-05 06:09:17.392 [info] All environment variables set for pytest execution: {"DOCKER_BUILDKIT":"1","ENABLE_DYNAMIC_INSTALL":"true","LESSOPEN":"| /usr/bin/lesspipe %s","GITHUB_TOKEN":"ghu_kETMfIxtmoP6wHqJorJRm76fSaWkkM3lFmY5","GIT_COMMITTER_NAME":"GitHub","PYTHONIOENCODING":"UTF-8","GITHUB_CODESPACE_TOKEN":"AMHJ22AEGTXSROPXLYJRMT3HKHUENANCNFSM4AKYDNKQ","USER":"codespace","RVM_PATH":"/usr/local/rvm","NVS_ROOT":"/usr/local/nvs","HOSTNAME":"codespaces-464917","DOTNET_USE_POLLING_FILE_WATCHER":"true","CONDA_SCRIPT":"/opt/conda/etc/profile.d/conda.sh","PIPX_HOME":"/usr/local/py-utils","SHLVL":"1","GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN":"app.github.dev","HUGO_ROOT":"/home/codespace/.hugo","HOME":"/home/codespace","OLDPWD":"/vscode/bin/linux-x64/f1a4fb101478ce6ec82fe9627c43efbf9e98c813","ORYX_ENV_TYPE":"vsonline-present","NVM_BIN":"/usr/local/share/nvm/versions/node/v20.17.0/bin","CODESPACES":"true","DOTNET_RUNNING_IN_CONTAINER":"true","NVM_SYMLINK_CURRENT":"true","DYNAMIC_INSTALL_ROOT_DIR":"/opt","PIPX_BIN_DIR":"/usr/local/py-utils/bin","NVM_INC":"/usr/local/share/nvm/versions/node/v20.17.0/include/node","rvm_stored_umask":"0022","ORYX_DIR":"/usr/local/oryx","GRADLE_HOME":"/usr/local/sdkman/candidates/gradle/current","JUPYTERLAB_PATH":"/home/codespace/.local/bin","rvm_user_install_flag":"0","MAVEN_HOME":"/usr/local/sdkman/candidates/maven/current","GOROOT":"/usr/local/go","NODE_ROOT":"/home/codespace/nvm","GITHUB_GRAPHQL_URL":"https://api.github.com/graphql","GITHUB_USER":"MtkN1","NVM_DIR":"/usr/local/share/nvm","PYTHON_PATH":"/usr/local/python/current","DOTNET_SKIP_FIRST_TIME_EXPERIENCE":"1","ContainerVersion":"13","NVS_HOME":"/usr/local/nvs","GITHUB_API_URL":"https://api.github.com","rvm_bin_path":"/usr/local/rvm/bin","SDKMAN_CANDIDATES_API":"https://api.sdkman.io/2","_":"/usr/bin/cat","RUBY_VERSION":"ruby-3.3.4","PROMPT_DIRTRIM":"4","IRBRC":"/usr/local/rvm/rubies/ruby-3.3.4/.irbrc","CLOUDENV_ENVIRONMENT_ID":"08b2dd41-2e13-4799-af58-e15b9d981e58","DOTNET_ROOT":"/usr/share/dotnet","NVS_DIR":"/usr/local/nvs","PHP_ROOT":"/home/codespace/.php","JAVA_ROOT":"/home/codespace/java","VSCODE_AGENT_FOLDER":"/home/codespace/.vscode-remote","SDKMAN_CANDIDATES_DIR":"/usr/local/sdkman/candidates","HUGO_DIR":"/usr/local/hugo/bin","NPM_GLOBAL":"/home/codespace/.npm-global","SHELL_LOGGED_IN":"true","MY_RUBY_HOME":"/usr/local/rvm/rubies/ruby-3.3.4","LANG":"C.UTF-8","SDKMAN_DIR":"/usr/local/sdkman","RUBY_ROOT":"/home/codespace/.ruby","LS_COLORS":"","SDKMAN_PLATFORM":"linuxx64","GITHUB_REPOSITORY":"MtkN1/vscode-pytest-skip-hang","SHELL":"/bin/bash","GOPATH":"/go","rvm_prefix":"/usr/local","rvm_loaded_flag":"1","GEM_HOME":"/usr/local/rvm/gems/ruby-3.3.4","ORYX_PREFER_USER_INSTALLED_SDKS":"true","LESSCLOSE":"/usr/bin/lesspipe %s %s","ORYX_SDK_STORAGE_BASE_URL":"https://oryx-cdn.microsoft.io","CONDA_DIR":"/opt/conda","rvm_version":"1.29.12 (latest)","DEBIAN_FLAVOR":"focal-scm","GIT_COMMITTER_EMAIL":"[email protected]","GEM_PATH":"/usr/local/rvm/gems/ruby-3.3.4:/usr/local/rvm/gems/ruby-3.3.4@global","JAVA_HOME":"/usr/local/sdkman/candidates/java/current","NVS_USE_XZ":"1","INTERNAL_VSCS_TARGET_URL":"https://southeastasia.online.visualstudio.com","PWD":"/vscode/bin/linux-x64/f1a4fb101478ce6ec82fe9627c43efbf9e98c813","NVM_CD_FLAGS":"","GITHUB_SERVER_URL":"https://github.com","PHP_PATH":"/usr/local/php/current","PYTHON_ROOT":"/home/codespace/.python","RAILS_DEVELOPMENT_HOSTS":".githubpreview.dev,.preview.app.github.dev,.app.github.dev","NVS_OS":"linux","CODESPACE_NAME":"animated-meme-64q64j59j9r2r9x","RUBY_HOME":"/usr/local/rvm/rubies/default","MAVEN_ROOT":"/home/codespace/.maven","rvm_path":"/usr/local/rvm","NUGET_XMLDOC_MODE":"skip","VSCODE_CWD":"/vscode/bin/linux-x64/f1a4fb101478ce6ec82fe9627c43efbf9e98c813","VSCODE_NLS_CONFIG":"{\"userLocale\":\"en\",\"osLocale\":\"en\",\"resolvedLanguage\":\"en\",\"defaultMessagesFile\":\"/vscode/bin/linux-x64/f1a4fb101478ce6ec82fe9627c43efbf9e98c813/out/nls.messages.json\",\"locale\":\"en\",\"availableLanguages\":{}}","VSCODE_HANDLES_SIGPIPE":"true","VSCODE_ESM_ENTRYPOINT":"vs/workbench/api/node/extensionHostProcess","VSCODE_HANDLES_UNCAUGHT_ERRORS":"true","BROWSER":"/vscode/bin/linux-x64/f1a4fb101478ce6ec82fe9627c43efbf9e98c813/bin/helpers/browser.sh","ELECTRON_RUN_AS_NODE":"1","VSCODE_IPC_HOOK_CLI":"/tmp/vscode-ipc-b434babb-d6d2-41df-aec5-8cdfc5433a0a.sock","PATH":"/vscode/bin/linux-x64/f1a4fb101478ce6ec82fe9627c43efbf9e98c813/bin/remote-cli:/home/codespace/.local/bin:/home/codespace/.dotnet:/home/codespace/nvm/current/bin:/home/codespace/.php/current/bin:/home/codespace/.python/current/bin:/home/codespace/java/current/bin:/home/codespace/.ruby/current/bin:/home/codespace/.local/bin:/usr/local/python/current/bin:/usr/local/py-utils/bin:/usr/local/oryx:/usr/local/go/bin:/go/bin:/usr/local/sdkman/bin:/usr/local/sdkman/candidates/java/current/bin:/usr/local/sdkman/candidates/gradle/current/bin:/usr/local/sdkman/candidates/maven/current/bin:/usr/local/sdkman/candidates/ant/current/bin:/usr/local/rvm/gems/default/bin:/usr/local/rvm/gems/default@global/bin:/usr/local/rvm/rubies/default/bin:/usr/local/share/rbenv/bin:/usr/local/php/current/bin:/opt/conda/bin:/usr/local/nvs:/usr/local/share/nvm/current/bin:/usr/local/hugo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/share/dotnet:/home/codespace/.dotnet/tools:/usr/local/rvm/bin","PYTHONPATH":"/home/codespace/.vscode-remote/extensions/ms-python.python-2024.20.0-linux-x64/python_files","TEST_RUN_PIPE":"/tmp/python-test-results-e8e4890b62ac3aff165e.sock","RUN_TEST_IDS_PIPE":"/tmp/test-ids-d0b8ce21c9feea6a0b73.txt"}
2024-12-05 06:09:17.393 [info] Running pytest with arguments: /home/codespace/.vscode-remote/extensions/ms-python.python-2024.20.0-linux-x64/python_files/vscode_pytest/run_pytest_script.py --rootdir=/workspaces/vscode-pytest-skip-hang for workspace /workspaces/vscode-pytest-skip-hang
2024-12-05 06:09:17.393 [info] > ~/.python/current/bin/python ~/.vscode-remote/extensions/ms-python.python-2024.20.0-linux-x64/python_files/vscode_pytest/run_pytest_script.py --rootdir=.
2024-12-05 06:09:17.393 [info] cwd: .
Metadata
Metadata
Assignees
Labels
area-testinginfo-neededIssue requires more information from posterIssue requires more information from postertriage-neededNeeds assignment to the proper sub-teamNeeds assignment to the proper sub-team