Skip to content

Commit 9382c2f

Browse files
committed
Fix pixi locator tests
1 parent 1091ad0 commit 9382c2f

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

src/test/pythonEnvironments/base/locators/lowLevel/pixiLocator.unit.test.ts

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,15 @@ suite('Pixi Locator', () => {
1717
let getPythonSetting: sinon.SinonStub;
1818
let getOSType: sinon.SinonStub;
1919
let locator: PixiLocator;
20+
let pathExistsStub: sinon.SinonStub;
2021

2122
suiteSetup(() => {
2223
getPythonSetting = sinon.stub(externalDependencies, 'getPythonSetting');
2324
getPythonSetting.returns('pixi');
2425
getOSType = sinon.stub(platformUtils, 'getOSType');
2526
exec = sinon.stub(externalDependencies, 'exec');
27+
pathExistsStub = sinon.stub(externalDependencies, 'pathExists');
28+
pathExistsStub.resolves(true);
2629
});
2730

2831
suiteTeardown(() => sinon.restore());
@@ -38,7 +41,7 @@ suite('Pixi Locator', () => {
3841
getOSType.returns(osType);
3942

4043
locator = new PixiLocator(projectDir);
41-
exec.callsFake(makeExecHandler({ pixiPath: 'pixi', cwd: projectDir }));
44+
exec.callsFake(makeExecHandler({ cwd: projectDir }));
4245

4346
const iterator = locator.iterEnvs();
4447
const actualEnvs = await getEnvs(iterator);
@@ -66,26 +69,15 @@ suite('Pixi Locator', () => {
6669
test('project with multiple environments', async () => {
6770
getOSType.returns(platformUtils.OSType.Linux);
6871

69-
exec.callsFake(makeExecHandler({ pixiPath: 'pixi', cwd: projectDirs.multiEnv.path }));
72+
exec.callsFake(makeExecHandler({ cwd: projectDirs.multiEnv.path }));
7073

7174
locator = new PixiLocator(projectDirs.multiEnv.path);
7275
const iterator = locator.iterEnvs();
7376
const actualEnvs = await getEnvs(iterator);
7477

75-
const expectedEnvs = [
76-
createBasicEnv(
77-
PythonEnvKind.Pixi,
78-
path.join(projectDirs.multiEnv.info.environments_info[1].prefix, 'bin/python'),
79-
undefined,
80-
projectDirs.multiEnv.info.environments_info[1].prefix,
81-
),
82-
createBasicEnv(
83-
PythonEnvKind.Pixi,
84-
path.join(projectDirs.multiEnv.info.environments_info[2].prefix, 'bin/python'),
85-
undefined,
86-
projectDirs.multiEnv.info.environments_info[2].prefix,
87-
),
88-
];
78+
const expectedEnvs = projectDirs.multiEnv.info.environments_info.map((info) =>
79+
createBasicEnv(PythonEnvKind.Pixi, path.join(info.prefix, 'bin/python'), undefined, info.prefix),
80+
);
8981
assertBasicEnvsEqual(actualEnvs, expectedEnvs);
9082
});
9183
});

0 commit comments

Comments
 (0)