Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add js kernel_info request #4847

Merged
merged 5 commits into from Jan 24, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 18 additions & 0 deletions IPython/html/static/services/kernels/js/kernel.js
Expand Up @@ -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
*
Expand Down
28 changes: 28 additions & 0 deletions IPython/html/tests/casperjs/test_cases/kernel_test.js
@@ -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');
});

});