[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/elpa a807b4f 43/71: Some test-related cleanup
From: |
João Távora |
Subject: |
[elpa] externals/elpa a807b4f 43/71: Some test-related cleanup |
Date: |
Wed, 16 Dec 2020 11:42:23 -0500 (EST) |
branch: externals/elpa
commit a807b4f30b6128f64d1ad44271e62a39a9623dc8
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>
Some test-related cleanup
* Makefile (ELPADEPS): Change order of ELPADEPS.
* eglot-tests.el (eglot--call-with-fixture): Bind
python-indent-guess-indent-offset-verbose here.
(eglot--tests--python-mode-bindings): Remove.
(auto-detect-running-server, auto-shutdown, auto-reconnect)
(basic-diagnostics, rename-a-symbol, basic-completions, basic-xref)
(snippet-completions, snippet-completions-with-company)
(hover-after-completions, hover-multiline-doc-locus)
(python-autopep-formatting, python-yapf-formatting, json-basic)
(eglot-ensure, slow-sync-connection-wait, slow-sync-connection-intime)
(slow-async-connection, slow-sync-timeout): Don't use
eglot--tests--python-mode-bindings.
(eglot--guessing-contact): Reindent.
---
Makefile | 4 +-
eglot-tests.el | 117 ++++++++++++++++++++++++---------------------------------
2 files changed, 51 insertions(+), 70 deletions(-)
diff --git a/Makefile b/Makefile
index 1a39c65..dfbd69f 100644
--- a/Makefile
+++ b/Makefile
@@ -13,11 +13,11 @@ ELCFILES := $(ELFILES:.el=.elc)
ELPADEPS ?=--eval '(package-initialize)' \
--eval '(package-refresh-contents)' \
- --eval '(package-install (quote company))' \
--eval '(package-install (quote jsonrpc))' \
- --eval '(package-install (quote xref))' \
--eval '(package-install (quote project))' \
+ --eval '(package-install (quote xref))' \
--eval '(package-install (quote eldoc))' \
+ --eval '(package-install (quote company))' \
--eval '(package-install (quote yasnippet))' \
--eval '(package-install \
(cadr (assoc (quote flymake) \
diff --git a/eglot-tests.el b/eglot-tests.el
index f701a01..059a565 100644
--- a/eglot-tests.el
+++ b/eglot-tests.el
@@ -88,6 +88,8 @@ then restored."
;; Prevent user-configuration to have an influence on
;; language servers. (See github#441)
(cons "XDG_CONFIG_HOME=/dev/null" process-environment))
+ ;; Prevent "Can't guess python-indent-offset ..." messages.
+ (python-indent-guess-indent-offset-verbose . nil)
(eglot-server-initialized-hook
(lambda (server) (push server new-servers))))
(setq created-files (mapcan #'eglot--make-file-or-dir file-specs))
@@ -257,11 +259,6 @@ Pass TIMEOUT to `eglot--with-timeout'."
(eglot-connect-timeout timeout))
(apply #'eglot--connect (eglot--guess-contact))))
-(defvar eglot--tests--python-mode-bindings
- '(;; Prevent "Can't guess python-indent-offset ..." messages.
- (python-indent-guess-indent-offset-verbose . nil))
- "Alist of variable bindings to be used in tests involving `python-mode'.")
-
;;; Unit tests
@@ -313,8 +310,7 @@ Pass TIMEOUT to `eglot--with-timeout'."
(eglot--with-fixture
`(("project" . (("coiso.py" . "bla")
("merdix.py" . "bla")))
- ("anotherproject" . (("cena.py" . "bla")))
- ,@eglot--tests--python-mode-bindings)
+ ("anotherproject" . (("cena.py" . "bla"))))
(with-current-buffer
(eglot--find-file-noselect "project/coiso.py")
(should (setq server (eglot--tests-connect)))
@@ -333,8 +329,7 @@ Pass TIMEOUT to `eglot--with-timeout'."
(let (server
buffer)
(eglot--with-fixture
- `(("project" . (("coiso.py" . "def coiso: pass")))
- ,@eglot--tests--python-mode-bindings)
+ `(("project" . (("coiso.py" . "def coiso: pass"))))
(with-current-buffer
(setq buffer (eglot--find-file-noselect "project/coiso.py"))
(should (setq server (eglot--tests-connect)))
@@ -353,8 +348,7 @@ Pass TIMEOUT to `eglot--with-timeout'."
(let (server (eglot-autoreconnect 1))
(eglot--with-fixture
`(("project" . (("coiso.py" . "bla")
- ("merdix.py" . "bla")))
- ,@eglot--tests--python-mode-bindings)
+ ("merdix.py" . "bla"))))
(with-current-buffer
(eglot--find-file-noselect "project/coiso.py")
(should (setq server (eglot--tests-connect)))
@@ -412,8 +406,8 @@ Pass TIMEOUT to `eglot--with-timeout'."
(skip-unless (executable-find "pyls"))
(eglot--with-fixture
`(("diag-project" .
- (("main.py" . "def foo(): if True pass"))) ; colon missing after True
- ,@eglot--tests--python-mode-bindings)
+ ; colon missing after True
+ (("main.py" . "def foo(): if True pass"))))
(with-current-buffer
(eglot--find-file-noselect "diag-project/main.py")
(eglot--sniffing (:server-notifications s-notifs)
@@ -466,8 +460,7 @@ Pass TIMEOUT to `eglot--with-timeout'."
(eglot--with-fixture
`(("rename-project"
. (("main.py" .
- "def foo (bar) : 1 + bar\n\ndef bar() : pass")))
- ,@eglot--tests--python-mode-bindings)
+ "def foo (bar) : 1 + bar\n\ndef bar() : pass"))))
(with-current-buffer
(eglot--find-file-noselect "rename-project/main.py")
(eglot--tests-connect)
@@ -480,8 +473,7 @@ Pass TIMEOUT to `eglot--with-timeout'."
"Test basic autocompletion in a python LSP"
(skip-unless (executable-find "pyls"))
(eglot--with-fixture
- `(("project" . (("something.py" . "import sys\nsys.exi")))
- ,@eglot--tests--python-mode-bindings)
+ `(("project" . (("something.py" . "import sys\nsys.exi"))))
(with-current-buffer
(eglot--find-file-noselect "project/something.py")
(should (eglot--tests-connect))
@@ -493,8 +485,7 @@ Pass TIMEOUT to `eglot--with-timeout'."
"Test basic xref functionality in a python LSP"
(skip-unless (executable-find "pyls"))
(eglot--with-fixture
- `(("project" . (("something.py" . "def foo(): pass\ndef bar(): foo()")))
- ,@eglot--tests--python-mode-bindings)
+ `(("project" . (("something.py" . "def foo(): pass\ndef bar(): foo()"))))
(with-current-buffer
(eglot--find-file-noselect "project/something.py")
(should (eglot--tests-connect))
@@ -513,8 +504,7 @@ def foobazquuz(d, e, f): pass
(skip-unless (and (executable-find "pyls")
(functionp 'yas-minor-mode)))
(eglot--with-fixture
- `(("project" . (("something.py" . ,eglot--test-python-buffer)))
- ,@eglot--tests--python-mode-bindings)
+ `(("project" . (("something.py" . ,eglot--test-python-buffer))))
(with-current-buffer
(eglot--find-file-noselect "project/something.py")
(yas-minor-mode 1)
@@ -535,8 +525,7 @@ def foobazquuz(d, e, f): pass
(functionp 'yas-minor-mode)
(functionp 'company-complete)))
(eglot--with-fixture
- `(("project" . (("something.py" . ,eglot--test-python-buffer)))
- ,@eglot--tests--python-mode-bindings)
+ `(("project" . (("something.py" . ,eglot--test-python-buffer))))
(with-current-buffer
(eglot--find-file-noselect "project/something.py")
(yas-minor-mode 1)
@@ -561,25 +550,23 @@ def foobazquuz(d, e, f): pass
;; `eglot-put-doc-in-help-buffer' to nil.
(let ((eglot-put-doc-in-help-buffer nil))
(eglot--with-fixture
- `(("project" . (("something.py" . "import sys\nsys.exi")))
- ,@eglot--tests--python-mode-bindings)
- (with-current-buffer
- (eglot--find-file-noselect "project/something.py")
- (should (eglot--tests-connect))
- (goto-char (point-max))
- (setq eldoc-last-message nil)
- (completion-at-point)
- (should (looking-back "sys.exit"))
- (while (not eldoc-last-message) (accept-process-output nil 0.1))
- (should (string-match "^exit" eldoc-last-message))))))
+ `(("project" . (("something.py" . "import sys\nsys.exi"))))
+ (with-current-buffer
+ (eglot--find-file-noselect "project/something.py")
+ (should (eglot--tests-connect))
+ (goto-char (point-max))
+ (setq eldoc-last-message nil)
+ (completion-at-point)
+ (should (looking-back "sys.exit"))
+ (while (not eldoc-last-message) (accept-process-output nil 0.1))
+ (should (string-match "^exit" eldoc-last-message))))))
(ert-deftest hover-multiline-doc-locus ()
"Test if suitable amount of lines of hover info are shown."
(skip-unless (executable-find "pyls"))
(eglot--with-fixture
`(("project" . (("hover-first.py" . "from datetime import datetime")))
- (eglot-put-doc-in-help-buffer nil)
- ,@eglot--tests--python-mode-bindings)
+ (eglot-put-doc-in-help-buffer nil))
(with-current-buffer
(eglot--find-file-noselect "project/hover-first.py")
(should (eglot--tests-connect))
@@ -607,8 +594,7 @@ pyls prefers autopep over yafp, despite its README stating
the contrary."
(skip-unless (and (executable-find "pyls")
(executable-find "autopep8")))
(eglot--with-fixture
- `(("project" . (("something.py" . "def a():pass\n\ndef b():pass")))
- ,@eglot--tests--python-mode-bindings)
+ `(("project" . (("something.py" . "def a():pass\n\ndef b():pass"))))
(with-current-buffer
(eglot--find-file-noselect "project/something.py")
(should (eglot--tests-connect))
@@ -629,8 +615,7 @@ pyls prefers autopep over yafp, despite its README stating
the contrary."
(not (executable-find "autopep8"))
(executable-find "yapf")))
(eglot--with-fixture
- `(("project" . (("something.py" . "def a():pass\ndef b():pass")))
- ,@eglot--tests--python-mode-bindings)
+ `(("project" . (("something.py" . "def a():pass\ndef b():pass"))))
(with-current-buffer
(eglot--find-file-noselect "project/something.py")
(should (eglot--tests-connect))
@@ -678,23 +663,23 @@ pyls prefers autopep over yafp, despite its README
stating the contrary."
"Test basic autocompletion in vscode-json-languageserver"
(skip-unless (executable-find "vscode-json-languageserver"))
(eglot--with-fixture
- '(("project" .
- (("p.json" . "{\"foo.b")
- ("s.json" . "{\"properties\":{\"foo.bar\":{\"default\":\"fb\"}}}")
- (".git" . nil))))
- (with-current-buffer
- (eglot--find-file-noselect "project/p.json")
- (yas-minor-mode)
- (goto-char 2)
- (insert "\"$schema\": \"file://"
- (file-name-directory buffer-file-name) "s.json\",")
- (let ((eglot-server-programs
- '((js-mode . ("vscode-json-languageserver" "--stdio")))))
- (goto-char (point-max))
- (should (eglot--tests-connect))
- (completion-at-point)
- (should (looking-back "\"foo.bar\": \""))
- (should (looking-at "fb\"$"))))))
+ '(("project" .
+ (("p.json" . "{\"foo.b")
+ ("s.json" . "{\"properties\":{\"foo.bar\":{\"default\":\"fb\"}}}")
+ (".git" . nil))))
+ (with-current-buffer
+ (eglot--find-file-noselect "project/p.json")
+ (yas-minor-mode)
+ (goto-char 2)
+ (insert "\"$schema\": \"file://"
+ (file-name-directory buffer-file-name) "s.json\",")
+ (let ((eglot-server-programs
+ '((js-mode . ("vscode-json-languageserver" "--stdio")))))
+ (goto-char (point-max))
+ (should (eglot--tests-connect))
+ (completion-at-point)
+ (should (looking-back "\"foo.bar\": \""))
+ (should (looking-at "fb\"$"))))))
(ert-deftest eglot-lsp-abiding-column ()
"Test basic `eglot-lsp-abiding-column' and
`eglot-move-to-lsp-abiding-column'"
@@ -729,8 +714,7 @@ pyls prefers autopep over yafp, despite its README stating
the contrary."
(python-mode-hook
(eglot-ensure
(lambda ()
- (remove-hook 'flymake-diagnostic-functions 'python-flymake))))
- ,@eglot--tests--python-mode-bindings)
+ (remove-hook 'flymake-diagnostic-functions 'python-flymake)))))
(let (server)
;; need `ert-simulate-command' because `eglot-ensure'
;; relies on `post-command-hook'.
@@ -747,8 +731,7 @@ pyls prefers autopep over yafp, despite its README stating
the contrary."
"Connect with `eglot-sync-connect' set to t."
(skip-unless (executable-find "pyls"))
(eglot--with-fixture
- `(("project" . (("something.py" . "import sys\nsys.exi")))
- ,@eglot--tests--python-mode-bindings)
+ `(("project" . (("something.py" . "import sys\nsys.exi"))))
(with-current-buffer
(eglot--find-file-noselect "project/something.py")
(let ((eglot-sync-connect t)
@@ -760,8 +743,7 @@ pyls prefers autopep over yafp, despite its README stating
the contrary."
"Connect synchronously with `eglot-sync-connect' set to 2."
(skip-unless (executable-find "pyls"))
(eglot--with-fixture
- `(("project" . (("something.py" . "import sys\nsys.exi")))
- ,@eglot--tests--python-mode-bindings)
+ `(("project" . (("something.py" . "import sys\nsys.exi"))))
(with-current-buffer
(eglot--find-file-noselect "project/something.py")
(let ((eglot-sync-connect 2)
@@ -773,8 +755,7 @@ pyls prefers autopep over yafp, despite its README stating
the contrary."
"Connect asynchronously with `eglot-sync-connect' set to 2."
(skip-unless (executable-find "pyls"))
(eglot--with-fixture
- `(("project" . (("something.py" . "import sys\nsys.exi")))
- ,@eglot--tests--python-mode-bindings)
+ `(("project" . (("something.py" . "import sys\nsys.exi"))))
(with-current-buffer
(eglot--find-file-noselect "project/something.py")
(let ((eglot-sync-connect 1)
@@ -790,8 +771,7 @@ pyls prefers autopep over yafp, despite its README stating
the contrary."
"Failed attempt at connection synchronously."
(skip-unless (executable-find "pyls"))
(eglot--with-fixture
- `(("project" . (("something.py" . "import sys\nsys.exi")))
- ,@eglot--tests--python-mode-bindings)
+ `(("project" . (("something.py" . "import sys\nsys.exi"))))
(with-current-buffer
(eglot--find-file-noselect "project/something.py")
(let ((eglot-sync-connect t)
@@ -906,7 +886,8 @@ pyls prefers autopep over yafp, despite its README stating
the contrary."
(((CodeAction) title command)
(list title command)))))))
-(cl-defmacro eglot--guessing-contact ((interactive-sym prompt-args-sym
+(cl-defmacro eglot--guessing-contact ((interactive-sym
+ prompt-args-sym
guessed-class-sym guessed-contact-sym)
&body body)
"Evaluate BODY twice, binding results of `eglot--guess-contact'.
- [elpa] externals/elpa d244cc5 22/71: Per #443: tweak handling of eldoc-echo-area-use-multiline-p, (continued)
- [elpa] externals/elpa d244cc5 22/71: Per #443: tweak handling of eldoc-echo-area-use-multiline-p, João Távora, 2020/12/16
- [elpa] externals/elpa e690e8c 32/71: Per #474, #478: add more tests for `eglot--guess-contact', João Távora, 2020/12/16
- [elpa] externals/elpa bb51d47 30/71: Close #409: make a test more robust, João Távora, 2020/12/16
- [elpa] externals/elpa 1cfcef4 37/71: Close #471: add support for erlang_ls, João Távora, 2020/12/16
- [elpa] externals/elpa da7ff48 31/71: Fix #468: don't call flymake report function if flymake is disabled, João Távora, 2020/12/16
- [elpa] externals/elpa e514f9e 29/71: Close #461: make CI fail if byte compiler warns, João Távora, 2020/12/16
- [elpa] externals/elpa ffe79b9 34/71: Pin pyls to 0.31.10, João Távora, 2020/12/16
- [elpa] externals/elpa b0bfbfb 38/71: Fix #488: fix type error in eglot--xref-make-match, João Távora, 2020/12/16
- [elpa] externals/elpa 3634402 36/71: Fix #479: correctly place diagnostics in narrowed buffers, João Távora, 2020/12/16
- [elpa] externals/elpa e7a43e2 40/71: Fix #480: also consider label of a CompletionItem for snippets, João Távora, 2020/12/16
- [elpa] externals/elpa a807b4f 43/71: Some test-related cleanup,
João Távora <=
- [elpa] externals/elpa 9874456 42/71: Close #482: use filter-buffer-substring to get buffer text, João Távora, 2020/12/16
- [elpa] externals/elpa b34447c 45/71: Close #473: simplify eglot-code-actions, João Távora, 2020/12/16
- [elpa] externals/elpa a044dec 47/71: Delegate "hover" and "signature" doc synchronization efforts to Eldoc, João Távora, 2020/12/16
- [elpa] externals/elpa a04b826 48/71: Update tests after update to newer Eldoc, João Távora, 2020/12/16
- [elpa] externals/elpa 2b7ec0e 51/71: Expect eglot-multiline-eldoc to fail on Travis, João Távora, 2020/12/16
- [elpa] externals/elpa 6d96601 52/71: Closes #509: fix sorting of completion items, João Távora, 2020/12/16
- [elpa] externals/elpa 4e82f53 53/71: Reload Eldoc if needed on Emacs < 28, João Távora, 2020/12/16
- [elpa] externals/elpa 8c9219d 55/71: Unbreak tests after changes to eldoc.el, João Távora, 2020/12/16
- [elpa] externals/elpa ea82b4b 57/71: Close #505: ensure completion terminates in correct buffer, João Távora, 2020/12/16
- [elpa] externals/elpa fb6b17e 58/71: New 'make interactive' target for debuggable M-x ert, João Távora, 2020/12/16