Python extension 2024.12.3 breaks pytest discovery in Cursor (env parse error / Pixi noise)

Summary

Running Cursor 0.49.6 on macOS arm64 with the bundled Python extension ms‑python.python 2024.12.3 (Cursor-bundled) breaks pytest discovery.
The extension crashes during startup with a JSON‑parse error and repeatedly watches a non‑existent .pixi/envs directory.

Environment

  • Python extension ms‑python.python 2024.12.3 (bundled)
Version: 0.49.6 (Universal)
VSCode Version: 1.96.2
Commit: 0781e811de386a0c5bcb07ceb259df8ff8246a50
Date: 2025-04-25T04:39:09.213Z (1 wk ago)
Electron: 34.3.4
Chromium: 132.0.6834.210
Node.js: 20.18.3
V8: 13.2.152.41-electron.0
OS: Darwin arm64 24.4.0

Steps to reproduce

  1. Open the repo in Cursor (only .venv, no pixi.toml, no .pixi/).
  2. Open the Testing view – Cursor starts “Discovering tests…”.
  3. Observe Output / Dev Tools logs:
2025-05-07 13:59:04.185 [info] Experiment 'pythonTerminalEnvVarActivation' is inactive
2025-05-07 13:59:04.185 [info] Experiment 'pythonDiscoveryUsingWorkers' is inactive
2025-05-07 13:59:04.185 [error] Reading directory to watch failed [Error: ENOENT: no such file or directory, scandir '~/Desktop/repos/my-repo/.pixi/envs'
	at Object.readdirSync (node:fs:1507:26)
	at t.readdirSync (node:electron/js2c/node_init:2:13703)
	at ~/.cursor/extensions/ms-python.python-2024.12.3-darwin-arm64/out/client/extension.js:2:586747
	at ~/.cursor/extensions/ms-python.python-2024.12.3-darwin-arm64/out/client/extension.js:2:586938
	at Array.map (<anonymous>)
	at d.initWatchers (~/.cursor/extensions/ms-python.python-2024.12.3-darwin-arm64/out/client/extension.js:2:586656)
	at async d.ensureWatchersReady (~/.cursor/extensions/ms-python.python-2024.12.3-darwin-arm64/out/client/extension.js:2:543067)] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'scandir',
  path: '~/Desktop/repos/my-repo/.pixi/envs'
}
2025-05-07 13:59:04.186 [error] Dir "~/Desktop/repos/my-repo/.pixi/envs" is not watchable (directory does not exist)
2025-05-07 13:59:04.186 [info] Default formatter is set to ms-python.black-formatter for workspace ~/Desktop/repos/my-repo
2025-05-07 13:59:04.186 [info] VS Code was launched from an activated environment: '.venv', selecting it as the interpreter for workspace.
2025-05-07 13:59:04.186 [info] Python interpreter path: ./.venv/bin/python
2025-05-07 13:59:04.209 [info] > pyenv which python
2025-05-07 13:59:04.209 [info] cwd: .
2025-05-07 13:59:06.347 [info] Starting Pylance language server.
2025-05-07 14:31:04.981 [info] Discover tests for workspace name: my-repo - uri: ~/Desktop/repos/my-repo
2025-05-07 14:31:04.995 [info] > pixi --version
2025-05-07 14:31:05.010 [error] [Error: spawn pixi ENOENT
	at ChildProcess._handle.onexit (node:internal/child_process:285:19)
	at onErrorNT (node:internal/child_process:483:16)
	at process.processTicksAndRejections (node:internal/process/task_queues:82:21)] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn pixi',
  path: 'pixi',
  spawnargs: [ '--version' ]
}
2025-05-07 14:31:05.011 [warning] could not find a pixi interpreter for the interpreter at ~/Desktop/repos/my-repo/.venv/bin/python
2025-05-07 14:31:05.024 [info] > . ./.venv/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.cursor/extensions/ms-python.python-2024.12.3-darwin-arm64/python_files/printEnvVariables.py
2025-05-07 14:31:05.024 [info] shell: bash
2025-05-07 14:31:05.209 [warning] could not find a pixi interpreter for the interpreter at ~/Desktop/repos/my-repo/.venv/bin/python
2025-05-07 14:31:05.210 [info] > ./.venv/bin/python ~/.cursor/extensions/ms-python.python-2024.12.3-darwin-arm64/python_files/testing_tools/run_adapter.py discover pytest -- --rootdir . -s --cache-clear tests
2025-05-07 14:31:05.210 [info] cwd: .
2025-05-07 14:31:10.246 [error] Error discovering pytest tests:
 [n [Error]: sys:1: DeprecationWarning: builtin type swigvarlink has no __module__ attribute

	at ChildProcess.<anonymous> (~/.cursor/extensions/ms-python.python-2024.12.3-darwin-arm64/out/client/extension.js:2:228920)
	at Object.onceWrapper (node:events:633:26)
	at ChildProcess.emit (node:events:518:28)
	at maybeClose (node:internal/child_process:1104:16)
	at ChildProcess._handle.onexit (node:internal/child_process:304:5)
	at Process.callbackTrampoline (node:internal/async_hooks:130:17)]
  1. Test explorer stays empty; individual tests cannot be debug‑run either.

Expected behaviour

  • Python extension starts without errors.
  • Pytest discovery lists tests, identical to VS Code (same workspace + extension 2025.4.0).

Actual behaviour

  • Extension crashes while parsing environment variables, so test discovery never completes.
  • Continuous ENOENT warnings for .pixi/envs although Pixi isn’t used in the project.

Root‑cause summary

  • 2024.12.3 always watches .pixi/envs, generating ENOENT noise when Pixi isn’t present.
  • The "pythonTerminalEnvVarActivation" experiment runs an env‑collector script whose output is not valid JSON when large multiline variables are present; the resulting SyntaxError aborts extension activation, killing pytest discovery.
  • Up‑stream fixes:
    • PR #24319 — watcher now activates only if pixi.toml exists.
    • Issue #23604 — env‑collector JSON bug was refactored; according to upstream reports, this is no longer an issue in 2025.x.

Note: I haven’t personally tested with 2025.x inside Cursor yet (can’t sideload), but this bug no longer occurs in standard VS Code with 2025.x.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.