mirror of
https://github.com/vale981/emacs-jupyter
synced 2025-03-05 23:41:38 -05:00
Add test for jupyter-connect-repl
This commit is contained in:
parent
9d39fbeaff
commit
9dc814e38a
2 changed files with 25 additions and 4 deletions
|
@ -404,10 +404,12 @@ called if needed.")
|
||||||
(if (eq channel :hb) (jupyter-stop-channel (oref comm hb))
|
(if (eq channel :hb) (jupyter-stop-channel (oref comm hb))
|
||||||
(with-slots (ioloop) comm
|
(with-slots (ioloop) comm
|
||||||
(jupyter-send ioloop 'stop-channel channel)
|
(jupyter-send ioloop 'stop-channel channel)
|
||||||
;; Verify that the channel stops
|
;; TODO: Figure out why tests now need a longer timeout sometimes.
|
||||||
(or (jupyter-ioloop-wait-until ioloop 'stop-channel
|
(let ((jupyter-default-timeout jupyter-long-timeout))
|
||||||
(lambda (_) (not (jupyter-channel-alive-p comm channel))))
|
;; Verify that the channel stops
|
||||||
(error "Channel not stopped in ioloop subprocess"))))))
|
(or (jupyter-ioloop-wait-until ioloop 'stop-channel
|
||||||
|
(lambda (_) (not (jupyter-channel-alive-p comm channel))))
|
||||||
|
(error "Channel not stopped in ioloop subprocess (%s)" channel)))))))
|
||||||
|
|
||||||
(cl-defmethod jupyter-start-channel ((comm jupyter-channel-ioloop-comm) channel)
|
(cl-defmethod jupyter-start-channel ((comm jupyter-channel-ioloop-comm) channel)
|
||||||
(unless (jupyter-channel-alive-p comm channel)
|
(unless (jupyter-channel-alive-p comm channel)
|
||||||
|
|
|
@ -1278,6 +1278,25 @@ last element being the newest element added to the history."
|
||||||
(when (buffer-live-p buffer)
|
(when (buffer-live-p buffer)
|
||||||
(kill-buffer buffer))))))
|
(kill-buffer buffer))))))
|
||||||
|
|
||||||
|
(ert-deftest jupyter-connect-repl ()
|
||||||
|
:tags '(repl)
|
||||||
|
(jupyter-test-with-python-repl client
|
||||||
|
(let ((client (jupyter-connect-repl
|
||||||
|
(jupyter-session-conn-info
|
||||||
|
(oref client session)))))
|
||||||
|
(unwind-protect
|
||||||
|
(let ((msg (jupyter-wait-until-received :execute-result
|
||||||
|
(let ((jupyter-inhibit-handlers t))
|
||||||
|
(jupyter-send-execute-request client
|
||||||
|
:code "1 + 1")))))
|
||||||
|
(should msg)
|
||||||
|
(should (equal (jupyter-message-data msg :text/plain) "2")))
|
||||||
|
(cl-letf (((symbol-function 'yes-or-no-p)
|
||||||
|
(lambda (_prompt) t))
|
||||||
|
((symbol-function 'y-or-n-p)
|
||||||
|
(lambda (_prompt) t)))
|
||||||
|
(kill-buffer (oref client buffer)))))))
|
||||||
|
|
||||||
;;; `org-mode'
|
;;; `org-mode'
|
||||||
|
|
||||||
(defvar org-babel-jupyter-resource-directory nil)
|
(defvar org-babel-jupyter-resource-directory nil)
|
||||||
|
|
Loading…
Add table
Reference in a new issue