aboutsummaryrefslogtreecommitdiffstats
path: root/test/lisp/progmodes/python-tests.el
diff options
context:
space:
mode:
authorkobarity2024-06-04 21:51:32 +0900
committerMattias EngdegÄrd2024-06-09 15:57:53 +0200
commitbfb4c69e7f1b86e358e827f757b73161952aae3c (patch)
tree0f4bca6d21ee877d2cf03a19c05c48354ecde7c8 /test/lisp/progmodes/python-tests.el
parent25ab3e7be8b1c71b5939682c5b5fe6810807bcc5 (diff)
downloademacs-bfb4c69e7f1b86e358e827f757b73161952aae3c.tar.gz
emacs-bfb4c69e7f1b86e358e827f757b73161952aae3c.zip
Specify Python 3 in some ERTs on Mac
* test/lisp/progmodes/python-tests.el (python-tests-with-temp-buffer-with-shell): Remove setting 'python-shell-interpreter'. (python-tests-shell-interpreter): Removed. (python-tests-shell-interpreters): New variable. (python-tests-with-shell-interpreter) (python-tests-with-temp-buffer-with-shell-interpreter): New macros. (python-tests-get-shell-interpreter): Add an optional PRED argument to allow ERts to specify Python interpreter version. (python-tests--get-interpreter-info): New function. (python-tests-interpreter-3-p): New function to be used as the PRED argument of 'python-tests-get-shell-interpreter'. (python-shell-make-comint-1) (python-shell-make-comint-2) (python-shell-make-comint-4) (python-shell-get-process-1) (python-shell-internal-get-or-create-process-1) (python-shell-prompt-detect-1) (python-shell-prompt-detect-2) (python-shell-prompt-detect-3) (python-shell-prompt-detect-4) (python-shell-prompt-detect-5) (python-shell-prompt-detect-6) (python-shell-prompt-set-calculated-regexps-6) (python-shell-completion-at-point-jedi-completer) (python-completion-at-point-pdb-1) (python-completion-at-point-while-running-1) (python-ffap-module-path-1) (python-ffap-module-path-while-running-1) (python-eldoc--get-doc-at-point-1) (python-eldoc--get-doc-at-point-while-running-1) (python-tests--run-python-selects-window) (python-test--shell-send-block): Use the new macro. (python-shell-completion-at-point-ipython): Remove setting 'python-tests-shell-interpreter'. (python-shell-completion-at-point-1) (python-completion-at-point-1) (python-completion-at-point-2) (python-completion-at-point-native-1) (python-completion-at-point-native-2) (python-completion-at-point-native-with-ffap-1) (python-completion-at-point-native-with-eldoc-1): Use the new macro and specify Python 3 on Mac to avoid errors. (Bug#70815)
Diffstat (limited to 'test/lisp/progmodes/python-tests.el')
-rw-r--r--test/lisp/progmodes/python-tests.el660
1 files changed, 352 insertions, 308 deletions
diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el
index 526dade335c..ce103921454 100644
--- a/test/lisp/progmodes/python-tests.el
+++ b/test/lisp/progmodes/python-tests.el
@@ -59,8 +59,7 @@ turned off. Shell buffer will be killed on exit."
59 (let ((dir (make-symbol "dir"))) 59 (let ((dir (make-symbol "dir")))
60 `(with-temp-buffer 60 `(with-temp-buffer
61 (let ((python-indent-guess-indent-offset nil) 61 (let ((python-indent-guess-indent-offset nil)
62 (python-shell-completion-native-enable nil) 62 (python-shell-completion-native-enable nil))
63 (python-shell-interpreter (python-tests-get-shell-interpreter)))
64 (python-mode) 63 (python-mode)
65 (unwind-protect 64 (unwind-protect
66 ;; Prevent test failures when Jedi is used as a completion 65 ;; Prevent test failures when Jedi is used as a completion
@@ -3759,21 +3758,67 @@ if x:
3759 3758
3760;;; Shell integration 3759;;; Shell integration
3761 3760
3762(defvar python-tests-shell-interpreter nil) 3761(defvar python-tests-shell-interpreters nil
3763 3762 "List of Python interpreter information.
3764(defun python-tests-get-shell-interpreter () 3763Set this variable to nil to rescan interpreters.")
3764
3765(defmacro python-tests-with-shell-interpreter (pred &rest body)
3766 "Bind `python-shell-interpreter' and execute BODY.
3767`python-shell-interpreter' is bound to the result of calling
3768`python-tests-get-shell-interpreter' with PRED argument. The calling
3769ERT is skipped if `python-tests-get-shell-interpreter' returned nil."
3770 `(let ((python-shell-interpreter
3771 (python-tests-get-shell-interpreter ,pred)))
3772 (skip-unless python-shell-interpreter)
3773 ,@body))
3774
3775(defmacro python-tests-with-temp-buffer-with-shell-interpreter
3776 (pred contents &rest body)
3777 "Variant of `python-tests-with-temp-buffer-with-shell'.
3778It binds `python-shell-interpreter' to the result of calling
3779`python-tests-get-shell-interpreter' with PRED argument, and calls
3780`python-tests-with-temp-buffer-with-shell' with CONTENTS and BODY."
3781 `(python-tests-with-shell-interpreter
3782 ,pred
3783 (python-tests-with-temp-buffer-with-shell ,contents ,@body)))
3784
3785(defun python-tests-get-shell-interpreter (&optional pred)
3765 "Get the shell interpreter. 3786 "Get the shell interpreter.
3766If env string EMACS_PYTHON_INTERPRETER exists, use it as preferred one." 3787If an optional PRED is specified, an interpreter is selected that
3767 (if python-tests-shell-interpreter 3788matches the predicate. PRED must return the absolute file name if the
3768 python-tests-shell-interpreter 3789condition is met. If env string EMACS_PYTHON_INTERPRETER exists, use it
3769 (setq python-tests-shell-interpreter 3790as preferred one."
3770 (or (when-let ((interpreter (getenv "EMACS_PYTHON_INTERPRETER"))) 3791 (unless python-tests-shell-interpreters
3771 (or (executable-find interpreter) 3792 (setq python-tests-shell-interpreters
3772 (error "Couldn't find EMACS_PYTHON_INTERPRETER(%s) in path" 3793 (if-let ((interpreter (getenv "EMACS_PYTHON_INTERPRETER")))
3773 interpreter))) 3794 (if-let ((info (python-tests--get-interpreter-info interpreter)))
3774 ;; Use the same order as for the default value of 3795 (list info)
3775 ;; `python-shell-interpreter'. 3796 (error "Couldn't find EMACS_PYTHON_INTERPRETER(%s) in path"
3776 (cl-some #'executable-find '("python3" "python" "python2")))))) 3797 interpreter))
3798 ;; Use the same order as for the default value of
3799 ;; `python-shell-interpreter'.
3800 (delq nil (mapcar #'python-tests--get-interpreter-info
3801 '("python3" "python" "python2"))))))
3802 (cl-some (or pred #'car) python-tests-shell-interpreters))
3803
3804(defun python-tests--get-interpreter-info (name)
3805 "Get Python interpreter information specified by NAME.
3806The information returned is a cons cell consisting of the file path and
3807the version string."
3808 (when-let ((interpreter (executable-find name)))
3809 (with-temp-buffer
3810 (and (equal (call-process interpreter nil t nil "--version") 0)
3811 (goto-char (point-min))
3812 (looking-at
3813 (rx (seq "Python" (+ space) (group (+ (any digit ?.))))))
3814 (cons interpreter (match-string-no-properties 1))))))
3815
3816(defun python-tests-interpreter-3-p (info)
3817 "Return the absolute file name if the interpreter major version in INFO is 3.
3818This function is intended to be used as the PRED argument of
3819`python-tests-get-shell-interpreter'."
3820 (when (string= (car (split-string (cdr info) "\\.")) "3")
3821 (car info)))
3777 3822
3778(ert-deftest python-shell-get-process-name-1 () 3823(ert-deftest python-shell-get-process-name-1 ()
3779 "Check process name calculation sans `buffer-file-name'." 3824 "Check process name calculation sans `buffer-file-name'."
@@ -4035,48 +4080,46 @@ If env string EMACS_PYTHON_INTERPRETER exists, use it as preferred one."
4035 4080
4036(ert-deftest python-shell-make-comint-1 () 4081(ert-deftest python-shell-make-comint-1 ()
4037 "Check comint creation for global shell buffer." 4082 "Check comint creation for global shell buffer."
4038 (skip-unless (python-tests-get-shell-interpreter))
4039 ;; The interpreter can get killed too quickly to allow it to clean 4083 ;; The interpreter can get killed too quickly to allow it to clean
4040 ;; up the tempfiles that the default python-shell-setup-codes create, 4084 ;; up the tempfiles that the default python-shell-setup-codes create,
4041 ;; so it leaves tempfiles behind, which is a minor irritation. 4085 ;; so it leaves tempfiles behind, which is a minor irritation.
4042 (let* ((python-shell-setup-codes nil) 4086 (python-tests-with-shell-interpreter
4043 (python-shell-interpreter 4087 nil
4044 (python-tests-get-shell-interpreter)) 4088 (let* ((python-shell-setup-codes nil)
4045 (proc-name (python-shell-get-process-name nil)) 4089 (proc-name (python-shell-get-process-name nil))
4046 (shell-buffer 4090 (shell-buffer
4047 (python-tests-with-temp-buffer 4091 (python-tests-with-temp-buffer
4048 "" (python-shell-make-comint 4092 "" (python-shell-make-comint
4049 (python-shell-calculate-command) proc-name))) 4093 (python-shell-calculate-command) proc-name)))
4050 (process (get-buffer-process shell-buffer))) 4094 (process (get-buffer-process shell-buffer)))
4051 (unwind-protect 4095 (unwind-protect
4052 (progn 4096 (progn
4053 (set-process-query-on-exit-flag process nil) 4097 (set-process-query-on-exit-flag process nil)
4054 (should (process-live-p process)) 4098 (should (process-live-p process))
4055 (with-current-buffer shell-buffer 4099 (with-current-buffer shell-buffer
4056 (should (eq major-mode 'inferior-python-mode)) 4100 (should (eq major-mode 'inferior-python-mode))
4057 (should (string= (buffer-name) (format "*%s*" proc-name))))) 4101 (should (string= (buffer-name) (format "*%s*" proc-name)))))
4058 (kill-buffer shell-buffer)))) 4102 (kill-buffer shell-buffer)))))
4059 4103
4060(ert-deftest python-shell-make-comint-2 () 4104(ert-deftest python-shell-make-comint-2 ()
4061 "Check comint creation for internal shell buffer." 4105 "Check comint creation for internal shell buffer."
4062 (skip-unless (python-tests-get-shell-interpreter)) 4106 (python-tests-with-shell-interpreter
4063 (let* ((python-shell-setup-codes nil) 4107 nil
4064 (python-shell-interpreter 4108 (let* ((python-shell-setup-codes nil)
4065 (python-tests-get-shell-interpreter)) 4109 (proc-name (python-shell-internal-get-process-name))
4066 (proc-name (python-shell-internal-get-process-name)) 4110 (shell-buffer
4067 (shell-buffer 4111 (python-tests-with-temp-buffer
4068 (python-tests-with-temp-buffer 4112 "" (python-shell-make-comint
4069 "" (python-shell-make-comint 4113 (python-shell-calculate-command) proc-name nil t)))
4070 (python-shell-calculate-command) proc-name nil t))) 4114 (process (get-buffer-process shell-buffer)))
4071 (process (get-buffer-process shell-buffer))) 4115 (unwind-protect
4072 (unwind-protect 4116 (progn
4073 (progn 4117 (set-process-query-on-exit-flag process nil)
4074 (set-process-query-on-exit-flag process nil) 4118 (should (process-live-p process))
4075 (should (process-live-p process)) 4119 (with-current-buffer shell-buffer
4076 (with-current-buffer shell-buffer 4120 (should (eq major-mode 'inferior-python-mode))
4077 (should (eq major-mode 'inferior-python-mode)) 4121 (should (string= (buffer-name) (format " *%s*" proc-name)))))
4078 (should (string= (buffer-name) (format " *%s*" proc-name))))) 4122 (kill-buffer shell-buffer)))))
4079 (kill-buffer shell-buffer))))
4080 4123
4081(ert-deftest python-shell-make-comint-3 () 4124(ert-deftest python-shell-make-comint-3 ()
4082 "Check comint creation with overridden python interpreter and args. 4125 "Check comint creation with overridden python interpreter and args.
@@ -4108,58 +4151,56 @@ and `python-shell-interpreter-args' in the new shell buffer."
4108 4151
4109(ert-deftest python-shell-make-comint-4 () 4152(ert-deftest python-shell-make-comint-4 ()
4110 "Check shell calculated prompts regexps are set." 4153 "Check shell calculated prompts regexps are set."
4111 (skip-unless (python-tests-get-shell-interpreter)) 4154 (python-tests-with-shell-interpreter
4112 (let* ((process-environment process-environment) 4155 nil
4113 (python-shell-setup-codes nil) 4156 (let* ((process-environment process-environment)
4114 (python-shell-interpreter 4157 (python-shell-setup-codes nil)
4115 (python-tests-get-shell-interpreter)) 4158 (python-shell-interpreter-args "-i")
4116 (python-shell-interpreter-args "-i") 4159 (python-shell--prompt-calculated-input-regexp nil)
4117 (python-shell--prompt-calculated-input-regexp nil) 4160 (python-shell--prompt-calculated-output-regexp nil)
4118 (python-shell--prompt-calculated-output-regexp nil) 4161 (python-shell-prompt-detect-enabled t)
4119 (python-shell-prompt-detect-enabled t) 4162 (python-shell-prompt-input-regexps '("extralargeinputprompt" "sml"))
4120 (python-shell-prompt-input-regexps '("extralargeinputprompt" "sml")) 4163 (python-shell-prompt-output-regexps '("extralargeoutputprompt" "sml"))
4121 (python-shell-prompt-output-regexps '("extralargeoutputprompt" "sml")) 4164 (python-shell-prompt-regexp "in")
4122 (python-shell-prompt-regexp "in") 4165 (python-shell-prompt-block-regexp "block")
4123 (python-shell-prompt-block-regexp "block") 4166 (python-shell-prompt-pdb-regexp "pdf")
4124 (python-shell-prompt-pdb-regexp "pdf") 4167 (python-shell-prompt-output-regexp "output")
4125 (python-shell-prompt-output-regexp "output") 4168 (startup-code (concat "import sys\n"
4126 (startup-code (concat "import sys\n" 4169 "sys.ps1 = 'py> '\n"
4127 "sys.ps1 = 'py> '\n" 4170 "sys.ps2 = '..> '\n"
4128 "sys.ps2 = '..> '\n" 4171 "sys.ps3 = 'out '\n"))
4129 "sys.ps3 = 'out '\n")) 4172 (startup-file (python-shell--save-temp-file startup-code))
4130 (startup-file (python-shell--save-temp-file startup-code)) 4173 (proc-name (python-shell-get-process-name nil))
4131 (proc-name (python-shell-get-process-name nil)) 4174 (shell-buffer
4132 (shell-buffer 4175 (progn
4133 (progn 4176 (setenv "PYTHONSTARTUP" startup-file)
4134 (setenv "PYTHONSTARTUP" startup-file) 4177 (python-tests-with-temp-buffer
4135 (python-tests-with-temp-buffer 4178 "" (python-shell-make-comint
4136 "" (python-shell-make-comint 4179 (python-shell-calculate-command) proc-name nil))))
4137 (python-shell-calculate-command) proc-name nil)))) 4180 (process (get-buffer-process shell-buffer)))
4138 (process (get-buffer-process shell-buffer))) 4181 (unwind-protect
4139 (unwind-protect 4182 (progn
4140 (progn 4183 (set-process-query-on-exit-flag process nil)
4141 (set-process-query-on-exit-flag process nil) 4184 (should (process-live-p process))
4142 (should (process-live-p process)) 4185 (with-current-buffer shell-buffer
4143 (with-current-buffer shell-buffer 4186 (should (eq major-mode 'inferior-python-mode))
4144 (should (eq major-mode 'inferior-python-mode)) 4187 (should (string=
4145 (should (string= 4188 python-shell--prompt-calculated-input-regexp
4146 python-shell--prompt-calculated-input-regexp 4189 (concat "^\\(extralargeinputprompt\\|\\.\\.> \\|"
4147 (concat "^\\(extralargeinputprompt\\|\\.\\.> \\|" 4190 "block\\|py> \\|pdf\\|sml\\|in\\)")))
4148 "block\\|py> \\|pdf\\|sml\\|in\\)"))) 4191 (should (string=
4149 (should (string= 4192 python-shell--prompt-calculated-output-regexp
4150 python-shell--prompt-calculated-output-regexp 4193 "^\\(extralargeoutputprompt\\|output\\|out \\|sml\\)"))))
4151 "^\\(extralargeoutputprompt\\|output\\|out \\|sml\\)")))) 4194 (delete-file startup-file)
4152 (delete-file startup-file) 4195 (kill-buffer shell-buffer)))))
4153 (kill-buffer shell-buffer))))
4154 4196
4155(ert-deftest python-shell-get-process-1 () 4197(ert-deftest python-shell-get-process-1 ()
4156 "Check dedicated shell process preference over global." 4198 "Check dedicated shell process preference over global."
4157 (skip-unless (python-tests-get-shell-interpreter)) 4199 (python-tests-with-shell-interpreter
4158 (python-tests-with-temp-file 4200 nil
4159 "" 4201 (python-tests-with-temp-file
4202 ""
4160 (let* ((python-shell-setup-codes nil) 4203 (let* ((python-shell-setup-codes nil)
4161 (python-shell-interpreter
4162 (python-tests-get-shell-interpreter))
4163 (global-proc-name (python-shell-get-process-name nil)) 4204 (global-proc-name (python-shell-get-process-name nil))
4164 (dedicated-proc-name (python-shell-get-process-name t)) 4205 (dedicated-proc-name (python-shell-get-process-name t))
4165 (global-shell-buffer 4206 (global-shell-buffer
@@ -4183,131 +4224,134 @@ and `python-shell-interpreter-args' in the new shell buffer."
4183 ;; No buffer available. 4224 ;; No buffer available.
4184 (should (not (python-shell-get-process)))) 4225 (should (not (python-shell-get-process))))
4185 (ignore-errors (kill-buffer global-shell-buffer)) 4226 (ignore-errors (kill-buffer global-shell-buffer))
4186 (ignore-errors (kill-buffer dedicated-shell-buffer)))))) 4227 (ignore-errors (kill-buffer dedicated-shell-buffer)))))))
4187 4228
4188(ert-deftest python-shell-internal-get-or-create-process-1 () 4229(ert-deftest python-shell-internal-get-or-create-process-1 ()
4189 "Check internal shell process creation fallback." 4230 "Check internal shell process creation fallback."
4190 (skip-unless (python-tests-get-shell-interpreter)) 4231 (python-tests-with-shell-interpreter
4191 (python-tests-with-temp-file 4232 nil
4192 "" 4233 (python-tests-with-temp-file
4193 (should (not (process-live-p (python-shell-internal-get-process-name)))) 4234 ""
4194 (let* ((python-shell-interpreter 4235 (should (not (process-live-p (python-shell-internal-get-process-name))))
4195 (python-tests-get-shell-interpreter)) 4236 (let* ((internal-process-name (python-shell-internal-get-process-name))
4196 (internal-process-name (python-shell-internal-get-process-name)) 4237 (internal-process (python-shell-internal-get-or-create-process))
4197 (internal-process (python-shell-internal-get-or-create-process)) 4238 (internal-shell-buffer (process-buffer internal-process)))
4198 (internal-shell-buffer (process-buffer internal-process))) 4239 (unwind-protect
4199 (unwind-protect 4240 (progn
4200 (progn 4241 (set-process-query-on-exit-flag internal-process nil)
4201 (set-process-query-on-exit-flag internal-process nil) 4242 (should (equal (process-name internal-process)
4202 (should (equal (process-name internal-process) 4243 internal-process-name))
4203 internal-process-name)) 4244 (should (equal internal-process
4204 (should (equal internal-process 4245 (python-shell-internal-get-or-create-process)))
4205 (python-shell-internal-get-or-create-process))) 4246 ;; Assert the internal process is not a user process
4206 ;; Assert the internal process is not a user process 4247 (should (not (python-shell-get-process)))
4207 (should (not (python-shell-get-process))) 4248 (kill-buffer internal-shell-buffer))
4208 (kill-buffer internal-shell-buffer)) 4249 (ignore-errors (kill-buffer internal-shell-buffer)))))))
4209 (ignore-errors (kill-buffer internal-shell-buffer))))))
4210 4250
4211(ert-deftest python-shell-prompt-detect-1 () 4251(ert-deftest python-shell-prompt-detect-1 ()
4212 "Check prompt autodetection." 4252 "Check prompt autodetection."
4213 (skip-unless (python-tests-get-shell-interpreter)) 4253 (python-tests-with-shell-interpreter
4214 (let ((process-environment process-environment) 4254 nil
4215 (python-shell-interpreter (python-tests-get-shell-interpreter))) 4255 (let ((process-environment process-environment))
4216 ;; Ensure no startup file is enabled 4256 ;; Ensure no startup file is enabled
4217 (setenv "PYTHONSTARTUP" "") 4257 (setenv "PYTHONSTARTUP" "")
4218 (should python-shell-prompt-detect-enabled) 4258 (should python-shell-prompt-detect-enabled)
4219 (should (equal (python-shell-prompt-detect) '(">>> " "... " ""))))) 4259 (should (equal (python-shell-prompt-detect) '(">>> " "... " ""))))))
4220 4260
4221(ert-deftest python-shell-prompt-detect-2 () 4261(ert-deftest python-shell-prompt-detect-2 ()
4222 "Check prompt autodetection with startup file. Bug#17370." 4262 "Check prompt autodetection with startup file. Bug#17370."
4223 (skip-unless (python-tests-get-shell-interpreter)) 4263 (python-tests-with-shell-interpreter
4224 (let* ((process-environment process-environment) 4264 nil
4225 (python-shell-interpreter (python-tests-get-shell-interpreter)) 4265 (let* ((process-environment process-environment)
4226 (startup-code (concat "import sys\n" 4266 (startup-code (concat "import sys\n"
4227 "sys.ps1 = 'py> '\n" 4267 "sys.ps1 = 'py> '\n"
4228 "sys.ps2 = '..> '\n" 4268 "sys.ps2 = '..> '\n"
4229 "sys.ps3 = 'out '\n")) 4269 "sys.ps3 = 'out '\n"))
4230 (startup-file (python-shell--save-temp-file startup-code))) 4270 (startup-file (python-shell--save-temp-file startup-code)))
4231 (unwind-protect 4271 (unwind-protect
4232 (progn 4272 (progn
4233 ;; Ensure startup file is enabled 4273 ;; Ensure startup file is enabled
4234 (setenv "PYTHONSTARTUP" startup-file) 4274 (setenv "PYTHONSTARTUP" startup-file)
4235 (should python-shell-prompt-detect-enabled) 4275 (should python-shell-prompt-detect-enabled)
4236 (should (equal (python-shell-prompt-detect) '("py> " "..> " "out ")))) 4276 (should (equal (python-shell-prompt-detect) '("py> " "..> " "out "))))
4237 (ignore-errors (delete-file startup-file))))) 4277 (ignore-errors (delete-file startup-file))))))
4238 4278
4239(ert-deftest python-shell-prompt-detect-3 () 4279(ert-deftest python-shell-prompt-detect-3 ()
4240 "Check prompts are not autodetected when feature is disabled." 4280 "Check prompts are not autodetected when feature is disabled."
4241 (skip-unless (python-tests-get-shell-interpreter)) 4281 (python-tests-with-shell-interpreter
4242 (let ((process-environment process-environment) 4282 nil
4243 (python-shell-prompt-detect-enabled nil)) 4283 (let ((process-environment process-environment)
4244 ;; Ensure no startup file is enabled 4284 (python-shell-prompt-detect-enabled nil))
4245 (should (not python-shell-prompt-detect-enabled)) 4285 ;; Ensure no startup file is enabled
4246 (should (not (python-shell-prompt-detect))))) 4286 (should (not python-shell-prompt-detect-enabled))
4287 (should (not (python-shell-prompt-detect))))))
4247 4288
4248(ert-deftest python-shell-prompt-detect-4 () 4289(ert-deftest python-shell-prompt-detect-4 ()
4249 "Check warning is shown when detection fails." 4290 "Check warning is shown when detection fails."
4250 (skip-unless (python-tests-get-shell-interpreter)) 4291 (python-tests-with-shell-interpreter
4251 (let* ((process-environment process-environment) 4292 nil
4252 ;; Trigger failure by removing prompts in the startup file 4293 (let* ((process-environment process-environment)
4253 (startup-code (concat "import sys\n" 4294 ;; Trigger failure by removing prompts in the startup file
4254 "sys.ps1 = ''\n" 4295 (startup-code (concat "import sys\n"
4255 "sys.ps2 = ''\n" 4296 "sys.ps1 = ''\n"
4256 "sys.ps3 = ''\n")) 4297 "sys.ps2 = ''\n"
4257 (startup-file (python-shell--save-temp-file startup-code))) 4298 "sys.ps3 = ''\n"))
4258 (unwind-protect 4299 (startup-file (python-shell--save-temp-file startup-code)))
4259 (progn 4300 (unwind-protect
4260 (kill-buffer (get-buffer-create "*Warnings*")) 4301 (progn
4261 (should (not (get-buffer "*Warnings*"))) 4302 (kill-buffer (get-buffer-create "*Warnings*"))
4262 (setenv "PYTHONSTARTUP" startup-file) 4303 (should (not (get-buffer "*Warnings*")))
4263 (should python-shell-prompt-detect-failure-warning) 4304 (setenv "PYTHONSTARTUP" startup-file)
4264 (should python-shell-prompt-detect-enabled) 4305 (should python-shell-prompt-detect-failure-warning)
4265 (should (not (python-shell-prompt-detect))) 4306 (should python-shell-prompt-detect-enabled)
4266 (should (get-buffer "*Warnings*"))) 4307 (should (not (python-shell-prompt-detect)))
4267 (ignore-errors (delete-file startup-file))))) 4308 (should (get-buffer "*Warnings*")))
4309 (ignore-errors (delete-file startup-file))))))
4268 4310
4269(ert-deftest python-shell-prompt-detect-5 () 4311(ert-deftest python-shell-prompt-detect-5 ()
4270 "Check disabled warnings are not shown when detection fails." 4312 "Check disabled warnings are not shown when detection fails."
4271 (skip-unless (python-tests-get-shell-interpreter)) 4313 (python-tests-with-shell-interpreter
4272 (let* ((process-environment process-environment) 4314 nil
4273 (startup-code (concat "import sys\n" 4315 (let* ((process-environment process-environment)
4274 "sys.ps1 = ''\n" 4316 (startup-code (concat "import sys\n"
4275 "sys.ps2 = ''\n" 4317 "sys.ps1 = ''\n"
4276 "sys.ps3 = ''\n")) 4318 "sys.ps2 = ''\n"
4277 (startup-file (python-shell--save-temp-file startup-code)) 4319 "sys.ps3 = ''\n"))
4278 (python-shell-prompt-detect-failure-warning nil)) 4320 (startup-file (python-shell--save-temp-file startup-code))
4279 (unwind-protect 4321 (python-shell-prompt-detect-failure-warning nil))
4280 (progn 4322 (unwind-protect
4281 (kill-buffer (get-buffer-create "*Warnings*")) 4323 (progn
4282 (should (not (get-buffer "*Warnings*"))) 4324 (kill-buffer (get-buffer-create "*Warnings*"))
4283 (setenv "PYTHONSTARTUP" startup-file) 4325 (should (not (get-buffer "*Warnings*")))
4284 (should (not python-shell-prompt-detect-failure-warning)) 4326 (setenv "PYTHONSTARTUP" startup-file)
4285 (should python-shell-prompt-detect-enabled) 4327 (should (not python-shell-prompt-detect-failure-warning))
4286 (should (not (python-shell-prompt-detect))) 4328 (should python-shell-prompt-detect-enabled)
4287 (should (not (get-buffer "*Warnings*")))) 4329 (should (not (python-shell-prompt-detect)))
4288 (ignore-errors (delete-file startup-file))))) 4330 (should (not (get-buffer "*Warnings*"))))
4331 (ignore-errors (delete-file startup-file))))))
4289 4332
4290(ert-deftest python-shell-prompt-detect-6 () 4333(ert-deftest python-shell-prompt-detect-6 ()
4291 "Warnings are not shown when detection is disabled." 4334 "Warnings are not shown when detection is disabled."
4292 (skip-unless (python-tests-get-shell-interpreter)) 4335 (python-tests-with-shell-interpreter
4293 (let* ((process-environment process-environment) 4336 nil
4294 (startup-code (concat "import sys\n" 4337 (let* ((process-environment process-environment)
4295 "sys.ps1 = ''\n" 4338 (startup-code (concat "import sys\n"
4296 "sys.ps2 = ''\n" 4339 "sys.ps1 = ''\n"
4297 "sys.ps3 = ''\n")) 4340 "sys.ps2 = ''\n"
4298 (startup-file (python-shell--save-temp-file startup-code)) 4341 "sys.ps3 = ''\n"))
4299 (python-shell-prompt-detect-failure-warning t) 4342 (startup-file (python-shell--save-temp-file startup-code))
4300 (python-shell-prompt-detect-enabled nil)) 4343 (python-shell-prompt-detect-failure-warning t)
4301 (unwind-protect 4344 (python-shell-prompt-detect-enabled nil))
4302 (progn 4345 (unwind-protect
4303 (kill-buffer (get-buffer-create "*Warnings*")) 4346 (progn
4304 (should (not (get-buffer "*Warnings*"))) 4347 (kill-buffer (get-buffer-create "*Warnings*"))
4305 (setenv "PYTHONSTARTUP" startup-file) 4348 (should (not (get-buffer "*Warnings*")))
4306 (should python-shell-prompt-detect-failure-warning) 4349 (setenv "PYTHONSTARTUP" startup-file)
4307 (should (not python-shell-prompt-detect-enabled)) 4350 (should python-shell-prompt-detect-failure-warning)
4308 (should (not (python-shell-prompt-detect))) 4351 (should (not python-shell-prompt-detect-enabled))
4309 (should (not (get-buffer "*Warnings*")))) 4352 (should (not (python-shell-prompt-detect)))
4310 (ignore-errors (delete-file startup-file))))) 4353 (should (not (get-buffer "*Warnings*"))))
4354 (ignore-errors (delete-file startup-file))))))
4311 4355
4312(ert-deftest python-shell-prompt-validate-regexps-1 () 4356(ert-deftest python-shell-prompt-validate-regexps-1 ()
4313 "Check `python-shell-prompt-input-regexps' are validated." 4357 "Check `python-shell-prompt-input-regexps' are validated."
@@ -4453,32 +4497,32 @@ and `python-shell-interpreter-args' in the new shell buffer."
4453 4497
4454(ert-deftest python-shell-prompt-set-calculated-regexps-6 () 4498(ert-deftest python-shell-prompt-set-calculated-regexps-6 ()
4455 "Check detected prompts are included `regexp-quote'd." 4499 "Check detected prompts are included `regexp-quote'd."
4456 (skip-unless (python-tests-get-shell-interpreter)) 4500 (python-tests-with-shell-interpreter
4457 (let* ((python-shell-prompt-input-regexps '("")) 4501 nil
4458 (python-shell-prompt-output-regexps '("")) 4502 (let* ((python-shell-prompt-input-regexps '(""))
4459 (python-shell-prompt-regexp "") 4503 (python-shell-prompt-output-regexps '(""))
4460 (python-shell-prompt-block-regexp "") 4504 (python-shell-prompt-regexp "")
4461 (python-shell-prompt-pdb-regexp "") 4505 (python-shell-prompt-block-regexp "")
4462 (python-shell-prompt-output-regexp "") 4506 (python-shell-prompt-pdb-regexp "")
4463 (python-shell--prompt-calculated-input-regexp nil) 4507 (python-shell-prompt-output-regexp "")
4464 (python-shell--prompt-calculated-output-regexp nil) 4508 (python-shell--prompt-calculated-input-regexp nil)
4465 (python-shell-prompt-detect-enabled t) 4509 (python-shell--prompt-calculated-output-regexp nil)
4466 (python-shell-interpreter (python-tests-get-shell-interpreter)) 4510 (python-shell-prompt-detect-enabled t)
4467 (process-environment process-environment) 4511 (process-environment process-environment)
4468 (startup-code (concat "import sys\n" 4512 (startup-code (concat "import sys\n"
4469 "sys.ps1 = 'p.> '\n" 4513 "sys.ps1 = 'p.> '\n"
4470 "sys.ps2 = '..> '\n" 4514 "sys.ps2 = '..> '\n"
4471 "sys.ps3 = 'o.t '\n")) 4515 "sys.ps3 = 'o.t '\n"))
4472 (startup-file (python-shell--save-temp-file startup-code))) 4516 (startup-file (python-shell--save-temp-file startup-code)))
4473 (unwind-protect 4517 (unwind-protect
4474 (progn 4518 (progn
4475 (setenv "PYTHONSTARTUP" startup-file) 4519 (setenv "PYTHONSTARTUP" startup-file)
4476 (python-shell-prompt-set-calculated-regexps) 4520 (python-shell-prompt-set-calculated-regexps)
4477 (should (string= python-shell--prompt-calculated-input-regexp 4521 (should (string= python-shell--prompt-calculated-input-regexp
4478 "^\\(\\.\\.> \\|p\\.> \\|\\)")) 4522 "^\\(\\.\\.> \\|p\\.> \\|\\)"))
4479 (should (string= python-shell--prompt-calculated-output-regexp 4523 (should (string= python-shell--prompt-calculated-output-regexp
4480 "^\\(o\\.t \\|\\)"))) 4524 "^\\(o\\.t \\|\\)")))
4481 (ignore-errors (delete-file startup-file))))) 4525 (ignore-errors (delete-file startup-file))))))
4482 4526
4483(ert-deftest python-shell-buffer-substring-1 () 4527(ert-deftest python-shell-buffer-substring-1 ()
4484 "Selecting a substring of the whole buffer must match its contents." 4528 "Selecting a substring of the whole buffer must match its contents."
@@ -4837,8 +4881,8 @@ def foo():
4837 (should (python-shell-completion-native-interpreter-disabled-p)))) 4881 (should (python-shell-completion-native-interpreter-disabled-p))))
4838 4882
4839(ert-deftest python-shell-completion-at-point-1 () 4883(ert-deftest python-shell-completion-at-point-1 ()
4840 (skip-unless (python-tests-get-shell-interpreter)) 4884 (python-tests-with-temp-buffer-with-shell-interpreter
4841 (python-tests-with-temp-buffer-with-shell 4885 (when (eq system-type 'darwin) #'python-tests-interpreter-3-p)
4842 "" 4886 ""
4843 (python-shell-with-shell-buffer 4887 (python-shell-with-shell-buffer
4844 (skip-unless python-shell-readline-completer-delims) 4888 (skip-unless python-shell-readline-completer-delims)
@@ -4851,8 +4895,8 @@ def foo():
4851 (should-not (nth 2 (python-shell-completion-at-point)))))) 4895 (should-not (nth 2 (python-shell-completion-at-point))))))
4852 4896
4853(ert-deftest python-shell-completion-at-point-native-1 () 4897(ert-deftest python-shell-completion-at-point-native-1 ()
4854 (skip-unless (python-tests-get-shell-interpreter)) 4898 (python-tests-with-temp-buffer-with-shell-interpreter
4855 (python-tests-with-temp-buffer-with-shell 4899 nil
4856 "" 4900 ""
4857 (python-shell-completion-native-turn-on) 4901 (python-shell-completion-native-turn-on)
4858 (python-shell-with-shell-buffer 4902 (python-shell-with-shell-buffer
@@ -4937,25 +4981,25 @@ def foo():
4937 4981
4938(ert-deftest python-shell-completion-at-point-jedi-completer () 4982(ert-deftest python-shell-completion-at-point-jedi-completer ()
4939 "Check if Python shell completion works when Jedi completer is used." 4983 "Check if Python shell completion works when Jedi completer is used."
4940 (skip-unless (python-tests-get-shell-interpreter)) 4984 (python-tests-with-shell-interpreter
4941 (with-environment-variables 4985 nil
4942 (("PYTHONSTARTUP" (python-tests--pythonstartup-file))) 4986 (with-environment-variables
4943 (python-tests-with-temp-buffer-with-shell 4987 (("PYTHONSTARTUP" (python-tests--pythonstartup-file)))
4944 "" 4988 (python-tests-with-temp-buffer-with-shell
4945 (python-shell-with-shell-buffer 4989 ""
4946 (skip-unless (string= python-shell-readline-completer-delims "")) 4990 (python-shell-with-shell-buffer
4947 (python-shell-completion-native-turn-off) 4991 (skip-unless (string= python-shell-readline-completer-delims ""))
4948 (python-tests--completion-module) 4992 (python-shell-completion-native-turn-off)
4949 (python-tests--completion-parameters) 4993 (python-tests--completion-module)
4950 (python-shell-completion-native-turn-on) 4994 (python-tests--completion-parameters)
4951 (python-tests--completion-module) 4995 (python-shell-completion-native-turn-on)
4952 (python-tests--completion-parameters) 4996 (python-tests--completion-module)
4953 (python-tests--completion-extra-context))))) 4997 (python-tests--completion-parameters)
4998 (python-tests--completion-extra-context))))))
4954 4999
4955(ert-deftest python-shell-completion-at-point-ipython () 5000(ert-deftest python-shell-completion-at-point-ipython ()
4956 "Check if Python shell completion works for IPython." 5001 "Check if Python shell completion works for IPython."
4957 (let ((python-tests-shell-interpreter "ipython") 5002 (let ((python-shell-interpreter "ipython")
4958 (python-shell-interpreter "ipython")
4959 (python-shell-interpreter-args "-i --simple-prompt")) 5003 (python-shell-interpreter-args "-i --simple-prompt"))
4960 (skip-unless 5004 (skip-unless
4961 (and 5005 (and
@@ -4982,8 +5026,8 @@ def foo():
4982;;; Symbol completion 5026;;; Symbol completion
4983 5027
4984(ert-deftest python-completion-at-point-1 () 5028(ert-deftest python-completion-at-point-1 ()
4985 (skip-unless (python-tests-get-shell-interpreter)) 5029 (python-tests-with-temp-buffer-with-shell-interpreter
4986 (python-tests-with-temp-buffer-with-shell 5030 (when (eq system-type 'darwin) #'python-tests-interpreter-3-p)
4987 " 5031 "
4988import abc 5032import abc
4989" 5033"
@@ -5000,8 +5044,8 @@ import abc
5000 5044
5001(ert-deftest python-completion-at-point-2 () 5045(ert-deftest python-completion-at-point-2 ()
5002 "Should work regardless of the point in the Shell buffer." 5046 "Should work regardless of the point in the Shell buffer."
5003 (skip-unless (python-tests-get-shell-interpreter)) 5047 (python-tests-with-temp-buffer-with-shell-interpreter
5004 (python-tests-with-temp-buffer-with-shell 5048 (when (eq system-type 'darwin) #'python-tests-interpreter-3-p)
5005 " 5049 "
5006import abc 5050import abc
5007" 5051"
@@ -5018,8 +5062,8 @@ import abc
5018 5062
5019(ert-deftest python-completion-at-point-pdb-1 () 5063(ert-deftest python-completion-at-point-pdb-1 ()
5020 "Should not complete PDB commands in Python buffer." 5064 "Should not complete PDB commands in Python buffer."
5021 (skip-unless (python-tests-get-shell-interpreter)) 5065 (python-tests-with-temp-buffer-with-shell-interpreter
5022 (python-tests-with-temp-buffer-with-shell 5066 nil
5023 " 5067 "
5024import pdb 5068import pdb
5025 5069
@@ -5037,8 +5081,8 @@ print('Hello')
5037 5081
5038(ert-deftest python-completion-at-point-while-running-1 () 5082(ert-deftest python-completion-at-point-while-running-1 ()
5039 "Should not try to complete when a program is running in the Shell buffer." 5083 "Should not try to complete when a program is running in the Shell buffer."
5040 (skip-unless (python-tests-get-shell-interpreter)) 5084 (python-tests-with-temp-buffer-with-shell-interpreter
5041 (python-tests-with-temp-buffer-with-shell 5085 nil
5042 " 5086 "
5043import time 5087import time
5044 5088
@@ -5053,8 +5097,8 @@ time.sleep(3)
5053 (should-not (with-timeout (1 t) (completion-at-point)))))) 5097 (should-not (with-timeout (1 t) (completion-at-point))))))
5054 5098
5055(ert-deftest python-completion-at-point-native-1 () 5099(ert-deftest python-completion-at-point-native-1 ()
5056 (skip-unless (python-tests-get-shell-interpreter)) 5100 (python-tests-with-temp-buffer-with-shell-interpreter
5057 (python-tests-with-temp-buffer-with-shell 5101 (when (eq system-type 'darwin) #'python-tests-interpreter-3-p)
5058 " 5102 "
5059import abc 5103import abc
5060" 5104"
@@ -5072,8 +5116,8 @@ import abc
5072 5116
5073(ert-deftest python-completion-at-point-native-2 () 5117(ert-deftest python-completion-at-point-native-2 ()
5074 "Should work regardless of the point in the Shell buffer." 5118 "Should work regardless of the point in the Shell buffer."
5075 (skip-unless (python-tests-get-shell-interpreter)) 5119 (python-tests-with-temp-buffer-with-shell-interpreter
5076 (python-tests-with-temp-buffer-with-shell 5120 (when (eq system-type 'darwin) #'python-tests-interpreter-3-p)
5077 " 5121 "
5078import abc 5122import abc
5079" 5123"
@@ -5090,8 +5134,8 @@ import abc
5090 (should (completion-at-point))))) 5134 (should (completion-at-point)))))
5091 5135
5092(ert-deftest python-completion-at-point-native-with-ffap-1 () 5136(ert-deftest python-completion-at-point-native-with-ffap-1 ()
5093 (skip-unless (python-tests-get-shell-interpreter)) 5137 (python-tests-with-temp-buffer-with-shell-interpreter
5094 (python-tests-with-temp-buffer-with-shell 5138 (when (eq system-type 'darwin) #'python-tests-interpreter-3-p)
5095 " 5139 "
5096import abc 5140import abc
5097" 5141"
@@ -5108,8 +5152,8 @@ import abc
5108 (should (completion-at-point))))) 5152 (should (completion-at-point)))))
5109 5153
5110(ert-deftest python-completion-at-point-native-with-eldoc-1 () 5154(ert-deftest python-completion-at-point-native-with-eldoc-1 ()
5111 (skip-unless (python-tests-get-shell-interpreter)) 5155 (python-tests-with-temp-buffer-with-shell-interpreter
5112 (python-tests-with-temp-buffer-with-shell 5156 (when (eq system-type 'darwin) #'python-tests-interpreter-3-p)
5113 " 5157 "
5114import abc 5158import abc
5115" 5159"
@@ -5135,8 +5179,8 @@ import abc
5135;;; FFAP 5179;;; FFAP
5136 5180
5137(ert-deftest python-ffap-module-path-1 () 5181(ert-deftest python-ffap-module-path-1 ()
5138 (skip-unless (python-tests-get-shell-interpreter)) 5182 (python-tests-with-temp-buffer-with-shell-interpreter
5139 (python-tests-with-temp-buffer-with-shell 5183 nil
5140 " 5184 "
5141import abc 5185import abc
5142" 5186"
@@ -5147,8 +5191,8 @@ import abc
5147 5191
5148(ert-deftest python-ffap-module-path-while-running-1 () 5192(ert-deftest python-ffap-module-path-while-running-1 ()
5149 "Should not get module path when a program is running in the Shell buffer." 5193 "Should not get module path when a program is running in the Shell buffer."
5150 (skip-unless (python-tests-get-shell-interpreter)) 5194 (python-tests-with-temp-buffer-with-shell-interpreter
5151 (python-tests-with-temp-buffer-with-shell 5195 nil
5152 " 5196 "
5153import abc 5197import abc
5154import time 5198import time
@@ -5223,8 +5267,8 @@ some_symbol some_other_symbol
5223 "some_symbol")))) 5267 "some_symbol"))))
5224 5268
5225(ert-deftest python-eldoc--get-doc-at-point-1 () 5269(ert-deftest python-eldoc--get-doc-at-point-1 ()
5226 (skip-unless (python-tests-get-shell-interpreter)) 5270 (python-tests-with-temp-buffer-with-shell-interpreter
5227 (python-tests-with-temp-buffer-with-shell 5271 nil
5228 " 5272 "
5229import time 5273import time
5230" 5274"
@@ -5236,8 +5280,8 @@ import time
5236 5280
5237(ert-deftest python-eldoc--get-doc-at-point-while-running-1 () 5281(ert-deftest python-eldoc--get-doc-at-point-while-running-1 ()
5238 "Should not get documentation when a program is running in the Shell buffer." 5282 "Should not get documentation when a program is running in the Shell buffer."
5239 (skip-unless (python-tests-get-shell-interpreter)) 5283 (python-tests-with-temp-buffer-with-shell-interpreter
5240 (python-tests-with-temp-buffer-with-shell 5284 nil
5241 " 5285 "
5242import time 5286import time
5243 5287
@@ -7472,18 +7516,18 @@ buffer with overlapping strings."
7472;; interpreter. 7516;; interpreter.
7473(ert-deftest python-tests--run-python-selects-window () 7517(ert-deftest python-tests--run-python-selects-window ()
7474 "Test for bug#31398. See also bug#44421 and bug#52380." 7518 "Test for bug#31398. See also bug#44421 and bug#52380."
7475 (skip-unless (python-tests-get-shell-interpreter)) 7519 (python-tests-with-shell-interpreter
7476 (let* ((python-shell-interpreter (python-tests-get-shell-interpreter)) 7520 nil
7477 (buffer (process-buffer (run-python nil nil 'show))) 7521 (let* ((buffer (process-buffer (run-python nil nil 'show)))
7478 (window (get-buffer-window buffer))) 7522 (window (get-buffer-window buffer)))
7479 ;; We look at `selected-window' rather than `current-buffer' 7523 ;; We look at `selected-window' rather than `current-buffer'
7480 ;; because as `(elisp)Current buffer' says, the latter will only 7524 ;; because as `(elisp)Current buffer' says, the latter will only
7481 ;; be synchronized with the former when returning to the "command 7525 ;; be synchronized with the former when returning to the "command
7482 ;; loop"; until then, `current-buffer' can change arbitrarily. 7526 ;; loop"; until then, `current-buffer' can change arbitrarily.
7483 (should (eq window (selected-window))) 7527 (should (eq window (selected-window)))
7484 (pop-to-buffer (other-buffer)) 7528 (pop-to-buffer (other-buffer))
7485 (run-python nil nil 'show) 7529 (run-python nil nil 'show)
7486 (should (eq window (selected-window))))) 7530 (should (eq window (selected-window))))))
7487 7531
7488(ert-deftest python-tests--fill-long-first-line () 7532(ert-deftest python-tests--fill-long-first-line ()
7489 (should 7533 (should
@@ -7544,31 +7588,31 @@ buffer with overlapping strings."
7544 "W0611: Unused import a.b.c (unused-import)")))))) 7588 "W0611: Unused import a.b.c (unused-import)"))))))
7545 7589
7546(ert-deftest python-test--shell-send-block () 7590(ert-deftest python-test--shell-send-block ()
7547 (skip-unless (python-tests-get-shell-interpreter)) 7591 (python-tests-with-temp-buffer-with-shell-interpreter
7548 (python-tests-with-temp-buffer-with-shell 7592 nil
7549 "print('current 0') 7593 "print('current 0')
7550for x in range(1,3): 7594for x in range(1,3):
7551 print('current %s' % x) 7595 print('current %s' % x)
7552print('current 3')" 7596print('current 3')"
7553 (goto-char (point-min)) 7597 (goto-char (point-min))
7554 (should-error (python-shell-send-block) :type 'user-error) 7598 (should-error (python-shell-send-block) :type 'user-error)
7555 (forward-line) 7599 (forward-line)
7556 (python-shell-send-block t) ;; send block with header 7600 (python-shell-send-block t) ;; send block with header
7557 (python-tests-shell-wait-for-prompt) 7601 (python-tests-shell-wait-for-prompt)
7558 (python-shell-with-shell-buffer 7602 (python-shell-with-shell-buffer
7559 (goto-char (point-min)) 7603 (goto-char (point-min))
7560 (should-not (re-search-forward "current 0" nil t)) 7604 (should-not (re-search-forward "current 0" nil t))
7561 (should (re-search-forward "current 1" nil t)) 7605 (should (re-search-forward "current 1" nil t))
7562 (should (re-search-forward "current 2" nil t)) 7606 (should (re-search-forward "current 2" nil t))
7563 (should-not (re-search-forward "current 3" nil t))) 7607 (should-not (re-search-forward "current 3" nil t)))
7564 (forward-line) 7608 (forward-line)
7565 (python-shell-send-block) ;; send block body only 7609 (python-shell-send-block) ;; send block body only
7566 (python-tests-shell-wait-for-prompt) 7610 (python-tests-shell-wait-for-prompt)
7567 (python-shell-with-shell-buffer 7611 (python-shell-with-shell-buffer
7568 ;; should only 1 line output from the block body 7612 ;; should only 1 line output from the block body
7569 (should (re-search-forward "current")) 7613 (should (re-search-forward "current"))
7570 (should (looking-at " 2")) 7614 (should (looking-at " 2"))
7571 (should-not (re-search-forward "current" nil t))))) 7615 (should-not (re-search-forward "current" nil t)))))
7572 7616
7573;;; python-ts-mode font-lock tests 7617;;; python-ts-mode font-lock tests
7574 7618