Skip to content

Commit 6de643e

Browse files
committed
update test
1 parent 648e8f5 commit 6de643e

3 files changed

Lines changed: 18 additions & 6 deletions

File tree

js/tests/supervisord.test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,13 @@ sandboxTest('restart after jupyter kernel kill', async ({ sandbox }) => {
5757
// Expected — the kill may terminate the command handle
5858
}
5959

60-
// Code execution still works but the variable is undefined
60+
// First call after kill returns context restarted error
6161
const code2 = await sandbox.runCode('x')
62-
expect(code2.error!.value).toEqual("name 'x' is not defined")
62+
expect(code2.error!.value).toEqual('Context was restarted')
63+
64+
// Subsequent call works normally
65+
const code3 = await sandbox.runCode('y = 1; y')
66+
expect(code3.text).toEqual('1')
6367
})
6468

6569
sandboxTest('restart after code-interpreter kill', async ({ sandbox }) => {

python/tests/async/test_async_supervisord.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,14 @@ async def test_restart_after_jupyter_kernel_kill(async_sandbox: AsyncSandbox):
5252
except Exception:
5353
pass
5454

55-
# Code execution still works but the variable is undefined
55+
# First call after kill returns context restarted error
5656
result = await async_sandbox.run_code("x")
5757
assert result.error is not None
58-
assert result.error.value == "name 'x' is not defined"
58+
assert result.error.value == "Context was restarted"
59+
60+
# Subsequent call works normally
61+
result2 = await async_sandbox.run_code("y = 1; y")
62+
assert result2.text == "1"
5963

6064

6165
async def test_restart_after_code_interpreter_kill(async_sandbox: AsyncSandbox):

python/tests/sync/test_supervisord.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,14 @@ def test_restart_after_jupyter_kernel_kill(sandbox: Sandbox):
5050
except Exception:
5151
pass
5252

53-
# Code execution still works but the variable is undefined
53+
# First call after kill returns context restarted error
5454
result = sandbox.run_code("x")
5555
assert result.error is not None
56-
assert result.error.value == "name 'x' is not defined"
56+
assert result.error.value == "Context was restarted"
57+
58+
# Subsequent call works normally
59+
result2 = sandbox.run_code("y = 1; y")
60+
assert result2.text == "1"
5761

5862

5963
def test_restart_after_code_interpreter_kill(sandbox: Sandbox):

0 commit comments

Comments
 (0)