From fe605194103fb9c481f95b5ae91e4f1722fccd69 Mon Sep 17 00:00:00 2001 From: Paul Ivanov Date: Wed, 16 Oct 2013 11:37:25 -0700 Subject: [PATCH] test kernel interrupt --- .../casperjs/test_cases/check_interrupt.js | 28 +++++++++++++++++++ .../casperjs/test_cases/execute_code_cell.js | 6 ---- 2 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 IPython/html/tests/casperjs/test_cases/check_interrupt.js diff --git a/IPython/html/tests/casperjs/test_cases/check_interrupt.js b/IPython/html/tests/casperjs/test_cases/check_interrupt.js new file mode 100644 index 000000000..2bfc96c7a --- /dev/null +++ b/IPython/html/tests/casperjs/test_cases/check_interrupt.js @@ -0,0 +1,28 @@ +// +// Test kernel interrupt +// +casper.notebook_test(function () { + this.evaluate(function () { + var cell = IPython.notebook.get_cell(0); + cell.set_text('import time\nfor x in range(3):\n time.sleep(1)'); + cell.execute(); + }); + + this.thenClick('li#int_kernel'); + + this.waitFor(function () { + return this.evaluate(function get_output() { + var cell = IPython.notebook.get_cell(0); + return cell.output_area.outputs.length != 0; + }) + }); + + this.then(function () { + var result = this.evaluate(function () { + var cell = IPython.notebook.get_cell(0); + var output = cell.output_area.outputs[0].ename; + return output; + }) + this.test.assertEquals(result, 'KeyboardInterrupt', 'keyboard interrupt') + }); +}); diff --git a/IPython/html/tests/casperjs/test_cases/execute_code_cell.js b/IPython/html/tests/casperjs/test_cases/execute_code_cell.js index 284a5e0bb..08cfa723f 100644 --- a/IPython/html/tests/casperjs/test_cases/execute_code_cell.js +++ b/IPython/html/tests/casperjs/test_cases/execute_code_cell.js @@ -8,17 +8,11 @@ casper.notebook_test(function () { cell.execute(); }); - this.waitFor(function () { return this.evaluate(function get_output() { var cell = IPython.notebook.get_cell(0); return cell.output_area.outputs.length != 0; }) - }, null, function on_timeout() { - this.echo( this.evaluate( function() { - IPython.notebook.save_notebook(); - return IPython.notebook.notebook_name; - }) + ".ipynb is the name of the notebook which failed"); }); this.then(function () {