Update heartbeat channel tests to take into account implementation changes

This commit is contained in:
Nathaniel Nicandro 2018-01-07 14:16:17 -06:00
parent 9e2db2146b
commit 346cdc78c8

View file

@ -220,18 +220,19 @@ testing the callback functionality of a
(ert-info ("Starting the channel")
(should-not (jupyter-channel-alive-p channel))
(jupyter-start-channel channel)
;; Let the channel start
(sleep-for 1)
(should (jupyter-channel-alive-p channel))
(should (jupyter-hb-beating-p channel))
(should-not (oref channel paused)))
(ert-info ("Pausing the channel")
(jupyter-hb-pause channel)
(should (oref channel paused)))
(ert-info ("Unpausing the channel")
(should (oref channel paused))
(jupyter-hb-unpause channel)
(sleep-for 2)
(should-not (oref channel paused))
(should (jupyter-hb-beating-p channel)))
(ert-info ("Pausing the channel")
(jupyter-hb-pause channel)
(oset channel beating 'beating)
(should (oref channel paused))
(sleep-for 1)
;; Channel shouldn't update when paused
(should (eq (oref channel beating) 'beating)))
(ert-info ("Checking the heartbeat")
(should (jupyter-hb-beating-p channel))
(delete-process proc)
@ -242,13 +243,15 @@ testing the callback functionality of a
(sleep-for 1)
(should (jupyter-hb-beating-p channel)))
(ert-info ("Stopping the channel")
(let ((p (oref channel process)))
(let ((p (oref channel timer)))
(jupyter-stop-channel channel)
(should-not (process-live-p p))
(should-not (oref channel process)))))
(should-not (memq p timer-list))
(should-not (oref channel timer)))))
(when (process-live-p proc)
(delete-process proc))
(kill-buffer (process-buffer proc))))))))
(delete-process proc)
(kill-buffer (process-buffer proc)))
(when (jupyter-channel-alive-p channel)
(jupyter-stop-channel channel))))))))
(ert-deftest jupyter-client ()
(let* ((socks (cl-loop repeat 4