@@ -30,15 +30,19 @@ suite('Interpreters - Auto Selection - Base Rule', () => {
3030 public async next ( resource : Resource , manager ?: IInterpreterAutoSelectionService ) : Promise < void > {
3131 return super . next ( resource , manager ) ;
3232 }
33+
3334 public async cacheSelectedInterpreter ( resource : Resource , interpreter : PythonEnvironment | undefined ) {
3435 return super . cacheSelectedInterpreter ( resource , interpreter ) ;
3536 }
37+
3638 public async setGlobalInterpreter (
3739 interpreter ?: PythonEnvironment ,
3840 manager ?: IInterpreterAutoSelectionService ,
3941 ) : Promise < boolean > {
4042 return super . setGlobalInterpreter ( interpreter , manager ) ;
4143 }
44+
45+ // eslint-disable-next-line class-methods-use-this
4246 protected async onAutoSelectInterpreter (
4347 _resource : Uri ,
4448 _manager ?: IInterpreterAutoSelectionService ,
@@ -97,7 +101,7 @@ suite('Interpreters - Auto Selection - Base Rule', () => {
97101 } ) ;
98102 test ( 'State store must be updated' , async ( ) => {
99103 const resource = Uri . parse ( 'x' ) ;
100- const interpreterInfo = { x : '1324' } as any ;
104+ const interpreterInfo = ( { x : '1324' } as unknown ) as PythonEnvironment ;
101105 when ( state . updateValue ( anything ( ) ) ) . thenResolve ( ) ;
102106
103107 await rule . cacheSelectedInterpreter ( resource , interpreterInfo ) ;
@@ -106,7 +110,7 @@ suite('Interpreters - Auto Selection - Base Rule', () => {
106110 } ) ;
107111 test ( 'State store must be cleared when file does not exist' , async ( ) => {
108112 const resource = Uri . parse ( 'x' ) ;
109- const interpreterInfo = { path : '1324' } as any ;
113+ const interpreterInfo = ( { path : '1324' } as unknown ) as PythonEnvironment ;
110114 when ( state . value ) . thenReturn ( interpreterInfo ) ;
111115 when ( state . updateValue ( anything ( ) ) ) . thenResolve ( ) ;
112116 when ( fs . fileExists ( interpreterInfo . path ) ) . thenResolve ( false ) ;
@@ -119,7 +123,7 @@ suite('Interpreters - Auto Selection - Base Rule', () => {
119123 } ) ;
120124 test ( 'State store must not be cleared when file exists' , async ( ) => {
121125 const resource = Uri . parse ( 'x' ) ;
122- const interpreterInfo = { path : '1324' } as any ;
126+ const interpreterInfo = ( { path : '1324' } as unknown ) as PythonEnvironment ;
123127 when ( state . value ) . thenReturn ( interpreterInfo ) ;
124128 when ( state . updateValue ( anything ( ) ) ) . thenResolve ( ) ;
125129 when ( fs . fileExists ( interpreterInfo . path ) ) . thenResolve ( true ) ;
@@ -139,15 +143,15 @@ suite('Interpreters - Auto Selection - Base Rule', () => {
139143 } ) ;
140144 test ( 'Get value from state store' , async ( ) => {
141145 const stateStoreValue = 'x' ;
142- when ( state . value ) . thenReturn ( stateStoreValue as any ) ;
146+ when ( state . value ) . thenReturn ( ( stateStoreValue as unknown ) as PythonEnvironment ) ;
143147
144148 expect ( rule . getPreviouslyAutoSelectedInterpreter ( Uri . parse ( 'x' ) ) ) . to . be . equal ( stateStoreValue ) ;
145149
146150 verify ( state . value ) . atLeast ( 1 ) ;
147151 } ) ;
148152 test ( 'setGlobalInterpreter should do nothing if interpreter is undefined or version is empty' , async ( ) => {
149153 const manager = mock ( InterpreterAutoSelectionService ) ;
150- const interpreterInfo = { path : '1324' } as any ;
154+ const interpreterInfo = ( { path : '1324' } as unknown ) as PythonEnvironment ;
151155
152156 const result1 = await rule . setGlobalInterpreter ( undefined , instance ( manager ) ) ;
153157 const result2 = await rule . setGlobalInterpreter ( interpreterInfo , instance ( manager ) ) ;
@@ -158,8 +162,8 @@ suite('Interpreters - Auto Selection - Base Rule', () => {
158162 } ) ;
159163 test ( 'setGlobalInterpreter should not update manager if interpreter is not better than one stored in manager' , async ( ) => {
160164 const manager = mock ( InterpreterAutoSelectionService ) ;
161- const interpreterInfo = { path : '1324' , version : new SemVer ( '1.0.0' ) } as any ;
162- const interpreterInfoInManager = { path : '2' , version : new SemVer ( '2.0.0' ) } as any ;
165+ const interpreterInfo = ( { path : '1324' , version : new SemVer ( '1.0.0' ) } as unknown ) as PythonEnvironment ;
166+ const interpreterInfoInManager = ( { path : '2' , version : new SemVer ( '2.0.0' ) } as unknown ) as PythonEnvironment ;
163167 when ( manager . getAutoSelectedInterpreter ( undefined ) ) . thenReturn ( interpreterInfoInManager ) ;
164168
165169 const result = await rule . setGlobalInterpreter ( interpreterInfo , instance ( manager ) ) ;
@@ -170,8 +174,8 @@ suite('Interpreters - Auto Selection - Base Rule', () => {
170174 } ) ;
171175 test ( 'setGlobalInterpreter should update manager if interpreter is better than one stored in manager' , async ( ) => {
172176 const manager = mock ( InterpreterAutoSelectionService ) ;
173- const interpreterInfo = { path : '1324' , version : new SemVer ( '3.0.0' ) } as any ;
174- const interpreterInfoInManager = { path : '2' , version : new SemVer ( '2.0.0' ) } as any ;
177+ const interpreterInfo = ( { path : '1324' , version : new SemVer ( '3.0.0' ) } as unknown ) as PythonEnvironment ;
178+ const interpreterInfoInManager = ( { path : '2' , version : new SemVer ( '2.0.0' ) } as unknown ) as PythonEnvironment ;
175179 when ( manager . getAutoSelectedInterpreter ( undefined ) ) . thenReturn ( interpreterInfoInManager ) ;
176180
177181 const result = await rule . setGlobalInterpreter ( interpreterInfo , instance ( manager ) ) ;
0 commit comments