From f601b902e2df5daed8b0eb07ccdc98a2591bceb5 Mon Sep 17 00:00:00 2001 From: Don Jayamanne Date: Wed, 3 Jun 2020 13:16:39 -0700 Subject: [PATCH 1/7] Include error in status and persist exec times --- .../datascience/notebook/executionHelpers.ts | 21 +++ .../datascience/notebook/executionService.ts | 16 ++ src/client/datascience/notebook/helpers.ts | 66 ++++++- src/test/common.ts | 3 + src/test/datascience/notebook/helper.ts | 18 +- .../datascience/notebook/saving.ds.test.ts | 167 ++++++++++++++++++ types/@jupyterlab_coreutils_nbformat.d.ts | 4 +- 7 files changed, 286 insertions(+), 9 deletions(-) create mode 100644 src/test/datascience/notebook/saving.ds.test.ts diff --git a/src/client/datascience/notebook/executionHelpers.ts b/src/client/datascience/notebook/executionHelpers.ts index f617557cd1f3..df1af430fbb4 100644 --- a/src/client/datascience/notebook/executionHelpers.ts +++ b/src/client/datascience/notebook/executionHelpers.ts @@ -140,6 +140,27 @@ export function updateCellOutput(notebookCellModel: ICell, outputs: nbformat.IOu model.update(updateCell); } +/** + * Store execution start and end times in ISO format for portability. + */ +export function updateCelExecutionTimes( + notebookCellModel: ICell, + model: INotebookModel, + startTime?: number, + duration?: number +) { + const startTimeISO = startTime ? new Date(startTime).toISOString() : undefined; + const endTimeISO = duration && startTime ? new Date(startTime + duration).toISOString() : undefined; + updateCellMetadata( + notebookCellModel, + { + end_execution_time: endTimeISO, + start_execution_time: startTimeISO + }, + model + ); +} + export function updateCellMetadata( notebookCellModel: ICell, metadata: Partial, diff --git a/src/client/datascience/notebook/executionService.ts b/src/client/datascience/notebook/executionService.ts index b36e184ac9aa..eb07d218bbf1 100644 --- a/src/client/datascience/notebook/executionService.ts +++ b/src/client/datascience/notebook/executionService.ts @@ -22,10 +22,12 @@ import { findMappedNotebookCellModel } from './cellUpdateHelpers'; import { handleUpdateDisplayDataMessage, hasTransientOutputForAnotherCell, + updateCelExecutionTimes, updateCellExecutionCount, updateCellOutput, updateCellWithErrorStatus } from './executionHelpers'; +import { getCellStatusMessageBasedOnFirstErrorOutput } from './helpers'; import { INotebookExecutionService } from './types'; // tslint:disable-next-line: no-var-requires no-require-imports const vscodeNotebookEnums = require('vscode') as typeof import('vscode-proposed'); @@ -185,9 +187,23 @@ export class NotebookExecutionService implements INotebookExecutionService { ? vscodeNotebookEnums.NotebookCellRunState.Idle : vscodeNotebookEnums.NotebookCellRunState.Success; cell.metadata.statusMessage = ''; + + // Update metadata in our model. + const notebookCellModel = findMappedNotebookCellModel(cell, model.cells); + updateCelExecutionTimes( + notebookCellModel, + model, + cell.metadata.runStartTime, + cell.metadata.lastRunDuration + ); + // If there are any errors in the cell, then change status to error. if (cell.outputs.some((output) => output.outputKind === vscodeNotebookEnums.CellOutputKind.Error)) { cell.metadata.runState = vscodeNotebookEnums.NotebookCellRunState.Error; + cell.metadata.statusMessage = getCellStatusMessageBasedOnFirstErrorOutput( + // tslint:disable-next-line: no-any + notebookCellModel.data.outputs as any + ); } deferred.resolve(); } diff --git a/src/client/datascience/notebook/helpers.ts b/src/client/datascience/notebook/helpers.ts index f522d879b38b..cb25f19c37d9 100644 --- a/src/client/datascience/notebook/helpers.ts +++ b/src/client/datascience/notebook/helpers.ts @@ -16,6 +16,7 @@ import type { // tslint:disable-next-line: no-var-requires no-require-imports const vscodeNotebookEnums = require('vscode') as typeof import('vscode-proposed'); import * as uuid from 'uuid/v4'; +import { NotebookCellRunState } from '../../../../typings/vscode-proposed'; import { concatMultilineStringInput, concatMultilineStringOutput, @@ -90,6 +91,33 @@ export function cellToVSCNotebookCellData(cell: ICell): NotebookCellData | undef return; } + // tslint:disable-next-line: no-any + const outputs = cellOutputsToVSCCellOutputs(cell.data.outputs as any); + + // If we have an execution count & no errors, then success state. + // If we have an execution count & errors, then error state. + // Else idle state. + const hasErrors = outputs.some((output) => output.outputKind === vscodeNotebookEnums.CellOutputKind.Error); + const hasExecutionCount = typeof cell.data.execution_count === 'number' && cell.data.execution_count > 0; + let runState: NotebookCellRunState; + let statusMessage = ''; + if (!hasExecutionCount) { + runState = vscodeNotebookEnums.NotebookCellRunState.Idle; + } else if (hasErrors) { + runState = vscodeNotebookEnums.NotebookCellRunState.Error; + // Error details are stripped from the output, get raw output. + // tslint:disable-next-line: no-any + statusMessage = getCellStatusMessageBasedOnFirstErrorOutput(cell.data.outputs as any); + } else { + runState = vscodeNotebookEnums.NotebookCellRunState.Success; + } + + const startExecutionTime = cell.data.metadata.vscode?.start_execution_time + ? new Date(Date.parse(cell.data.metadata.vscode.start_execution_time)).getTime() + : undefined; + const endExecutionTime = cell.data.metadata.vscode?.end_execution_time + ? new Date(Date.parse(cell.data.metadata.vscode.end_execution_time)).getTime() + : undefined; return { cellKind: cell.data.cell_type === 'code' ? vscodeNotebookEnums.CellKind.Code : vscodeNotebookEnums.CellKind.Markdown, @@ -98,15 +126,20 @@ export function cellToVSCNotebookCellData(cell: ICell): NotebookCellData | undef editable: true, executionOrder: typeof cell.data.execution_count === 'number' ? cell.data.execution_count : undefined, hasExecutionOrder: cell.data.cell_type === 'code', - runState: vscodeNotebookEnums.NotebookCellRunState.Idle, + runState, runnable: cell.data.cell_type === 'code', custom: { cellId: cell.id - } + }, + runStartTime: startExecutionTime, + lastRunDuration: + startExecutionTime && typeof endExecutionTime === 'number' + ? endExecutionTime - startExecutionTime + : undefined, + statusMessage }, source: concatMultilineStringInput(cell.data.source), - // tslint:disable-next-line: no-any - outputs: cellOutputsToVSCCellOutputs(cell.data.outputs as any) + outputs }; } @@ -205,11 +238,32 @@ function translateStreamOutput(output: nbformat.IStream): CellStreamOutput | Cel } }; } + +/** + * We will display the error message in the status of the cell. + * We will display the error message in the status of the cell. + * The `ename` & `evalue` is displayed at the top of the output by VS Code. + * As we're displaying the error in the statusbar, we don't want this dup error in output. + * Hence remove this. + */ export function translateErrorOutput(output: nbformat.IError): CellErrorOutput { return { - ename: output.ename, - evalue: output.evalue, + ename: '', + evalue: '', outputKind: vscodeNotebookEnums.CellOutputKind.Error, traceback: output.traceback }; } + +export function getCellStatusMessageBasedOnFirstErrorOutput(outputs?: nbformat.IOutput[]): string { + if (!Array.isArray(outputs)) { + return ''; + } + const errorOutput = (outputs.find((output) => output.output_type === 'error') as unknown) as + | nbformat.IError + | undefined; + if (!errorOutput) { + return ''; + } + return `${errorOutput.ename}${errorOutput.evalue ? ': ' : ''}${errorOutput.evalue}`; +} diff --git a/src/test/common.ts b/src/test/common.ts index 3d4b446efcae..c01bb1cf257f 100644 --- a/src/test/common.ts +++ b/src/test/common.ts @@ -652,6 +652,9 @@ export class TestEventHandler implements IDisposable public get count(): number { return this.handledEvents.length; } + public get all(): T[] { + return this.handledEvents; + } private readonly handler: IDisposable; // tslint:disable-next-line: no-any private readonly handledEvents: any[] = []; diff --git a/src/test/datascience/notebook/helper.ts b/src/test/datascience/notebook/helper.ts index e0967f616df1..99711999f9dc 100644 --- a/src/test/datascience/notebook/helper.ts +++ b/src/test/datascience/notebook/helper.ts @@ -18,7 +18,7 @@ import { IDisposable } from '../../../client/common/types'; import { noop, swallowExceptions } from '../../../client/common/utils/misc'; import { NotebookContentProvider } from '../../../client/datascience/notebook/contentProvider'; import { ICell, INotebookEditorProvider, INotebookProvider } from '../../../client/datascience/types'; -import { waitForCondition } from '../../common'; +import { createEventHandler, waitForCondition } from '../../common'; import { EXTENSION_ROOT_DIR_FOR_TESTS } from '../../constants'; import { closeActiveWindows, initialize } from '../../initialize'; const vscodeNotebookEnums = require('vscode') as typeof import('vscode-proposed'); @@ -252,3 +252,19 @@ export function assertVSCCellHasErrors(cell: NotebookCell) { assert.equal(cell.metadata.runState, vscodeNotebookEnums.NotebookCellRunState.Error); return true; } +export function assertVSCCellHasErrorOutput(cell: NotebookCell) { + assert.ok( + cell.outputs.filter((output) => output.outputKind === vscodeNotebookEnums.CellOutputKind.Error).length, + 'No error output in cell' + ); + return true; +} + +export async function saveActiveNotebook(disposables: IDisposable[]) { + const api = await initialize(); + const editorProvider = api.serviceContainer.get(INotebookEditorProvider); + const savedEvent = createEventHandler(editorProvider.activeEditor!.model!, 'changed', disposables); + await commands.executeCommand('workbench.action.files.saveAll'); + + await waitForCondition(async () => savedEvent.all.some((e) => e.kind === 'save'), 5_000, 'Not saved'); +} diff --git a/src/test/datascience/notebook/saving.ds.test.ts b/src/test/datascience/notebook/saving.ds.test.ts new file mode 100644 index 000000000000..bca295b73fb1 --- /dev/null +++ b/src/test/datascience/notebook/saving.ds.test.ts @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +'use strict'; + +// tslint:disable:no-require-imports no-var-requires +import { assert, expect } from 'chai'; +import * as path from 'path'; +import * as sinon from 'sinon'; +import { commands, Uri } from 'vscode'; +import { NotebookCell } from '../../../../typings/vscode-proposed'; +import { IVSCodeNotebook } from '../../../client/common/application/types'; +import { IDisposable } from '../../../client/common/types'; +import { sleep } from '../../../client/common/utils/async'; +import { INotebookEditorProvider } from '../../../client/datascience/types'; +import { IExtensionTestApi, waitForCondition } from '../../common'; +import { closeActiveWindows, EXTENSION_ROOT_DIR_FOR_TESTS, initialize } from '../../initialize'; +import { + assertHasExecutionCompletedSuccessfully, + assertHasExecutionCompletedWithErrors, + assertHasTextOutputInVSCode, + assertVSCCellHasErrorOutput, + assertVSCCellIsIdle, + assertVSCCellIsRunning, + canRunTests, + closeNotebooksAndCleanUpAfterTests, + createTemporaryNotebook, + deleteAllCellsAndWait, + insertPythonCellAndWait, + saveActiveNotebook, + startJupyter, + swallowSavingOfNotebooks +} from './helper'; +const vscodeNotebookEnums = require('vscode') as typeof import('vscode-proposed'); + +// tslint:disable: no-any no-invalid-this +suite('DataScience - VSCode Notebook - (Saving)', function () { + this.timeout(15_000); + this.retries(0); + const templateIPynb = path.join(EXTENSION_ROOT_DIR_FOR_TESTS, 'src', 'test', 'datascience', 'test.ipynb'); + let api: IExtensionTestApi; + let testIPynb: Uri; + let editorProvider: INotebookEditorProvider; + const disposables: IDisposable[] = []; + let vscodeNotebook: IVSCodeNotebook; + suiteSetup(async function () { + this.timeout(15_000); + this.retries(0); + api = await initialize(); + if (!(await canRunTests())) { + return this.skip(); + } + await startJupyter(); + vscodeNotebook = api.serviceContainer.get(IVSCodeNotebook); + editorProvider = api.serviceContainer.get(INotebookEditorProvider); + }); + setup(async () => { + sinon.restore(); + // Don't use same file (due to dirty handling, we might save in dirty.) + // Cuz we won't save to file, hence extension will backup in dirty file and when u re-open it will open from dirty. + testIPynb = Uri.file(await createTemporaryNotebook(templateIPynb, disposables)); + await editorProvider.open(testIPynb); + await deleteAllCellsAndWait(); + }); + teardown(async () => { + await swallowSavingOfNotebooks(); + await closeNotebooksAndCleanUpAfterTests(disposables); + }); + + test('Verify output & metadata when re-opening (slow)', async () => { + await insertPythonCellAndWait('import time\nfor i in range(10000):\n print(i)\n time.sleep(0.1)', 0); + await insertPythonCellAndWait('import time\nfor i in range(10000):\n print(i)\n time.sleep(0.1)', 0); + await insertPythonCellAndWait('print(a)', 0); + await insertPythonCellAndWait('print(1)', 0); + let cell1: NotebookCell; + let cell2: NotebookCell; + let cell3: NotebookCell; + let cell4: NotebookCell; + + function initializeCells() { + cell1 = vscodeNotebook.activeNotebookEditor?.document.cells![0]!; + cell2 = vscodeNotebook.activeNotebookEditor?.document.cells![1]!; + cell3 = vscodeNotebook.activeNotebookEditor?.document.cells![2]!; + cell4 = vscodeNotebook.activeNotebookEditor?.document.cells![3]!; + } + initializeCells(); + await commands.executeCommand('notebook.execute'); + + // Wait till 1 & 2 finish & 3rd cell starts executing. + await waitForCondition( + async () => + assertHasExecutionCompletedSuccessfully(cell1) && + assertHasExecutionCompletedWithErrors(cell2) && + assertVSCCellIsRunning(cell3) && + assertVSCCellIsRunning(cell4), + 15_000, + 'Cells not running' + ); + + await sleep(1); // Wait for some output. + await commands.executeCommand('notebook.cancelExecution'); + + // Wait till execution count changes and status is error. + await waitForCondition( + async () => assertHasExecutionCompletedWithErrors(cell3) && assertVSCCellIsIdle(cell4), + 15_000, + 'Cells not running' + ); + + function verifyCelMetadata() { + assert.lengthOf(cell1.outputs, 1, 'Incorrect output for cell 1'); + assert.lengthOf(cell2.outputs, 1, 'Incorrect output for cell 2'); + assert.lengthOf(cell3.outputs, 2, 'Incorrect output for cell 3'); // stream and interrupt error. + assert.lengthOf(cell4.outputs, 0, 'Incorrect output for cell 4'); + + assert.equal( + cell1.metadata.runState, + vscodeNotebookEnums.NotebookCellRunState.Success, + 'Incorrect state 1' + ); + assert.equal(cell2.metadata.runState, vscodeNotebookEnums.NotebookCellRunState.Error, 'Incorrect state 2'); + assert.equal(cell3.metadata.runState, vscodeNotebookEnums.NotebookCellRunState.Error, 'Incorrect state 3'); + assert.equal(cell4.metadata.runState, vscodeNotebookEnums.NotebookCellRunState.Idle, 'Incorrect state 4'); + + assertHasTextOutputInVSCode(cell1, '1', 0); + assertVSCCellHasErrorOutput(cell2); + assertHasTextOutputInVSCode(cell3, '0', 0); + assertVSCCellHasErrorOutput(cell3); + + expect(cell1.metadata.executionOrder).to.be.greaterThan(0, 'Execution count should be > 0'); + expect(cell2.metadata.executionOrder).to.be.greaterThan( + cell1.metadata.executionOrder!, + 'Execution count > cell 1' + ); + expect(cell3.metadata.executionOrder).to.be.greaterThan( + cell2.metadata.executionOrder!, + 'Execution count > cell 2' + ); + assert.isNotOk(cell4.metadata.executionOrder, 'Execution count should be 0|null'); + + assert.isEmpty(cell1.metadata.statusMessage, 'Cell 1 status should be empty'); // No errors. + assert.isNotEmpty(cell2.metadata.statusMessage, 'Cell 1 status should be empty'); // Errors. + assert.isNotEmpty(cell3.metadata.statusMessage, 'Cell 1 status should be empty'); // Errors (interrupted). + assert.isEmpty(cell4.metadata.statusMessage, 'Cell 1 status should be empty'); // No errors (didn't run). + + assert.isOk(cell1.metadata.runStartTime, 'Start time should be > 0'); + assert.isOk(cell1.metadata.lastRunDuration, 'Duration should be > 0'); + assert.isOk(cell2.metadata.runStartTime, 'Start time should be > 0'); + assert.isOk(cell2.metadata.lastRunDuration, 'Duration should be > 0'); + assert.isOk(cell3.metadata.runStartTime, 'Start time should be > 0'); + assert.isOk(cell3.metadata.lastRunDuration, 'Duration should be > 0'); + assert.isOk(cell4.metadata.runStartTime, 'Start time should be > 0'); + assert.isOk(cell4.metadata.lastRunDuration, 'Duration should be > 0'); + } + + verifyCelMetadata(); + + // Save and close this nb. + await saveActiveNotebook(disposables); + await closeActiveWindows(); + + // Reopen the notebook & validate the metadata. + await editorProvider.open(testIPynb); + initializeCells(); + verifyCelMetadata(); + }); +}); diff --git a/types/@jupyterlab_coreutils_nbformat.d.ts b/types/@jupyterlab_coreutils_nbformat.d.ts index 477a06d4b761..b16ef776c208 100644 --- a/types/@jupyterlab_coreutils_nbformat.d.ts +++ b/types/@jupyterlab_coreutils_nbformat.d.ts @@ -2,8 +2,8 @@ import { JSONObject } from '@phosphor/coreutils'; // This is the custom type we are adding into nbformat.IBaseCellMetadata export interface IBaseCellVSCodeMetadata { - lastExecutionTime?: number; - startExecutionTime?: number; + end_execution_time?: string; + start_execution_time?: string; } declare module '@jupyterlab/coreutils' { From e50e3a487e2e9d8d05c16278e2fdbab1d111e4df Mon Sep 17 00:00:00 2001 From: Don Jayamanne Date: Wed, 3 Jun 2020 14:10:19 -0700 Subject: [PATCH 2/7] Fix tests --- src/client/datascience/notebook/helpers.ts | 36 +++++++++++-------- .../datascience/notebook/helpers.unit.test.ts | 4 +-- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/src/client/datascience/notebook/helpers.ts b/src/client/datascience/notebook/helpers.ts index cb25f19c37d9..1333e14ae5b8 100644 --- a/src/client/datascience/notebook/helpers.ts +++ b/src/client/datascience/notebook/helpers.ts @@ -100,7 +100,7 @@ export function cellToVSCNotebookCellData(cell: ICell): NotebookCellData | undef const hasErrors = outputs.some((output) => output.outputKind === vscodeNotebookEnums.CellOutputKind.Error); const hasExecutionCount = typeof cell.data.execution_count === 'number' && cell.data.execution_count > 0; let runState: NotebookCellRunState; - let statusMessage = ''; + let statusMessage: string | undefined; if (!hasExecutionCount) { runState = vscodeNotebookEnums.NotebookCellRunState.Idle; } else if (hasErrors) { @@ -112,13 +112,7 @@ export function cellToVSCNotebookCellData(cell: ICell): NotebookCellData | undef runState = vscodeNotebookEnums.NotebookCellRunState.Success; } - const startExecutionTime = cell.data.metadata.vscode?.start_execution_time - ? new Date(Date.parse(cell.data.metadata.vscode.start_execution_time)).getTime() - : undefined; - const endExecutionTime = cell.data.metadata.vscode?.end_execution_time - ? new Date(Date.parse(cell.data.metadata.vscode.end_execution_time)).getTime() - : undefined; - return { + const notebookCellData: NotebookCellData = { cellKind: cell.data.cell_type === 'code' ? vscodeNotebookEnums.CellKind.Code : vscodeNotebookEnums.CellKind.Markdown, language: cell.data.cell_type === 'code' ? PYTHON_LANGUAGE : MARKDOWN_LANGUAGE, @@ -130,17 +124,29 @@ export function cellToVSCNotebookCellData(cell: ICell): NotebookCellData | undef runnable: cell.data.cell_type === 'code', custom: { cellId: cell.id - }, - runStartTime: startExecutionTime, - lastRunDuration: - startExecutionTime && typeof endExecutionTime === 'number' - ? endExecutionTime - startExecutionTime - : undefined, - statusMessage + } }, source: concatMultilineStringInput(cell.data.source), outputs }; + + if (statusMessage) { + notebookCellData.metadata.statusMessage = statusMessage; + } + + const startExecutionTime = cell.data.metadata.vscode?.start_execution_time + ? new Date(Date.parse(cell.data.metadata.vscode.start_execution_time)).getTime() + : undefined; + const endExecutionTime = cell.data.metadata.vscode?.end_execution_time + ? new Date(Date.parse(cell.data.metadata.vscode.end_execution_time)).getTime() + : undefined; + + if (startExecutionTime && typeof endExecutionTime === 'number') { + notebookCellData.metadata.runStartTime = startExecutionTime; + notebookCellData.metadata.lastRunDuration = endExecutionTime - startExecutionTime; + } + + return notebookCellData; } export function cellOutputsToVSCCellOutputs(outputs?: nbformat.IOutput[]): CellOutput[] { diff --git a/src/test/datascience/notebook/helpers.unit.test.ts b/src/test/datascience/notebook/helpers.unit.test.ts index 3d09641e705c..bad791cee5de 100644 --- a/src/test/datascience/notebook/helpers.unit.test.ts +++ b/src/test/datascience/notebook/helpers.unit.test.ts @@ -204,8 +204,8 @@ suite('Data Science - NativeNotebook helpers', () => { [ { outputKind: vscodeNotebookEnums.CellOutputKind.Error, - ename: 'Error Name', - evalue: 'Error Value', + ename: '', + evalue: '', traceback: ['stack1', 'stack2', 'stack3'] } ] From 0e578761ae09dec002b5457656e6f4f452d78515 Mon Sep 17 00:00:00 2001 From: Don Jayamanne Date: Wed, 3 Jun 2020 14:23:04 -0700 Subject: [PATCH 3/7] Typo --- src/client/datascience/notebook/executionHelpers.ts | 2 +- src/client/datascience/notebook/executionService.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/client/datascience/notebook/executionHelpers.ts b/src/client/datascience/notebook/executionHelpers.ts index df1af430fbb4..f8b402a77037 100644 --- a/src/client/datascience/notebook/executionHelpers.ts +++ b/src/client/datascience/notebook/executionHelpers.ts @@ -143,7 +143,7 @@ export function updateCellOutput(notebookCellModel: ICell, outputs: nbformat.IOu /** * Store execution start and end times in ISO format for portability. */ -export function updateCelExecutionTimes( +export function updateCellExecutionTimes( notebookCellModel: ICell, model: INotebookModel, startTime?: number, diff --git a/src/client/datascience/notebook/executionService.ts b/src/client/datascience/notebook/executionService.ts index eb07d218bbf1..56c1db459ce0 100644 --- a/src/client/datascience/notebook/executionService.ts +++ b/src/client/datascience/notebook/executionService.ts @@ -22,7 +22,7 @@ import { findMappedNotebookCellModel } from './cellUpdateHelpers'; import { handleUpdateDisplayDataMessage, hasTransientOutputForAnotherCell, - updateCelExecutionTimes, + updateCellExecutionTimes, updateCellExecutionCount, updateCellOutput, updateCellWithErrorStatus @@ -190,7 +190,7 @@ export class NotebookExecutionService implements INotebookExecutionService { // Update metadata in our model. const notebookCellModel = findMappedNotebookCellModel(cell, model.cells); - updateCelExecutionTimes( + updateCellExecutionTimes( notebookCellModel, model, cell.metadata.runStartTime, From 110b5c279827a11365356099a80a6aa3551ad5ab Mon Sep 17 00:00:00 2001 From: Don Jayamanne Date: Wed, 3 Jun 2020 14:33:46 -0700 Subject: [PATCH 4/7] Fix tests --- src/test/datascience/notebook/contentProvider.unit.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/datascience/notebook/contentProvider.unit.test.ts b/src/test/datascience/notebook/contentProvider.unit.test.ts index 91ee84c60463..ca98351bc639 100644 --- a/src/test/datascience/notebook/contentProvider.unit.test.ts +++ b/src/test/datascience/notebook/contentProvider.unit.test.ts @@ -72,7 +72,7 @@ suite('Data Science - NativeNotebook ContentProvider', () => { editable: true, executionOrder: 10, hasExecutionOrder: true, - runState: (vscodeNotebookEnums as any).NotebookCellRunState.Idle, + runState: (vscodeNotebookEnums as any).NotebookCellRunState.Success, runnable: true, custom: { cellId: 'MyCellId1' @@ -88,7 +88,7 @@ suite('Data Science - NativeNotebook ContentProvider', () => { editable: true, executionOrder: undefined, hasExecutionOrder: false, - runState: (vscodeNotebookEnums as any).NotebookCellRunState.Idle, + runState: (vscodeNotebookEnums as any).NotebookCellRunState.Success, runnable: false, custom: { cellId: 'MyCellId2' From 53eb9876d8a81ebd76b529fb0c3397c0d484939e Mon Sep 17 00:00:00 2001 From: Don Jayamanne Date: Wed, 3 Jun 2020 14:34:11 -0700 Subject: [PATCH 5/7] Fix linter --- src/client/datascience/notebook/executionService.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/datascience/notebook/executionService.ts b/src/client/datascience/notebook/executionService.ts index 56c1db459ce0..a128cafbf778 100644 --- a/src/client/datascience/notebook/executionService.ts +++ b/src/client/datascience/notebook/executionService.ts @@ -22,8 +22,8 @@ import { findMappedNotebookCellModel } from './cellUpdateHelpers'; import { handleUpdateDisplayDataMessage, hasTransientOutputForAnotherCell, - updateCellExecutionTimes, updateCellExecutionCount, + updateCellExecutionTimes, updateCellOutput, updateCellWithErrorStatus } from './executionHelpers'; From c4209dc0c8057ce0ad714f7930b7cc96ffe3603f Mon Sep 17 00:00:00 2001 From: Don Jayamanne Date: Wed, 3 Jun 2020 14:59:15 -0700 Subject: [PATCH 6/7] Fix tests --- src/test/datascience/notebook/contentProvider.unit.test.ts | 2 +- src/test/datascience/notebook/helpers.unit.test.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/datascience/notebook/contentProvider.unit.test.ts b/src/test/datascience/notebook/contentProvider.unit.test.ts index ca98351bc639..bd39cc2f72e6 100644 --- a/src/test/datascience/notebook/contentProvider.unit.test.ts +++ b/src/test/datascience/notebook/contentProvider.unit.test.ts @@ -88,7 +88,7 @@ suite('Data Science - NativeNotebook ContentProvider', () => { editable: true, executionOrder: undefined, hasExecutionOrder: false, - runState: (vscodeNotebookEnums as any).NotebookCellRunState.Success, + runState: (vscodeNotebookEnums as any).NotebookCellRunState.Idle, runnable: false, custom: { cellId: 'MyCellId2' diff --git a/src/test/datascience/notebook/helpers.unit.test.ts b/src/test/datascience/notebook/helpers.unit.test.ts index bad791cee5de..77566a0ca415 100644 --- a/src/test/datascience/notebook/helpers.unit.test.ts +++ b/src/test/datascience/notebook/helpers.unit.test.ts @@ -57,7 +57,7 @@ suite('Data Science - NativeNotebook helpers', () => { editable: true, executionOrder: 10, hasExecutionOrder: true, - runState: vscodeNotebookEnums.NotebookCellRunState.Idle, + runState: vscodeNotebookEnums.NotebookCellRunState.Success, runnable: true, custom: { cellId: 'MyCellId1' From 17dae29175538357678bd6be4012d229f4d1f881 Mon Sep 17 00:00:00 2001 From: Don Jayamanne Date: Wed, 3 Jun 2020 15:59:06 -0700 Subject: [PATCH 7/7] Oops --- src/client/datascience/notebook/helpers.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/client/datascience/notebook/helpers.ts b/src/client/datascience/notebook/helpers.ts index 1333e14ae5b8..0351f82f2d90 100644 --- a/src/client/datascience/notebook/helpers.ts +++ b/src/client/datascience/notebook/helpers.ts @@ -246,7 +246,6 @@ function translateStreamOutput(output: nbformat.IStream): CellStreamOutput | Cel } /** - * We will display the error message in the status of the cell. * We will display the error message in the status of the cell. * The `ename` & `evalue` is displayed at the top of the output by VS Code. * As we're displaying the error in the statusbar, we don't want this dup error in output.