diff --git a/news/2 Fixes/18530.md b/news/2 Fixes/18530.md new file mode 100644 index 000000000000..306c991183ca --- /dev/null +++ b/news/2 Fixes/18530.md @@ -0,0 +1 @@ +If a conda environment is not returned via the `conda env list` command, consider it as unknown env type. diff --git a/src/client/pythonEnvironments/base/locators/composite/resolverUtils.ts b/src/client/pythonEnvironments/base/locators/composite/resolverUtils.ts index bc04869cc19c..abc08c0a7833 100644 --- a/src/client/pythonEnvironments/base/locators/composite/resolverUtils.ts +++ b/src/client/pythonEnvironments/base/locators/composite/resolverUtils.ts @@ -173,6 +173,7 @@ async function resolveCondaEnv(env: BasicEnvInfo, useCache?: boolean): Promise
{ ); }); - test('resolveEnv: If no conda binary found, resolve as a simple environment', async () => { + test('resolveEnv: If no conda binary found, resolve as an unknown environment', async () => { sinon.stub(platformApis, 'getOSType').callsFake(() => platformApis.OSType.Windows); sinon.stub(externalDependencies, 'shellExecute').callsFake(async (command: string) => { throw new Error(`${command} is missing or is not executable`); @@ -293,7 +293,7 @@ suite('Resolver Utils', () => { actual, createSimpleEnvInfo( path.join(TEST_LAYOUT_ROOT, 'conda1', 'python.exe'), - PythonEnvKind.Conda, + PythonEnvKind.Unknown, undefined, 'conda1', path.join(TEST_LAYOUT_ROOT, 'conda1'), @@ -616,8 +616,8 @@ suite('Resolver Utils', () => { }); const expected = buildEnvInfo({ location: path.join(regTestRoot, 'conda3'), - // Environment should already be marked as Conda. No need to update it to Global. - kind: PythonEnvKind.Conda, + // Environment is not marked as Conda, update it to Global. + kind: PythonEnvKind.OtherGlobal, executable: interpreterPath, // Registry does not provide the minor version, so keep version provided by Conda resolver instead. version: parseVersion('3.8.5'),