2018-10-11 16:53:02 -04:00
|
|
|
(eval-when-compile (require 'cl))
|
2018-09-26 10:25:48 -04:00
|
|
|
(require 'f)
|
|
|
|
(require 'espuds)
|
|
|
|
(require 'ert)
|
2019-05-24 16:37:33 -04:00
|
|
|
(require 'undo-tree)
|
2018-09-26 10:25:48 -04:00
|
|
|
|
2019-05-16 15:01:45 -04:00
|
|
|
(with-eval-after-load "python"
|
|
|
|
(setq python-indent-guess-indent-offset-verbose nil))
|
|
|
|
|
2018-09-26 10:25:48 -04:00
|
|
|
(let* ((support-path (f-dirname load-file-name))
|
|
|
|
(root-path (f-parent (f-parent support-path))))
|
|
|
|
(add-to-list 'load-path (concat root-path "/lisp"))
|
|
|
|
(add-to-list 'load-path (concat root-path "/test")))
|
|
|
|
|
|
|
|
(require 'ein-notebooklist)
|
|
|
|
(require 'ein-jupyter)
|
|
|
|
(require 'ein-dev)
|
|
|
|
(require 'ein-testing)
|
2018-10-24 13:12:16 -04:00
|
|
|
(require 'ein-ipynb-mode)
|
|
|
|
(require 'ein-contents-api)
|
2019-05-16 15:01:45 -04:00
|
|
|
(require 'poly-ein)
|
2019-02-14 15:28:18 -05:00
|
|
|
(require 'ob-ein)
|
2018-09-26 10:25:48 -04:00
|
|
|
|
2018-11-06 13:26:33 -05:00
|
|
|
(if (member "timestamp" ecukes-include-tags)
|
|
|
|
(require 'ein-timestamp)
|
|
|
|
(!cons "timestamp" ecukes-exclude-tags))
|
|
|
|
|
2018-12-05 17:15:02 -05:00
|
|
|
(unless (member "jupyterhub" ecukes-include-tags)
|
|
|
|
(!cons "jupyterhub" ecukes-exclude-tags))
|
|
|
|
|
2019-05-16 15:01:45 -04:00
|
|
|
(when (file-exists-p (concat default-directory "features/support/test-poly.el"))
|
|
|
|
(load-file (concat default-directory "features/support/test-poly.el")))
|
2018-12-01 18:54:58 -05:00
|
|
|
|
2019-05-24 15:58:07 -04:00
|
|
|
(when ein:polymode
|
|
|
|
(!cons "evil" ecukes-exclude-tags))
|
|
|
|
|
2019-05-16 15:01:45 -04:00
|
|
|
(cond ((not ein:polymode)
|
|
|
|
(!cons "julia" ecukes-exclude-tags)
|
|
|
|
(!cons "memory" ecukes-exclude-tags))
|
|
|
|
((string= (getenv "TRAVIS_OS_NAME") "linux")
|
|
|
|
(!cons "memory" ecukes-exclude-tags)))
|
2019-02-14 15:28:18 -05:00
|
|
|
|
2018-09-26 10:25:48 -04:00
|
|
|
(defvar ein:testing-jupyter-server-root (f-parent (f-dirname load-file-name)))
|
|
|
|
|
2018-10-01 18:40:31 -04:00
|
|
|
(defun ein:testing-after-scenario ()
|
2018-10-11 16:53:02 -04:00
|
|
|
(ein:testing-flush-queries)
|
2018-10-15 16:57:22 -04:00
|
|
|
(with-current-buffer (ein:notebooklist-get-buffer (car (ein:jupyter-server-conn-info)))
|
2019-08-10 18:00:03 -04:00
|
|
|
(loop for notebook in (ein:notebook-opened-notebooks)
|
|
|
|
for path = (ein:$notebook-notebook-path notebook)
|
|
|
|
do (ein:notebook-kill-kernel-then-close-command notebook)
|
|
|
|
do (loop repeat 16
|
|
|
|
until (not (ein:notebook-live-p notebook))
|
|
|
|
do (sleep-for 0 1000)
|
|
|
|
finally do (when (ein:notebook-live-p notebook)
|
|
|
|
(ein:display-warning (format "cannot close %s" path))))
|
|
|
|
do (when (or (ob-ein-anonymous-p path)
|
|
|
|
(search "Untitled" path)
|
|
|
|
(search "Renamed" path))
|
|
|
|
(ein:notebooklist-delete-notebook path)
|
|
|
|
(loop repeat 16
|
|
|
|
with fullpath = (concat (file-name-as-directory ein:testing-jupyter-server-root) path)
|
|
|
|
for extant = (file-exists-p fullpath)
|
|
|
|
until (not extant)
|
|
|
|
do (sleep-for 0 1000)
|
|
|
|
finally do (when extant
|
|
|
|
(ein:display-warning (format "cannot del %s" path)))))))
|
2018-11-08 03:44:59 -05:00
|
|
|
(ein:aif (ein:notebook-opened-notebooks)
|
|
|
|
(loop for nb in it
|
|
|
|
for path = (ein:$notebook-notebook-path nb)
|
2018-11-08 03:47:28 -05:00
|
|
|
do (ein:log 'debug "Notebook %s still open" path)
|
2018-11-08 03:44:59 -05:00
|
|
|
finally do (assert nil))))
|
2018-10-11 16:53:02 -04:00
|
|
|
|
2018-10-01 18:40:31 -04:00
|
|
|
(Setup
|
|
|
|
(ein:dev-start-debug)
|
2019-09-30 18:35:39 -04:00
|
|
|
(setq ein:jupyter-default-kernel
|
2019-09-21 10:50:43 -04:00
|
|
|
(loop with cand = ""
|
|
|
|
for (k . spec) in
|
|
|
|
(alist-get
|
|
|
|
'kernelspecs
|
|
|
|
(let ((json-object-type 'alist))
|
|
|
|
(json-read-from-string
|
|
|
|
(shell-command-to-string
|
|
|
|
(format "%s kernelspec list --json"
|
|
|
|
ein:jupyter-default-server-command)))))
|
|
|
|
if (let ((lang (alist-get 'language (alist-get 'spec spec))))
|
|
|
|
(and (string= "python" lang)
|
|
|
|
(string> (symbol-name k) cand)))
|
|
|
|
do (setq cand (symbol-name k))
|
|
|
|
end
|
|
|
|
finally return (intern cand)))
|
2018-10-12 10:58:59 -05:00
|
|
|
(setq ein:notebook-autosave-frequency 0)
|
2018-11-08 03:44:59 -05:00
|
|
|
(setq ein:notebook-create-checkpoint-on-save nil)
|
2018-10-01 18:40:31 -04:00
|
|
|
(setq ein:testing-dump-file-log (concat default-directory "log/ecukes.log"))
|
|
|
|
(setq ein:testing-dump-file-messages (concat default-directory "log/ecukes.messages"))
|
2019-05-07 15:13:29 -04:00
|
|
|
(setq ein:testing-dump-file-server (concat default-directory "log/ecukes.server"))
|
|
|
|
(setq ein:testing-dump-file-websocket (concat default-directory "log/ecukes.websocket"))
|
2018-10-01 18:40:31 -04:00
|
|
|
(setq ein:testing-dump-file-request (concat default-directory "log/ecukes.request"))
|
2019-02-14 15:28:18 -05:00
|
|
|
(setq org-confirm-babel-evaluate nil)
|
2019-03-29 12:11:12 -04:00
|
|
|
(setq transient-mark-mode t)
|
2019-02-14 15:28:18 -05:00
|
|
|
(Given "I start and login to the server configured \"\\n\""))
|
2018-10-01 18:40:31 -04:00
|
|
|
|
|
|
|
(After
|
|
|
|
(ein:testing-after-scenario))
|
2018-09-26 10:25:48 -04:00
|
|
|
|
|
|
|
(Teardown
|
2018-12-05 17:15:02 -05:00
|
|
|
(Given "I finally stop the server"))
|
2018-09-26 10:25:48 -04:00
|
|
|
|
|
|
|
(Fail
|
2018-10-01 18:40:31 -04:00
|
|
|
(if noninteractive
|
|
|
|
(ein:testing-after-scenario)
|
|
|
|
(keyboard-quit))) ;; useful to prevent emacs from quitting
|