Skip to content

Commit

Permalink
Revert tests due to incompatibilities
Browse files Browse the repository at this point in the history
  • Loading branch information
DonJayamanne committed Nov 21, 2019
1 parent 6657b52 commit 0421d73
Showing 1 changed file with 4 additions and 24 deletions.
28 changes: 4 additions & 24 deletions src/test/datascience/execution.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,6 @@ suite('Jupyter Execution', async () => {
});

teardown(() => {
reset(fileSystem);
return cleanupDisposables();
});

Expand Down Expand Up @@ -440,7 +439,7 @@ suite('Jupyter Execution', async () => {
.returns(() => result);
}

function setupWorkingPythonService(service: TypeMoq.IMock<IPythonExecutionService>, notebookStdErr?: string[], runInDocker?: boolean) {
function setupWorkingPythonService(service: TypeMoq.IMock<IPythonExecutionService>, notebookStdErr?: string[]) {
setupPythonService(service, 'ipykernel', ['--version'], Promise.resolve({ stdout: '1.1.1.1' }));
setupPythonService(service, 'jupyter', ['nbconvert', '--version'], Promise.resolve({ stdout: '1.1.1.1' }));
setupPythonService(service, 'jupyter', ['notebook', '--version'], Promise.resolve({ stdout: '1.1.1.1' }));
Expand All @@ -463,8 +462,7 @@ suite('Jupyter Execution', async () => {
const getServerInfoPath = path.join(EXTENSION_ROOT_DIR, 'pythonFiles', 'datascience', 'getServerInfo.py');
setupPythonService(service, undefined, [getServerInfoPath], Promise.resolve({ stdout: 'failure to get server infos' }));
setupPythonServiceExecObservable(service, 'jupyter', ['kernelspec', 'list'], [], []);
const dockerArgs = runInDocker ? ['--ip', '127.0.0.1'] : [];
setupPythonServiceExecObservable(service, 'jupyter', ['notebook', '--no-browser', /--notebook-dir=.*/, /--config=.*/, '--NotebookApp.iopub_data_rate_limit=10000000000.0', ...dockerArgs], [], notebookStdErr ? notebookStdErr : ['http://localhost:8888/?token=198']);
setupPythonServiceExecObservable(service, 'jupyter', ['notebook', '--no-browser', /--notebook-dir=.*/, /--config=.*/, '--NotebookApp.iopub_data_rate_limit=10000000000.0'], [], notebookStdErr ? notebookStdErr : ['http://localhost:8888/?token=198']);
}

function setupMissingKernelPythonService(service: TypeMoq.IMock<IPythonExecutionService>, notebookStdErr?: string[]) {
Expand Down Expand Up @@ -529,9 +527,6 @@ suite('Jupyter Execution', async () => {
}

function createExecution(activeInterpreter: PythonInterpreter, notebookStdErr?: string[], skipSearch?: boolean): JupyterExecutionFactory {
return createExecutionAndReturnProcessService(activeInterpreter, notebookStdErr, skipSearch).jupyterExecutionFactory;
}
function createExecutionAndReturnProcessService(activeInterpreter: PythonInterpreter, notebookStdErr?: string[], skipSearch?: boolean, runInDocker?: boolean): {workingPythonExecutionService: TypeMoq.IMock<IPythonExecutionService>; jupyterExecutionFactory: JupyterExecutionFactory} {
// Setup defaults
when(interpreterService.onDidChangeInterpreter).thenReturn(dummyEvent.event);
when(interpreterService.getActiveInterpreter()).thenResolve(activeInterpreter);
Expand All @@ -540,12 +535,10 @@ suite('Jupyter Execution', async () => {
when(interpreterService.getInterpreterDetails(match('/foo/baz/python.exe'))).thenResolve(missingKernelPython);
when(interpreterService.getInterpreterDetails(match('/bar/baz/python.exe'))).thenResolve(missingNotebookPython);
when(interpreterService.getInterpreterDetails(argThat(o => !o.includes || !o.includes('python')))).thenReject('Unknown interpreter');
if (runInDocker){
when(fileSystem.readFile('/proc/self/cgroup')).thenResolve('hello docker world');
}

// Create our working python and process service.
const workingService = createTypeMoq<IPythonExecutionService>('working');
setupWorkingPythonService(workingService, notebookStdErr, runInDocker);
setupWorkingPythonService(workingService, notebookStdErr);
const missingKernelService = createTypeMoq<IPythonExecutionService>('missingKernel');
setupMissingKernelPythonService(missingKernelService, notebookStdErr);
const missingNotebookService = createTypeMoq<IPythonExecutionService>('missingNotebook');
Expand Down Expand Up @@ -692,19 +685,6 @@ suite('Jupyter Execution', async () => {
await assert.isFulfilled(execution.connectToNotebookServer(), 'Should be able to start a server');
}).timeout(10000);

test('Includes correct args for running in docker', async () => {
const { workingPythonExecutionService, jupyterExecutionFactory} = createExecutionAndReturnProcessService(workingPython, undefined, undefined, true);
when(executionFactory.createDaemon(deepEqual({ daemonModule: PythonDaemonModule, pythonPath: workingPython.path }))).thenResolve(workingPythonExecutionService.object);

await assert.eventually.equal(jupyterExecutionFactory.isNotebookSupported(), true, 'Notebook not supported');
await assert.eventually.equal(jupyterExecutionFactory.isImportSupported(), true, 'Import not supported');
await assert.eventually.equal(jupyterExecutionFactory.isKernelSpecSupported(), true, 'Kernel Spec not supported');
await assert.eventually.equal(jupyterExecutionFactory.isKernelCreateSupported(), true, 'Kernel Create not supported');
const usableInterpreter = await jupyterExecutionFactory.getUsableJupyterPython();
assert.isOk(usableInterpreter, 'Usable interpreter not found');
await assert.isFulfilled(jupyterExecutionFactory.connectToNotebookServer(), 'Should be able to start a server');
}).timeout(10000);

test('Failing notebook throws exception', async () => {
const execution = createExecution(missingNotebookPython);
when(interpreterService.getInterpreters()).thenResolve([missingNotebookPython]);
Expand Down

0 comments on commit 0421d73

Please sign in to comment.