forked from mirrors/org-mode
test-ob-python: Unit test for restarting session
See: https://list.orgmode.org/87ttsnh5bx.fsf@localhost/T/#t * testing/lisp/test-ob-python.el (test-ob-python/session-restart): New test for restarting ob-python session process.
This commit is contained in:
parent
b49275acbe
commit
8000b11209
|
@ -310,6 +310,25 @@ print(list(range(3)))
|
||||||
#+end_src"
|
#+end_src"
|
||||||
(should (org-babel-execute-src-block))))
|
(should (org-babel-execute-src-block))))
|
||||||
|
|
||||||
|
(ert-deftest test-ob-python/session-restart ()
|
||||||
|
;; Disable the test on older Emacs as built-in python.el sometimes
|
||||||
|
;; fail to initialize session.
|
||||||
|
(skip-unless (version<= "28" emacs-version))
|
||||||
|
(should
|
||||||
|
(equal "success"
|
||||||
|
(progn
|
||||||
|
(org-test-with-temp-text "#+begin_src python :session :results output
|
||||||
|
print('start')
|
||||||
|
#+end_src"
|
||||||
|
(org-babel-execute-src-block))
|
||||||
|
(let ((proc (python-shell-get-process)))
|
||||||
|
(python-shell-send-string "exit()")
|
||||||
|
(while (accept-process-output proc)))
|
||||||
|
(org-test-with-temp-text "#+begin_src python :session :results output
|
||||||
|
print('success')
|
||||||
|
#+end_src"
|
||||||
|
(org-babel-execute-src-block))))))
|
||||||
|
|
||||||
(provide 'test-ob-python)
|
(provide 'test-ob-python)
|
||||||
|
|
||||||
;;; test-ob-python.el ends here
|
;;; test-ob-python.el ends here
|
||||||
|
|
Loading…
Reference in a new issue