diff --git a/src/client/pythonEnvironments/creation/provider/condaCreationProvider.ts b/src/client/pythonEnvironments/creation/provider/condaCreationProvider.ts index 28046cbc73ad..5bf032f9f65f 100644 --- a/src/client/pythonEnvironments/creation/provider/condaCreationProvider.ts +++ b/src/client/pythonEnvironments/creation/provider/condaCreationProvider.ts @@ -192,6 +192,10 @@ async function createEnvironment(options?: CreateEnvironmentOptions): Promise { packages.push({ installType: 'requirements', installItem: i }); }); + } else { + return MultiStepAction.Cancel; } } catch (ex) { if (ex === MultiStepAction.Back || ex === MultiStepAction.Cancel) { diff --git a/src/test/pythonEnvironments/creation/provider/condaCreationProvider.unit.test.ts b/src/test/pythonEnvironments/creation/provider/condaCreationProvider.unit.test.ts index f5267aa634cb..db5eb351211e 100644 --- a/src/test/pythonEnvironments/creation/provider/condaCreationProvider.unit.test.ts +++ b/src/test/pythonEnvironments/creation/provider/condaCreationProvider.unit.test.ts @@ -76,7 +76,7 @@ suite('Conda Creation provider tests', () => { }); pickPythonVersionStub.resolves(undefined); - assert.isUndefined(await condaProvider.createEnvironment()); + await assert.isRejected(condaProvider.createEnvironment()); }); test('Create conda environment', async () => { diff --git a/src/test/pythonEnvironments/creation/provider/venvUtils.unit.test.ts b/src/test/pythonEnvironments/creation/provider/venvUtils.unit.test.ts index a0d030853717..360bb43fad4b 100644 --- a/src/test/pythonEnvironments/creation/provider/venvUtils.unit.test.ts +++ b/src/test/pythonEnvironments/creation/provider/venvUtils.unit.test.ts @@ -80,7 +80,7 @@ suite('Venv Utils test', () => { '[project]\nname = "spam"\nversion = "2020.0.0"\n[build-system]\nrequires = ["setuptools ~= 58.0", "cython ~= 0.29.0"]\n[project.optional-dependencies]\ntest = ["pytest"]\ndoc = ["sphinx", "furo"]', ); - showQuickPickWithBackStub.rejects(windowApis.MultiStepAction.Cancel); + showQuickPickWithBackStub.resolves(undefined); await assert.isRejected(pickPackagesToInstall(workspace1)); assert.isTrue( @@ -215,7 +215,7 @@ suite('Venv Utils test', () => { return Promise.resolve([]); }); - showQuickPickWithBackStub.rejects(windowApis.MultiStepAction.Cancel); + showQuickPickWithBackStub.resolves(undefined); await assert.isRejected(pickPackagesToInstall(workspace1)); assert.isTrue(