test kernel interrupt

This commit is contained in:
Paul Ivanov 2013-10-16 11:37:25 -07:00
parent e8fba5dd6d
commit fe60519410
2 changed files with 28 additions and 6 deletions

View File

@ -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')
});
});

View File

@ -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 () {