@@ -17,6 +17,7 @@ import { Architecture } from '../../../../client/common/utils/platform';
1717import { JupyterInterpreterDependencyResponse , JupyterInterpreterDependencyService } from '../../../../client/datascience/jupyter/interpreter/jupyterInterpreterDependencyService' ;
1818import { InterpreterType , PythonInterpreter } from '../../../../client/interpreter/contracts' ;
1919
20+ // tslint:disable-next-line: max-func-body-length
2021suite ( 'Data Science - Jupyter Interpreter Configuration' , ( ) => {
2122 let configuration : JupyterInterpreterDependencyService ;
2223 let appShell : IApplicationShell ;
@@ -62,6 +63,24 @@ suite('Data Science - Jupyter Interpreter Configuration', () => {
6263 test ( 'Prompt to install if Jupyter is not installed' , async ( ) => testPromptIfModuleNotInstalled ( false , true ) ) ;
6364 test ( 'Prompt to install if notebook is not installed' , async ( ) => testPromptIfModuleNotInstalled ( true , false ) ) ;
6465 test ( 'Prompt to install if jupyter & notebook is not installed' , async ( ) => testPromptIfModuleNotInstalled ( false , false ) ) ;
66+ test ( 'Reinstall Jupyter if jupyter and notebook are installed but kernelspec is not found' , async ( ) => {
67+ when ( installer . isInstalled ( Product . jupyter , pythonInterpreter ) ) . thenResolve ( true ) ;
68+ when ( installer . isInstalled ( Product . notebook , pythonInterpreter ) ) . thenResolve ( true ) ;
69+ when ( appShell . showErrorMessage ( anything ( ) , anything ( ) , anything ( ) , anything ( ) ) ) . thenResolve (
70+ // tslint:disable-next-line: no-any
71+ DataScience . jupyterInstall ( ) as any
72+ ) ;
73+ when ( pythonExecService . execModule ( 'jupyter' , deepEqual ( [ 'kernelspec' , '--version' ] ) , anything ( ) ) ) . thenReject ( new Error ( 'Not found' ) ) ;
74+ when ( installer . install ( anything ( ) , anything ( ) , anything ( ) ) ) . thenResolve ( InstallerResponse . Installed ) ;
75+
76+ const response = await configuration . installMissingDependencies ( pythonInterpreter ) ;
77+
78+ // Jupyter must be installed & not kernelspec or anything else.
79+ verify ( installer . install ( Product . jupyter , anything ( ) , anything ( ) ) ) . once ( ) ;
80+ verify ( installer . install ( anything ( ) , anything ( ) , anything ( ) ) ) . once ( ) ;
81+ verify ( appShell . showErrorMessage ( anything ( ) , DataScience . jupyterInstall ( ) , DataScience . selectDifferentJupyterInterpreter ( ) , anything ( ) ) ) . once ( ) ;
82+ assert . equal ( response , JupyterInterpreterDependencyResponse . cancel ) ;
83+ } ) ;
6584
6685 async function testInstallationOfJupyter ( installerResponse : InstallerResponse , expectedConfigurationReponse : JupyterInterpreterDependencyResponse ) : Promise < void > {
6786 when ( installer . isInstalled ( Product . jupyter , pythonInterpreter ) ) . thenResolve ( false ) ;
0 commit comments