Skip to content

Commit 7b1b3f2

Browse files
committed
v5
1 parent b2f66ab commit 7b1b3f2

File tree

12 files changed

+55
-8
lines changed

12 files changed

+55
-8
lines changed

.vscode-test.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export default defineConfig([
4848
{
4949
label: 'integrationTests',
5050
files: 'out/test/integration/**/*.integration.test.js',
51+
workspaceFolder: 'src/test/integration/test-workspace/integration-tests.code-workspace',
5152
mocha: {
5253
ui: 'tdd',
5354
timeout: 60000,

.vscode/settings.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,8 @@
2929
"python-envs.pythonProjects": [],
3030
"git.branchRandomName.enable": true,
3131
"git.branchProtection": ["main"],
32-
"git.branchProtectionPrompt": "alwaysCommitToNewBranch"
32+
"git.branchProtectionPrompt": "alwaysCommitToNewBranch",
33+
"chat.tools.terminal.autoApprove": {
34+
"npx tsc": true
35+
}
3336
}

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,14 @@ suite('Integration: Interpreter Selection Priority', function () {
255255
// Set environment first time
256256
await api.setEnvironment(undefined, env);
257257

258+
// Wait for any async config changes to settle before testing idempotency
259+
await new Promise((resolve) => setTimeout(resolve, 500));
260+
261+
// Verify the environment was actually set
262+
const currentEnv = await api.getEnvironment(undefined);
263+
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');
265+
258266
const handler = new TestEventHandler<DidChangeEnvironmentEventArgs>(
259267
api.onDidChangeEnvironment,
260268
'onDidChangeEnvironment',
@@ -284,7 +292,7 @@ suite('Integration: Interpreter Selection Priority', function () {
284292
}
285293
} else {
286294
// No event fired - this is the ideal idempotent behavior
287-
console.log('No event fired for same env selection (idempotent behavior)');
295+
assert.ok(!handler.fired, 'No event should fire when setting same environment');
288296
}
289297
} finally {
290298
handler.dispose();
@@ -353,7 +361,7 @@ suite('Integration: Interpreter Selection Priority', function () {
353361
// but the explicit selection should be cleared
354362
} else {
355363
// Undefined is a valid result - no auto-discovery available
356-
console.log('Selection cleared, no auto-discovery fallback');
364+
assert.strictEqual(autoEnv, undefined, 'Cleared selection with no auto-discovery should return undefined');
357365
}
358366
});
359367
});

src/test/integration/packageManagement.integration.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ suite('Integration: Package Management', function () {
8484

8585
// May be undefined if package manager not available
8686
if (packages === undefined) {
87-
console.log('Package manager not available for:', targetEnv.displayName);
87+
this.skip();
8888
return;
8989
}
9090

@@ -224,7 +224,7 @@ suite('Integration: Package Management', function () {
224224

225225
// Both should return valid results (or undefined for same reason)
226226
if (packages1 === undefined || packages2 === undefined) {
227-
console.log('Package manager not available for one or both environments');
227+
this.skip();
228228
return;
229229
}
230230

src/test/integration/pythonProjects.integration.test.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,10 +254,13 @@ suite('Integration: Python Projects', function () {
254254
if (afterClear) {
255255
assert.ok(afterClear.envId, 'If environment returned, it must have valid envId');
256256
assert.ok(afterClear.envId.id, 'If environment returned, envId must have id');
257+
} else {
258+
assert.strictEqual(
259+
afterClear,
260+
undefined,
261+
'Cleared association should return undefined when no auto-discovery',
262+
);
257263
}
258-
// If undefined, that's also valid - explicit selection was cleared
259-
260-
console.log('After clearing:', afterClear?.displayName ?? 'undefined (no auto-discovery)');
261264
});
262265

263266
/**

src/test/integration/test-workspace/.gitkeep

Whitespace-only changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"python-envs.defaultEnvManager": "ms-python.python:system"
3+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"folders": [
3+
{
4+
"path": "project-a",
5+
},
6+
{
7+
"path": "project-b",
8+
},
9+
],
10+
"settings": {},
11+
}

src/test/integration/test-workspace/project-a/.gitkeep

Whitespace-only changes.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"python-envs.pythonProjects": [
3+
{
4+
"path": ".",
5+
"envManager": "ms-python.python:system",
6+
"packageManager": "ms-python.python:pip"
7+
}
8+
]
9+
}

0 commit comments

Comments
 (0)