1
1
import { expect } from 'chai' ;
2
2
import * as path from 'path' ;
3
3
import { SemVer } from 'semver' ;
4
- import { anything , instance , mock , verify , when } from 'ts-mockito' ;
5
4
import * as TypeMoq from 'typemoq' ;
6
5
import {
7
6
ConfigurationTarget ,
@@ -15,17 +14,9 @@ import {
15
14
import { IApplicationShell , IWorkspaceService } from '../../client/common/application/types' ;
16
15
import { STANDARD_OUTPUT_CHANNEL } from '../../client/common/constants' ;
17
16
import { IFileSystem } from '../../client/common/platform/types' ;
18
- import {
19
- IInterpreterPathProxyService ,
20
- IDisposableRegistry ,
21
- IOutputChannel ,
22
- IPathUtils ,
23
- ReadWrite ,
24
- } from '../../client/common/types' ;
17
+ import { IDisposableRegistry , IOutputChannel , IPathUtils , ReadWrite } from '../../client/common/types' ;
25
18
import { Interpreters } from '../../client/common/utils/localize' ;
26
19
import { Architecture } from '../../client/common/utils/platform' ;
27
- import { InterpreterAutoSelectionService } from '../../client/interpreter/autoSelection' ;
28
- import { IInterpreterAutoSelectionService } from '../../client/interpreter/autoSelection/types' ;
29
20
import {
30
21
IInterpreterDisplay ,
31
22
IInterpreterHelper ,
@@ -57,12 +48,10 @@ suite('Interpreters Display', () => {
57
48
let fileSystem : TypeMoq . IMock < IFileSystem > ;
58
49
let disposableRegistry : Disposable [ ] ;
59
50
let statusBar : TypeMoq . IMock < StatusBarItem > ;
60
- let interpreterPathProxyService : TypeMoq . IMock < IInterpreterPathProxyService > ;
61
51
let interpreterDisplay : IInterpreterDisplay ;
62
52
let interpreterHelper : TypeMoq . IMock < IInterpreterHelper > ;
63
53
let pathUtils : TypeMoq . IMock < IPathUtils > ;
64
54
let output : TypeMoq . IMock < IOutputChannel > ;
65
- let autoSelection : IInterpreterAutoSelectionService ;
66
55
let python27SupportPrompt : TypeMoq . IMock < IPython27SupportPrompt > ;
67
56
68
57
setup ( ( ) => {
@@ -74,11 +63,9 @@ suite('Interpreters Display', () => {
74
63
interpreterHelper = TypeMoq . Mock . ofType < IInterpreterHelper > ( ) ;
75
64
disposableRegistry = [ ] ;
76
65
statusBar = TypeMoq . Mock . ofType < StatusBarItem > ( ) ;
77
- interpreterPathProxyService = TypeMoq . Mock . ofType < IInterpreterPathProxyService > ( ) ;
78
66
pathUtils = TypeMoq . Mock . ofType < IPathUtils > ( ) ;
79
67
output = TypeMoq . Mock . ofType < IOutputChannel > ( ) ;
80
68
python27SupportPrompt = TypeMoq . Mock . ofType < IPython27SupportPrompt > ( ) ;
81
- autoSelection = mock ( InterpreterAutoSelectionService ) ;
82
69
83
70
serviceContainer
84
71
. setup ( ( c ) => c . get ( TypeMoq . It . isValue ( IOutputChannel ) , STANDARD_OUTPUT_CHANNEL ) )
@@ -94,16 +81,10 @@ suite('Interpreters Display', () => {
94
81
. returns ( ( ) => interpreterService . object ) ;
95
82
serviceContainer . setup ( ( c ) => c . get ( TypeMoq . It . isValue ( IFileSystem ) ) ) . returns ( ( ) => fileSystem . object ) ;
96
83
serviceContainer . setup ( ( c ) => c . get ( TypeMoq . It . isValue ( IDisposableRegistry ) ) ) . returns ( ( ) => disposableRegistry ) ;
97
- serviceContainer
98
- . setup ( ( c ) => c . get ( TypeMoq . It . isValue ( IInterpreterPathProxyService ) ) )
99
- . returns ( ( ) => interpreterPathProxyService . object ) ;
100
84
serviceContainer
101
85
. setup ( ( c ) => c . get ( TypeMoq . It . isValue ( IInterpreterHelper ) ) )
102
86
. returns ( ( ) => interpreterHelper . object ) ;
103
87
serviceContainer . setup ( ( c ) => c . get ( TypeMoq . It . isValue ( IPathUtils ) ) ) . returns ( ( ) => pathUtils . object ) ;
104
- serviceContainer
105
- . setup ( ( c ) => c . get ( TypeMoq . It . isValue ( IInterpreterAutoSelectionService ) ) )
106
- . returns ( ( ) => instance ( autoSelection ) ) ;
107
88
serviceContainer
108
89
. setup ( ( c ) => c . get ( TypeMoq . It . isValue ( IPython27SupportPrompt ) ) )
109
90
. returns ( ( ) => python27SupportPrompt . object ) ;
@@ -148,7 +129,6 @@ suite('Interpreters Display', () => {
148
129
path : path . join ( 'user' , 'development' , 'env' , 'bin' , 'python' ) ,
149
130
} ;
150
131
setupWorkspaceFolder ( resource , workspaceFolder ) ;
151
- when ( autoSelection . autoSelectInterpreter ( anything ( ) ) ) . thenResolve ( ) ;
152
132
interpreterService
153
133
. setup ( ( i ) => i . getInterpreters ( TypeMoq . It . isValue ( workspaceFolder ) ) )
154
134
. returns ( ( ) => Promise . resolve ( [ ] ) ) ;
@@ -158,7 +138,6 @@ suite('Interpreters Display', () => {
158
138
159
139
await interpreterDisplay . refresh ( resource ) ;
160
140
161
- verify ( autoSelection . autoSelectInterpreter ( anything ( ) ) ) . once ( ) ;
162
141
statusBar . verify ( ( s ) => ( s . text = TypeMoq . It . isValue ( activeInterpreter . displayName ) ! ) , TypeMoq . Times . once ( ) ) ;
163
142
statusBar . verify ( ( s ) => ( s . tooltip = TypeMoq . It . isValue ( activeInterpreter . path ) ! ) , TypeMoq . Times . atLeastOnce ( ) ) ;
164
143
} ) ;
@@ -175,7 +154,6 @@ suite('Interpreters Display', () => {
175
154
. setup ( ( p ) => p . getDisplayName ( TypeMoq . It . isAny ( ) , TypeMoq . It . isAny ( ) ) )
176
155
. returns ( ( ) => activeInterpreter . path ) ;
177
156
setupWorkspaceFolder ( resource , workspaceFolder ) ;
178
- when ( autoSelection . autoSelectInterpreter ( anything ( ) ) ) . thenResolve ( ) ;
179
157
interpreterService
180
158
. setup ( ( i ) => i . getInterpreters ( TypeMoq . It . isValue ( workspaceFolder ) ) )
181
159
. returns ( ( ) => Promise . resolve ( [ ] ) ) ;
@@ -223,7 +201,6 @@ suite('Interpreters Display', () => {
223
201
interpreterService
224
202
. setup ( ( i ) => i . getActiveInterpreter ( TypeMoq . It . isValue ( workspaceFolder ) ) )
225
203
. returns ( ( ) => Promise . resolve ( undefined ) ) ;
226
- interpreterPathProxyService . setup ( ( c ) => c . get ( TypeMoq . It . isAny ( ) ) ) . returns ( ( ) => pythonPath ) ;
227
204
fileSystem . setup ( ( f ) => f . fileExists ( TypeMoq . It . isValue ( pythonPath ) ) ) . returns ( ( ) => Promise . resolve ( false ) ) ;
228
205
interpreterHelper
229
206
. setup ( ( v ) => v . getInterpreterInformation ( TypeMoq . It . isValue ( pythonPath ) ) )
@@ -278,7 +255,6 @@ suite('Interpreters Display', () => {
278
255
path : path . join ( 'user' , 'development' , 'env' , 'bin' , 'python' ) ,
279
256
} ;
280
257
setupWorkspaceFolder ( resource , workspaceFolder ) ;
281
- when ( autoSelection . autoSelectInterpreter ( anything ( ) ) ) . thenResolve ( ) ;
282
258
interpreterService
283
259
. setup ( ( i ) => i . getInterpreters ( TypeMoq . It . isValue ( workspaceFolder ) ) )
284
260
. returns ( ( ) => Promise . resolve ( [ ] ) ) ;
0 commit comments