More robustly unspoof HOME in Eglot tests (bug#61637)
A fair number of LSP servers allow user-local installations instead of system wide installations. Emacs's technique of spoofing the HOME env var to some non-existent or non-home directory during 'make check' breaks these tests. That's because the executables are still found by executable-find, but their invocation will rarely be successful as HOME isn't what they expect it to be. Eglot tests already had a technique for dealing with this, "unspoffing" HOME just for the invocations of LSP server but it stopped working a while back. So make it more robust. Eventually, we'll want to decide wether these local servers should be considered in 'make check' runs at all, or whether there is a way to use them with a spoofed HOME. * test/lisp/progmodes/eglot-tests.el (eglot--call-with-fixture): More robustly unspoof HOME.
This commit is contained in:
parent
6c66dbd02c
commit
a7cd125d49
1 changed files with 8 additions and 9 deletions
|
@ -103,22 +103,21 @@ then restored."
|
||||||
(set (car spec) (cadr spec)))
|
(set (car spec) (cadr spec)))
|
||||||
((stringp (car spec)) (push spec file-specs))))
|
((stringp (car spec)) (push spec file-specs))))
|
||||||
(unwind-protect
|
(unwind-protect
|
||||||
(let* ((home (getenv "HOME"))
|
(let* ((process-environment
|
||||||
(process-environment
|
|
||||||
(append
|
(append
|
||||||
`(;; Set XDF_CONFIG_HOME to /dev/null to prevent
|
`(;; Set XDF_CONFIG_HOME to /dev/null to prevent
|
||||||
;; user-configuration to have an influence on
|
;; user-configuration to have an influence on
|
||||||
;; language servers. (See github#441)
|
;; language servers. (See github#441)
|
||||||
"XDG_CONFIG_HOME=/dev/null"
|
"XDG_CONFIG_HOME=/dev/null"
|
||||||
;; ... on the flip-side, a similar technique by
|
;; ... on the flip-side, a similar technique by
|
||||||
;; Emacs's test makefiles means that HOME is set to
|
;; Emacs's test makefiles means that HOME is
|
||||||
;; /nonexistent. This breaks some common
|
;; spoofed to /nonexistent, or sometimes /tmp.
|
||||||
;; installations for LSP servers like pylsp, making
|
;; This breaks some common installations for LSP
|
||||||
;; these tests mostly useless, so we hack around it
|
;; servers like pylsp, rust-analyzer making these
|
||||||
;; here with a great big hack.
|
;; tests mostly useless, so we hack around it here
|
||||||
|
;; with a great big hack.
|
||||||
,(format "HOME=%s"
|
,(format "HOME=%s"
|
||||||
(if (file-exists-p home) home
|
(expand-file-name (format "~%s" (user-login-name)))))
|
||||||
(format "/home/%s" (getenv "USER")))))
|
|
||||||
process-environment))
|
process-environment))
|
||||||
;; Prevent "Can't guess python-indent-offset ..." messages.
|
;; Prevent "Can't guess python-indent-offset ..." messages.
|
||||||
(python-indent-guess-indent-offset-verbose . nil)
|
(python-indent-guess-indent-offset-verbose . nil)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue