mirror of
https://github.com/vale981/emacs-ipython-notebook
synced 2025-03-05 17:11:41 -05:00
squash one of possibly many bugs that could cause intermittent travis failure
This commit is contained in:
parent
b4c51b46b9
commit
270f157751
5 changed files with 32 additions and 10 deletions
|
@ -71,7 +71,7 @@
|
||||||
(lexical-let (notebook)
|
(lexical-let (notebook)
|
||||||
(with-current-buffer (ein:notebooklist-get-buffer url-or-port)
|
(with-current-buffer (ein:notebooklist-get-buffer url-or-port)
|
||||||
(lexical-let ((ks (ein:get-kernelspec url-or-port kernel)))
|
(lexical-let ((ks (ein:get-kernelspec url-or-port kernel)))
|
||||||
(loop repeat 3
|
(loop repeat 2
|
||||||
until notebook
|
until notebook
|
||||||
do (setq notebook (ein:testing-new-notebook url-or-port ks)))))
|
do (setq notebook (ein:testing-new-notebook url-or-port ks)))))
|
||||||
(let ((buf-name (format ein:notebook-buffer-name-template
|
(let ((buf-name (format ein:notebook-buffer-name-template
|
||||||
|
|
|
@ -25,17 +25,34 @@
|
||||||
(ein:testing-flush-queries)
|
(ein:testing-flush-queries)
|
||||||
(with-current-buffer (ein:notebooklist-get-buffer (car (ein:jupyter-server-conn-info)))
|
(with-current-buffer (ein:notebooklist-get-buffer (car (ein:jupyter-server-conn-info)))
|
||||||
(if ein:%notebooklist%
|
(if ein:%notebooklist%
|
||||||
(let ((urlport (ein:$notebooklist-url-or-port ein:%notebooklist%)))
|
|
||||||
(loop for notebook in (ein:notebook-opened-notebooks)
|
(loop for notebook in (ein:notebook-opened-notebooks)
|
||||||
for path = (ein:$notebook-notebook-path notebook)
|
for path = (ein:$notebook-notebook-path notebook)
|
||||||
do (ein:notebook-kill-kernel-then-close-command notebook t)
|
do (ein:notebook-kill-kernel-then-close-command notebook t)
|
||||||
(if (search "Untitled" path )
|
do (loop repeat 8
|
||||||
(ein:notebooklist-delete-notebook path))))))
|
until (not (ein:notebook-live-p notebook))
|
||||||
(ein:testing-flush-queries))
|
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
|
(Setup
|
||||||
(ein:dev-start-debug)
|
(ein:dev-start-debug)
|
||||||
(setq ein:notebook-autosave-frequency 0)
|
(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-log (concat default-directory "log/ecukes.log"))
|
||||||
(setq ein:testing-dump-file-messages (concat default-directory "log/ecukes.messages"))
|
(setq ein:testing-dump-file-messages (concat default-directory "log/ecukes.messages"))
|
||||||
(setq ein:testing-dump-file-server (concat default-directory "log/ecukes.server"))
|
(setq ein:testing-dump-file-server (concat default-directory "log/ecukes.server"))
|
||||||
|
|
|
@ -887,7 +887,9 @@ as usual."
|
||||||
(let ((kernel (ein:$notebook-kernel notebook)))
|
(let ((kernel (ein:$notebook-kernel notebook)))
|
||||||
;; If kernel is live, kill it before closing.
|
;; If kernel is live, kill it before closing.
|
||||||
(if (ein:kernel-live-p kernel)
|
(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)))))
|
(ein:notebook-close notebook)))))
|
||||||
|
|
||||||
(defun ein:fast-content-from-notebook (notebook)
|
(defun ein:fast-content-from-notebook (notebook)
|
||||||
|
@ -1685,6 +1687,8 @@ Called via `kill-emacs-query-functions'."
|
||||||
;; -- `kill-buffer-hook'
|
;; -- `kill-buffer-hook'
|
||||||
(defun ein:notebook-kill-buffer-callback ()
|
(defun ein:notebook-kill-buffer-callback ()
|
||||||
"Call notebook destructor. This function is called via `kill-buffer-hook'."
|
"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%)
|
(when (ein:$notebook-p ein:%notebook%)
|
||||||
(ein:notebook-disable-autosaves ein:%notebook%)
|
(ein:notebook-disable-autosaves ein:%notebook%)
|
||||||
(ein:notebook-close-worksheet ein:%notebook% ein:%worksheet%)))
|
(ein:notebook-close-worksheet ein:%notebook% ein:%worksheet%)))
|
||||||
|
|
|
@ -472,6 +472,7 @@ You may find the new one in the notebook list." error)
|
||||||
(ein:notebooklist-delete-notebook path)))
|
(ein:notebooklist-delete-notebook path)))
|
||||||
|
|
||||||
(defun ein:notebooklist-delete-notebook (path &optional callback)
|
(defun ein:notebooklist-delete-notebook (path &optional callback)
|
||||||
|
"CALLBACK with no arguments, e.g., semaphore"
|
||||||
(lexical-let* ((path path)
|
(lexical-let* ((path path)
|
||||||
(notebooklist ein:%notebooklist%)
|
(notebooklist ein:%notebooklist%)
|
||||||
(callback callback)
|
(callback callback)
|
||||||
|
|
|
@ -970,7 +970,7 @@ defined."
|
||||||
((:input (list kernel) :output t)))
|
((:input (list kernel) :output t)))
|
||||||
(ein:kernel-delete-session
|
(ein:kernel-delete-session
|
||||||
(kernel &optional callback)
|
(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))
|
(call-interactively #'ein:notebook-kill-kernel-then-close-command))
|
||||||
(should (buffer-live-p buffer))
|
(should (buffer-live-p buffer))
|
||||||
;; Pretend that `ein:notebook-close' is called.
|
;; Pretend that `ein:notebook-close' is called.
|
||||||
|
|
Loading…
Add table
Reference in a new issue