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

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

bug#61637: 30.0.50; Fix Eglot tests that need HOME=~USER


From: Basil Contovounesios
Subject: bug#61637: 30.0.50; Fix Eglot tests that need HOME=~USER
Date: Sat, 04 Mar 2023 17:20:08 +0000
User-agent: Gnus/5.13 (Gnus v5.13)

João Távora [2023-03-04 11:48 +0000] wrote:

> In fact, I missed this in Basil's patch, but I think the correct fix is
> actually to fix eglot--call-with-fixture directly

I'm not sure what you mean by 'directly': the patch below
unconditionally sets HOME=~USER for all eglot-tests.el, whereas the
patch in the OP was more conservative in doing this for only those tests
which are found to need it, thus mitigating to an extent the risk that
Eli is (understandably) concerned about.

> diff --git a/test/lisp/progmodes/eglot-tests.el 
> b/test/lisp/progmodes/eglot-tests.el
> index 5d5de59a19a..5f5adc8e5b3 100644
> --- a/test/lisp/progmodes/eglot-tests.el
> +++ b/test/lisp/progmodes/eglot-tests.el
> @@ -103,22 +103,21 @@ eglot--call-with-fixture
>               (set (car spec) (cadr spec)))
>              ((stringp (car spec)) (push spec file-specs))))
>      (unwind-protect
> -        (let* ((home (getenv "HOME"))
> -               (process-environment
> +        (let* ((process-environment
>                  (append
>                   `(;; Set XDF_CONFIG_HOME to /dev/null to prevent
> -                   ;; user-configuration to have an influence on
> +                   ;; user's configuration to have an influence on
>                     ;; language servers. (See github#441)
>                     "XDG_CONFIG_HOME=/dev/null"

Note that test/Makefile.in already unexports XDG_CONFIG_HOME, so
eglot-tests.el needs not concern itself with it.

>                     ;; ... on the flip-side, a similar technique by
>                     ;; Emacs's test makefiles means that HOME is set to
> -                   ;; /nonexistent.  This breaks some common
> -                   ;; installations for LSP servers like pylsp, making
> -                   ;; these tests mostly useless, so we hack around it
> -                   ;; here with a great big hack.
> -                   ,(format "HOME=%s"
> -                            (if (file-exists-p home) home
> -                              (format "/home/%s" (getenv "USER")))))
> +                   ;; /nonexistent or /tmp/.  This breaks some common
> +                   ;; installations for LSP servers like pylsp, and
> +                   ;; rust-analyzer, making these tests mostly
> +                   ;; useless, so we hack around it here with a great
> +                   ;; big hack.
> +                   ,(format "HOME=%s" (expand-file-name (concat
> +                                                         "~" 
> (user-login-name)))))
>                   process-environment))
>                 ;; Prevent "Can't guess python-indent-offset ..." messages.
>                 (python-indent-guess-indent-offset-verbose . nil)

-- 
Basil





reply via email to

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