diff options
| author | Lin Sun | 2024-05-03 06:52:22 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 2024-05-23 16:07:52 +0300 |
| commit | a2ca5d01989cbe8d43f7763aa5ac374b49980c39 (patch) | |
| tree | 73ce4c005f9695d3afc41ae6ebe272a57b24263a /test/lisp/progmodes/python-tests.el | |
| parent | f75fec5cacce47c9714f10592d75c8fb9c63999d (diff) | |
| download | emacs-a2ca5d01989cbe8d43f7763aa5ac374b49980c39.tar.gz emacs-a2ca5d01989cbe8d43f7763aa5ac374b49980c39.zip | |
Enhance python-tests to adapt different Python interpreters (bug#70815)
* test/lisp/progmodes/python-tests.el
(python-tests-get-shell-interpreter): New function to get Python
interpreter for testing; and also introduce new env variable
EMACS_PYTHON_INTERPRETER to support customer Python interpreter.
Co-authored-by: kobarity <kobarity@gmail.com>
Diffstat (limited to 'test/lisp/progmodes/python-tests.el')
| -rw-r--r-- | test/lisp/progmodes/python-tests.el | 102 |
1 files changed, 60 insertions, 42 deletions
diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el index 2960cca2c06..b19c5c31f16 100644 --- a/test/lisp/progmodes/python-tests.el +++ b/test/lisp/progmodes/python-tests.el | |||
| @@ -21,6 +21,7 @@ | |||
| 21 | 21 | ||
| 22 | ;;; Code: | 22 | ;;; Code: |
| 23 | 23 | ||
| 24 | (require 'cl-extra) | ||
| 24 | (require 'ert) | 25 | (require 'ert) |
| 25 | (require 'ert-x) | 26 | (require 'ert-x) |
| 26 | (require 'python) | 27 | (require 'python) |
| @@ -58,7 +59,8 @@ turned off. Shell buffer will be killed on exit." | |||
| 58 | (let ((dir (make-symbol "dir"))) | 59 | (let ((dir (make-symbol "dir"))) |
| 59 | `(with-temp-buffer | 60 | `(with-temp-buffer |
| 60 | (let ((python-indent-guess-indent-offset nil) | 61 | (let ((python-indent-guess-indent-offset nil) |
| 61 | (python-shell-completion-native-enable nil)) | 62 | (python-shell-completion-native-enable nil) |
| 63 | (python-shell-interpreter (python-tests-get-shell-interpreter))) | ||
| 62 | (python-mode) | 64 | (python-mode) |
| 63 | (unwind-protect | 65 | (unwind-protect |
| 64 | ;; Prevent test failures when Jedi is used as a completion | 66 | ;; Prevent test failures when Jedi is used as a completion |
| @@ -3738,7 +3740,19 @@ if x: | |||
| 3738 | 3740 | ||
| 3739 | ;;; Shell integration | 3741 | ;;; Shell integration |
| 3740 | 3742 | ||
| 3741 | (defvar python-tests-shell-interpreter "python") | 3743 | (defvar python-tests-shell-interpreter nil) |
| 3744 | |||
| 3745 | (defun python-tests-get-shell-interpreter () | ||
| 3746 | "Get the shell interpreter. | ||
| 3747 | If env string EMACS_PYTHON_INTERPRETER exists, use it as preferred one." | ||
| 3748 | (if python-tests-shell-interpreter | ||
| 3749 | python-tests-shell-interpreter | ||
| 3750 | (setq python-tests-shell-interpreter | ||
| 3751 | (or (when-let ((interpreter (getenv "EMACS_PYTHON_INTERPRETER"))) | ||
| 3752 | (or (executable-find interpreter) | ||
| 3753 | (error "Couldn't find EMACS_PYTHON_INTERPRETER(%s) in path" | ||
| 3754 | interpreter))) | ||
| 3755 | (cl-some #'executable-find '("python" "python3" "python2")))))) | ||
| 3742 | 3756 | ||
| 3743 | (ert-deftest python-shell-get-process-name-1 () | 3757 | (ert-deftest python-shell-get-process-name-1 () |
| 3744 | "Check process name calculation sans `buffer-file-name'." | 3758 | "Check process name calculation sans `buffer-file-name'." |
| @@ -4000,13 +4014,13 @@ if x: | |||
| 4000 | 4014 | ||
| 4001 | (ert-deftest python-shell-make-comint-1 () | 4015 | (ert-deftest python-shell-make-comint-1 () |
| 4002 | "Check comint creation for global shell buffer." | 4016 | "Check comint creation for global shell buffer." |
| 4003 | (skip-unless (executable-find python-tests-shell-interpreter)) | 4017 | (skip-unless (python-tests-get-shell-interpreter)) |
| 4004 | ;; The interpreter can get killed too quickly to allow it to clean | 4018 | ;; The interpreter can get killed too quickly to allow it to clean |
| 4005 | ;; up the tempfiles that the default python-shell-setup-codes create, | 4019 | ;; up the tempfiles that the default python-shell-setup-codes create, |
| 4006 | ;; so it leaves tempfiles behind, which is a minor irritation. | 4020 | ;; so it leaves tempfiles behind, which is a minor irritation. |
| 4007 | (let* ((python-shell-setup-codes nil) | 4021 | (let* ((python-shell-setup-codes nil) |
| 4008 | (python-shell-interpreter | 4022 | (python-shell-interpreter |
| 4009 | (executable-find python-tests-shell-interpreter)) | 4023 | (python-tests-get-shell-interpreter)) |
| 4010 | (proc-name (python-shell-get-process-name nil)) | 4024 | (proc-name (python-shell-get-process-name nil)) |
| 4011 | (shell-buffer | 4025 | (shell-buffer |
| 4012 | (python-tests-with-temp-buffer | 4026 | (python-tests-with-temp-buffer |
| @@ -4024,10 +4038,10 @@ if x: | |||
| 4024 | 4038 | ||
| 4025 | (ert-deftest python-shell-make-comint-2 () | 4039 | (ert-deftest python-shell-make-comint-2 () |
| 4026 | "Check comint creation for internal shell buffer." | 4040 | "Check comint creation for internal shell buffer." |
| 4027 | (skip-unless (executable-find python-tests-shell-interpreter)) | 4041 | (skip-unless (python-tests-get-shell-interpreter)) |
| 4028 | (let* ((python-shell-setup-codes nil) | 4042 | (let* ((python-shell-setup-codes nil) |
| 4029 | (python-shell-interpreter | 4043 | (python-shell-interpreter |
| 4030 | (executable-find python-tests-shell-interpreter)) | 4044 | (python-tests-get-shell-interpreter)) |
| 4031 | (proc-name (python-shell-internal-get-process-name)) | 4045 | (proc-name (python-shell-internal-get-process-name)) |
| 4032 | (shell-buffer | 4046 | (shell-buffer |
| 4033 | (python-tests-with-temp-buffer | 4047 | (python-tests-with-temp-buffer |
| @@ -4048,13 +4062,13 @@ if x: | |||
| 4048 | The command passed to `python-shell-make-comint' as argument must | 4062 | The command passed to `python-shell-make-comint' as argument must |
| 4049 | locally override global values set in `python-shell-interpreter' | 4063 | locally override global values set in `python-shell-interpreter' |
| 4050 | and `python-shell-interpreter-args' in the new shell buffer." | 4064 | and `python-shell-interpreter-args' in the new shell buffer." |
| 4051 | (skip-unless (executable-find python-tests-shell-interpreter)) | 4065 | (skip-unless (python-tests-get-shell-interpreter)) |
| 4052 | (let* ((python-shell-setup-codes nil) | 4066 | (let* ((python-shell-setup-codes nil) |
| 4053 | (python-shell-interpreter "interpreter") | 4067 | (python-shell-interpreter "interpreter") |
| 4054 | (python-shell-interpreter-args "--some-args") | 4068 | (python-shell-interpreter-args "--some-args") |
| 4055 | (proc-name (python-shell-get-process-name nil)) | 4069 | (proc-name (python-shell-get-process-name nil)) |
| 4056 | (interpreter-override | 4070 | (interpreter-override |
| 4057 | (concat (executable-find python-tests-shell-interpreter) " " "-i")) | 4071 | (concat (python-tests-get-shell-interpreter) " " "-i")) |
| 4058 | (shell-buffer | 4072 | (shell-buffer |
| 4059 | (python-tests-with-temp-buffer | 4073 | (python-tests-with-temp-buffer |
| 4060 | "" (python-shell-make-comint interpreter-override proc-name nil))) | 4074 | "" (python-shell-make-comint interpreter-override proc-name nil))) |
| @@ -4067,17 +4081,17 @@ and `python-shell-interpreter-args' in the new shell buffer." | |||
| 4067 | (should (eq major-mode 'inferior-python-mode)) | 4081 | (should (eq major-mode 'inferior-python-mode)) |
| 4068 | (should (file-equal-p | 4082 | (should (file-equal-p |
| 4069 | python-shell-interpreter | 4083 | python-shell-interpreter |
| 4070 | (executable-find python-tests-shell-interpreter))) | 4084 | (python-tests-get-shell-interpreter))) |
| 4071 | (should (string= python-shell-interpreter-args "-i")))) | 4085 | (should (string= python-shell-interpreter-args "-i")))) |
| 4072 | (kill-buffer shell-buffer)))) | 4086 | (kill-buffer shell-buffer)))) |
| 4073 | 4087 | ||
| 4074 | (ert-deftest python-shell-make-comint-4 () | 4088 | (ert-deftest python-shell-make-comint-4 () |
| 4075 | "Check shell calculated prompts regexps are set." | 4089 | "Check shell calculated prompts regexps are set." |
| 4076 | (skip-unless (executable-find python-tests-shell-interpreter)) | 4090 | (skip-unless (python-tests-get-shell-interpreter)) |
| 4077 | (let* ((process-environment process-environment) | 4091 | (let* ((process-environment process-environment) |
| 4078 | (python-shell-setup-codes nil) | 4092 | (python-shell-setup-codes nil) |
| 4079 | (python-shell-interpreter | 4093 | (python-shell-interpreter |
| 4080 | (executable-find python-tests-shell-interpreter)) | 4094 | (python-tests-get-shell-interpreter)) |
| 4081 | (python-shell-interpreter-args "-i") | 4095 | (python-shell-interpreter-args "-i") |
| 4082 | (python-shell--prompt-calculated-input-regexp nil) | 4096 | (python-shell--prompt-calculated-input-regexp nil) |
| 4083 | (python-shell--prompt-calculated-output-regexp nil) | 4097 | (python-shell--prompt-calculated-output-regexp nil) |
| @@ -4119,12 +4133,12 @@ and `python-shell-interpreter-args' in the new shell buffer." | |||
| 4119 | 4133 | ||
| 4120 | (ert-deftest python-shell-get-process-1 () | 4134 | (ert-deftest python-shell-get-process-1 () |
| 4121 | "Check dedicated shell process preference over global." | 4135 | "Check dedicated shell process preference over global." |
| 4122 | (skip-unless (executable-find python-tests-shell-interpreter)) | 4136 | (skip-unless (python-tests-get-shell-interpreter)) |
| 4123 | (python-tests-with-temp-file | 4137 | (python-tests-with-temp-file |
| 4124 | "" | 4138 | "" |
| 4125 | (let* ((python-shell-setup-codes nil) | 4139 | (let* ((python-shell-setup-codes nil) |
| 4126 | (python-shell-interpreter | 4140 | (python-shell-interpreter |
| 4127 | (executable-find python-tests-shell-interpreter)) | 4141 | (python-tests-get-shell-interpreter)) |
| 4128 | (global-proc-name (python-shell-get-process-name nil)) | 4142 | (global-proc-name (python-shell-get-process-name nil)) |
| 4129 | (dedicated-proc-name (python-shell-get-process-name t)) | 4143 | (dedicated-proc-name (python-shell-get-process-name t)) |
| 4130 | (global-shell-buffer | 4144 | (global-shell-buffer |
| @@ -4152,12 +4166,12 @@ and `python-shell-interpreter-args' in the new shell buffer." | |||
| 4152 | 4166 | ||
| 4153 | (ert-deftest python-shell-internal-get-or-create-process-1 () | 4167 | (ert-deftest python-shell-internal-get-or-create-process-1 () |
| 4154 | "Check internal shell process creation fallback." | 4168 | "Check internal shell process creation fallback." |
| 4155 | (skip-unless (executable-find python-tests-shell-interpreter)) | 4169 | (skip-unless (python-tests-get-shell-interpreter)) |
| 4156 | (python-tests-with-temp-file | 4170 | (python-tests-with-temp-file |
| 4157 | "" | 4171 | "" |
| 4158 | (should (not (process-live-p (python-shell-internal-get-process-name)))) | 4172 | (should (not (process-live-p (python-shell-internal-get-process-name)))) |
| 4159 | (let* ((python-shell-interpreter | 4173 | (let* ((python-shell-interpreter |
| 4160 | (executable-find python-tests-shell-interpreter)) | 4174 | (python-tests-get-shell-interpreter)) |
| 4161 | (internal-process-name (python-shell-internal-get-process-name)) | 4175 | (internal-process-name (python-shell-internal-get-process-name)) |
| 4162 | (internal-process (python-shell-internal-get-or-create-process)) | 4176 | (internal-process (python-shell-internal-get-or-create-process)) |
| 4163 | (internal-shell-buffer (process-buffer internal-process))) | 4177 | (internal-shell-buffer (process-buffer internal-process))) |
| @@ -4175,8 +4189,9 @@ and `python-shell-interpreter-args' in the new shell buffer." | |||
| 4175 | 4189 | ||
| 4176 | (ert-deftest python-shell-prompt-detect-1 () | 4190 | (ert-deftest python-shell-prompt-detect-1 () |
| 4177 | "Check prompt autodetection." | 4191 | "Check prompt autodetection." |
| 4178 | (skip-unless (executable-find python-tests-shell-interpreter)) | 4192 | (skip-unless (python-tests-get-shell-interpreter)) |
| 4179 | (let ((process-environment process-environment)) | 4193 | (let ((process-environment process-environment) |
| 4194 | (python-shell-interpreter (python-tests-get-shell-interpreter))) | ||
| 4180 | ;; Ensure no startup file is enabled | 4195 | ;; Ensure no startup file is enabled |
| 4181 | (setenv "PYTHONSTARTUP" "") | 4196 | (setenv "PYTHONSTARTUP" "") |
| 4182 | (should python-shell-prompt-detect-enabled) | 4197 | (should python-shell-prompt-detect-enabled) |
| @@ -4184,8 +4199,9 @@ and `python-shell-interpreter-args' in the new shell buffer." | |||
| 4184 | 4199 | ||
| 4185 | (ert-deftest python-shell-prompt-detect-2 () | 4200 | (ert-deftest python-shell-prompt-detect-2 () |
| 4186 | "Check prompt autodetection with startup file. Bug#17370." | 4201 | "Check prompt autodetection with startup file. Bug#17370." |
| 4187 | (skip-unless (executable-find python-tests-shell-interpreter)) | 4202 | (skip-unless (python-tests-get-shell-interpreter)) |
| 4188 | (let* ((process-environment process-environment) | 4203 | (let* ((process-environment process-environment) |
| 4204 | (python-shell-interpreter (python-tests-get-shell-interpreter)) | ||
| 4189 | (startup-code (concat "import sys\n" | 4205 | (startup-code (concat "import sys\n" |
| 4190 | "sys.ps1 = 'py> '\n" | 4206 | "sys.ps1 = 'py> '\n" |
| 4191 | "sys.ps2 = '..> '\n" | 4207 | "sys.ps2 = '..> '\n" |
| @@ -4201,7 +4217,7 @@ and `python-shell-interpreter-args' in the new shell buffer." | |||
| 4201 | 4217 | ||
| 4202 | (ert-deftest python-shell-prompt-detect-3 () | 4218 | (ert-deftest python-shell-prompt-detect-3 () |
| 4203 | "Check prompts are not autodetected when feature is disabled." | 4219 | "Check prompts are not autodetected when feature is disabled." |
| 4204 | (skip-unless (executable-find python-tests-shell-interpreter)) | 4220 | (skip-unless (python-tests-get-shell-interpreter)) |
| 4205 | (let ((process-environment process-environment) | 4221 | (let ((process-environment process-environment) |
| 4206 | (python-shell-prompt-detect-enabled nil)) | 4222 | (python-shell-prompt-detect-enabled nil)) |
| 4207 | ;; Ensure no startup file is enabled | 4223 | ;; Ensure no startup file is enabled |
| @@ -4210,7 +4226,7 @@ and `python-shell-interpreter-args' in the new shell buffer." | |||
| 4210 | 4226 | ||
| 4211 | (ert-deftest python-shell-prompt-detect-4 () | 4227 | (ert-deftest python-shell-prompt-detect-4 () |
| 4212 | "Check warning is shown when detection fails." | 4228 | "Check warning is shown when detection fails." |
| 4213 | (skip-unless (executable-find python-tests-shell-interpreter)) | 4229 | (skip-unless (python-tests-get-shell-interpreter)) |
| 4214 | (let* ((process-environment process-environment) | 4230 | (let* ((process-environment process-environment) |
| 4215 | ;; Trigger failure by removing prompts in the startup file | 4231 | ;; Trigger failure by removing prompts in the startup file |
| 4216 | (startup-code (concat "import sys\n" | 4232 | (startup-code (concat "import sys\n" |
| @@ -4231,7 +4247,7 @@ and `python-shell-interpreter-args' in the new shell buffer." | |||
| 4231 | 4247 | ||
| 4232 | (ert-deftest python-shell-prompt-detect-5 () | 4248 | (ert-deftest python-shell-prompt-detect-5 () |
| 4233 | "Check disabled warnings are not shown when detection fails." | 4249 | "Check disabled warnings are not shown when detection fails." |
| 4234 | (skip-unless (executable-find python-tests-shell-interpreter)) | 4250 | (skip-unless (python-tests-get-shell-interpreter)) |
| 4235 | (let* ((process-environment process-environment) | 4251 | (let* ((process-environment process-environment) |
| 4236 | (startup-code (concat "import sys\n" | 4252 | (startup-code (concat "import sys\n" |
| 4237 | "sys.ps1 = ''\n" | 4253 | "sys.ps1 = ''\n" |
| @@ -4252,7 +4268,7 @@ and `python-shell-interpreter-args' in the new shell buffer." | |||
| 4252 | 4268 | ||
| 4253 | (ert-deftest python-shell-prompt-detect-6 () | 4269 | (ert-deftest python-shell-prompt-detect-6 () |
| 4254 | "Warnings are not shown when detection is disabled." | 4270 | "Warnings are not shown when detection is disabled." |
| 4255 | (skip-unless (executable-find python-tests-shell-interpreter)) | 4271 | (skip-unless (python-tests-get-shell-interpreter)) |
| 4256 | (let* ((process-environment process-environment) | 4272 | (let* ((process-environment process-environment) |
| 4257 | (startup-code (concat "import sys\n" | 4273 | (startup-code (concat "import sys\n" |
| 4258 | "sys.ps1 = ''\n" | 4274 | "sys.ps1 = ''\n" |
| @@ -4416,7 +4432,7 @@ and `python-shell-interpreter-args' in the new shell buffer." | |||
| 4416 | 4432 | ||
| 4417 | (ert-deftest python-shell-prompt-set-calculated-regexps-6 () | 4433 | (ert-deftest python-shell-prompt-set-calculated-regexps-6 () |
| 4418 | "Check detected prompts are included `regexp-quote'd." | 4434 | "Check detected prompts are included `regexp-quote'd." |
| 4419 | (skip-unless (executable-find python-tests-shell-interpreter)) | 4435 | (skip-unless (python-tests-get-shell-interpreter)) |
| 4420 | (let* ((python-shell-prompt-input-regexps '("")) | 4436 | (let* ((python-shell-prompt-input-regexps '("")) |
| 4421 | (python-shell-prompt-output-regexps '("")) | 4437 | (python-shell-prompt-output-regexps '("")) |
| 4422 | (python-shell-prompt-regexp "") | 4438 | (python-shell-prompt-regexp "") |
| @@ -4426,6 +4442,7 @@ and `python-shell-interpreter-args' in the new shell buffer." | |||
| 4426 | (python-shell--prompt-calculated-input-regexp nil) | 4442 | (python-shell--prompt-calculated-input-regexp nil) |
| 4427 | (python-shell--prompt-calculated-output-regexp nil) | 4443 | (python-shell--prompt-calculated-output-regexp nil) |
| 4428 | (python-shell-prompt-detect-enabled t) | 4444 | (python-shell-prompt-detect-enabled t) |
| 4445 | (python-shell-interpreter (python-tests-get-shell-interpreter)) | ||
| 4429 | (process-environment process-environment) | 4446 | (process-environment process-environment) |
| 4430 | (startup-code (concat "import sys\n" | 4447 | (startup-code (concat "import sys\n" |
| 4431 | "sys.ps1 = 'p.> '\n" | 4448 | "sys.ps1 = 'p.> '\n" |
| @@ -4799,7 +4816,7 @@ def foo(): | |||
| 4799 | (should (python-shell-completion-native-interpreter-disabled-p)))) | 4816 | (should (python-shell-completion-native-interpreter-disabled-p)))) |
| 4800 | 4817 | ||
| 4801 | (ert-deftest python-shell-completion-at-point-1 () | 4818 | (ert-deftest python-shell-completion-at-point-1 () |
| 4802 | (skip-unless (executable-find python-tests-shell-interpreter)) | 4819 | (skip-unless (python-tests-get-shell-interpreter)) |
| 4803 | (python-tests-with-temp-buffer-with-shell | 4820 | (python-tests-with-temp-buffer-with-shell |
| 4804 | "" | 4821 | "" |
| 4805 | (python-shell-with-shell-buffer | 4822 | (python-shell-with-shell-buffer |
| @@ -4813,7 +4830,7 @@ def foo(): | |||
| 4813 | (should-not (nth 2 (python-shell-completion-at-point)))))) | 4830 | (should-not (nth 2 (python-shell-completion-at-point)))))) |
| 4814 | 4831 | ||
| 4815 | (ert-deftest python-shell-completion-at-point-native-1 () | 4832 | (ert-deftest python-shell-completion-at-point-native-1 () |
| 4816 | (skip-unless (executable-find python-tests-shell-interpreter)) | 4833 | (skip-unless (python-tests-get-shell-interpreter)) |
| 4817 | (python-tests-with-temp-buffer-with-shell | 4834 | (python-tests-with-temp-buffer-with-shell |
| 4818 | "" | 4835 | "" |
| 4819 | (python-shell-completion-native-turn-on) | 4836 | (python-shell-completion-native-turn-on) |
| @@ -4892,14 +4909,14 @@ def foo(): | |||
| 4892 | "Return Jedi readline setup file if PYTHONSTARTUP is not set." | 4909 | "Return Jedi readline setup file if PYTHONSTARTUP is not set." |
| 4893 | (or (getenv "PYTHONSTARTUP") | 4910 | (or (getenv "PYTHONSTARTUP") |
| 4894 | (with-temp-buffer | 4911 | (with-temp-buffer |
| 4895 | (if (eql 0 (call-process python-tests-shell-interpreter | 4912 | (if (eql 0 (call-process (python-tests-get-shell-interpreter) |
| 4896 | nil t nil "-m" "jedi" "repl")) | 4913 | nil t nil "-m" "jedi" "repl")) |
| 4897 | (string-trim (buffer-string)) | 4914 | (string-trim (buffer-string)) |
| 4898 | "")))) | 4915 | "")))) |
| 4899 | 4916 | ||
| 4900 | (ert-deftest python-shell-completion-at-point-jedi-completer () | 4917 | (ert-deftest python-shell-completion-at-point-jedi-completer () |
| 4901 | "Check if Python shell completion works when Jedi completer is used." | 4918 | "Check if Python shell completion works when Jedi completer is used." |
| 4902 | (skip-unless (executable-find python-tests-shell-interpreter)) | 4919 | (skip-unless (python-tests-get-shell-interpreter)) |
| 4903 | (with-environment-variables | 4920 | (with-environment-variables |
| 4904 | (("PYTHONSTARTUP" (python-tests--pythonstartup-file))) | 4921 | (("PYTHONSTARTUP" (python-tests--pythonstartup-file))) |
| 4905 | (python-tests-with-temp-buffer-with-shell | 4922 | (python-tests-with-temp-buffer-with-shell |
| @@ -4944,7 +4961,7 @@ def foo(): | |||
| 4944 | ;;; Symbol completion | 4961 | ;;; Symbol completion |
| 4945 | 4962 | ||
| 4946 | (ert-deftest python-completion-at-point-1 () | 4963 | (ert-deftest python-completion-at-point-1 () |
| 4947 | (skip-unless (executable-find python-tests-shell-interpreter)) | 4964 | (skip-unless (python-tests-get-shell-interpreter)) |
| 4948 | (python-tests-with-temp-buffer-with-shell | 4965 | (python-tests-with-temp-buffer-with-shell |
| 4949 | " | 4966 | " |
| 4950 | import abc | 4967 | import abc |
| @@ -4962,7 +4979,7 @@ import abc | |||
| 4962 | 4979 | ||
| 4963 | (ert-deftest python-completion-at-point-2 () | 4980 | (ert-deftest python-completion-at-point-2 () |
| 4964 | "Should work regardless of the point in the Shell buffer." | 4981 | "Should work regardless of the point in the Shell buffer." |
| 4965 | (skip-unless (executable-find python-tests-shell-interpreter)) | 4982 | (skip-unless (python-tests-get-shell-interpreter)) |
| 4966 | (python-tests-with-temp-buffer-with-shell | 4983 | (python-tests-with-temp-buffer-with-shell |
| 4967 | " | 4984 | " |
| 4968 | import abc | 4985 | import abc |
| @@ -4980,7 +4997,7 @@ import abc | |||
| 4980 | 4997 | ||
| 4981 | (ert-deftest python-completion-at-point-pdb-1 () | 4998 | (ert-deftest python-completion-at-point-pdb-1 () |
| 4982 | "Should not complete PDB commands in Python buffer." | 4999 | "Should not complete PDB commands in Python buffer." |
| 4983 | (skip-unless (executable-find python-tests-shell-interpreter)) | 5000 | (skip-unless (python-tests-get-shell-interpreter)) |
| 4984 | (python-tests-with-temp-buffer-with-shell | 5001 | (python-tests-with-temp-buffer-with-shell |
| 4985 | " | 5002 | " |
| 4986 | import pdb | 5003 | import pdb |
| @@ -4999,7 +5016,7 @@ print('Hello') | |||
| 4999 | 5016 | ||
| 5000 | (ert-deftest python-completion-at-point-while-running-1 () | 5017 | (ert-deftest python-completion-at-point-while-running-1 () |
| 5001 | "Should not try to complete when a program is running in the Shell buffer." | 5018 | "Should not try to complete when a program is running in the Shell buffer." |
| 5002 | (skip-unless (executable-find python-tests-shell-interpreter)) | 5019 | (skip-unless (python-tests-get-shell-interpreter)) |
| 5003 | (python-tests-with-temp-buffer-with-shell | 5020 | (python-tests-with-temp-buffer-with-shell |
| 5004 | " | 5021 | " |
| 5005 | import time | 5022 | import time |
| @@ -5015,7 +5032,7 @@ time.sleep(3) | |||
| 5015 | (should-not (with-timeout (1 t) (completion-at-point)))))) | 5032 | (should-not (with-timeout (1 t) (completion-at-point)))))) |
| 5016 | 5033 | ||
| 5017 | (ert-deftest python-completion-at-point-native-1 () | 5034 | (ert-deftest python-completion-at-point-native-1 () |
| 5018 | (skip-unless (executable-find python-tests-shell-interpreter)) | 5035 | (skip-unless (python-tests-get-shell-interpreter)) |
| 5019 | (python-tests-with-temp-buffer-with-shell | 5036 | (python-tests-with-temp-buffer-with-shell |
| 5020 | " | 5037 | " |
| 5021 | import abc | 5038 | import abc |
| @@ -5034,7 +5051,7 @@ import abc | |||
| 5034 | 5051 | ||
| 5035 | (ert-deftest python-completion-at-point-native-2 () | 5052 | (ert-deftest python-completion-at-point-native-2 () |
| 5036 | "Should work regardless of the point in the Shell buffer." | 5053 | "Should work regardless of the point in the Shell buffer." |
| 5037 | (skip-unless (executable-find python-tests-shell-interpreter)) | 5054 | (skip-unless (python-tests-get-shell-interpreter)) |
| 5038 | (python-tests-with-temp-buffer-with-shell | 5055 | (python-tests-with-temp-buffer-with-shell |
| 5039 | " | 5056 | " |
| 5040 | import abc | 5057 | import abc |
| @@ -5052,7 +5069,7 @@ import abc | |||
| 5052 | (should (completion-at-point))))) | 5069 | (should (completion-at-point))))) |
| 5053 | 5070 | ||
| 5054 | (ert-deftest python-completion-at-point-native-with-ffap-1 () | 5071 | (ert-deftest python-completion-at-point-native-with-ffap-1 () |
| 5055 | (skip-unless (executable-find python-tests-shell-interpreter)) | 5072 | (skip-unless (python-tests-get-shell-interpreter)) |
| 5056 | (python-tests-with-temp-buffer-with-shell | 5073 | (python-tests-with-temp-buffer-with-shell |
| 5057 | " | 5074 | " |
| 5058 | import abc | 5075 | import abc |
| @@ -5070,7 +5087,7 @@ import abc | |||
| 5070 | (should (completion-at-point))))) | 5087 | (should (completion-at-point))))) |
| 5071 | 5088 | ||
| 5072 | (ert-deftest python-completion-at-point-native-with-eldoc-1 () | 5089 | (ert-deftest python-completion-at-point-native-with-eldoc-1 () |
| 5073 | (skip-unless (executable-find python-tests-shell-interpreter)) | 5090 | (skip-unless (python-tests-get-shell-interpreter)) |
| 5074 | (python-tests-with-temp-buffer-with-shell | 5091 | (python-tests-with-temp-buffer-with-shell |
| 5075 | " | 5092 | " |
| 5076 | import abc | 5093 | import abc |
| @@ -5097,7 +5114,7 @@ import abc | |||
| 5097 | ;;; FFAP | 5114 | ;;; FFAP |
| 5098 | 5115 | ||
| 5099 | (ert-deftest python-ffap-module-path-1 () | 5116 | (ert-deftest python-ffap-module-path-1 () |
| 5100 | (skip-unless (executable-find python-tests-shell-interpreter)) | 5117 | (skip-unless (python-tests-get-shell-interpreter)) |
| 5101 | (python-tests-with-temp-buffer-with-shell | 5118 | (python-tests-with-temp-buffer-with-shell |
| 5102 | " | 5119 | " |
| 5103 | import abc | 5120 | import abc |
| @@ -5109,7 +5126,7 @@ import abc | |||
| 5109 | 5126 | ||
| 5110 | (ert-deftest python-ffap-module-path-while-running-1 () | 5127 | (ert-deftest python-ffap-module-path-while-running-1 () |
| 5111 | "Should not get module path when a program is running in the Shell buffer." | 5128 | "Should not get module path when a program is running in the Shell buffer." |
| 5112 | (skip-unless (executable-find python-tests-shell-interpreter)) | 5129 | (skip-unless (python-tests-get-shell-interpreter)) |
| 5113 | (python-tests-with-temp-buffer-with-shell | 5130 | (python-tests-with-temp-buffer-with-shell |
| 5114 | " | 5131 | " |
| 5115 | import abc | 5132 | import abc |
| @@ -5185,7 +5202,7 @@ some_symbol some_other_symbol | |||
| 5185 | "some_symbol")))) | 5202 | "some_symbol")))) |
| 5186 | 5203 | ||
| 5187 | (ert-deftest python-eldoc--get-doc-at-point-1 () | 5204 | (ert-deftest python-eldoc--get-doc-at-point-1 () |
| 5188 | (skip-unless (executable-find python-tests-shell-interpreter)) | 5205 | (skip-unless (python-tests-get-shell-interpreter)) |
| 5189 | (python-tests-with-temp-buffer-with-shell | 5206 | (python-tests-with-temp-buffer-with-shell |
| 5190 | " | 5207 | " |
| 5191 | import time | 5208 | import time |
| @@ -5198,7 +5215,7 @@ import time | |||
| 5198 | 5215 | ||
| 5199 | (ert-deftest python-eldoc--get-doc-at-point-while-running-1 () | 5216 | (ert-deftest python-eldoc--get-doc-at-point-while-running-1 () |
| 5200 | "Should not get documentation when a program is running in the Shell buffer." | 5217 | "Should not get documentation when a program is running in the Shell buffer." |
| 5201 | (skip-unless (executable-find python-tests-shell-interpreter)) | 5218 | (skip-unless (python-tests-get-shell-interpreter)) |
| 5202 | (python-tests-with-temp-buffer-with-shell | 5219 | (python-tests-with-temp-buffer-with-shell |
| 5203 | " | 5220 | " |
| 5204 | import time | 5221 | import time |
| @@ -7416,8 +7433,9 @@ buffer with overlapping strings." | |||
| 7416 | ;; interpreter. | 7433 | ;; interpreter. |
| 7417 | (ert-deftest python-tests--run-python-selects-window () | 7434 | (ert-deftest python-tests--run-python-selects-window () |
| 7418 | "Test for bug#31398. See also bug#44421 and bug#52380." | 7435 | "Test for bug#31398. See also bug#44421 and bug#52380." |
| 7419 | (skip-unless (executable-find python-tests-shell-interpreter)) | 7436 | (skip-unless (python-tests-get-shell-interpreter)) |
| 7420 | (let* ((buffer (process-buffer (run-python nil nil 'show))) | 7437 | (let* ((python-shell-interpreter (python-tests-get-shell-interpreter)) |
| 7438 | (buffer (process-buffer (run-python nil nil 'show))) | ||
| 7421 | (window (get-buffer-window buffer))) | 7439 | (window (get-buffer-window buffer))) |
| 7422 | ;; We look at `selected-window' rather than `current-buffer' | 7440 | ;; We look at `selected-window' rather than `current-buffer' |
| 7423 | ;; because as `(elisp)Current buffer' says, the latter will only | 7441 | ;; because as `(elisp)Current buffer' says, the latter will only |
| @@ -7487,7 +7505,7 @@ buffer with overlapping strings." | |||
| 7487 | "W0611: Unused import a.b.c (unused-import)")))))) | 7505 | "W0611: Unused import a.b.c (unused-import)")))))) |
| 7488 | 7506 | ||
| 7489 | (ert-deftest python-test--shell-send-block () | 7507 | (ert-deftest python-test--shell-send-block () |
| 7490 | (skip-unless (executable-find python-tests-shell-interpreter)) | 7508 | (skip-unless (python-tests-get-shell-interpreter)) |
| 7491 | (python-tests-with-temp-buffer-with-shell | 7509 | (python-tests-with-temp-buffer-with-shell |
| 7492 | "print('current 0') | 7510 | "print('current 0') |
| 7493 | for x in range(1,3): | 7511 | for x in range(1,3): |