Skip to content

Commit 84e3309

Browse files
committed
Ensure escape on TOML and requirements is treated as cancel.
1 parent fc72be9 commit 84e3309

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/client/pythonEnvironments/creation/provider/venvUtils.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ export async function pickPackagesToInstall(
151151
});
152152
}
153153
packages.push({ installType: 'toml', source: tomlPath });
154+
} else {
155+
return MultiStepAction.Cancel;
154156
}
155157
} catch (ex) {
156158
if (ex === MultiStepAction.Back || ex === MultiStepAction.Cancel) {
@@ -192,6 +194,8 @@ export async function pickPackagesToInstall(
192194
installList.forEach((i) => {
193195
packages.push({ installType: 'requirements', installItem: i });
194196
});
197+
} else {
198+
return MultiStepAction.Cancel;
195199
}
196200
} catch (ex) {
197201
if (ex === MultiStepAction.Back || ex === MultiStepAction.Cancel) {

src/test/pythonEnvironments/creation/provider/venvUtils.unit.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ suite('Venv Utils test', () => {
8080
'[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"]',
8181
);
8282

83-
showQuickPickWithBackStub.rejects(windowApis.MultiStepAction.Cancel);
83+
showQuickPickWithBackStub.resolves(undefined);
8484

8585
await assert.isRejected(pickPackagesToInstall(workspace1));
8686
assert.isTrue(
@@ -215,7 +215,7 @@ suite('Venv Utils test', () => {
215215
return Promise.resolve([]);
216216
});
217217

218-
showQuickPickWithBackStub.rejects(windowApis.MultiStepAction.Cancel);
218+
showQuickPickWithBackStub.resolves(undefined);
219219

220220
await assert.isRejected(pickPackagesToInstall(workspace1));
221221
assert.isTrue(

0 commit comments

Comments
 (0)