bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#68559: [PATCH] Improve Python shell completion


From: Liu Hui
Subject: bug#68559: [PATCH] Improve Python shell completion
Date: Wed, 21 Feb 2024 18:00:00 +0800

On Tue, Feb 20, 2024 at 9:15 PM Basil L. Contovounesios
<basil@contovou.net> wrote:
>
> Liu Hui [2024-02-20 12:46 +0800] wrote:
>
> > On Mon, Feb 19, 2024 at 9:18 PM Basil L. Contovounesios
> > <basil@contovou.net> wrote:
> >>
> >> BTW, I have been seeing an IPython test failure on GNU/Linux:
> >> Any pointers?
> >
> > I cannot reproduce the problem with Python 3.12 and IPython 8.21. Can
> > you check the results with the following steps? Thanks.
>
> Thanks.  These all work as expected in 'emacs -Q', which made me realise
> what may be the problem:
>
> - the Emacs test suite runs under HOME=/nonexistent
> - but PATH is unchanged
> - I have the latest IPython installed locally using pipx:
>   $ ls -l $(which ipython)
>   lrwxrwxrwx 1 blc blc 53 Feb 20 11:46
>     /home/blc/.local/bin/ipython ->
>       /home/blc/.local/share/pipx/venvs/ipython/bin/ipython
>
> This is confirmed by the following experiment:
>
>
> Running 'make TEST_LOAD_EL=no test/python-tests' now results in the
> following output file:
>
>
> In this case list(get_ipython().Completer.completions(...)) is empty.

Thank you for the investigation! I didn't realize the problem is
related to HOME=/nonexistent in 'make test'. Now I can also reproduce
it. In fact, I found that the test failure was caused by Jedi, as it
attempts to write cache to a non-existent directory.

When Jedi is directly used as the completion backend, more test
failures will be triggered:

PYTHONSTARTUP="$(python -m jedi repl)" make TEST_LOAD_EL=no test/python-tests

If the cache directory is writable, all tests will pass:

PYTHONSTARTUP="$(python -m jedi repl)" XDG_CACHE_HOME=~/.cache make
TEST_LOAD_EL=no test/python-tests

The attached patch should fix the problem.

Attachment: 0001-Fix-Python-shell-completion-test-failures.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]