Skip to content

Commit 34c9e53

Browse files
authored
Stabilize interpreter selection integration tests by asserting on interpreter path, not envId (microsoft#1571)
`interpreterSelection.integration.test.ts` was asserting equality on `envId.id` across `setEnvironment → getEnvironment` flows. That ID is intentionally non-stable after persistence (manager may re-register with a suffixed opaque ID), which caused CI failures despite selecting the same interpreter. - **Root cause** - Tests treated `envId.id` as a stable identity across persistence round-trips. - For these flows, stable identity is the interpreter executable path (`environmentPath.fsPath`). - **Changes in this PR** - Replaced `envId.id` equality assertions with `environmentPath.fsPath` equality in all affected integration tests: - `setEnvironment persists selection` - `Project selection is independent of global` (global + project assertions) - `Change event includes old and new values` - `File inherits project environment` - `Setting same environment is idempotent` - Updated assertion message text where needed to reflect path-based interpreter identity. - **Scope** - Test-only change in `src/test/integration/interpreterSelection.integration.test.ts`. - No production/runtime behavior changes. ```ts assert.strictEqual( retrieved.environmentPath.fsPath, envToSet.environmentPath.fsPath, 'Retrieved environment should point to the same interpreter as the one set', ); ``` --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
1 parent b991b71 commit 34c9e53

1 file changed

Lines changed: 30 additions & 6 deletions

File tree

src/test/integration/interpreterSelection.integration.test.ts

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,11 @@ suite('Integration: Interpreter Selection Priority', function () {
103103
const retrieved = await api.getEnvironment(undefined);
104104

105105
assert.ok(retrieved, 'Should have environment after setting');
106-
assert.strictEqual(retrieved.envId.id, envToSet.envId.id, 'Retrieved environment should match set environment');
106+
assert.strictEqual(
107+
retrieved.environmentPath.fsPath,
108+
envToSet.environmentPath.fsPath,
109+
'Retrieved environment should point to the same interpreter as the one set',
110+
);
107111
});
108112

109113
/**
@@ -134,12 +138,20 @@ suite('Integration: Interpreter Selection Priority', function () {
134138
// Verify global is unchanged
135139
const globalRetrieved = await api.getEnvironment(undefined);
136140
assert.ok(globalRetrieved, 'Global should have environment');
137-
assert.strictEqual(globalRetrieved.envId.id, globalEnv.envId.id, 'Global selection should be unchanged');
141+
assert.strictEqual(
142+
globalRetrieved.environmentPath.fsPath,
143+
globalEnv.environmentPath.fsPath,
144+
'Global selection should be unchanged',
145+
);
138146

139147
// Verify project has its own selection
140148
const projectRetrieved = await api.getEnvironment(project.uri);
141149
assert.ok(projectRetrieved, 'Project should have environment');
142-
assert.strictEqual(projectRetrieved.envId.id, projectEnv.envId.id, 'Project should have its own selection');
150+
assert.strictEqual(
151+
projectRetrieved.environmentPath.fsPath,
152+
projectEnv.environmentPath.fsPath,
153+
'Project should have its own selection',
154+
);
143155
});
144156

145157
/**
@@ -177,7 +189,11 @@ suite('Integration: Interpreter Selection Priority', function () {
177189
const event = handler.last;
178190
assert.ok(event, 'Event should have fired');
179191
assert.ok(event.new, 'Event should have new environment');
180-
assert.strictEqual(event.new.envId.id, newEnv.envId.id, 'New should match set environment');
192+
assert.strictEqual(
193+
event.new.environmentPath.fsPath,
194+
newEnv.environmentPath.fsPath,
195+
'New should match set environment',
196+
);
181197
} finally {
182198
handler.dispose();
183199
}
@@ -209,7 +225,11 @@ suite('Integration: Interpreter Selection Priority', function () {
209225
const fileEnv = await api.getEnvironment(fileUri);
210226

211227
assert.ok(fileEnv, 'File should inherit project environment');
212-
assert.strictEqual(fileEnv.envId.id, env.envId.id, 'File should use project environment');
228+
assert.strictEqual(
229+
fileEnv.environmentPath.fsPath,
230+
env.environmentPath.fsPath,
231+
'File should use project environment',
232+
);
213233
});
214234

215235
/**
@@ -261,7 +281,11 @@ suite('Integration: Interpreter Selection Priority', function () {
261281
// Verify the environment was actually set
262282
const currentEnv = await api.getEnvironment(undefined);
263283
assert.ok(currentEnv, 'Environment should be set before idempotency test');
264-
assert.strictEqual(currentEnv.envId.id, env.envId.id, 'Environment should match what we just set');
284+
assert.strictEqual(
285+
currentEnv.environmentPath.fsPath,
286+
env.environmentPath.fsPath,
287+
'Environment should match what we just set',
288+
);
265289

266290
const handler = new TestEventHandler<DidChangeEnvironmentEventArgs>(
267291
api.onDidChangeEnvironment,

0 commit comments

Comments
 (0)