Commit graph

1809 commits

Author SHA1 Message Date
Nathaniel Nicandro
18f108f144 Use jupyter-ert-info in jupyter-repl-prompts test 2019-05-13 12:23:02 -05:00
Nathaniel Nicandro
d01dd82713 Once again increase timeouts during tests 2019-05-13 12:23:02 -05:00
Nathaniel Nicandro
b6d221c835 Be more diligent with processes used during testing 2019-05-13 12:21:59 -05:00
Nathaniel Nicandro
db3bf0b681 Add FIXME for jupyter-shutdown-kernel 2019-05-13 12:07:22 -05:00
Nathaniel Nicandro
3705243179 jupyter-start-kernel (jupyter-kernel-process): Don't verify executable path
Doesn't work on remote hosts since `executable-find` is only meant for the
local Emacs instance.
2019-05-13 12:07:22 -05:00
Nathaniel Nicandro
904434c510 jupyter-locate-python: Always return the file-local-name of the path 2019-05-13 12:01:13 -05:00
Nathaniel Nicandro
4c7b7d61cd appveyor.yml: Use ert-runner batch script 2019-05-12 18:00:39 -05:00
Nathaniel Nicandro
a775ac29bd Add jupyter-comm-client-loop 2019-05-11 09:48:08 -05:00
Nathaniel Nicandro
dae02fa7d4 jupyter-interrupt-kernel: Don't use a signal when its not possible 2019-05-11 09:48:08 -05:00
Nathaniel Nicandro
eaf6478aa3 jupyter-make-client: Do boilerplate in less specialized methods 2019-05-11 09:48:08 -05:00
Nathaniel Nicandro
0f06ea1407 Add jupyter-kernel-lifetime test 2019-05-10 17:28:04 -05:00
Nathaniel Nicandro
c9abe85be7 jupyter-available-kernelspecs: Fix for remote hosts 2019-05-09 21:41:26 -05:00
Nathaniel Nicandro
d7ce2b0c38 jupyter-repl-preserve-window-margins: Remove superfluous doc 2019-05-09 20:10:49 -05:00
Nathaniel Nicandro
f7b0ab2bc1 Rework jupyter-requests-pending-p test
Getting failures on Appveyor
2019-05-09 20:10:49 -05:00
Nathaniel Nicandro
ea8176d6fa jupyter-start-new-kernel: Remove unreliable jupyter-wait-until-startup 2019-05-09 20:10:49 -05:00
Nathaniel Nicandro
099d2b6511 jupyter-start-kernel (jupyter-command-kernel): Directly use Jupyter's python
instead of relying on the `jupyter kernel` command
2019-05-09 20:10:49 -05:00
Nathaniel Nicandro
258d1edfdb Shutdown kernel after jupyter-command-kernel test 2019-05-09 19:49:45 -05:00
Nathaniel Nicandro
f158f10c12 jupyter-start-kernel (jupyter-kernel-process): Display process arguments 2019-05-09 19:49:45 -05:00
Nathaniel Nicandro
ac7ed04488 appveyor.yml: Swap stderr and stdout when running cask 2019-05-09 19:49:45 -05:00
Nathaniel Nicandro
3f0a4b7829 Make jupyter-write-connection-file test more reliable 2019-05-09 19:49:45 -05:00
Nathaniel Nicandro
7945b6f444 jupyter-available-kernelspecs: Use --json argument to jupyter command 2019-05-09 19:49:18 -05:00
Nathaniel Nicandro
b715ada492 Always name method arguments
If method arguments are not named it gives rise to errors like

    `Args out of range: "", 0`

that originate in `help-function-arglist` when calling `describe-function` on
those methods.
2019-05-09 13:32:45 -05:00
Nathaniel Nicandro
64d9c773df Make jupyter-weak-ref test more reliable 2019-05-09 12:51:00 -05:00
Nathaniel Nicandro
eb3708fa0c .travis.yml: Limit output when installing Emacs 2019-05-09 12:50:00 -05:00
Nathaniel Nicandro
3628cab446 Refactor of jupyter-kernel-manager.el
This refactor implements a new class hierarchy to manage the lifetime of a
Jupyter kernel. The first node in this hierarchy is the
`jupyter-kernel-lifetime` class which defines a set of methods to manage the
lifetime of a kernel. An object that inherits from `jupyter-kernel-lifetime` is
stating that it has an association with a kernel and can be used to manage the
lifetime of the associated kernel.

The `jupyter-meta-kernel` class inherits from `jupyter-kernel-lifetime` and
mainly defines a `spec` slot used to hold the `kernelspec` from which a command
can be constructed to start a kernel and a `session` slot used to hold the
`jupyter-session` object that clients can use to establish communication with a
kernel once its live. Concrete classes that actually launch kernels are
intended to inherit from this class and use its slots.

`jupyter-kernel-process` manages the lifetime of a kernel started as a process
using the function `start-file-process`, `jupyter-command-kernel` calls the
`jupyter kernel` shell command to start a kernel, finally `jupyter-spec-kernel`
uses the `spec` slot to construct a shell command to start a kernel.

A `jupyter-kernel-manager` now consists of a `kernel` slot that holds a
`jupyter-meta-kernel` and a `control-channel` slot and inherits from
`jupyter-kernel-lifetime`. The `jupyter-kernel-lifetime` methods of the manager
just defer to those of `kernel` while also taking into account the
`control-channel`.

* jupyter-base.el (jupyter-write-connection-file): New function.

* jupyter-channel-ioloop.el
(jupyter-channel-ioloop-add-start-channel-event): Remove `sleep-for` call.
The startup message is not so important anymore.

* jupyter-client.el (jupyter-wait-until-startup: New function.

* jupyter-kernel-manager.el (jupyter-kernel-lifetime)
(jupyter-kernel, jupyter-kernel-process, jupyter-command-kernel)
(jupyter-spec-kernel): New classes.
(jupyter-kernel-manager): Inherit from jupyter-kernel-lifetime only and
implement its methods.
(jupyter-kernel-manager--cleanup, jupyter-kernel-managers)
(jupyter-delete-all-kernels, jupyter--kernel-sentinel)
(jupyter--start-kernel): Remove and remove related, their functionality has
been generalized in the new classes.
(jupyter-interrupt-kernel, jupyter-shutdown-kernel)
(jupyter-start-channels, jupyter-start-kernel, jupyter-kernel-alive-p)
(jupyter-kill-kernel): Refactor and implement to use the new class hierarchy.

* test/jupyter-test.el: Refactor tests to account for changes.
(jupyter-write-connect-file, jupyter-command-kernel): New tests.

* jupyter-kernelspec.el (jupyter-guess-kernelspec): New function.
2019-05-09 12:20:27 -05:00
Nathaniel Nicandro
ab79985580 Fix initialize-instance method signature 2019-05-09 10:56:02 -05:00
Nathaniel Nicandro
edb452618e jupyter-test-with-client-cache: Call accept-process-output 2019-05-09 10:36:43 -05:00
Nathaniel Nicandro
cdfefd5002 Increase timeouts during testing 2019-05-09 09:41:19 -05:00
Nathaniel Nicandro
c18de820e9 .travis.yml: Quiet shell output during testing 2019-05-09 09:41:19 -05:00
Nathaniel Nicandro
c9770d1789 appveyor.yml: Call WaitForExit() on the Emacs process before checking its exit code 2019-05-09 08:41:16 -05:00
Nathaniel Nicandro
d0000e8382 org-babel-jupyter-aliases-from-kernelspecs: Use symbols in org-src-lang-modes
This avoids a bug in `org-mode`. Although the documentation of
`org-src-lang-modes` says the mode can be a symbol or a string, the
customization type only specifies symbol so having a string causes errors when
`custom-initialize-reset` is called after
`org-babel-jupyter-aliases-from-kernelspecs`.
2019-05-08 23:26:07 -05:00
Nathaniel Nicandro
5cd1e55616 org-babel-jupyter-strip-ansi-escapes: Handle blocks without results
Fixes #112.
2019-05-08 10:36:38 -05:00
Nathaniel Nicandro
4302da35ef Shutdown kernel properly when testing 2019-05-07 22:47:22 -05:00
Nathaniel Nicandro
e948d4f705 Try to make jupyter-weak-ref test more reliable 2019-05-07 22:47:22 -05:00
Nathaniel Nicandro
1d8f28f2fc Simplify test macros
Also fix misuse of `alist-get`. `alist-get` uses `assq` for comparison by
default, but we are comparing strings. This caused issues when caching REPL
buffers and the subsequent re-use of them during testing.
2019-05-07 17:30:16 -05:00
Nathaniel Nicandro
87d078edca Add more tests
* Add tests for `jupyter-weak-ref`, `jupyter-add-finalizer`, and `jupyter-eval`
2019-05-07 17:30:16 -05:00
Nathaniel Nicandro
820202eca7 Fix typo 2019-05-07 00:38:01 -05:00
Nathaniel Nicandro
178ce69ace Clarify documentation of jupyter-channel methods 2019-05-07 00:38:01 -05:00
Nathaniel Nicandro
2091a01b52 org-babel-jupyter-strip-ansi-escapes: Avoid when-let* 2019-05-07 00:38:01 -05:00
Nathaniel Nicandro
d8781d594c Fix byte compile warning 2019-05-07 00:38:01 -05:00
Ning Xu
59275f655a Fix two org-src-lang-modes calc issues (#107)
For assoc lang org-src-lang-modes may return symbol sh, (inter 'sh) will
return an error.

For some languages like C++, the corresponding language mode shall be c++
2019-05-06 23:53:29 -05:00
Nathaniel Nicandro
abd7bed138
Fast finish when testing on Travis 2019-05-04 09:33:38 -05:00
Nathaniel Nicandro
112769e0c6
Bump version 2019-05-04 03:31:50 -05:00
Nathaniel Nicandro
598359459c
jupyter-R.el: Fix byte compilation warnings 2019-05-04 02:56:08 -05:00
Nathaniel Nicandro
0357961777 Add Appveyor build script 2019-05-04 02:33:11 -05:00
Nathaniel Nicandro
c8dd1236df Generalize tests for Windows 2019-05-04 02:33:11 -05:00
Nathaniel Nicandro
f4bf16079d jupyter-start-kernel: Don't check access time of conn. file on Windows 2019-05-04 02:33:11 -05:00
Nathaniel Nicandro
f890238345 Handle Windows systems when using jupyter-ioloop
On Windows systems we can't poll the STDIN of the created subprocess when using
`jupyter-ioloop` since Windows does not allow polling file handles. To get
around this we create a (PUSH, PULL) socket pair that the parent Emacs process
uses to communicate with its subprocess. See dzop/emacs-zmq#10 and thanks to
@fleimgruber for investigating this issue.
2019-05-04 02:33:11 -05:00
Nathaniel Nicandro
32ce45b707
Fix Travis 2019-05-04 01:41:31 -05:00
Nathaniel Nicandro
4a07dc143e
Add test for jupyter-ioloop-wait-until 2019-05-04 01:27:54 -05:00