Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news/2 Fixes/18530.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
If a conda environment is not returned via the `conda env list` command, consider it as unknown env type.
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ async function resolveCondaEnv(env: BasicEnvInfo, useCache?: boolean): Promise<P
} info' command`,
);
// Environment could still be valid, resolve as a simple env.
env.kind = PythonEnvKind.Unknown;
return resolveSimpleEnv(env);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ suite('Resolver Utils', () => {
);
});

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`);
Expand All @@ -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'),
Expand Down Expand Up @@ -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'),
Expand Down