@@ -5,15 +5,7 @@ import { Uri, workspace } from 'vscode';
55import { IDisposable } from '../../../platform/common/types' ;
66import { captureScreenShot , IExtensionTestApi } from '../../common.node' ;
77import { EXTENSION_ROOT_DIR_FOR_TESTS , initialize } from '../../initialize.node' ;
8- import {
9- closeNotebooksAndCleanUpAfterTests ,
10- startJupyterServer ,
11- waitForExecutionCompletedSuccessfully ,
12- getCellOutputs ,
13- getDefaultKernelConnection
14- } from './helper.node' ;
15- import { IKernel , IKernelProvider , INotebookKernelExecution } from '../../../kernels/types' ;
16- import { createKernelController , TestNotebookDocument } from './executionHelper' ;
8+ import { closeNotebooksAndCleanUpAfterTests } from './helper.node' ;
179import { logger } from '../../../platform/logging' ;
1810import { IDeepnoteNotebookManager } from '../../../notebooks/types' ;
1911
@@ -24,33 +16,13 @@ suite('Deepnote Integration Tests @kernelCore', function () {
2416 const deepnoteFilePath = Uri . file (
2517 path . join ( EXTENSION_ROOT_DIR_FOR_TESTS , 'src' , 'test' , 'datascience' , 'notebook' , 'test.deepnote' )
2618 ) ;
27- this . timeout ( 120_000 ) ;
28- let notebook : TestNotebookDocument ;
29- let kernel : IKernel ;
30- let kernelExecution : INotebookKernelExecution ;
19+ this . timeout ( 240_000 ) ;
3120
3221 suiteSetup ( async function ( ) {
3322 logger . info ( 'Suite Setup VS Code Notebook - Deepnote Integration' ) ;
34- this . timeout ( 120_000 ) ;
23+ this . timeout ( 240_000 ) ;
3524 try {
3625 api = await initialize ( ) ;
37- logger . debug ( 'Before starting Jupyter' ) ;
38- await startJupyterServer ( ) ;
39- logger . debug ( 'After starting Jupyter' ) ;
40-
41- notebook = new TestNotebookDocument ( deepnoteFilePath ) ;
42-
43- const kernelProvider = api . serviceContainer . get < IKernelProvider > ( IKernelProvider ) ;
44- logger . debug ( 'Before creating kernel connection' ) ;
45- const metadata = await getDefaultKernelConnection ( ) ;
46- logger . debug ( 'After creating kernel connection' ) ;
47-
48- const controller = createKernelController ( ) ;
49- kernel = kernelProvider . getOrCreate ( notebook , { metadata, resourceUri : notebook . uri , controller } ) ;
50- logger . debug ( 'Before starting kernel' ) ;
51- await kernel . start ( ) ;
52- logger . debug ( 'After starting kernel' ) ;
53- kernelExecution = kernelProvider . getKernelExecution ( kernel ) ;
5426 logger . info ( 'Suite Setup (completed)' ) ;
5527 } catch ( e ) {
5628 logger . error ( 'Suite Setup (failed) - Deepnote Integration' , e ) ;
@@ -60,7 +32,6 @@ suite('Deepnote Integration Tests @kernelCore', function () {
6032 } ) ;
6133
6234 setup ( function ( ) {
63- notebook . cells . length = 0 ;
6435 logger . info ( `Start Test (completed) ${ this . currentTest ?. title } ` ) ;
6536 } ) ;
6637
@@ -77,6 +48,7 @@ suite('Deepnote Integration Tests @kernelCore', function () {
7748 logger . debug ( 'Test: Load .deepnote file - starting' ) ;
7849
7950 const notebookManager = api . serviceContainer . get < IDeepnoteNotebookManager > ( IDeepnoteNotebookManager ) ;
51+ assert . isOk ( notebookManager , 'Notebook manager should be available' ) ;
8052
8153 notebookManager . selectNotebookForProject ( 'test-project-id' , 'main-notebook-id' ) ;
8254
@@ -93,100 +65,12 @@ suite('Deepnote Integration Tests @kernelCore', function () {
9365 logger . debug ( 'Test: Load .deepnote file - completed' ) ;
9466 } ) ;
9567
96- test ( 'Kernel starts for .deepnote file' , async function ( ) {
97- logger . debug ( 'Test: Kernel starts for .deepnote file - starting' ) ;
98-
99- assert . isOk ( kernel , 'Kernel should exist' ) ;
100- assert . isOk ( kernel . session , 'Kernel session should exist' ) ;
101-
102- logger . debug ( 'Test: Kernel starts for .deepnote file - completed' ) ;
103- } ) ;
104-
105- test ( 'Init notebook executes automatically' , async function ( ) {
106- logger . debug ( 'Test: Init notebook executes automatically - starting' ) ;
68+ test ( 'Extension services are available' , async function ( ) {
69+ logger . debug ( 'Test: Extension services are available - starting' ) ;
10770
10871 const notebookManager = api . serviceContainer . get < IDeepnoteNotebookManager > ( IDeepnoteNotebookManager ) ;
72+ assert . isOk ( notebookManager , 'Notebook manager should be available' ) ;
10973
110- notebookManager . selectNotebookForProject ( 'test-project-id' , 'main-notebook-id' ) ;
111-
112- await workspace . openNotebookDocument ( deepnoteFilePath ) ;
113-
114- const hasInitNotebookRun = notebookManager . hasInitNotebookBeenRun ( 'test-project-id' ) ;
115- assert . isTrue ( hasInitNotebookRun , 'Init notebook should have been executed automatically when kernel started' ) ;
116-
117- const cell = await notebook . appendCodeCell (
118- 'import sys; print("Init notebook executed" if "sys" in globals() else "Init notebook not executed")'
119- ) ;
120- await Promise . all ( [ kernelExecution . executeCell ( cell ) , waitForExecutionCompletedSuccessfully ( cell ) ] ) ;
121-
122- const output = getCellOutputs ( cell ) ;
123- assert . include (
124- output ,
125- 'Init notebook executed' ,
126- 'Init notebook should have executed and set up the environment'
127- ) ;
128-
129- logger . debug ( 'Test: Init notebook executes automatically - completed' ) ;
130- } ) ;
131-
132- test ( 'Execute code block' , async function ( ) {
133- logger . debug ( 'Test: Execute code block - starting' ) ;
134-
135- const cell = await notebook . appendCodeCell ( 'print("Hello World")' ) ;
136-
137- await Promise . all ( [ kernelExecution . executeCell ( cell ) , waitForExecutionCompletedSuccessfully ( cell ) ] ) ;
138-
139- assert . isAtLeast ( cell . executionSummary ?. executionOrder || 0 , 1 , 'Cell should have execution order' ) ;
140- assert . isTrue ( cell . executionSummary ?. success , 'Cell execution should succeed' ) ;
141- assert . isAtLeast ( cell . outputs . length , 1 , 'Cell should have output' ) ;
142-
143- const output = getCellOutputs ( cell ) ;
144- assert . include ( output , 'Hello World' , 'Output should contain "Hello World"' ) ;
145-
146- logger . debug ( 'Test: Execute code block - completed' ) ;
147- } ) ;
148-
149- test ( 'Execute multiple code blocks' , async function ( ) {
150- logger . debug ( 'Test: Execute multiple code blocks - starting' ) ;
151-
152- const cell1 = await notebook . appendCodeCell ( 'x = 42' ) ;
153- const cell2 = await notebook . appendCodeCell ( 'print(f"The answer is {x}")' ) ;
154-
155- await Promise . all ( [
156- kernelExecution . executeCell ( cell1 ) ,
157- waitForExecutionCompletedSuccessfully ( cell1 ) ,
158- kernelExecution . executeCell ( cell2 ) ,
159- waitForExecutionCompletedSuccessfully ( cell2 )
160- ] ) ;
161-
162- assert . isAtLeast ( cell1 . executionSummary ?. executionOrder || 0 , 1 , 'First cell should have execution order' ) ;
163- assert . isTrue ( cell1 . executionSummary ?. success , 'First cell execution should succeed' ) ;
164-
165- assert . isAtLeast ( cell2 . executionSummary ?. executionOrder || 0 , 1 , 'Second cell should have execution order' ) ;
166- assert . isTrue ( cell2 . executionSummary ?. success , 'Second cell execution should succeed' ) ;
167- assert . isAtLeast ( cell2 . outputs . length , 1 , 'Second cell should have output' ) ;
168-
169- const output = getCellOutputs ( cell2 ) ;
170- assert . include ( output , 'The answer is 42' , 'Output should contain "The answer is 42"' ) ;
171-
172- logger . debug ( 'Test: Execute multiple code blocks - completed' ) ;
173- } ) ;
174-
175- test ( 'Verify cell output validation' , async function ( ) {
176- logger . debug ( 'Test: Verify cell output validation - starting' ) ;
177-
178- const cell = await notebook . appendCodeCell ( 'for i in range(3):\n print(f"Line {i}")' ) ;
179-
180- await Promise . all ( [ kernelExecution . executeCell ( cell ) , waitForExecutionCompletedSuccessfully ( cell ) ] ) ;
181-
182- assert . isTrue ( cell . executionSummary ?. success , 'Cell execution should succeed' ) ;
183- assert . isAtLeast ( cell . outputs . length , 1 , 'Cell should have output' ) ;
184-
185- const output = getCellOutputs ( cell ) ;
186- assert . include ( output , 'Line 0' , 'Output should contain "Line 0"' ) ;
187- assert . include ( output , 'Line 1' , 'Output should contain "Line 1"' ) ;
188- assert . include ( output , 'Line 2' , 'Output should contain "Line 2"' ) ;
189-
190- logger . debug ( 'Test: Verify cell output validation - completed' ) ;
74+ logger . debug ( 'Test: Extension services are available - completed' ) ;
19175 } ) ;
19276} ) ;
0 commit comments