File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -95,4 +95,26 @@ suite('REPL - Native REPL', () => {
9595 setReplDirectoryStub . restore ( ) ;
9696 setReplControllerSpy . restore ( ) ;
9797 } ) ;
98+
99+ test ( 'Closing REPL should dispose of the previous instance and create a new one on reopening' , async ( ) => {
100+ const disposeSpy = sinon . spy ( NativeRepl . prototype , 'dispose' ) ;
101+ const createStub = sinon . stub ( NativeRepl , 'create' ) . callThrough ( ) ;
102+ interpreterService
103+ . setup ( ( i ) => i . getActiveInterpreter ( TypeMoq . It . isAny ( ) ) )
104+ . returns ( ( ) => Promise . resolve ( ( { path : 'ps' } as unknown ) as PythonEnvironment ) ) ;
105+ const interpreter = await interpreterService . object . getActiveInterpreter ( ) ;
106+
107+ const firstRepl = await getNativeRepl ( interpreter as PythonEnvironment , disposableArray ) ;
108+
109+ firstRepl . dispose ( ) ;
110+
111+ const secondRepl = await getNativeRepl ( interpreter as PythonEnvironment , disposableArray ) ;
112+
113+ expect ( disposeSpy . calledOnce ) . to . be . true ;
114+ expect ( createStub . calledTwice ) . to . be . true ;
115+ expect ( firstRepl ) . to . not . equal ( secondRepl ) ;
116+
117+ disposeSpy . restore ( ) ;
118+ createStub . restore ( ) ;
119+ } ) ;
98120} ) ;
You can’t perform that action at this time.
0 commit comments