Subject: bug#70815: [PATCH] ; Enahnce python-tests.el to adapt different python interpreters

From: Stefan Kangas <[email-masked]>
Date: Sat, 18 May 2024 22:20:44 +0000

Lin Sun <[email-masked]> writes:

> From 49dfcecbbffaf15aa0414d15f22d8bcbf768ebb3 Mon Sep 17 00:00:00 2001
> From: Lin Sun <[email-masked]>
> Date: Fri, 3 May 2024 06:52:22 +0000
> Subject: [PATCH] ; Enahnce python-tests.el to adapt different python
>  interpreters
>
> * test/lisp/progmodes/python-tests.el
>   (python-tests-get-shell-interpreter): New function to get python
>   interpreter for testing.
> ---
>  test/lisp/progmodes/python-tests.el | 87 ++++++++++++++++-------------
>  1 file changed, 48 insertions(+), 39 deletions(-)
>
> diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el
> index f50797953c3..6da149925ec 100644
> --- a/test/lisp/progmodes/python-tests.el
> +++ b/test/lisp/progmodes/python-tests.el
> @@ -3718,7 +3718,16 @@ if x:
>  
>  ;;; Shell integration
>
> -(defvar python-tests-shell-interpreter "python")
> +(defvar python-tests-shell-interpreter nil)
> +
> +(defun python-tests-get-shell-interpreter (&optional refresh)
> +  (if (and python-tests-shell-interpreter (null refresh))
> +      python-tests-shell-interpreter
> +    (setq python-tests-shell-interpreter
> +          (or (when-let* ((interpreter (getenv "EMACS_PYTHON_INTERPRETER")))
> +                (or (executable-find interpreter)
> +                    (error "Not found EMACS_PYTHON_INTERPRETER: %s" interpreter)))
> +              (cl-some #'executable-find '("python" "python3" "python2"))))))

It makes sense to look for "python3", but is it really useful to look
for "python2" at this point?