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

From: kobarity <[email-masked]>
Date: Tue, 04 Jun 2024 23:29:52 +0900

kobarity wrote:
> 
> kobarity wrote:
> > Mattias Engdegård wrote:
> > > > 2. Revert 9c7de10079 and run ERTs.  The expectation is that the 7 ERTs
> > > >   that previously failed will succeed.
> > > 
> > > No, they still fail:
> > > 
> > > 7 unexpected results:
> > >    FAILED  python-completion-at-point-1
> > >    FAILED  python-completion-at-point-2
> > >    FAILED  python-completion-at-point-native-1
> > >    FAILED  python-completion-at-point-native-2
> > >    FAILED  python-completion-at-point-native-with-eldoc-1
> > >    FAILED  python-completion-at-point-native-with-ffap-1
> > >    FAILED  python-shell-completion-at-point-1
> > > 
> > > 2 skipped results:
> > >   SKIPPED  python-shell-completion-at-point-ipython
> > >   SKIPPED  python-shell-completion-at-point-jedi-completer
> > 
> > Maybe I did not make the right request.  What I wanted you to try was
> > to make the following changes after applying my patch in the previous
> > email.
> > 
> > diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el
> > index 970ec32bc0c..77b30f8bdbc 100644
> > --- a/test/lisp/progmodes/python-tests.el
> > +++ b/test/lisp/progmodes/python-tests.el
> > @@ -3770,7 +3770,7 @@ python-tests-get-shell-interpreter
> >              ;; Use the same order as for the default value of
> >              ;; `python-shell-interpreter'.
> >              (delq nil (mapcar #'python-tests--get-interpreter-info
> > -                              '("python3" "python" "python2"))))))
> > +                              '("python" "python3" "python2"))))))
> >    (cl-some (or pred #'car) python-tests-shell-interpreters))
> > 
> >  (defun python-tests--get-interpreter-info (name)
> > 
> > If you have tried it this way, could you tell me what the value of
> > `python-tests-shell-interpreters' is?
> 
> Sorry, I realized my mistake.  I will revise my patch within a few
> days.

The attached is the revised patch.  In order to bind
`python-shell-interpreter' consistently, new macros
`python-tests-with-shell-interpreter' and
`python-tests-with-temp-buffer-with-shell-interpreter' were
introduced.  The patch is larger because some of the indentations have
been changed by using new macros.  I have fixed
`python-shell-interpreter' was not bound correctly in some ERTs, so
you might find new ERTs that fail with Python 2 on Mac.

Same as before, it would be helpful if you could try each of the
following on Mac.

1. Set EMACS_PYTHON_INTERPRETER environment variable to "python" and
   run ERTs.  The expectation is that the 7 ERTs that previously
   resulted in errors will be skipped.
2. Change the order of the interpreters in
   `python-tests-get-shell-interpreter' to  "python" "python3"
   "python2" and run ERTs.  The expectation is that the 7 ERTs that
   previously failed will succeed.

Another change is the behavior when the interpreter specified in
EMACS_PYTHON_INTERPRETER is not found.  In the current master, ERTs
are skipped if the interpreter specified by EMACS_PYTHON_INTERPRETER
is not found.  This is because although
`python-tests-get-shell-interpreter' raises an error, `skip-unless'
ignores it.

However, if the interpreter specified by EMACS_PYTHON_INTERPRETER is
not found, it is likely that EMACS_PYTHON_INTERPRETER is incorrectly
configured, and I would prefer to let it fail rather than let it be
skipped.  If it is better to be skipped, it would be better to have
`python-tests-get-shell-interpreter' return nil without raising an
error.  I would like to hear Lin's and others opinions on this matter.