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

From: kobarity <[email-masked]>
Date: Wed, 29 May 2024 00:17:27 +0900

Mattias Engdegård wrote:
> 
> 27 maj 2024 kl. 14.33 skrev kobarity <[email-masked]>:
> 
> > We probably have found the bug with Python 2 on Mac, unless
> > there is a bug on the ERTs.
> 
> It could just be a mismatch of expectations. With python-shell-interpreter set to "python2", tab-completion in the Python interactive shell works but in a diminished capacity. For example, 'pri<TAB>' completes to 'print' but 'math.sq<TAB>' does not complete to 'math.sqrt(' as it does in Python 3.

I think it is a "bug".  Because it is working with Python 2 on Linux
(with native and non-native completions), and I believe many would
expect it to work.

In any case, to accommodate the ERTs for such differences, a mechanism
to skip an ERT based on the interpreter version (or some other
property) is needed.

> > Changing the order of the interpreters to find or skipping
> > some ERTs does not solve the problem.
> 
> But it does fix a different problem: it tests python-mode with Python 3, which is more important.

As I mentioned before, I am not opposed to prioritize "python3".  I
don't think anyone is arguing that "python" should precede "python3"
anymore.

> >  However, it seems that only a
> > limited number of people can pursue the problem on Mac, and fewer
> > people will have trouble with Python 2 issues.  So for now, I think it
> > is better to skip these ERTs for Python 2 on Mac only.
> 
> We can probably agree that absent explicit information about what version the user wants tested, we should test python-mode with Python 3 on macOS and other platforms.
> 
> If you think it is important we can also test it with Python 2 if available. Rejigging the tests to run for multiple Python versions is certainly possible but would be some work.
> 
> Meanwhile I'm just going to make the tests use the same logic as python.el for selecting the binary to use, as there does not seem to be a reason why this would make anything worse.
> 

You have an option to set EMACS_PYTHON_INTERPRETER environment
variable to "python3", just for now.