Merge pull request #4847 from Carreau/js-kernel-info

add js kernel_info request
This commit is contained in:
Min RK 2014-01-24 12:20:12 -08:00
commit b5a85af6e5
2 changed files with 46 additions and 0 deletions

View File

@ -242,6 +242,24 @@ var IPython = (function (IPython) {
return msg.header.msg_id;
};
/**
* Get kernel info
*
* @param callback {function}
* @method object_info
*
* When calling this method, pass a callback function that expects one argument.
* The callback will be passed the complete `kernel_info_reply` message documented
* [here](http://ipython.org/ipython-doc/dev/development/messaging.html#kernel-info)
*/
Kernel.prototype.kernel_info = function (callback) {
var callbacks;
if (callback) {
callbacks = { shell : { reply : callback } };
}
return this.send_shell_message("kernel_info_request", {}, callbacks);
};
/**
* Get info on an object
*

View File

@ -0,0 +1,28 @@
//
// Miscellaneous javascript tests
//
casper.notebook_test(function () {
this.evaluate(function () {
IPython.notebook.kernel.kernel_info(
function(msg){
IPython._kernel_info_response = msg;
})
});
this.waitFor(
function () {
return this.evaluate(function(){
return IPython._kernel_info_response;
});
});
this.then(function () {
var kernel_info_response = this.evaluate(function(){
return IPython._kernel_info_response;
});
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');
});
});