Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix failing nbconvert CI test by generating a proper temp ipynb file #11191

Merged
merged 2 commits into from
Aug 26, 2022
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
14 changes: 7 additions & 7 deletions TELEMETRY.md
Original file line number Diff line number Diff line change
Expand Up @@ -952,9 +952,9 @@ No properties for event
traceCellMessage(cell, `kernel.executeCell, ${getDisplayPath(cell.notebook.uri)}`);
initializeInteractiveOrNotebookTelemetryBasedOnUserAction(this.resourceUri, this.kernelConnectionMetadata);
sendKernelTelemetryEvent(this.resourceUri, Telemetry.ExecuteCell);
this.sendKernelStartedTelemetry();
const stopWatch = new StopWatch();
const sessionPromise = this.startJupyterSession();
const promise = this.kernelExecution.executeCell(sessionPromise, cell, codeOverride);
```


Expand Down Expand Up @@ -2007,12 +2007,12 @@ No description provided

[src/kernels/kernel.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/kernel.ts)
```typescript
await this.executeSilently(session, startupCode, {
traceErrors: true,
traceErrorsMessage: 'Error executing jupyter extension internal startup code',
telemetryName: Telemetry.KernelStartupCodeFailure
});

await this.executeSilently(session, startupCode, {
traceErrors: true,
traceErrorsMessage: 'Error executing jupyter extension internal startup code',
telemetryName: Telemetry.KernelStartupCodeFailure
});
if (this.kernelConnectionMetadata.kind !== 'connectToLiveRemoteKernel') {
// Run user specified startup commands
```

Expand Down
1 change: 1 addition & 0 deletions news/3 Code Health/11190.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix the test "Export a basic notebook document with nbconvert" CI failure.
12 changes: 5 additions & 7 deletions src/test/datascience/notebook/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ export async function createTemporaryNotebookFromFile(
export async function createTemporaryNotebook(
cells: (nbformat.ICodeCell | nbformat.IMarkdownCell | nbformat.IRawCell | nbformat.IUnrecognizedCell)[],
disposables: IDisposable[],
kernelName: string = 'Python 3',
kernelSpec: nbformat.IKernelspecMetadata = { display_name: 'Python 3', name: 'python3' },
rootFolder?: Uri,
prefix?: string
): Promise<Uri> {
Expand All @@ -251,13 +251,11 @@ export async function createTemporaryNotebook(
const data: nbformat.INotebookContent = {
cells,
metadata: {
orig_nbformat: 4
orig_nbformat: 4,
kernelspec: kernelSpec
},
nbformat: 4,
nbformat_minor: 2,
kernel: {
Copy link
Member Author

@IanMatthewHuff IanMatthewHuff Aug 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an invalid INotebookContent and nbconvert wasn't liking the kernel entry as it's not part of the spec.

display_name: kernelName
}
nbformat_minor: 2
};
return createTemporaryNotebookFromNotebook(data, disposables, rootFolder, prefix);
}
Expand All @@ -280,7 +278,7 @@ export async function createEmptyPythonNotebook(
const serverConnectionType = serviceContainer.get<IServerConnectionType>(IServerConnectionType);
// Don't use same file (due to dirty handling, we might save in dirty.)
// Coz we won't save to file, hence extension will backup in dirty file and when u re-open it will open from dirty.
const nbFile = await createTemporaryNotebook([], disposables, 'Python 3', rootFolder, 'emptyPython');
const nbFile = await createTemporaryNotebook([], disposables, undefined, rootFolder, 'emptyPython');
// Open a python notebook and use this for all tests in this test suite.
await openAndShowNotebook(nbFile);
assert.isOk(vscodeNotebook.activeNotebookEditor, 'No active notebook');
Expand Down