Skip to content

Commit 38c3929

Browse files
committed
cleanup
1 parent eb775e4 commit 38c3929

8 files changed

Lines changed: 153 additions & 106 deletions

File tree

.github/workflows/pr-check.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ on:
99

1010
env:
1111
NODE_VERSION: '22.21.1'
12-
PYTHON_VERSION: '3.11'
1312

1413
jobs:
1514
build-vsix:

.github/workflows/push-check.yml

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,153 @@ jobs:
7474

7575
- name: Run Tests
7676
run: npm run unittest
77+
78+
smoke-tests:
79+
name: Smoke Tests
80+
runs-on: ${{ matrix.os }}
81+
needs: [build-vsix]
82+
strategy:
83+
fail-fast: false
84+
matrix:
85+
os: [ubuntu-latest, windows-latest, macos-latest]
86+
python-version: ['3.9', '3.12', '3.14']
87+
88+
steps:
89+
- name: Checkout
90+
uses: actions/checkout@v4
91+
92+
- name: Install Node
93+
uses: actions/setup-node@v4
94+
with:
95+
node-version: ${{ env.NODE_VERSION }}
96+
cache: 'npm'
97+
98+
- name: Install Python
99+
uses: actions/setup-python@v5
100+
with:
101+
python-version: ${{ matrix.python-version }}
102+
103+
- name: Install Dependencies
104+
run: npm ci
105+
106+
- name: Compile Extension
107+
run: npm run compile
108+
109+
- name: Compile Tests
110+
run: npm run compile-tests
111+
112+
- name: Configure Test Settings
113+
run: |
114+
mkdir -p .vscode-test/user-data/User
115+
echo '{"python.useEnvironmentsExtension": true}' > .vscode-test/user-data/User/settings.json
116+
shell: bash
117+
118+
- name: Run Smoke Tests (Linux)
119+
if: runner.os == 'Linux'
120+
uses: GabrielBB/xvfb-action@v1
121+
with:
122+
run: npm run smoke-test
123+
124+
- name: Run Smoke Tests (non-Linux)
125+
if: runner.os != 'Linux'
126+
run: npm run smoke-test
127+
128+
e2e-tests:
129+
name: E2E Tests
130+
runs-on: ${{ matrix.os }}
131+
needs: [smoke-tests]
132+
strategy:
133+
fail-fast: false
134+
matrix:
135+
os: [ubuntu-latest, windows-latest, macos-latest]
136+
python-version: ['3.9', '3.12', '3.14']
137+
138+
steps:
139+
- name: Checkout
140+
uses: actions/checkout@v4
141+
142+
- name: Install Node
143+
uses: actions/setup-node@v4
144+
with:
145+
node-version: ${{ env.NODE_VERSION }}
146+
cache: 'npm'
147+
148+
- name: Install Python
149+
uses: actions/setup-python@v5
150+
with:
151+
python-version: ${{ matrix.python-version }}
152+
153+
- name: Install Dependencies
154+
run: npm ci
155+
156+
- name: Compile Extension
157+
run: npm run compile
158+
159+
- name: Compile Tests
160+
run: npm run compile-tests
161+
162+
- name: Configure Test Settings
163+
run: |
164+
mkdir -p .vscode-test/user-data/User
165+
echo '{"python.useEnvironmentsExtension": true}' > .vscode-test/user-data/User/settings.json
166+
shell: bash
167+
168+
- name: Run E2E Tests (Linux)
169+
if: runner.os == 'Linux'
170+
uses: GabrielBB/xvfb-action@v1
171+
with:
172+
run: npm run e2e-test
173+
174+
- name: Run E2E Tests (non-Linux)
175+
if: runner.os != 'Linux'
176+
run: npm run e2e-test
177+
178+
integration-tests:
179+
name: Integration Tests
180+
runs-on: ${{ matrix.os }}
181+
needs: [smoke-tests]
182+
strategy:
183+
fail-fast: false
184+
matrix:
185+
os: [ubuntu-latest, windows-latest, macos-latest]
186+
python-version: ['3.9', '3.12', '3.14']
187+
188+
steps:
189+
- name: Checkout
190+
uses: actions/checkout@v4
191+
192+
- name: Install Node
193+
uses: actions/setup-node@v4
194+
with:
195+
node-version: ${{ env.NODE_VERSION }}
196+
cache: 'npm'
197+
198+
- name: Install Python
199+
uses: actions/setup-python@v5
200+
with:
201+
python-version: ${{ matrix.python-version }}
202+
203+
- name: Install Dependencies
204+
run: npm ci
205+
206+
- name: Compile Extension
207+
run: npm run compile
208+
209+
- name: Compile Tests
210+
run: npm run compile-tests
211+
212+
- name: Configure Test Settings
213+
run: |
214+
mkdir -p .vscode-test/user-data/User
215+
echo '{"python.useEnvironmentsExtension": true}' > .vscode-test/user-data/User/settings.json
216+
shell: bash
217+
218+
- name: Run Integration Tests (Linux)
219+
if: runner.os == 'Linux'
220+
uses: GabrielBB/xvfb-action@v1
221+
with:
222+
run: npm run integration-test
223+
224+
- name: Run Integration Tests (non-Linux)
225+
if: runner.os != 'Linux'
226+
run: npm run integration-test

src/extension.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ import { registerPoetryFeatures } from './managers/poetry/main';
9797
import { registerPyenvFeatures } from './managers/pyenv/main';
9898

9999
export async function activate(context: ExtensionContext): Promise<PythonEnvironmentApi | undefined> {
100-
// Only skip activation if user explicitly set useEnvironmentsExtension to false
100+
// Only skip activation if user explicitly set useEnvironmentsExtension to false.
101+
// When disabled, the main Python extension handles environments instead (legacy mode).
101102
const config = getConfiguration('python');
102103
const inspection = config.inspect<boolean>('useEnvironmentsExtension');
103104
const explicitlyDisabled =

src/test/e2e/environmentDiscovery.e2e.test.ts

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,6 @@
1313
* 2. Environment discovery runs successfully
1414
* 3. At least one Python environment is found (assumes Python is installed)
1515
* 4. Environment objects have expected properties
16-
*
17-
* PREREQUISITES:
18-
* - Python must be installed on the test machine
19-
* - At least one Python environment should be discoverable (system Python, venv, conda, etc.)
20-
*
21-
* HOW TO RUN:
22-
* Option 1: VS Code - Use "E2E Tests" launch configuration
23-
* Option 2: Terminal - npm run e2e-test
2416
*/
2517

2618
import * as assert from 'assert';
@@ -29,7 +21,6 @@ import { ENVS_EXTENSION_ID } from '../constants';
2921
import { waitForCondition } from '../testUtils';
3022

3123
suite('E2E: Environment Discovery', function () {
32-
// E2E can be slower but 2x activation time is excessive
3324
this.timeout(90_000);
3425

3526
// The API is FLAT - methods are directly on the api object, not nested
@@ -48,7 +39,6 @@ suite('E2E: Environment Discovery', function () {
4839
await waitForCondition(() => extension.isActive, 30_000, 'Extension did not activate');
4940
}
5041

51-
// Get the API - it's a flat interface, not nested
5242
api = extension.exports;
5343
assert.ok(api, 'Extension API not available');
5444
assert.ok(typeof api.getEnvironments === 'function', 'getEnvironments method not available');
@@ -57,9 +47,6 @@ suite('E2E: Environment Discovery', function () {
5747
/**
5848
* Test: Can trigger environment refresh
5949
*
60-
* WHY THIS MATTERS:
61-
* Users need to be able to refresh environments when they install new Python versions
62-
* or create new virtual environments outside VS Code.
6350
*/
6451
test('Can trigger environment refresh', async function () {
6552
// Skip if API doesn't have refresh method
@@ -89,13 +76,6 @@ suite('E2E: Environment Discovery', function () {
8976
/**
9077
* Test: Discovers at least one environment
9178
*
92-
* WHY THIS MATTERS:
93-
* The primary value of this extension is discovering Python environments.
94-
* If no environments are found, the extension isn't working.
95-
*
96-
* ASSUMPTIONS:
97-
* - Test machine has Python installed somewhere
98-
* - Discovery timeout is sufficient for the machine
9979
*/
10080
test('Discovers at least one environment', async function () {
10181
// Wait for discovery to find at least one environment
@@ -116,9 +96,6 @@ suite('E2E: Environment Discovery', function () {
11696
/**
11797
* Test: Discovered environments have required properties
11898
*
119-
* WHY THIS MATTERS:
120-
* Other parts of the extension and external consumers depend on environment
121-
* objects having certain properties. This catches schema regressions.
12299
*/
123100
test('Environments have required properties', async function () {
124101
const environments = await api.getEnvironments('all');
@@ -174,9 +151,6 @@ suite('E2E: Environment Discovery', function () {
174151
/**
175152
* Test: Can get global environments
176153
*
177-
* WHY THIS MATTERS:
178-
* Users often want to see system-wide Python installations separate from
179-
* workspace-specific virtual environments.
180154
*/
181155
test('Can get global environments', async function () {
182156
// This should not throw, even if there are no global environments

src/test/e2e/index.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@
66
*
77
* This file is loaded by the VS Code Extension Host test runner.
88
* It configures Mocha and runs all E2E tests.
9-
*
10-
* E2E tests differ from smoke tests:
11-
* - Smoke tests: Quick sanity checks (extension loads, commands exist)
12-
* - E2E tests: Full user workflows (create env, install packages, select interpreter)
13-
*
14-
* Both run in a REAL VS Code instance with REAL APIs.
159
*/
1610

1711
import * as glob from 'glob';

src/test/integration/envManagerApi.integration.test.ts

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@
1414
* 2. Changes through API update manager state
1515
* 3. Events fire when state changes
1616
*
17-
* DIFFERS FROM:
18-
* - Unit tests: Uses real VS Code, not mocks
19-
* - E2E tests: Focuses on component integration, not full workflows
20-
* - Smoke tests: More thorough verification of behavior
2117
*/
2218

2319
import * as assert from 'assert';
@@ -26,7 +22,7 @@ import { ENVS_EXTENSION_ID } from '../constants';
2622
import { TestEventHandler, waitForCondition } from '../testUtils';
2723

2824
suite('Integration: Environment Manager + API', function () {
29-
// Shorter timeout for faster feedback - integration tests shouldn't take 2 min
25+
// Shorter timeout for faster feedback
3026
this.timeout(45_000);
3127

3228
// The API is FLAT - methods are directly on the api object, not nested
@@ -55,9 +51,6 @@ suite('Integration: Environment Manager + API', function () {
5551
/**
5652
* Test: API and manager stay in sync after refresh
5753
*
58-
* WHY THIS MATTERS:
59-
* The API is backed by internal managers. If they get out of sync,
60-
* users see stale data or missing environments.
6154
*/
6255
test('API reflects manager state after refresh', async function () {
6356
// Get initial state (verify we can call API before refresh)
@@ -80,9 +73,6 @@ suite('Integration: Environment Manager + API', function () {
8073
/**
8174
* Test: Events fire when environments change
8275
*
83-
* WHY THIS MATTERS:
84-
* UI components and other extensions subscribe to change events.
85-
* If events don't fire, the UI won't update.
8676
*/
8777
test('Change events fire on refresh', async function () {
8878
// Skip if event is not available
@@ -115,9 +105,6 @@ suite('Integration: Environment Manager + API', function () {
115105
/**
116106
* Test: Global vs all environments are different scopes
117107
*
118-
* WHY THIS MATTERS:
119-
* Users expect "global" to show system Python, "all" to include workspace envs.
120-
* If scopes aren't properly separated, filtering doesn't work.
121108
*/
122109
test('Different scopes return appropriate environments', async function () {
123110
const allEnvs = await api.getEnvironments('all');
@@ -138,9 +125,6 @@ suite('Integration: Environment Manager + API', function () {
138125
/**
139126
* Test: Environment objects are properly structured
140127
*
141-
* WHY THIS MATTERS:
142-
* Consumers depend on environment object structure. If properties
143-
* are missing or malformed, integrations break.
144128
*/
145129
test('Environment objects have consistent structure', async function () {
146130
const environments = await api.getEnvironments('all');

src/test/integration/index.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,6 @@
33

44
/**
55
* Integration Test Runner Entry Point
6-
*
7-
* Integration tests verify that multiple components work together correctly.
8-
* They run in a REAL VS Code instance but focus on component interactions
9-
* rather than full user workflows (that's E2E).
10-
*
11-
* Integration tests differ from:
12-
* - Unit tests: Use real VS Code APIs, not mocks
13-
* - E2E tests: Test component interactions, not complete workflows
14-
* - Smoke tests: More thorough than quick sanity checks
156
*/
167

178
import * as glob from 'glob';

0 commit comments

Comments
 (0)