##// END OF EJS Templates
test kernel interrupt
Paul Ivanov -
Show More
@@ -0,0 +1,28 b''
1 //
2 // Test kernel interrupt
3 //
4 casper.notebook_test(function () {
5 this.evaluate(function () {
6 var cell = IPython.notebook.get_cell(0);
7 cell.set_text('import time\nfor x in range(3):\n time.sleep(1)');
8 cell.execute();
9 });
10
11 this.thenClick('li#int_kernel');
12
13 this.waitFor(function () {
14 return this.evaluate(function get_output() {
15 var cell = IPython.notebook.get_cell(0);
16 return cell.output_area.outputs.length != 0;
17 })
18 });
19
20 this.then(function () {
21 var result = this.evaluate(function () {
22 var cell = IPython.notebook.get_cell(0);
23 var output = cell.output_area.outputs[0].ename;
24 return output;
25 })
26 this.test.assertEquals(result, 'KeyboardInterrupt', 'keyboard interrupt')
27 });
28 });
@@ -1,32 +1,26 b''
1 1 //
2 2 // Test code cell execution.
3 3 //
4 4 casper.notebook_test(function () {
5 5 this.evaluate(function () {
6 6 var cell = IPython.notebook.get_cell(0);
7 7 cell.set_text('a=10; print(a)');
8 8 cell.execute();
9 9 });
10 10
11
12 11 this.waitFor(function () {
13 12 return this.evaluate(function get_output() {
14 13 var cell = IPython.notebook.get_cell(0);
15 14 return cell.output_area.outputs.length != 0;
16 15 })
17 }, null, function on_timeout() {
18 this.echo( this.evaluate( function() {
19 IPython.notebook.save_notebook();
20 return IPython.notebook.notebook_name;
21 }) + ".ipynb is the name of the notebook which failed");
22 16 });
23 17
24 18 this.then(function () {
25 19 var result = this.evaluate(function () {
26 20 var cell = IPython.notebook.get_cell(0);
27 21 var output = cell.output_area.outputs[0].text;
28 22 return output;
29 23 })
30 24 this.test.assertEquals(result, '10\n', 'stdout output matches')
31 25 });
32 26 });
General Comments 0
You need to be logged in to leave comments. Login now