@@ -17,6 +17,7 @@ import { Architecture } from '../../../../client/common/utils/platform';
17
17
import { JupyterInterpreterDependencyResponse , JupyterInterpreterDependencyService } from '../../../../client/datascience/jupyter/interpreter/jupyterInterpreterDependencyService' ;
18
18
import { InterpreterType , PythonInterpreter } from '../../../../client/interpreter/contracts' ;
19
19
20
+ // tslint:disable-next-line: max-func-body-length
20
21
suite ( 'Data Science - Jupyter Interpreter Configuration' , ( ) => {
21
22
let configuration : JupyterInterpreterDependencyService ;
22
23
let appShell : IApplicationShell ;
@@ -62,6 +63,24 @@ suite('Data Science - Jupyter Interpreter Configuration', () => {
62
63
test ( 'Prompt to install if Jupyter is not installed' , async ( ) => testPromptIfModuleNotInstalled ( false , true ) ) ;
63
64
test ( 'Prompt to install if notebook is not installed' , async ( ) => testPromptIfModuleNotInstalled ( true , false ) ) ;
64
65
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
+ } ) ;
65
84
66
85
async function testInstallationOfJupyter ( installerResponse : InstallerResponse , expectedConfigurationReponse : JupyterInterpreterDependencyResponse ) : Promise < void > {
67
86
when ( installer . isInstalled ( Product . jupyter , pythonInterpreter ) ) . thenResolve ( false ) ;
0 commit comments