Skip to content

Commit 2f0b4c4

Browse files
committed
Fix pixi unit test
1 parent ed1b43d commit 2f0b4c4

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/test/pythonEnvironments/common/environmentManagers/pixi.unit.test.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,12 @@ export function makeExecHandler(verify: VerifyOptions = {}) {
105105
suite('Pixi binary is located correctly', async () => {
106106
let exec: sinon.SinonStub;
107107
let getPythonSetting: sinon.SinonStub;
108+
let pathExists: sinon.SinonStub;
108109

109110
setup(() => {
110111
getPythonSetting = sinon.stub(externalDependencies, 'getPythonSetting');
111112
exec = sinon.stub(externalDependencies, 'exec');
113+
pathExists = sinon.stub(externalDependencies, 'pathExists');
112114
});
113115

114116
teardown(() => {
@@ -117,10 +119,16 @@ suite('Pixi binary is located correctly', async () => {
117119

118120
const testPath = async (pixiPath: string, verify = true) => {
119121
getPythonSetting.returns(pixiPath);
122+
pathExists.returns(pixiPath !== 'pixi');
120123
// If `verify` is false, don’t verify that the command has been called with that path
121124
exec.callsFake(makeExecHandler(verify ? { pixiPath } : undefined));
122125
const pixi = await getPixi();
123-
expect(pixi?.command).to.equal(pixiPath);
126+
127+
if (pixiPath === 'pixi') {
128+
expect(pixi).to.equal(undefined);
129+
} else {
130+
expect(pixi?.command).to.equal(pixiPath);
131+
}
124132
};
125133

126134
test('Return a Pixi instance in an empty directory', () => testPath('pixiPath', false));

0 commit comments

Comments
 (0)