Skip to content

Conversation

@eleanorjboyd
Copy link
Member

No description provided.

@eleanorjboyd eleanorjboyd self-assigned this Feb 11, 2026
The smoke/e2e/integration tests were failing because VS Code
wasn't reading the settings.json file we created. This happened
because @vscode/test-cli uses its own default user-data directory
unless we explicitly pass --user-data-dir.

This fix adds launchArgs to each test profile to point to our
.vscode-test/user-data directory where CI creates the settings file
with 'python.useEnvironmentsExtension': true.
The python.useEnvironmentsExtension setting is defined by ms-python.python
which isn't installed during tests. Instead of polluting the python.* namespace
by defining the setting ourselves, we check for test environment variables
(VSC_PYTHON_SMOKE_TEST, VSC_PYTHON_E2E_TEST, VSC_PYTHON_INTEGRATION_TEST)
and skip the setting check when running tests.
The previous code used config.get() which may return defaultValue from
other extensions' package.json (like ms-python.python setting
useEnvironmentsExtension to false) even when those extensions aren't
installed.

Now we use inspect() to check if the setting has been explicitly set
by the user (globalValue, workspaceValue, or workspaceFolderValue).
If not explicitly set, we default to true, allowing the extension
to activate properly in test environments and clean VS Code instances.
Previous logic used config.get() which was affected by defaultValue from
other extensions' package.json. Now we use inspect() to check if the user
has EXPLICITLY set useEnvironmentsExtension to false.

- If user sets to true: activate
- If user sets to false: don't activate
- If user doesn't set anything: activate (default behavior)
- If only defaultValue exists: ignored, activate anyway

This is more robust and matches user intent.
The extension's main entry point is dist/extension.js which requires
webpack to build. The test CI jobs were only running tsc (compile-tests)
but not webpack (compile), so the extension code wasn't being built
and tests were running against stale/missing code.

Also simplified the useEnvironmentsExtension check to only skip
activation when explicitly set to false by the user.
Now that we use inspect() for useEnvironmentsExtension check, the
default value from Python extension's package.json is ignored. This
lets us safely install ms-python.python which bundles the pet binary
needed for native Python environment discovery.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant