From 26b330c44aeb024940a95be1879167957345fbf6 Mon Sep 17 00:00:00 2001 From: Kartik Raj Date: Mon, 4 Apr 2022 14:36:03 -0700 Subject: [PATCH 1/3] If a conda environment is not returned via the conda env list command, resolve it as unknown --- .../base/locators/composite/resolverUtils.ts | 1 + .../base/locators/composite/resolverUtils.unit.test.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) 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'), From 96c0760fc5fbf1f80309b50eed745d6d8d3f62f9 Mon Sep 17 00:00:00 2001 From: Kartik Raj Date: Mon, 4 Apr 2022 14:36:58 -0700 Subject: [PATCH 2/3] News entry --- news/2 Fixes/18530.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/2 Fixes/18530.md 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. From 6a24a3ca418063389bf3a408ff2b2d1e13e9c12b Mon Sep 17 00:00:00 2001 From: Kartik Raj Date: Mon, 4 Apr 2022 14:45:02 -0700 Subject: [PATCH 3/3] Fix unit tests --- .../base/locators/composite/resolverUtils.unit.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/pythonEnvironments/base/locators/composite/resolverUtils.unit.test.ts b/src/test/pythonEnvironments/base/locators/composite/resolverUtils.unit.test.ts index 62367c654ada..e1ff24802746 100644 --- a/src/test/pythonEnvironments/base/locators/composite/resolverUtils.unit.test.ts +++ b/src/test/pythonEnvironments/base/locators/composite/resolverUtils.unit.test.ts @@ -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'),