Skip to content
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
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ script:
bash <(curl -s https://codecov.io/bash);
fi
- if [ $FUNCTIONAL_TEST == "true" ]; then
python -m pip install --upgrade -r functionalTestRequirements.txt
npm run cover:enable;
npm run test:functional;
fi
Expand Down
18 changes: 17 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,23 @@
"sourceMaps": true,
"args": [
"timeout=300000",
"grep=History"
"grep="
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "Compile"
},
{
"name": "Functional Tests (without VS Code, *.functional.test.ts)",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/out/test/functionalTests.js",
"stopOnEntry": false,
"sourceMaps": true,
"args": [
"timeout=300000",
"grep="
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"
Expand Down
2 changes: 2 additions & 0 deletions functionalTestRequirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# List of requirements for functional tests
jupyter
2 changes: 1 addition & 1 deletion src/client/datascience/history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ export class History implements IWebPanelMessageListener, IHistory {
@captureTelemetry(Telemetry.RestartKernel)
private restartKernel() {
if (this.jupyterServer) {
this.jupyterServer.restartKernel();
this.jupyterServer.restartKernel().ignoreErrors();
}
}

Expand Down
8 changes: 5 additions & 3 deletions src/client/datascience/jupyterServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export class JupyterServer implements INotebookServer {
});
}

return Promise.reject(localize.DataScience.sessionDisposed);
return Promise.reject(new Error(localize.DataScience.sessionDisposed()));
}

public get onStatusChanged() : vscode.Event<boolean> {
Expand All @@ -196,10 +196,12 @@ export class JupyterServer implements INotebookServer {
}
}

public restartKernel = () => {
public restartKernel = () : Promise<void> => {
if (this.session && this.session.kernel) {
this.session.kernel.restart().ignoreErrors();
return this.session.kernel.restart();
}

return Promise.reject(new Error(localize.DataScience.sessionDisposed()));
}

public translateToNotebook = async (cells: ICell[]) : Promise<nbformat.INotebookContent | undefined> => {
Expand Down
2 changes: 1 addition & 1 deletion src/client/datascience/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export interface INotebookServer extends IDisposable {
getCurrentState() : Promise<ICell[]>;
executeObservable(code: string, file: string, line: number) : Observable<ICell[]>;
execute(code: string, file: string, line: number) : Promise<ICell[]>;
restartKernel();
restartKernel() : Promise<void>;
translateToNotebook(cells: ICell[]) : Promise<JSONObject | undefined>;
launchNotebook(file: string) : Promise<boolean>;
}
Expand Down
13 changes: 11 additions & 2 deletions src/client/ioc/serviceManager.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

import { Container, injectable, interfaces } from 'inversify';
import { Abstract, IServiceManager, Newable } from './types';

import { Abstract, ClassType, IServiceManager, Newable } from './types';

type identifier<T> = string | symbol | Newable<T> | Abstract<T>;

Expand Down Expand Up @@ -43,4 +43,13 @@ export class ServiceManager implements IServiceManager {
public getAll<T>(serviceIdentifier: identifier<T>, name?: string | number | symbol | undefined): T[] {
return name ? this.container.getAllNamed<T>(serviceIdentifier, name) : this.container.getAll<T>(serviceIdentifier);
}

public rebind<T>(serviceIdentifier: interfaces.ServiceIdentifier<T>, constructor: ClassType<T>, name?: string | number | symbol): void {
if (name) {
this.container.rebind<T>(serviceIdentifier).to(constructor).whenTargetNamed(name);
Comment thread
rchiodo marked this conversation as resolved.
} else {
this.container.rebind<T>(serviceIdentifier).to(constructor);
}
}

}
1 change: 1 addition & 0 deletions src/client/ioc/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export interface IServiceManager {
addFactory<T>(factoryIdentifier: interfaces.ServiceIdentifier<interfaces.Factory<T>>, factoryMethod: interfaces.FactoryCreator<T>): void;
get<T>(serviceIdentifier: interfaces.ServiceIdentifier<T>, name?: string | number | symbol): T;
getAll<T>(serviceIdentifier: interfaces.ServiceIdentifier<T>, name?: string | number | symbol): T[];
rebind<T>(serviceIdentifier: interfaces.ServiceIdentifier<T>, constructor: ClassType<T>, name?: string | number | symbol): void;
}

export const IServiceContainer = Symbol('IServiceContainer');
Expand Down
Loading