##// END OF EJS Templates
Return a proper JSON object
Return a proper JSON object

File last commit:

r17640:5d9d0dac
r18065:bbf6cb02
Show More
kernel.js
64 lines | 1.9 KiB | application/javascript | JavascriptLexer
Matthias BUSSONNIER
add kernel test
r14718
//
MinRK
JS: close WebSockets when killing kernels...
r17640 // Kernel tests
Matthias BUSSONNIER
add kernel test
r14718 //
casper.notebook_test(function () {
this.evaluate(function () {
IPython.notebook.kernel.kernel_info(
function(msg){
MinRK
JS: close WebSockets when killing kernels...
r17640 IPython._kernel_info_response = msg;
Matthias BUSSONNIER
add kernel test
r14718 })
});
this.waitFor(
function () {
return this.evaluate(function(){
return IPython._kernel_info_response;
});
});
Matthias BUSSONNIER
fix js formatting
r14719 this.then(function () {
Matthias BUSSONNIER
typo
r14722 var kernel_info_response = this.evaluate(function(){
Matthias BUSSONNIER
fix js formatting
r14719 return IPython._kernel_info_response;
Matthias BUSSONNIER
add kernel test
r14718 });
this.test.assertTrue( kernel_info_response.msg_type === 'kernel_info_reply', 'Kernel info request return kernel_info_reply');
this.test.assertTrue( kernel_info_response.content !== undefined, 'Kernel_info_reply is not undefined');
Matthias BUSSONNIER
fix js formatting
r14719 });
MinRK
JS: close WebSockets when killing kernels...
r17640
this.thenEvaluate(function () {
var kernel = IPython.notebook.session.kernel;
IPython._channels = [
kernel.shell_channel,
kernel.iopub_channel,
kernel.stdin_channel
];
kernel.kill();
});
this.waitFor(function () {
return this.evaluate(function(){
for (var i=0; i < IPython._channels.length; i++) {
var ws = IPython._channels[i];
if (ws.readyState !== ws.CLOSED) {
return false;
}
}
return true;
});
});
this.then(function () {
var states = this.evaluate(function() {
var states = [];
for (var i = 0; i < IPython._channels.length; i++) {
states.push(IPython._channels[i].readyState);
}
return states;
});
for (var i = 0; i < states.length; i++) {
this.test.assertEquals(states[i], WebSocket.CLOSED,
"Kernel.kill closes websockets[" + i + "]");
}
});
Matthias BUSSONNIER
add kernel test
r14718 });