Commit 200be24b authored by Ludovic Courtès's avatar Ludovic Courtès
Browse files

kernels: Test "kernel_info_request".

* tests/kernels.scm ("run-kernel python3"): Try to get a "status"
message.
("kernel_info_request"): New test.
parent d88fb653
......@@ -39,7 +39,49 @@
(let ((kernel (run-kernel %context "python3" %kernel-key)))
(set! %kernel kernel)
(and (kernel? (pk 'kernel kernel))
(kill (kernel-pid kernel) 0))))
(begin
(kill (kernel-pid kernel) 0)
;; FIXME: For some reason, we don't always get a "starting" status
;; message. Thus, don't fail if we don't receive it.
(let ((greetings (read-message %kernel 3000)))
(or (not greetings)
(list (message-type greetings)
(hash-ref (json-string->scm
(message-content greetings))
"execution_state"))))))))
(unless %kernel (test-skip 1))
(test-equal "kernel_info_request"
"python"
(let ((request (message (header "kernel_info_request" "luser" "12345")
"{}")))
(send-message %kernel request)
(let* ((reply1 (read-message %kernel))
(reply2 (read-message %kernel))
(reply3 (read-message %kernel))
(replies (pk 'replies (list reply1 reply2 reply3))))
(and (every message? replies)
(string=? "status" (message-type reply1))
(string=? "busy"
(hash-ref (json-string->scm (message-content reply1))
"execution_state"))
(equal? (message-parent-header reply1) (message-header request))
(string=? "kernel_info_reply" (message-type reply2))
(equal? (message-parent-header reply2) (message-header request))
(string=? "status" (message-type reply3))
(string=? "idle"
(hash-ref (json-string->scm (message-content reply3))
"execution_state"))
(equal? (message-parent-header reply3) (message-header request))
(hash-ref (hash-ref
(json-string->scm (message-content reply2))
"language_info")
"name")))))
(unless %kernel (test-skip 1))
(test-equal "execute_request"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment