diff options
| author | Fabián Ezequiel Gallina | 2014-12-27 20:12:00 -0300 |
|---|---|---|
| committer | Fabián Ezequiel Gallina | 2014-12-27 20:12:00 -0300 |
| commit | 7d1e62d51b51be27b11a67d7828b77f2df9e1eb1 (patch) | |
| tree | 8404c3b50203c55b9cbffdbe0e0553311ff7df22 /test | |
| parent | 996ad1b846a0865245df008bdb551093278b3c30 (diff) | |
| download | emacs-7d1e62d51b51be27b11a67d7828b77f2df9e1eb1.tar.gz emacs-7d1e62d51b51be27b11a67d7828b77f2df9e1eb1.zip | |
python.el: Enhance shell user interaction and deprecate python-shell-get-or-create-process.
* lisp/progmodes/python.el
(python-shell-get-process-or-error): New function.
(python-shell-with-shell-buffer): Use it.
(python-shell-send-string, python-shell-send-region)
(python-shell-send-buffer, python-shell-send-defun)
(python-shell-send-file, python-shell-switch-to-shell): Use it.
Add argument MSG to display user-friendly message when no process
is running.
(python-shell-switch-to-shell): Call pop-to-buffer with NORECORD.
(python-shell-make-comint): Rename argument SHOW from POP. Use
display-buffer instead of pop-to-buffer.
(run-python): Doc fix. Return process.
(python-shell-get-or-create-process): Make obsolete.
* test/automated/python-tests.el (python-shell-get-or-create-process-1)
(python-shell-get-or-create-process-2)
(python-shell-get-or-create-process-3): Remove tests.
Diffstat (limited to 'test')
| -rw-r--r-- | test/ChangeLog | 6 | ||||
| -rw-r--r-- | test/automated/python-tests.el | 78 |
2 files changed, 6 insertions, 78 deletions
diff --git a/test/ChangeLog b/test/ChangeLog index d541910b630..b7861654328 100644 --- a/test/ChangeLog +++ b/test/ChangeLog | |||
| @@ -1,5 +1,11 @@ | |||
| 1 | 2014-12-27 Fabián Ezequiel Gallina <fgallina@gnu.org> | 1 | 2014-12-27 Fabián Ezequiel Gallina <fgallina@gnu.org> |
| 2 | 2 | ||
| 3 | * automated/python-tests.el (python-shell-get-or-create-process-1) | ||
| 4 | (python-shell-get-or-create-process-2) | ||
| 5 | (python-shell-get-or-create-process-3): Remove tests. | ||
| 6 | |||
| 7 | 2014-12-27 Fabián Ezequiel Gallina <fgallina@gnu.org> | ||
| 8 | |||
| 3 | (python-shell-buffer-substring-9): New test. | 9 | (python-shell-buffer-substring-9): New test. |
| 4 | 10 | ||
| 5 | 2014-12-27 Fabián Ezequiel Gallina <fgallina@gnu.org> | 11 | 2014-12-27 Fabián Ezequiel Gallina <fgallina@gnu.org> |
diff --git a/test/automated/python-tests.el b/test/automated/python-tests.el index a6ed6808182..90fa79ee966 100644 --- a/test/automated/python-tests.el +++ b/test/automated/python-tests.el | |||
| @@ -2083,84 +2083,6 @@ and `python-shell-interpreter-args' in the new shell buffer." | |||
| 2083 | (ignore-errors (kill-buffer global-shell-buffer)) | 2083 | (ignore-errors (kill-buffer global-shell-buffer)) |
| 2084 | (ignore-errors (kill-buffer dedicated-shell-buffer)))))) | 2084 | (ignore-errors (kill-buffer dedicated-shell-buffer)))))) |
| 2085 | 2085 | ||
| 2086 | (ert-deftest python-shell-get-or-create-process-1 () | ||
| 2087 | "Check shell dedicated process creation." | ||
| 2088 | (skip-unless (executable-find python-tests-shell-interpreter)) | ||
| 2089 | (python-tests-with-temp-file | ||
| 2090 | "" | ||
| 2091 | (let* ((cmd | ||
| 2092 | (concat (executable-find python-tests-shell-interpreter) " -i")) | ||
| 2093 | (use-dialog-box) | ||
| 2094 | (dedicated-process-name (python-shell-get-process-name t)) | ||
| 2095 | (dedicated-process (python-shell-get-or-create-process cmd t)) | ||
| 2096 | (dedicated-shell-buffer (process-buffer dedicated-process))) | ||
| 2097 | (unwind-protect | ||
| 2098 | (progn | ||
| 2099 | (set-process-query-on-exit-flag dedicated-process nil) | ||
| 2100 | ;; should be dedicated. | ||
| 2101 | (should (equal (process-name dedicated-process) | ||
| 2102 | dedicated-process-name)) | ||
| 2103 | (kill-buffer dedicated-shell-buffer) | ||
| 2104 | ;; Check there are no processes for current buffer. | ||
| 2105 | (should (not (python-shell-get-process)))) | ||
| 2106 | (ignore-errors (kill-buffer dedicated-shell-buffer)))))) | ||
| 2107 | |||
| 2108 | (ert-deftest python-shell-get-or-create-process-2 () | ||
| 2109 | "Check shell global process creation." | ||
| 2110 | (skip-unless (executable-find python-tests-shell-interpreter)) | ||
| 2111 | (python-tests-with-temp-file | ||
| 2112 | "" | ||
| 2113 | (let* ((cmd | ||
| 2114 | (concat (executable-find python-tests-shell-interpreter) " -i")) | ||
| 2115 | (use-dialog-box) | ||
| 2116 | (process-name (python-shell-get-process-name nil)) | ||
| 2117 | (process (python-shell-get-or-create-process cmd)) | ||
| 2118 | (shell-buffer (process-buffer process))) | ||
| 2119 | (unwind-protect | ||
| 2120 | (progn | ||
| 2121 | (set-process-query-on-exit-flag process nil) | ||
| 2122 | ;; should be global. | ||
| 2123 | (should (equal (process-name process) process-name)) | ||
| 2124 | (kill-buffer shell-buffer) | ||
| 2125 | ;; Check there are no processes for current buffer. | ||
| 2126 | (should (not (python-shell-get-process)))) | ||
| 2127 | (ignore-errors (kill-buffer shell-buffer)))))) | ||
| 2128 | |||
| 2129 | (ert-deftest python-shell-get-or-create-process-3 () | ||
| 2130 | "Check shell dedicated/global process preference." | ||
| 2131 | (skip-unless (executable-find python-tests-shell-interpreter)) | ||
| 2132 | (python-tests-with-temp-file | ||
| 2133 | "" | ||
| 2134 | (let* ((cmd | ||
| 2135 | (concat (executable-find python-tests-shell-interpreter) " -i")) | ||
| 2136 | (python-shell-interpreter python-tests-shell-interpreter) | ||
| 2137 | (use-dialog-box) | ||
| 2138 | (dedicated-process-name (python-shell-get-process-name t)) | ||
| 2139 | (global-process) | ||
| 2140 | (dedicated-process)) | ||
| 2141 | (progn | ||
| 2142 | ;; Create global process | ||
| 2143 | (run-python cmd nil) | ||
| 2144 | (setq global-process (get-buffer-process "*Python*")) | ||
| 2145 | (should global-process) | ||
| 2146 | (set-process-query-on-exit-flag global-process nil) | ||
| 2147 | ;; Create dedicated process | ||
| 2148 | (run-python cmd t) | ||
| 2149 | (setq dedicated-process (get-process dedicated-process-name)) | ||
| 2150 | (should dedicated-process) | ||
| 2151 | (set-process-query-on-exit-flag dedicated-process nil) | ||
| 2152 | ;; Prefer dedicated. | ||
| 2153 | (should (equal (python-shell-get-or-create-process) | ||
| 2154 | dedicated-process)) | ||
| 2155 | ;; Kill the dedicated so the global takes over. | ||
| 2156 | (kill-buffer (process-buffer dedicated-process)) | ||
| 2157 | ;; Detect global. | ||
| 2158 | (should (equal (python-shell-get-or-create-process) global-process)) | ||
| 2159 | ;; Kill the global. | ||
| 2160 | (kill-buffer (process-buffer global-process)) | ||
| 2161 | ;; Check there are no processes for current buffer. | ||
| 2162 | (should (not (python-shell-get-process))))))) | ||
| 2163 | |||
| 2164 | (ert-deftest python-shell-internal-get-or-create-process-1 () | 2086 | (ert-deftest python-shell-internal-get-or-create-process-1 () |
| 2165 | "Check internal shell process creation fallback." | 2087 | "Check internal shell process creation fallback." |
| 2166 | (skip-unless (executable-find python-tests-shell-interpreter)) | 2088 | (skip-unless (executable-find python-tests-shell-interpreter)) |