emacs-ipython-notebook/test/testfunc.el
dickmao 085a188b20 Streamline login
Merge the login and open commands (open aliased to login).  Add login
tests described in #352.

Attempt to improve user experience by synchronously executing
`ein:jupyter-server-start`.  `ein:dev-prefer-deferred` custom variable
allows easy switch to compare sychronous versus old asynchronous behavior.
2018-10-17 16:52:10 -04:00

34 lines
1.4 KiB
EmacsLisp

(prefer-coding-system 'utf-8)
(require 'ein-dev)
(require 'ein-testing)
(require 'ein-jupyter)
(require 'ein-notebooklist)
(require 'deferred)
(ein:log 'info "Starting jupyter notebook server.")
(defvar *ein:testing-jupyter-server-command* (or (getenv "JUPYTER_TESTING_COMMAND")
(executable-find "jupyter"))
"Path to command that starts the jupyter notebook server.")
(defvar *ein:testing-jupyter-server-directory* (or (getenv "JUPYTER_TESTING_DIR") (concat default-directory "test"))
"Location where to start the jupyter notebook server.")
(setq ein:testing-dump-file-log (concat default-directory "log/testfunc.log"))
(setq ein:testing-dump-file-messages (concat default-directory "log/testfunc.messages"))
(setq ein:testing-dump-file-server (concat default-directory "log/testfunc.server"))
(setq ein:testing-dump-file-request (concat default-directory "log/testfunc.request"))
(setq message-log-max t)
(setq ein:force-sync t)
(setq ein:jupyter-server-run-timeout 120000)
(setq ein:content-query-timeout nil)
(setq ein:query-timeout nil)
(setq ein:jupyter-server-args '("--no-browser" "--debug"))
(ein:dev-start-debug)
(ein:jupyter-server-start *ein:testing-jupyter-server-command* *ein:testing-jupyter-server-directory*)
(ein:testing-wait-until (lambda () (ein:notebooklist-list)) nil 15000 1000)
(defvar *ein:testing-port* (car (ein:jupyter-server-conn-info)))
(fset 'y-or-n-p (lambda (prompt) nil))