mirror of
https://github.com/jupyter/notebook.git
synced 2025-03-19 13:20:36 +08:00
Merge pull request #4847 from Carreau/js-kernel-info
add js kernel_info request
This commit is contained in:
commit
b5a85af6e5
@ -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
|
||||
*
|
||||
|
28
IPython/html/tests/casperjs/test_cases/kernel_test.js
Normal file
28
IPython/html/tests/casperjs/test_cases/kernel_test.js
Normal 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');
|
||||
});
|
||||
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user