From 2f19904fe7a454a236d500e8e455573ebed0fdb5 Mon Sep 17 00:00:00 2001 From: dickmao Date: Tue, 19 Feb 2019 15:29:18 -0500 Subject: [PATCH] travis buttressing --- features/step-definitions/ein-steps.el | 4 +-- lisp/ein-notebooklist.el | 44 ++++++++++++-------------- test/ein-testing.el | 12 ++++--- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/features/step-definitions/ein-steps.el b/features/step-definitions/ein-steps.el index eb9e1b7..a8d2829 100644 --- a/features/step-definitions/ein-steps.el +++ b/features/step-definitions/ein-steps.el @@ -119,9 +119,9 @@ (When "^new \\(.+\\) notebook$" (lambda (kernel) (multiple-value-bind (url-or-port token) (ein:jupyter-server-conn-info) - (lexical-let (notebook) + (let (notebook) (with-current-buffer (ein:notebooklist-get-buffer url-or-port) - (lexical-let ((ks (ein:get-kernelspec url-or-port kernel))) + (let ((ks (ein:get-kernelspec url-or-port kernel))) (setq notebook (ein:testing-new-notebook url-or-port ks)))) (let ((buf-name (format ein:notebook-buffer-name-template (ein:$notebook-url-or-port notebook) diff --git a/lisp/ein-notebooklist.el b/lisp/ein-notebooklist.el index 2fe5a98..25a3959 100644 --- a/lisp/ein-notebooklist.el +++ b/lisp/ein-notebooklist.el @@ -368,7 +368,7 @@ This function is called via `ein:notebook-after-rename-hook'." (ein:content-upload nb-path upload-path))) ;;;###autoload -(defun ein:notebooklist-new-notebook (url-or-port kernelspec &optional callback no-pop) +(defun ein:notebooklist-new-notebook (url-or-port kernelspec &optional callback no-pop retry) (interactive (list (ein:notebooklist-ask-url-or-port) (ido-completing-read "Select kernel: " @@ -386,18 +386,18 @@ This function is called via `ein:notebook-after-rename-hook'." :data (json-encode '((:type . "notebook"))) :parser #'ein:json-read :error (apply-partially #'ein:notebooklist-new-notebook-error - url-or-port path callback) - :success (apply-partially #'ein:notebooklist-new-notebook-callback + url-or-port kernelspec path callback no-pop retry) + :success (apply-partially #'ein:notebooklist-new-notebook-success url-or-port kernelspec path callback no-pop)))) -(defun* ein:notebooklist-new-notebook-callback (url-or-port - kernelspec - path - callback - no-pop - &key - data - &allow-other-keys) +(defun* ein:notebooklist-new-notebook-success (url-or-port + kernelspec + path + callback + no-pop + &key + data + &allow-other-keys) (let ((nbname (plist-get data :name)) (nbpath (plist-get data :path))) (when (< (ein:notebook-version-numeric url-or-port) 3) @@ -408,19 +408,15 @@ This function is called via `ein:notebook-after-rename-hook'." (ein:notebooklist-open* url-or-port path))) (defun* ein:notebooklist-new-notebook-error - (url-or-port callback - &key response &allow-other-keys - &aux - (error (request-response-error-thrown response)) - (dest (request-response-url response))) - (ein:log 'verbose - "NOTEBOOKLIST-NEW-NOTEBOOK-ERROR url-or-port: %S; error: %S; dest: %S" - url-or-port error dest) - (ein:log 'error - "Failed to open new notebook (error: %S). \ -You may find the new one in the notebook list." error) - (ein:notebooklist-open* url-or-port nil nil (lambda (buffer url-or-port) - (pop-to-buffer buffer)))) + (url-or-port kernelspec path callback no-pop retry + &key symbol-status error-thrown &allow-other-keys) + (let ((notice (format "ein:notebooklist-new-notebook-error: %s %s" + symbol-status error-thrown))) + (if retry + (ein:log 'error notice) + (ein:log 'info notice) + (sleep-for 0 1500) + (ein:notebooklist-new-notebook url-or-port kernelspec callback no-pop t)))) ;;;###autoload (defun ein:notebooklist-new-notebook-with-name diff --git a/test/ein-testing.el b/test/ein-testing.el index e20d19e..9adaffe 100644 --- a/test/ein-testing.el +++ b/test/ein-testing.el @@ -93,7 +93,7 @@ if I call this between links in a deferred chain. Adding a flush-queue." continue) (error "Timeout: %s" predicate)))) -(defun ein:testing-new-notebook (url-or-port ks) +(defun ein:testing-new-notebook (url-or-port ks &optional retry) (lexical-let (notebook) (condition-case err (progn @@ -109,9 +109,13 @@ if I call this between links in a deferred chain. Adding a flush-queue." (ein:kernel-live-p it)))) nil 10000 1000) notebook) - (error (ein:log 'error "ein:testing-new-notebook: [%s] %s" - url-or-port (error-message-string err)) - nil)))) + (error (let ((notice (format "ein:testing-new-notebook: [%s] %s" + url-or-port (error-message-string err)))) + (if retry + (progn (ein:log 'error notice) nil) + (ein:log 'info notice) + (sleep-for 0 1500) + (ein:testing-new-notebook url-or-port ks t))))))) (defadvice ert-run-tests-batch (after ein:testing-dump-logs-hook activate) "Hook `ein:testing-dump-logs-hook' because `kill-emacs-hook'