branch: externals/org commit 8000b1120935bd7a9cc56eb6a65c90bc021f42f3 Author: Jack Kamm <jackk...@gmail.com> Commit: Jack Kamm <jackk...@gmail.com>
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. --- testing/lisp/test-ob-python.el | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/testing/lisp/test-ob-python.el b/testing/lisp/test-ob-python.el index 82fbca36e0..c11e1d0c20 100644 --- a/testing/lisp/test-ob-python.el +++ b/testing/lisp/test-ob-python.el @@ -310,6 +310,25 @@ print(list(range(3))) #+end_src" (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) ;;; test-ob-python.el ends here