squash one of possibly many bugs that could cause intermittent travis failure

This commit is contained in:
dickmao 2018-11-08 03:44:59 -05:00 committed by John Miller
parent b4c51b46b9
commit 270f157751
5 changed files with 32 additions and 10 deletions

View file

@ -71,7 +71,7 @@
(lexical-let (notebook)
(with-current-buffer (ein:notebooklist-get-buffer url-or-port)
(lexical-let ((ks (ein:get-kernelspec url-or-port kernel)))
(loop repeat 3
(loop repeat 2
until notebook
do (setq notebook (ein:testing-new-notebook url-or-port ks)))))
(let ((buf-name (format ein:notebook-buffer-name-template

View file

@ -25,17 +25,34 @@
(ein:testing-flush-queries)
(with-current-buffer (ein:notebooklist-get-buffer (car (ein:jupyter-server-conn-info)))
(if ein:%notebooklist%
(let ((urlport (ein:$notebooklist-url-or-port ein:%notebooklist%)))
(loop for notebook in (ein:notebook-opened-notebooks)
for path = (ein:$notebook-notebook-path notebook)
do (ein:notebook-kill-kernel-then-close-command notebook t)
(if (search "Untitled" path )
(ein:notebooklist-delete-notebook path))))))
(ein:testing-flush-queries))
do (loop repeat 8
until (not (ein:notebook-live-p notebook))
do (sleep-for 0 500)
finally do (when (ein:notebook-live-p notebook)
(ein:display-warning (format "cannot close %s" path))))
do (when (search "Untitled" path)
(lexical-let (done-p)
(ein:notebooklist-delete-notebook
path
(lambda () (setq done-p t)))
(loop repeat 8
until done-p
do (sleep-for 0 500)
finally do (when (not done-p)
(ein:display-warning (format "cannot del %s" path)))))))))
(ein:aif (ein:notebook-opened-notebooks)
(loop for nb in it
for path = (ein:$notebook-notebook-path nb)
do (ein:log 'verbose "Notebook %s still open" path)
finally do (assert nil))))
(Setup
(ein:dev-start-debug)
(setq ein:notebook-autosave-frequency 0)
(setq ein:notebook-create-checkpoint-on-save nil)
(setq ein:testing-dump-file-log (concat default-directory "log/ecukes.log"))
(setq ein:testing-dump-file-messages (concat default-directory "log/ecukes.messages"))
(setq ein:testing-dump-file-server (concat default-directory "log/ecukes.server"))

View file

@ -887,7 +887,9 @@ as usual."
(let ((kernel (ein:$notebook-kernel notebook)))
;; If kernel is live, kill it before closing.
(if (ein:kernel-live-p kernel)
(ein:kernel-delete-session kernel (apply-partially #'ein:notebook-close notebook))
(ein:kernel-delete-session kernel
(lambda (kernel)
(ein:notebook-close notebook)))
(ein:notebook-close notebook)))))
(defun ein:fast-content-from-notebook (notebook)
@ -1685,6 +1687,8 @@ Called via `kill-emacs-query-functions'."
;; -- `kill-buffer-hook'
(defun ein:notebook-kill-buffer-callback ()
"Call notebook destructor. This function is called via `kill-buffer-hook'."
;; TODO - it remains a bug that neither `ein:notebook-kill-buffer-callback'
;; nor `ein:notebook-close' updates ein:notebook--opened-map
(when (ein:$notebook-p ein:%notebook%)
(ein:notebook-disable-autosaves ein:%notebook%)
(ein:notebook-close-worksheet ein:%notebook% ein:%worksheet%)))

View file

@ -472,6 +472,7 @@ You may find the new one in the notebook list." error)
(ein:notebooklist-delete-notebook path)))
(defun ein:notebooklist-delete-notebook (path &optional callback)
"CALLBACK with no arguments, e.g., semaphore"
(lexical-let* ((path path)
(notebooklist ein:%notebooklist%)
(callback callback)

View file

@ -970,7 +970,7 @@ defined."
((:input (list kernel) :output t)))
(ein:kernel-delete-session
(kernel &optional callback)
((:input (list kernel (apply-partially #'ein:notebook-close notebook))))))
((:input (list kernel (lambda (kernel) (ein:notebook-close notebook)))))))
(call-interactively #'ein:notebook-kill-kernel-then-close-command))
(should (buffer-live-p buffer))
;; Pretend that `ein:notebook-close' is called.