Skip to content

Commit b0746af

Browse files
authored
Fallback to conda if we don't find conda in env (#18724)
* Fallback to conda if we don't find conda in env * Fix tests
1 parent 787fa5a commit b0746af

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

src/client/pythonEnvironments/common/environmentManagers/condaService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export class CondaService implements ICondaService {
110110
return condaPath2;
111111
}
112112

113-
return undefined;
113+
return this.getCondaFile();
114114
}
115115

116116
/**

src/test/pythonEnvironments/discovery/locators/condaService.unit.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import * as assert from 'assert';
22
import * as path from 'path';
33
import * as TypeMoq from 'typemoq';
4+
import * as sinon from 'sinon';
45
import { IWorkspaceService } from '../../../../client/common/application/types';
56
import { FileSystemPaths, FileSystemPathUtils } from '../../../../client/common/platform/fs-paths';
67
import { IFileSystem, IPlatformService } from '../../../../client/common/platform/types';
78
import { CondaService } from '../../../../client/pythonEnvironments/common/environmentManagers/condaService';
9+
import { Conda } from '../../../../client/pythonEnvironments/common/environmentManagers/conda';
810

911
suite('Interpreters Conda Service', () => {
1012
let platformService: TypeMoq.IMock<IPlatformService>;
@@ -26,7 +28,9 @@ suite('Interpreters Conda Service', () => {
2628
});
2729

2830
condaService = new CondaService(platformService.object, fileSystem.object, [], workspaceService.object);
31+
sinon.stub(Conda, 'getConda').callsFake(() => Promise.resolve(undefined));
2932
});
33+
teardown(() => sinon.restore());
3034

3135
type InterpreterSearchTestParams = {
3236
pythonPath: string;
@@ -106,7 +110,7 @@ suite('Interpreters Conda Service', () => {
106110
if (t.expectedCondaPath.includes(t.environmentName)) {
107111
assert.strictEqual(condaFile, t.expectedCondaPath);
108112
} else {
109-
assert.strictEqual(condaFile, undefined);
113+
assert.strictEqual(condaFile, 'conda');
110114
}
111115
});
112116
});

0 commit comments

Comments
 (0)