Show More
@@ -3,11 +3,15 | |||
|
3 | 3 | // Kernel tests |
|
4 | 4 | // |
|
5 | 5 | casper.notebook_test(function () { |
|
6 | this.then(function () { | |
|
7 | this.test.assert(this.kernel_running(), 'kernel: kernel is running'); | |
|
8 | }); | |
|
9 | ||
|
6 | 10 | this.evaluate(function () { |
|
7 | 11 | IPython.notebook.kernel.kernel_info( |
|
8 | 12 | function(msg){ |
|
9 | 13 | IPython._kernel_info_response = msg; |
|
10 | }) | |
|
14 | }); | |
|
11 | 15 | }); |
|
12 | 16 | |
|
13 | 17 | this.waitFor( |
@@ -26,39 +30,16 casper.notebook_test(function () { | |||
|
26 | 30 | }); |
|
27 | 31 | |
|
28 | 32 | this.thenEvaluate(function () { |
|
29 |
|
|
|
30 | IPython._channels = [ | |
|
31 | kernel.shell_channel, | |
|
32 | kernel.iopub_channel, | |
|
33 | kernel.stdin_channel | |
|
34 | ]; | |
|
35 | kernel.kill(); | |
|
33 | IPython.notebook.kernel.kill(); | |
|
36 | 34 | }); |
|
37 | 35 | |
|
38 | 36 | this.waitFor(function () { |
|
39 | return this.evaluate(function(){ | |
|
40 | for (var i=0; i < IPython._channels.length; i++) { | |
|
41 | var ws = IPython._channels[i]; | |
|
42 | if (ws.readyState !== ws.CLOSED) { | |
|
43 | return false; | |
|
44 | } | |
|
45 | } | |
|
46 | return true; | |
|
37 | return this.evaluate(function () { | |
|
38 | return IPython.notebook.kernel.is_fully_disconnected(); | |
|
47 | 39 | }); |
|
48 | 40 | }); |
|
49 | 41 | |
|
50 | 42 | this.then(function () { |
|
51 | var states = this.evaluate(function() { | |
|
52 | var states = []; | |
|
53 | for (var i = 0; i < IPython._channels.length; i++) { | |
|
54 | states.push(IPython._channels[i].readyState); | |
|
55 | } | |
|
56 | return states; | |
|
57 | }); | |
|
58 | ||
|
59 | for (var i = 0; i < states.length; i++) { | |
|
60 | this.test.assertEquals(states[i], WebSocket.CLOSED, | |
|
61 | "Kernel.kill closes websockets[" + i + "]"); | |
|
62 | } | |
|
43 | this.test.assert(!this.kernel_running(), 'kernel is not running'); | |
|
63 | 44 | }); |
|
64 | 45 | }); |
@@ -4,40 +4,21 | |||
|
4 | 4 | // |
|
5 | 5 | |
|
6 | 6 | casper.notebook_test(function () { |
|
7 |
this. |
|
|
8 | var kernel = IPython.notebook.session.kernel; | |
|
9 | IPython._channels = [ | |
|
10 | kernel.shell_channel, | |
|
11 | kernel.iopub_channel, | |
|
12 | kernel.stdin_channel | |
|
13 | ]; | |
|
7 | this.then(function () { | |
|
8 | this.test.assert(this.kernel_running(), 'session: kernel is running'); | |
|
9 | }); | |
|
10 | ||
|
11 | this.thenEvaluate(function () { | |
|
14 | 12 | IPython.notebook.session.delete(); |
|
15 | 13 | }); |
|
16 | ||
|
14 | ||
|
17 | 15 | this.waitFor(function () { |
|
18 | return this.evaluate(function(){ | |
|
19 | for (var i=0; i < IPython._channels.length; i++) { | |
|
20 | var ws = IPython._channels[i]; | |
|
21 | if (ws.readyState !== ws.CLOSED) { | |
|
22 | return false; | |
|
23 | } | |
|
24 | } | |
|
25 | return true; | |
|
16 | return this.evaluate(function () { | |
|
17 | return IPython.notebook.kernel.is_fully_disconnected(); | |
|
26 | 18 | }); |
|
27 | 19 | }); |
|
28 | 20 | |
|
29 | 21 | this.then(function () { |
|
30 | var states = this.evaluate(function() { | |
|
31 | var states = []; | |
|
32 | for (var i = 0; i < IPython._channels.length; i++) { | |
|
33 | states.push(IPython._channels[i].readyState); | |
|
34 | } | |
|
35 | return states; | |
|
36 | }); | |
|
37 | ||
|
38 | for (var i = 0; i < states.length; i++) { | |
|
39 | this.test.assertEquals(states[i], WebSocket.CLOSED, | |
|
40 | "Session.delete closes websockets[" + i + "]"); | |
|
41 | } | |
|
22 | this.test.assert(!this.kernel_running(), 'session deletes kernel'); | |
|
42 | 23 | }); |
|
43 | 24 | }); |
General Comments 0
You need to be logged in to leave comments.
Login now