Skip to content

Commit 2ec51f2

Browse files
committed
oops
1 parent e8f2f66 commit 2ec51f2

File tree

4 files changed

+30
-38
lines changed

4 files changed

+30
-38
lines changed

src/test/datascience/widgets/commUtils.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@
44
import { NotebookCell, NotebookEditor, NotebookRendererMessaging, notebooks } from 'vscode';
55
import { disposeAllDisposables } from '../../../platform/common/helpers';
66
import { traceInfo, traceInfoIfCI } from '../../../platform/logging';
7-
import { IDisposable, IDisposableRegistry } from '../../../platform/common/types';
7+
import { IDisposable } from '../../../platform/common/types';
88
import { createDeferred } from '../../../platform/common/utils/async';
9-
import { IServiceContainer } from '../../../platform/ioc/types';
109
import { noop } from '../../core';
1110
import { IPyWidgetRendererId } from '../../../platform/common/constants';
1211
import * as colors from 'colors';
1312

14-
export function initializeWidgetComms(serviceContainer: IServiceContainer): Utils {
15-
const disposables = serviceContainer.get<IDisposableRegistry>(IDisposableRegistry);
13+
export function initializeWidgetComms(disposables: IDisposable[]): Utils {
1614
const messageChannel = notebooks.createRendererMessaging(IPyWidgetRendererId);
1715
if (!messageChannel) {
1816
throw new Error('No Widget renderer comms channel');

src/test/datascience/widgets/rendererUtils.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,6 @@ function initializeComms() {
4444
return;
4545
}
4646
rendererContext.onDidReceiveMessage((message) => {
47-
rendererContext.postMessage!({
48-
command: 'log',
49-
message: `Received message in Widget renderer ${JSON.stringify(message)}`
50-
});
51-
5247
if (!message || !message.command) {
5348
return;
5449
}

src/test/datascience/widgets/standardWidgets.vscode.common.test.ts

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ const templateRootPath: Uri =
3636
? urlPath.joinPath(workspace.workspaceFolders[0].uri, 'widgets', 'notebooks')
3737
: Uri.file('');
3838
export async function initializeNotebookForWidgetTest(
39-
api: IExtensionTestApi,
4039
disposables: IDisposable[],
4140
options: { templateFile: string } | { notebookFile: Uri }
4241
) {
@@ -55,7 +54,7 @@ export async function initializeNotebookForWidgetTest(
5554
await commands.executeCommand('workbench.action.closePanel');
5655
await commands.executeCommand('workbench.action.maximizeEditor');
5756
await commands.executeCommand('notebook.cell.collapseAllCellInputs');
58-
return initializeWidgetComms(api.serviceContainer);
57+
return initializeWidgetComms(disposables);
5958
}
6059
export async function executeCellAndWaitForOutput(cell: NotebookCell, comms: Utils) {
6160
await Promise.all([
@@ -136,21 +135,21 @@ suite('Standard IPyWidget Tests', function () {
136135
});
137136
suiteTeardown(async () => closeNotebooksAndCleanUpAfterTests(disposables));
138137
test('Slider Widget', async function () {
139-
const comms = await initializeNotebookForWidgetTest(api, disposables, { templateFile: 'slider_widgets.ipynb' });
138+
const comms = await initializeNotebookForWidgetTest(disposables, { templateFile: 'slider_widgets.ipynb' });
140139
const cell = vscodeNotebook.activeNotebookEditor?.notebook.cellAt(0)!;
141140
await executeCellAndWaitForOutput(cell, comms);
142141
await assertOutputContainsHtml(cell, comms, ['6519'], '.widget-readout');
143142
});
144143
test('Textbox Widget', async () => {
145-
const comms = await initializeNotebookForWidgetTest(api, disposables, {
144+
const comms = await initializeNotebookForWidgetTest(disposables, {
146145
templateFile: 'standard_widgets.ipynb'
147146
});
148147
const cell = vscodeNotebook.activeNotebookEditor?.notebook.cellAt(1)!;
149148
await executeCellAndWaitForOutput(cell, comms);
150149
await assertOutputContainsHtml(cell, comms, ['<input type="text', 'Enter your name:'], '.widget-text');
151150
});
152151
test('Linking Widgets slider to textbox widget', async function () {
153-
const comms = await initializeNotebookForWidgetTest(api, disposables, { templateFile: 'slider_widgets.ipynb' });
152+
const comms = await initializeNotebookForWidgetTest(disposables, { templateFile: 'slider_widgets.ipynb' });
154153
const [, cell1, cell2, cell3] = vscodeNotebook.activeNotebookEditor!.notebook.getCells()!;
155154
await executeCellAndDontWaitForOutput(cell1);
156155
await executeCellAndWaitForOutput(cell2, comms);
@@ -165,15 +164,15 @@ suite('Standard IPyWidget Tests', function () {
165164
await assertOutputContainsHtml(cell2, comms, ['60'], '.widget-readout');
166165
});
167166
test('Checkbox Widget', async () => {
168-
const comms = await initializeNotebookForWidgetTest(api, disposables, {
167+
const comms = await initializeNotebookForWidgetTest(disposables, {
169168
templateFile: 'standard_widgets.ipynb'
170169
});
171170
const cell = vscodeNotebook.activeNotebookEditor?.notebook.cellAt(2)!;
172171
await executeCellAndWaitForOutput(cell, comms);
173172
await assertOutputContainsHtml(cell, comms, ['Check me', '<input type="checkbox'], '.widget-checkbox');
174173
});
175174
test('Button Widget (click button)', async () => {
176-
const comms = await initializeNotebookForWidgetTest(api, disposables, { templateFile: 'button_widgets.ipynb' });
175+
const comms = await initializeNotebookForWidgetTest(disposables, { templateFile: 'button_widgets.ipynb' });
177176
const [cell0, cell1, cell2] = vscodeNotebook.activeNotebookEditor!.notebook.getCells();
178177

179178
await executeCellAndWaitForOutput(cell0, comms);
@@ -189,7 +188,7 @@ suite('Standard IPyWidget Tests', function () {
189188
await assertOutputContainsHtml(cell2, comms, ['Button clicked']);
190189
});
191190
test('Button Widget (click button in output of another cell)', async () => {
192-
const comms = await initializeNotebookForWidgetTest(api, disposables, { templateFile: 'button_widgets.ipynb' });
191+
const comms = await initializeNotebookForWidgetTest(disposables, { templateFile: 'button_widgets.ipynb' });
193192
const [cell0, cell1, cell2] = vscodeNotebook.activeNotebookEditor!.notebook.getCells();
194193

195194
await executeCellAndWaitForOutput(cell0, comms);
@@ -205,7 +204,7 @@ suite('Standard IPyWidget Tests', function () {
205204
await assertOutputContainsHtml(cell2, comms, ['Button clicked']);
206205
});
207206
test('Button Widget with custom comm message', async () => {
208-
const comms = await initializeNotebookForWidgetTest(api, disposables, {
207+
const comms = await initializeNotebookForWidgetTest(disposables, {
209208
templateFile: 'button_widget_comm_msg.ipynb'
210209
});
211210
const [cell0, cell1] = vscodeNotebook.activeNotebookEditor!.notebook.getCells();
@@ -220,7 +219,7 @@ suite('Standard IPyWidget Tests', function () {
220219
});
221220
test.skip('Widget renders after executing a notebook which was saved after previous execution', async () => {
222221
// https://github.com/microsoft/vscode-jupyter/issues/8748
223-
let comms = await initializeNotebookForWidgetTest(api, disposables, { templateFile: 'standard_widgets.ipynb' });
222+
let comms = await initializeNotebookForWidgetTest(disposables, { templateFile: 'standard_widgets.ipynb' });
224223
const cell = vscodeNotebook.activeNotebookEditor?.notebook.cellAt(0)!;
225224
await executeCellAndWaitForOutput(cell, comms);
226225
await assertOutputContainsHtml(cell, comms, ['66'], '.widget-readout');
@@ -231,7 +230,7 @@ suite('Standard IPyWidget Tests', function () {
231230
await closeActiveWindows();
232231

233232
// Open this notebook again.
234-
comms = await initializeNotebookForWidgetTest(api, disposables, { notebookFile: uri });
233+
comms = await initializeNotebookForWidgetTest(disposables, { notebookFile: uri });
235234

236235
// Verify we have output in the first cell.
237236
assert.isOk(cell.outputs.length, 'No outputs in the cell after saving nb');
@@ -240,7 +239,7 @@ suite('Standard IPyWidget Tests', function () {
240239
await assertOutputContainsHtml(cell, comms, ['66'], '.widget-readout');
241240
});
242241
test.skip('Widget renders after restarting kernel', async () => {
243-
const comms = await initializeNotebookForWidgetTest(api, disposables, {
242+
const comms = await initializeNotebookForWidgetTest(disposables, {
244243
templateFile: 'standard_widgets.ipynb'
245244
});
246245
const cell = vscodeNotebook.activeNotebookEditor?.notebook.cellAt(0)!;
@@ -263,7 +262,7 @@ suite('Standard IPyWidget Tests', function () {
263262
});
264263
test.skip('Widget renders after interrupting kernel', async () => {
265264
// https://github.com/microsoft/vscode-jupyter/issues/8749
266-
const comms = await initializeNotebookForWidgetTest(api, disposables, {
265+
const comms = await initializeNotebookForWidgetTest(disposables, {
267266
templateFile: 'standard_widgets.ipynb'
268267
});
269268
const cell = vscodeNotebook.activeNotebookEditor?.notebook.cellAt(0)!;
@@ -285,7 +284,7 @@ suite('Standard IPyWidget Tests', function () {
285284
await assertOutputContainsHtml(cell, comms, ['66'], '.widget-readout');
286285
});
287286
test('Nested Output Widgets', async () => {
288-
const comms = await initializeNotebookForWidgetTest(api, disposables, {
287+
const comms = await initializeNotebookForWidgetTest(disposables, {
289288
templateFile: 'nested_output_widget.ipynb'
290289
});
291290
const [cell1, cell2, cell3, cell4] = vscodeNotebook.activeNotebookEditor!.notebook.getCells();
@@ -313,7 +312,7 @@ suite('Standard IPyWidget Tests', function () {
313312
assert.strictEqual(cell3.outputs.length, 0, 'Cell 3 should not have any output');
314313
});
315314
test('More Nested Output Widgets', async () => {
316-
const comms = await initializeNotebookForWidgetTest(api, disposables, {
315+
const comms = await initializeNotebookForWidgetTest(disposables, {
317316
templateFile: 'nested_output_widget2.ipynb'
318317
});
319318
const [cell1, cell2, cell3, cell4, cell5, cell6] = vscodeNotebook.activeNotebookEditor!.notebook.getCells();
@@ -443,7 +442,7 @@ suite('Standard IPyWidget Tests', function () {
443442
);
444443
});
445444
test('Interactive Button', async () => {
446-
const comms = await initializeNotebookForWidgetTest(api, disposables, {
445+
const comms = await initializeNotebookForWidgetTest(disposables, {
447446
templateFile: 'interactive_button.ipynb'
448447
});
449448
const cell = vscodeNotebook.activeNotebookEditor!.notebook.cellAt(0);
@@ -463,7 +462,7 @@ suite('Standard IPyWidget Tests', function () {
463462
);
464463
});
465464
test('Interactive Function', async () => {
466-
const comms = await initializeNotebookForWidgetTest(api, disposables, {
465+
const comms = await initializeNotebookForWidgetTest(disposables, {
467466
templateFile: 'interactive_function.ipynb'
468467
});
469468
const cell = vscodeNotebook.activeNotebookEditor!.notebook.cellAt(0);
@@ -489,7 +488,7 @@ suite('Standard IPyWidget Tests', function () {
489488
assert.strictEqual(getTextOutputValue(cell.outputs[2]).trim(), `'Hello World'`);
490489
});
491490
test('Interactive Plot', async () => {
492-
const comms = await initializeNotebookForWidgetTest(api, disposables, {
491+
const comms = await initializeNotebookForWidgetTest(disposables, {
493492
templateFile: 'interactive_plot.ipynb'
494493
});
495494
const cell = vscodeNotebook.activeNotebookEditor!.notebook.cellAt(0);

src/test/datascience/widgets/thirdpartyWidgets.vscode.common.test.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ import { GlobalStateKeyToTrackIfUserConfiguredCDNAtLeastOnce } from '../../../ke
8888
suiteTeardown(async () => closeNotebooksAndCleanUpAfterTests(disposables));
8989

9090
test('Button Widget with custom comm message rendering a matplotlib widget', async () => {
91-
const comms = await initializeNotebookForWidgetTest(api, disposables, {
91+
const comms = await initializeNotebookForWidgetTest(disposables, {
9292
templateFile: 'button_widget_comm_msg_matplotlib.ipynb'
9393
});
9494
const [cell0, cell1] = vscodeNotebook.activeNotebookEditor!.notebook.getCells();
@@ -106,7 +106,7 @@ import { GlobalStateKeyToTrackIfUserConfiguredCDNAtLeastOnce } from '../../../ke
106106
// https://github.com/microsoft/vscode-jupyter/issues/10506
107107
return this.skip();
108108
}
109-
const comms = await initializeNotebookForWidgetTest(api, disposables, {
109+
const comms = await initializeNotebookForWidgetTest(disposables, {
110110
templateFile: 'ipySheet_widgets.ipynb'
111111
});
112112
const [, cell1] = vscodeNotebook.activeNotebookEditor!.notebook.getCells();
@@ -119,7 +119,7 @@ import { GlobalStateKeyToTrackIfUserConfiguredCDNAtLeastOnce } from '../../../ke
119119
// https://github.com/microsoft/vscode-jupyter/issues/10506
120120
return this.skip();
121121
}
122-
const comms = await initializeNotebookForWidgetTest(api, disposables, {
122+
const comms = await initializeNotebookForWidgetTest(disposables, {
123123
templateFile: 'ipySheet_widgets_search.ipynb'
124124
});
125125
const [, cell1, cell2] = vscodeNotebook.activeNotebookEditor!.notebook.getCells();
@@ -138,7 +138,7 @@ import { GlobalStateKeyToTrackIfUserConfiguredCDNAtLeastOnce } from '../../../ke
138138
// https://github.com/microsoft/vscode-jupyter/issues/10506
139139
return this.skip();
140140
}
141-
const comms = await initializeNotebookForWidgetTest(api, disposables, {
141+
const comms = await initializeNotebookForWidgetTest(disposables, {
142142
templateFile: 'ipySheet_widgets_slider.ipynb'
143143
});
144144
const [, cell1, cell2, cell3] = vscodeNotebook.activeNotebookEditor!.notebook.getCells();
@@ -155,7 +155,7 @@ import { GlobalStateKeyToTrackIfUserConfiguredCDNAtLeastOnce } from '../../../ke
155155
await assertOutputContainsHtml(cell3, comms, ['>5255<', '>5378.0']);
156156
});
157157
test('Render ipyvolume (slider, color picker, figure)', async function () {
158-
const comms = await initializeNotebookForWidgetTest(api, disposables, {
158+
const comms = await initializeNotebookForWidgetTest(disposables, {
159159
templateFile: 'ipyvolume_widgets.ipynb'
160160
});
161161
const cell = vscodeNotebook.activeNotebookEditor!.notebook.cellAt(1);
@@ -175,7 +175,7 @@ import { GlobalStateKeyToTrackIfUserConfiguredCDNAtLeastOnce } from '../../../ke
175175
await assertOutputContainsHtml(cell, comms, ['<input type="color"', '>Slider1<', '>Slider2<', '<canvas']);
176176
});
177177
test('Render pythreejs', async function () {
178-
const comms = await initializeNotebookForWidgetTest(api, disposables, {
178+
const comms = await initializeNotebookForWidgetTest(disposables, {
179179
templateFile: 'pythreejs_widgets.ipynb'
180180
});
181181
const cell = vscodeNotebook.activeNotebookEditor!.notebook.cellAt(1);
@@ -184,7 +184,7 @@ import { GlobalStateKeyToTrackIfUserConfiguredCDNAtLeastOnce } from '../../../ke
184184
await assertOutputContainsHtml(cell, comms, ['<canvas']);
185185
});
186186
test('Render pythreejs, 2', async function () {
187-
const comms = await initializeNotebookForWidgetTest(api, disposables, {
187+
const comms = await initializeNotebookForWidgetTest(disposables, {
188188
templateFile: 'pythreejs_widgets2.ipynb'
189189
});
190190
const cell = vscodeNotebook.activeNotebookEditor!.notebook.cellAt(1);
@@ -193,7 +193,7 @@ import { GlobalStateKeyToTrackIfUserConfiguredCDNAtLeastOnce } from '../../../ke
193193
await assertOutputContainsHtml(cell, comms, ['<canvas']);
194194
});
195195
test('Render matplotlib, interactive inline', async function () {
196-
const comms = await initializeNotebookForWidgetTest(api, disposables, {
196+
const comms = await initializeNotebookForWidgetTest(disposables, {
197197
templateFile: 'matplotlib_widgets_interactive.ipynb'
198198
});
199199
const cell = vscodeNotebook.activeNotebookEditor!.notebook.cellAt(1);
@@ -202,7 +202,7 @@ import { GlobalStateKeyToTrackIfUserConfiguredCDNAtLeastOnce } from '../../../ke
202202
await assertOutputContainsHtml(cell, comms, ['>m<', '>b<', '<img src="data:image']);
203203
});
204204
test('Render matplotlib, non-interactive inline', async function () {
205-
await initializeNotebookForWidgetTest(api, disposables, {
205+
await initializeNotebookForWidgetTest(disposables, {
206206
templateFile: 'matplotlib_widgets_inline.ipynb'
207207
});
208208
const cell = vscodeNotebook.activeNotebookEditor!.notebook.cellAt(2);
@@ -217,7 +217,7 @@ import { GlobalStateKeyToTrackIfUserConfiguredCDNAtLeastOnce } from '../../../ke
217217
);
218218
});
219219
test('Render matplotlib, widget', async function () {
220-
const comms = await initializeNotebookForWidgetTest(api, disposables, {
220+
const comms = await initializeNotebookForWidgetTest(disposables, {
221221
templateFile: 'matplotlib_widgets_widget.ipynb'
222222
});
223223
const cell = vscodeNotebook.activeNotebookEditor!.notebook.cellAt(3);
@@ -226,7 +226,7 @@ import { GlobalStateKeyToTrackIfUserConfiguredCDNAtLeastOnce } from '../../../ke
226226
await assertOutputContainsHtml(cell, comms, ['>Figure 1<', '<canvas', 'Download plot']);
227227
});
228228
test('Render matplotlib, widget in multiple cells', async function () {
229-
const comms = await initializeNotebookForWidgetTest(api, disposables, {
229+
const comms = await initializeNotebookForWidgetTest(disposables, {
230230
templateFile: 'matplotlib_multiple_cells_widgets.ipynb'
231231
});
232232
const [, cell1, cell2, cell3] = vscodeNotebook.activeNotebookEditor!.notebook.getCells();

0 commit comments

Comments
 (0)