@@ -41,7 +41,7 @@ suite('Debugging - Config Resolver Launch', () => {
4141 folder . setup ( f  =>  f . uri ) . returns ( ( )  =>  Uri . file ( folderPath ) ) ; 
4242 return  folder . object ; 
4343 } 
44-  function  setupIoc ( pythonPath : string ,  isWindows : boolean  =  false ,  isMac : boolean  =  false ,  isLinux : boolean  =  false )  { 
44+  function  setupIoc ( pythonPath : string ,  workspaceFolder ?:  WorkspaceFolder ,   isWindows : boolean  =  false ,  isMac : boolean  =  false ,  isLinux : boolean  =  false )  { 
4545 const  confgService  =  TypeMoq . Mock . ofType < IConfigurationService > ( ) ; 
4646 workspaceService  =  TypeMoq . Mock . ofType < IWorkspaceService > ( ) ; 
4747 documentManager  =  TypeMoq . Mock . ofType < IDocumentManager > ( ) ; 
@@ -77,6 +77,9 @@ suite('Debugging - Config Resolver Launch', () => {
7777
7878 const  settings  =  TypeMoq . Mock . ofType < IPythonSettings > ( ) ; 
7979 settings . setup ( s  =>  s . pythonPath ) . returns ( ( )  =>  pythonPath ) ; 
80+  if  ( workspaceFolder )  { 
81+  settings . setup ( s  =>  s . envFile ) . returns ( ( )  =>  path . join ( workspaceFolder ! . uri . fsPath ,  '.env2' ) ) ; 
82+  } 
8083 confgService . setup ( c  =>  c . getSettings ( TypeMoq . It . isAny ( ) ) ) . returns ( ( )  =>  settings . object ) ; 
8184 setupOs ( isWindows ,  isMac ,  isLinux ) ; 
8285
@@ -109,7 +112,7 @@ suite('Debugging - Config Resolver Launch', () => {
109112 const  pythonPath  =  `PythonPath_${ new  Date ( ) . toString ( ) }  ; 
110113 const  workspaceFolder  =  createMoqWorkspaceFolder ( __dirname ) ; 
111114 const  pythonFile  =  'xyz.py' ; 
112-  setupIoc ( pythonPath ) ; 
115+  setupIoc ( pythonPath ,   workspaceFolder ) ; 
113116
114117 setupActiveEditor ( pythonFile ,  PYTHON_LANGUAGE ) ; 
115118
@@ -123,7 +126,7 @@ suite('Debugging - Config Resolver Launch', () => {
123126 expect ( debugConfig ) . to . have . property ( 'cwd' ) ; 
124127 expect ( debugConfig ! . cwd ! . toLowerCase ( ) ) . to . be . equal ( __dirname . toLowerCase ( ) ) ; 
125128 expect ( debugConfig ) . to . have . property ( 'envFile' ) ; 
126-  expect ( debugConfig ! . envFile ! . toLowerCase ( ) ) . to . be . equal ( path . join ( __dirname ,  '.env ' ) . toLowerCase ( ) ) ; 
129+  expect ( debugConfig ! . envFile ! . toLowerCase ( ) ) . to . be . equal ( path . join ( __dirname ,  '.env2 ' ) . toLowerCase ( ) ) ; 
127130 expect ( debugConfig ) . to . have . property ( 'env' ) ; 
128131 // tslint:disable-next-line:no-any 
129132 expect ( Object . keys ( ( debugConfig  as  any ) . env ) ) . to . have . lengthOf ( 0 ) ; 
@@ -132,7 +135,7 @@ suite('Debugging - Config Resolver Launch', () => {
132135 const  pythonPath  =  `PythonPath_${ new  Date ( ) . toString ( ) }  ; 
133136 const  workspaceFolder  =  createMoqWorkspaceFolder ( __dirname ) ; 
134137 const  pythonFile  =  'xyz.py' ; 
135-  setupIoc ( pythonPath ) ; 
138+  setupIoc ( pythonPath ,   workspaceFolder ) ; 
136139 setupActiveEditor ( pythonFile ,  PYTHON_LANGUAGE ) ; 
137140
138141 const  debugConfig  =  await  debugProvider . resolveDebugConfiguration ! ( workspaceFolder ,  {  noDebug : true  }  as  any  as  DebugConfiguration ) ; 
@@ -145,15 +148,15 @@ suite('Debugging - Config Resolver Launch', () => {
145148 expect ( debugConfig ) . to . have . property ( 'cwd' ) ; 
146149 expect ( debugConfig ! . cwd ! . toLowerCase ( ) ) . to . be . equal ( __dirname . toLowerCase ( ) ) ; 
147150 expect ( debugConfig ) . to . have . property ( 'envFile' ) ; 
148-  expect ( debugConfig ! . envFile ! . toLowerCase ( ) ) . to . be . equal ( path . join ( __dirname ,  '.env ' ) . toLowerCase ( ) ) ; 
151+  expect ( debugConfig ! . envFile ! . toLowerCase ( ) ) . to . be . equal ( path . join ( __dirname ,  '.env2 ' ) . toLowerCase ( ) ) ; 
149152 expect ( debugConfig ) . to . have . property ( 'env' ) ; 
150153 // tslint:disable-next-line:no-any 
151154 expect ( Object . keys ( ( debugConfig  as  any ) . env ) ) . to . have . lengthOf ( 0 ) ; 
152155 } ) ; 
153156 test ( 'Defaults should be returned when an empty object is passed without Workspace Folder, no workspaces and active file' ,  async  ( )  =>  { 
154157 const  pythonPath  =  `PythonPath_${ new  Date ( ) . toString ( ) }  ; 
155158 const  pythonFile  =  'xyz.py' ; 
156-  setupIoc ( pythonPath ) ; 
159+  setupIoc ( pythonPath ,   createMoqWorkspaceFolder ( path . dirname ( pythonFile ) ) ) ; 
157160 setupActiveEditor ( pythonFile ,  PYTHON_LANGUAGE ) ; 
158161 setupWorkspaces ( [ ] ) ; 
159162
@@ -168,7 +171,7 @@ suite('Debugging - Config Resolver Launch', () => {
168171 expect ( debugConfig ) . to . have . property ( 'cwd' ) ; 
169172 expect ( debugConfig ! . cwd ! . toLowerCase ( ) ) . to . be . equal ( filePath . toLowerCase ( ) ) ; 
170173 expect ( debugConfig ) . to . have . property ( 'envFile' ) ; 
171-  expect ( debugConfig ! . envFile ! . toLowerCase ( ) ) . to . be . equal ( path . join ( filePath ,  '.env ' ) . toLowerCase ( ) ) ; 
174+  expect ( debugConfig ! . envFile ! . toLowerCase ( ) ) . to . be . equal ( path . join ( filePath ,  '.env2 ' ) . toLowerCase ( ) ) ; 
172175 expect ( debugConfig ) . to . have . property ( 'env' ) ; 
173176 // tslint:disable-next-line:no-any 
174177 expect ( Object . keys ( ( debugConfig  as  any ) . env ) ) . to . have . lengthOf ( 0 ) ; 
@@ -215,9 +218,9 @@ suite('Debugging - Config Resolver Launch', () => {
215218 test ( 'Defaults should be returned when an empty object is passed without Workspace Folder, with a workspace and an active python file' ,  async  ( )  =>  { 
216219 const  pythonPath  =  `PythonPath_${ new  Date ( ) . toString ( ) }  ; 
217220 const  activeFile  =  'xyz.py' ; 
218-  setupIoc ( pythonPath ) ; 
219-  setupActiveEditor ( activeFile ,  PYTHON_LANGUAGE ) ; 
220221 const  defaultWorkspace  =  path . join ( 'usr' ,  'desktop' ) ; 
222+  setupIoc ( pythonPath ,  createMoqWorkspaceFolder ( defaultWorkspace ) ) ; 
223+  setupActiveEditor ( activeFile ,  PYTHON_LANGUAGE ) ; 
221224 setupWorkspaces ( [ defaultWorkspace ] ) ; 
222225
223226 const  debugConfig  =  await  debugProvider . resolveDebugConfiguration ! ( undefined ,  { }  as  DebugConfiguration ) ; 
@@ -231,7 +234,7 @@ suite('Debugging - Config Resolver Launch', () => {
231234 expect ( debugConfig ) . to . have . property ( 'cwd' ) ; 
232235 expect ( debugConfig ! . cwd ! . toLowerCase ( ) ) . to . be . equal ( filePath . toLowerCase ( ) ) ; 
233236 expect ( debugConfig ) . to . have . property ( 'envFile' ) ; 
234-  expect ( debugConfig ! . envFile ! . toLowerCase ( ) ) . to . be . equal ( path . join ( filePath ,  '.env ' ) . toLowerCase ( ) ) ; 
237+  expect ( debugConfig ! . envFile ! . toLowerCase ( ) ) . to . be . equal ( path . join ( filePath ,  '.env2 ' ) . toLowerCase ( ) ) ; 
235238 expect ( debugConfig ) . to . have . property ( 'env' ) ; 
236239 // tslint:disable-next-line:no-any 
237240 expect ( Object . keys ( ( debugConfig  as  any ) . env ) ) . to . have . lengthOf ( 0 ) ; 
@@ -314,7 +317,7 @@ suite('Debugging - Config Resolver Launch', () => {
314317 const  pythonPath  =  `PythonPath_${ new  Date ( ) . toString ( ) }  ; 
315318 const  workspaceFolder  =  createMoqWorkspaceFolder ( __dirname ) ; 
316319 const  pythonFile  =  'xyz.py' ; 
317-  setupIoc ( pythonPath ,  isWindows ,  isMac ,  isLinux ) ; 
320+  setupIoc ( pythonPath ,  undefined ,   isWindows ,  isMac ,  isLinux ) ; 
318321 setupActiveEditor ( pythonFile ,  PYTHON_LANGUAGE ) ; 
319322
320323 const  debugConfig  =  await  debugProvider . resolveDebugConfiguration ! ( workspaceFolder ,  { }  as  DebugConfiguration ) ; 
@@ -342,7 +345,7 @@ suite('Debugging - Config Resolver Launch', () => {
342345 const  workspaceFolder  =  createMoqWorkspaceFolder ( workspacePath ) ; 
343346 const  pythonFile  =  'xyz.py' ; 
344347
345-  setupIoc ( pythonPath ,  isWindows ,  isMac ,  isLinux ) ; 
348+  setupIoc ( pythonPath ,  undefined ,   isWindows ,  isMac ,  isLinux ) ; 
346349 setupActiveEditor ( pythonFile ,  PYTHON_LANGUAGE ) ; 
347350
348351 if  ( pyramidExists )  { 
0 commit comments