Skip to content

Commit 50c5856

Browse files
Copilotedvilme
andauthored
fix: use cross-platform path computation in multi-root test assertions
Agent-Logs-Url: https://github.com/microsoft/vscode-python-environments/sessions/dc6f6330-b142-4812-ad6e-de7204f2bb93 Co-authored-by: edvilme <5952839+edvilme@users.noreply.github.com>
1 parent 7c5897c commit 50c5856

1 file changed

Lines changed: 10 additions & 12 deletions

File tree

src/test/managers/common/nativePythonFinder.getAllExtraSearchPaths.unit.test.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import assert from 'node:assert';
2+
import * as path from 'node:path';
23
import * as sinon from 'sinon';
34
import { Uri } from 'vscode';
45
import * as logging from '../../../common/logging';
@@ -587,23 +588,20 @@ suite('getAllExtraSearchPaths Integration Tests', () => {
587588
const result = await getAllExtraSearchPaths();
588589

589590
// Assert - relative paths resolved only against their own folder
591+
const expected1 = path.resolve(workspace1.fsPath, 'envs').replace(/\\/g, '/');
592+
const expected2 = path.resolve(workspace2.fsPath, 'venvs').replace(/\\/g, '/');
593+
const wrong1In2 = path.resolve(workspace2.fsPath, 'envs').replace(/\\/g, '/');
594+
const wrong2In1 = path.resolve(workspace1.fsPath, 'venvs').replace(/\\/g, '/');
595+
590596
assert.strictEqual(result.length, 2, 'Should have exactly 2 paths (one per folder)');
597+
assert.ok(result.includes(expected1), 'project1/envs should come from project1 config');
598+
assert.ok(result.includes(expected2), 'project2/venvs should come from project2 config');
591599
assert.ok(
592-
result.some((p) => p.includes('project1') && p.endsWith('/envs')),
593-
'project1/envs should come from project1 config',
594-
);
595-
assert.ok(
596-
result.some((p) => p.includes('project2') && p.endsWith('/venvs')),
597-
'project2/venvs should come from project2 config',
598-
);
599-
// project1 relative path must NOT be resolved against project2
600-
assert.ok(
601-
!result.some((p) => p.includes('project2') && p.endsWith('/envs')),
600+
!result.includes(wrong1In2),
602601
'project1 relative path should not be resolved against project2',
603602
);
604-
// project2 relative path must NOT be resolved against project1
605603
assert.ok(
606-
!result.some((p) => p.includes('project1') && p.endsWith('/venvs')),
604+
!result.includes(wrong2In1),
607605
'project2 relative path should not be resolved against project1',
608606
);
609607
});

0 commit comments

Comments
 (0)