Skip to content

Discovered pytests are not loaded into test explorerΒ #24655

@jbhannah

Description

@jbhannah

Type: Bug

Behaviour

When opening a Python project that uses pytest, the Test Explorer panel never displays the results of the pytest collection command. The loading indicator continues moving, and the Refresh Tests button only reports to the console that test discovery is already in progress. Rolling back to extension version 2024.22.0 when opted-into the pythonTestAdapter experiment, or opting-out of the pythonTestAdapter experiment in version 2024.22.1, fixes the issue.

Steps to reproduce:

  1. Install the ms-python.python extension version 2024.22.1.
  2. Opt into the pythonTestAdapter experiment.
  3. Load a Python project that uses pytest.

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-23 23:00:03.352 [info] Experiment 'pythonTestAdapter' is active
2024-12-23 23:00:03.352 [info] Experiment 'pythonRecommendTensorboardExt' is active
2024-12-23 23:00:03.352 [info] Experiment 'pythonTerminalEnvVarActivation' is active
2024-12-23 23:00:03.352 [warning] Dir "/Users/jbhannah/Code/src/github.com/budgeapp/budge/.pixi/envs" is not watchable (directory does not exist)
2024-12-23 23:00:03.358 [info] Python interpreter path: ./.venv/bin/python
2024-12-23 23:00:03.687 [info] > pyenv which python
2024-12-23 23:00:03.687 [info] cwd: .
2024-12-23 23:00:03.945 [info] > conda info --json
2024-12-23 23:00:04.128 [info] > . ./.venv/bin/activate.fish && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode/extensions/ms-python.python-2024.22.1-darwin-arm64/python_files/printEnvVariables.py
2024-12-23 23:00:04.128 [info] shell: fish
2024-12-23 23:00:04.208 [info] > /usr/bin/python3 ~/.vscode/extensions/ms-python.python-2024.22.1-darwin-arm64/python_files/printEnvVariables.py
2024-12-23 23:00:04.209 [info] shell: fish
2024-12-23 23:00:04.279 [info] Setting environment variable VIRTUAL_ENV_PROMPT in collection to budge {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-12-23 23:00:04.279 [info] Prepending environment variable PATH in collection to /Users/jbhannah/.vscode/extensions/ms-python.python-2024.22.1-darwin-arm64/python_files/deactivate/fish:/Users/jbhannah/Code/src/github.com/budgeapp/budge/.venv/bin:/Users/jbhannah/.rbenv/shims:/Applications/Postgres.app/Contents/Versions/latest/bin:/Users/jbhannah/Code/bin:/Users/jbhannah/.local/state/fnm_multishells/30763_1735023604148/bin:/Users/jbhannah/.cargo/bin:/Users/jbhannah/.local/bin:/Users/jbhannah/.pub-cache/bin:/Users/jbhannah/.deno/bin:/Users/jbhannah/Library/Android/sdk/tools/bin:/Users/jbhannah/.bun/bin:/opt/homebrew/opt/ruby/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/jbhannah/.rbenv/shims:/Applications/Postgres.app/Contents/Versions/latest/bin:/Users/jbhannah/.jenv/shims:/Users/jbhannah/.jenv/shims:/Users/jbhannah/Code/bin:/Users/jbhannah/.local/state/fnm_multishells/2373_1735021339740/bin:/Users/jbhannah/.cargo/bin:/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:/Library/Apple/usr/bin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/TeX/texbin: {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-12-23 23:00:04.279 [info] Setting environment variable VIRTUAL_ENV in collection to /Users/jbhannah/Code/src/github.com/budgeapp/budge/.venv {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-12-23 23:00:04.279 [info] Setting environment variable _OLD_FISH_PROMPT_OVERRIDE in collection to /Users/jbhannah/Code/src/github.com/budgeapp/budge/.venv {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-12-23 23:00:04.279 [info] Setting environment variable FNM_MULTISHELL_PATH in collection to /Users/jbhannah/.local/state/fnm_multishells/30763_1735023604148 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-12-23 23:00:04.279 [info] Setting environment variable MANPATH in collection to /usr/share/man:/usr/local/share/man:/Library/TeX/Distributions/.DefaultTeX/Contents/Man:/opt/homebrew/share/man {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-12-23 23:00:04.280 [info] Send text to terminal: /usr/bin/python3 /Users/jbhannah/.vscode/extensions/ms-python.python-2024.22.1-darwin-arm64/python_files/printEnvVariablesToFile.py /Users/jbhannah/.vscode/extensions/ms-python.python-2024.22.1-darwin-arm64/python_files/deactivate/fish/envVars.txt
2024-12-23 23:00:07.969 [info] Discover tests for workspace name: budge - uri: /Users/jbhannah/Code/src/github.com/budgeapp/budge
2024-12-23 23:00:07.969 [info] Running discovery for pytest using the new test adapter.
2024-12-23 23:00:08.039 [info] All environment variables set for pytest discovery: {"BUN_INSTALL":"/Users/jbhannah/.bun","COMMAND_MODE":"unix2003","EDITOR":"nvim","FNM_ARCH":"arm64","FNM_COREPACK_ENABLED":"false","FNM_DIR":"/Users/jbhannah/Library/Application Support/fnm","FNM_LOGLEVEL":"info","FNM_MULTISHELL_PATH":"/Users/jbhannah/.local/state/fnm_multishells/2373_1735021339740","FNM_NODE_DIST_MIRROR":"https://nodejs.org/dist","FNM_RESOLVE_ENGINES":"true","FNM_VERSION_FILE_STRATEGY":"local","FZF_ALT_C_COMMAND":"fd --type directory . $dir","FZF_CD_COMMAND":"fd --type directory . $dir","FZF_CD_WITH_HIDDEN_COMMAND":"fd --type directory --hidden . $dir","FZF_COMPLETE":"2","FZF_CTRL_T_COMMAND":"fd --type file --hidden . $dir","FZF_DEFAULT_COMMAND":"fd --type file --hidden . $dir","FZF_DEFAULT_OPTS":"--reverse --height=20","FZF_FIND_FILE_COMMAND":"fd --type file --hidden . $dir","FZF_LEGACY_KEYBINDINGS":"0","FZF_PREVIEW_DIR_CMD":"eza --group-directories-first -algh --color always","FZF_PREVIEW_FILE_CMD":"bat --color always --number","FZF_TMUX_OPTS":"-d 30%","GOPATH":"/Users/jbhannah/Code","HAXE_STD_PATH":"/opt/homebrew/lib/haxe/std","HOME":"/Users/jbhannah","HOMEBREW_CELLAR":"/opt/homebrew/Cellar","HOMEBREW_NO_ENV_HINTS":"1","HOMEBREW_PREFIX":"/opt/homebrew","HOMEBREW_REPOSITORY":"/opt/homebrew","INFOPATH":"/opt/homebrew/share/info:/opt/homebrew/share/info:/opt/homebrew/share/info:/opt/homebrew/share/info:/opt/homebrew/share/info:/opt/homebrew/share/info:/opt/homebrew/share/info:/opt/homebrew/share/info:/opt/homebrew/share/info:/opt/homebrew/share/info:/opt/homebrew/share/info:/opt/homebrew/share/info:/opt/homebrew/share/info:/opt/homebrew/share/info:/opt/homebrew/share/info:/opt/homebrew/share/info:/opt/homebrew/share/info:/opt/homebrew/share/info:/opt/homebrew/share/info:/opt/homebrew/share/info:/opt/homebrew/share/info:/opt/homebrew/share/info:/opt/homebrew/share/info:/opt/homebrew/share/info:/opt/homebrew/share/info:/opt/homebrew/share/info:/opt/homebrew/share/info:/opt/homebrew/share/info","JENV_LOADED":"1","JENV_SHELL":"fish","LOGNAME":"jbhannah","LaunchInstanceID":"86B30646-B678-47F2-BF6D-86C0CA1417BF","MANPATH":"/usr/share/man:/usr/local/share/man:/Library/TeX/Distributions/.DefaultTeX/Contents/Man:/opt/homebrew/share/man","MallocNanoZone":"0","OP_PLUGIN_ALIASES_SOURCED":"1","ORIGINAL_XDG_CURRENT_DESKTOP":"undefined","PWD":"/","RBENV_SHELL":"fish","SECURITYSESSIONID":"186b4","SHELL":"/opt/homebrew/bin/fish","SHLVL":"1","SSH_AUTH_SOCK":"/Users/jbhannah/.1password/agent.sock","STARSHIP_SESSION_KEY":"5781276623106532","STARSHIP_SHELL":"fish","TMPDIR":"/var/folders/nv/pplgqy294y5064k53t0yvdfc0000gn/T/","TMUX_CONF":"/Users/jbhannah/.tmux.conf","TMUX_CONF_LOCAL":"/Users/jbhannah/.tmux.conf.local","TMUX_PROGRAM":"/opt/homebrew/bin/tmux","TZ":"America/Los_Angeles","USER":"jbhannah","VISUAL":"nvim","VSCODE_CODE_CACHE_PATH":"/Users/jbhannah/Library/Application Support/Code/CachedData/fabdb6a30b49f79a7aba0f2ad9df9b399473380f","VSCODE_CRASH_REPORTER_PROCESS_TYPE":"extensionHost","VSCODE_CWD":"/","VSCODE_ESM_ENTRYPOINT":"vs/workbench/api/node/extensionHostProcess","VSCODE_HANDLES_UNCAUGHT_ERRORS":"true","VSCODE_IPC_HOOK":"/Users/jbhannah/Library/Application Support/Code/1.96-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":"2364","XPC_FLAGS":"0x0","XPC_SERVICE_NAME":"application.com.microsoft.VSCode.312447736.312447742","__CFBundleIdentifier":"com.microsoft.VSCode","__CF_USER_TEXT_ENCODING":"0x1F5:0x0:0x0","ELECTRON_RUN_AS_NODE":"1","DEBUG":"WARN","VSCODE_L10N_BUNDLE_LOCATION":"","PATH":"/Users/jbhannah/.rbenv/shims:/Applications/Postgres.app/Contents/Versions/latest/bin:/Users/jbhannah/.jenv/shims:/Users/jbhannah/.jenv/shims:/Users/jbhannah/Code/bin:/Users/jbhannah/.local/state/fnm_multishells/2373_1735021339740/bin:/Users/jbhannah/.cargo/bin:/Users/jbhannah/.local/bin:/Users/jbhannah/.pub-cache/bin:/Users/jbhannah/.deno/bin:/Users/jbhannah/Library/Android/sdk/tools/bin:/Users/jbhannah/.bun/bin:/opt/homebrew/opt/ruby/bin:/opt/homebrew/bin:/opt/homebrew/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:/Library/Apple/usr/bin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/TeX/texbin","PYTHONPATH":"/Users/jbhannah/.vscode/extensions/ms-python.python-2024.22.1-darwin-arm64/python_files","TEST_RUN_PIPE":"/var/folders/nv/pplgqy294y5064k53t0yvdfc0000gn/T/python-test-discovery-c91addae37ee66a71789"}
2024-12-23 23:00:08.054 [info] > . ./.venv/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode/extensions/ms-python.python-2024.22.1-darwin-arm64/python_files/printEnvVariables.py
2024-12-23 23:00:08.054 [info] shell: bash
2024-12-23 23:00:08.092 [info] > ./.venv/bin/python -m pytest -p vscode_pytest --collect-only tests --rootdir=.
2024-12-23 23:00:08.092 [info] cwd: .
2024-12-23 23:00:08.249 [info] ============================= test session starts ==============================
platform darwin -- Python 3.13.1, pytest-8.3.4, pluggy-1.5.0

2024-12-23 23:00:08.256 [info] rootdir: /Users/jbhannah/Code/src/github.com/budgeapp/budge
configfile: pyproject.toml
plugins: cov-6.0.0

2024-12-23 23:00:08.276 [info] collected 16 items

<Dir budge>
  <Dir tests>
    <Dir budge>
      <Module test_account.py>
        <Class TestAccount>
          <Function test_balance>
          <Function test_balance_as_of_future>
          <Function test_transactions_range>
          <Function test_daily_balance_past>
          <Function test_daily_balance_future>
      <Module test_collection.py>
        <Function test_add_item>
        <Function test_add_multiple_items>
        <Function test_add_item_already_in_other_collection>
        <Function test_remove_item>
        <Function test_remove_item_not_in_collection>
        <Function test_discard_item>
        <Function test_pop_item>
        <Function test_clear_collection>
      <Module test_date.py>
        <Function test_daterange>
      <Module test_transfer.py>
        <Class TestTransfer>
          <Function test_transfer>
        <Class TestRepeatingTransfer>
          <Function test_repeating_transfer>

2024-12-23 23:00:14.352 [info] Starting Pylance language server.
2024-12-23 23:00:38.717 [info] Discover tests for workspace name: budge - uri: /Users/jbhannah/Code/src/github.com/budgeapp/budge
2024-12-23 23:00:38.717 [info] Running discovery for pytest using the new test adapter.
2024-12-23 23:00:38.717 [error] Test discovery already in progress, not starting a new one.

Extension version: 2024.22.1
VS Code version: Code 1.96.2 (fabdb6a30b49f79a7aba0f2ad9df9b399473380f, 2024-12-19T10:22:47.216Z)
OS version: Darwin arm64 24.2.0
Modes:

System Info
Item Value
CPUs Apple M1 Max (10 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, 8, 13
Memory (System) 32.00GB (3.67GB free)
Process Argv --enable-proposed-api flexpilot.flexpilot-vscode-extension --log flexpilot.flexpilot-vscode-extension=debug --crash-reporter-id 46bcaca3-e957-4afa-a616-9447f1127fb3
Screen Reader no
VM 0%

Metadata

Metadata

Assignees

Labels

area-testingbugIssue identified by VS Code Team member as probable bugtriage-neededNeeds assignment to the proper sub-team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions