[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/elpa 8900a35 04/71: Prevent "Cant guess python-indent-o
From: |
João Távora |
Subject: |
[elpa] externals/elpa 8900a35 04/71: Prevent "Cant guess python-indent-offset..." messages in tests |
Date: |
Wed, 16 Dec 2020 11:42:13 -0500 (EST) |
branch: externals/elpa
commit 8900a3533da1cecc016d5f61242c90ea38b9b9d6
Author: Tobias Rittweiler <trittweiler@gmail.com>
Commit: GitHub <noreply@github.com>
Prevent "Cant guess python-indent-offset..." messages in tests
* eglot-tests.el (eglot--tests--python-mode-bindings): New. Sets
`python-indent-guess-indent-offset-verbose' to nil.
(auto-detect-running-server)
(auto-shutdown)
(auto-reconnect)
(basic-diagnostics)
(rename-a-symbol)
(basic-completion)
(basic-xref)
(snippet-completions)
(snippet-completions-with-company)
(hover-after-completions)
(python-autopep-formatting)
(python-yaps-formatting)
(eglot-ensure)
(slow-sync-connection-wait)
(slow-sync-connection-intime)
(slow-async-connection)
(slow-sync-timeout): Use `eglot--tests--python-mode-bindings' in these
tests.
---
eglot-tests.el | 75 +++++++++++++++++++++++++++++++++++++---------------------
1 file changed, 48 insertions(+), 27 deletions(-)
diff --git a/eglot-tests.el b/eglot-tests.el
index d516891..fb62a72 100644
--- a/eglot-tests.el
+++ b/eglot-tests.el
@@ -31,7 +31,7 @@
(require 'python) ; python-mode-hook
(require 'company nil t)
-;; Helpers
+;;; Helpers
(defun eglot--have-eclipse-jdt-ls-p ()
(and (getenv "CLASSPATH")
@@ -232,6 +232,14 @@ 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
+
(ert-deftest eclipse-connect ()
"Connect to eclipse.jdt.ls server."
(skip-unless (eglot--have-eclipse-jdt-ls-p))
@@ -278,9 +286,10 @@ Pass TIMEOUT to `eglot--with-timeout'."
(skip-unless (executable-find "pyls"))
(let (server)
(eglot--with-fixture
- '(("project" . (("coiso.py" . "bla")
+ `(("project" . (("coiso.py" . "bla")
("merdix.py" . "bla")))
- ("anotherproject" . (("cena.py" . "bla"))))
+ ("anotherproject" . (("cena.py" . "bla")))
+ ,@eglot--tests--python-mode-bindings)
(with-current-buffer
(eglot--find-file-noselect "project/coiso.py")
(should (setq server (eglot--tests-connect)))
@@ -299,7 +308,8 @@ Pass TIMEOUT to `eglot--with-timeout'."
(let (server
buffer)
(eglot--with-fixture
- '(("project" . (("coiso.py" . "def coiso: pass"))))
+ `(("project" . (("coiso.py" . "def coiso: pass")))
+ ,@eglot--tests--python-mode-bindings)
(with-current-buffer
(setq buffer (eglot--find-file-noselect "project/coiso.py"))
(should (setq server (eglot--tests-connect)))
@@ -317,8 +327,9 @@ Pass TIMEOUT to `eglot--with-timeout'."
(skip-unless (executable-find "pyls"))
(let (server (eglot-autoreconnect 1))
(eglot--with-fixture
- '(("project" . (("coiso.py" . "bla")
- ("merdix.py" . "bla"))))
+ `(("project" . (("coiso.py" . "bla")
+ ("merdix.py" . "bla")))
+ ,@eglot--tests--python-mode-bindings)
(with-current-buffer
(eglot--find-file-noselect "project/coiso.py")
(should (setq server (eglot--tests-connect)))
@@ -375,8 +386,9 @@ Pass TIMEOUT to `eglot--with-timeout'."
"Test basic diagnostics."
(skip-unless (executable-find "pyls"))
(eglot--with-fixture
- '(("diag-project" .
- (("main.py" . "def foo(): if True pass")))) ; colon missing after True
+ `(("diag-project" .
+ (("main.py" . "def foo(): if True pass"))) ; colon missing after True
+ ,@eglot--tests--python-mode-bindings)
(with-current-buffer
(eglot--find-file-noselect "diag-project/main.py")
(eglot--sniffing (:server-notifications s-notifs)
@@ -427,9 +439,10 @@ Pass TIMEOUT to `eglot--with-timeout'."
"Test basic symbol renaming"
(skip-unless (executable-find "pyls"))
(eglot--with-fixture
- '(("rename-project"
+ `(("rename-project"
. (("main.py" .
- "def foo (bar) : 1 + bar\n\ndef bar() : pass"))))
+ "def foo (bar) : 1 + bar\n\ndef bar() : pass")))
+ ,@eglot--tests--python-mode-bindings)
(with-current-buffer
(eglot--find-file-noselect "rename-project/main.py")
(eglot--tests-connect)
@@ -442,7 +455,8 @@ 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"))))
+ `(("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))
@@ -454,7 +468,8 @@ 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()"))))
+ `(("project" . (("something.py" . "def foo(): pass\ndef bar(): foo()")))
+ ,@eglot--tests--python-mode-bindings)
(with-current-buffer
(eglot--find-file-noselect "project/something.py")
(should (eglot--tests-connect))
@@ -473,7 +488,8 @@ 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))))
+ `(("project" . (("something.py" . ,eglot--test-python-buffer)))
+ ,@eglot--tests--python-mode-bindings)
(with-current-buffer
(eglot--find-file-noselect "project/something.py")
(yas-minor-mode 1)
@@ -494,7 +510,8 @@ def foobazquuz(d, e, f): pass
(functionp 'yas-minor-mode)
(functionp 'company-complete)))
(eglot--with-fixture
- `(("project" . (("something.py" . ,eglot--test-python-buffer))))
+ `(("project" . (("something.py" . ,eglot--test-python-buffer)))
+ ,@eglot--tests--python-mode-bindings)
(with-current-buffer
(eglot--find-file-noselect "project/something.py")
(yas-minor-mode 1)
@@ -519,7 +536,8 @@ 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"))))
+ `(("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))
@@ -544,7 +562,8 @@ 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"))))
+ `(("project" . (("something.py" . "def a():pass\n\ndef b():pass")))
+ ,@eglot--tests--python-mode-bindings)
(with-current-buffer
(eglot--find-file-noselect "project/something.py")
(should (eglot--tests-connect))
@@ -565,7 +584,8 @@ 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"))))
+ `(("project" . (("something.py" . "def a():pass\ndef b():pass")))
+ ,@eglot--tests--python-mode-bindings)
(with-current-buffer
(eglot--find-file-noselect "project/something.py")
(should (eglot--tests-connect))
@@ -659,12 +679,13 @@ pyls prefers autopep over yafp, despite its README
stating the contrary."
"Test basic `eglot-ensure' functionality"
(skip-unless (executable-find "pyls"))
(eglot--with-fixture
- '(("project" . (("foo.py" . "import sys\nsys.exi")
+ `(("project" . (("foo.py" . "import sys\nsys.exi")
("bar.py" . "import sys\nsys.exi")))
(python-mode-hook
(eglot-ensure
(lambda ()
- (remove-hook 'flymake-diagnostic-functions 'python-flymake)))))
+ (remove-hook 'flymake-diagnostic-functions 'python-flymake))))
+ ,@eglot--tests--python-mode-bindings)
(let (server)
;; need `ert-simulate-command' because `eglot-ensure'
;; relies on `post-command-hook'.
@@ -681,7 +702,8 @@ 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"))))
+ `(("project" . (("something.py" . "import sys\nsys.exi")))
+ ,@eglot--tests--python-mode-bindings)
(with-current-buffer
(eglot--find-file-noselect "project/something.py")
(let ((eglot-sync-connect t)
@@ -693,7 +715,8 @@ 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"))))
+ `(("project" . (("something.py" . "import sys\nsys.exi")))
+ ,@eglot--tests--python-mode-bindings)
(with-current-buffer
(eglot--find-file-noselect "project/something.py")
(let ((eglot-sync-connect 2)
@@ -705,7 +728,8 @@ 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"))))
+ `(("project" . (("something.py" . "import sys\nsys.exi")))
+ ,@eglot--tests--python-mode-bindings)
(with-current-buffer
(eglot--find-file-noselect "project/something.py")
(let ((eglot-sync-connect 1)
@@ -721,7 +745,8 @@ 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"))))
+ `(("project" . (("something.py" . "import sys\nsys.exi")))
+ ,@eglot--tests--python-mode-bindings)
(with-current-buffer
(eglot--find-file-noselect "project/something.py")
(let ((eglot-sync-connect t)
@@ -730,10 +755,6 @@ pyls prefers autopep over yafp, despite its README stating
the contrary."
`((python-mode . ("sh" "-c" "sleep 2 && pyls")))))
(should-error (apply #'eglot--connect (eglot--guess-contact)))))))
-
-
-;;; Unit tests
-;;;
(ert-deftest eglot-capabilities ()
"Unit test for `eglot--server-capable'."
(cl-letf (((symbol-function 'eglot--capabilities)
- [elpa] branch externals/elpa created (now 4edd478), João Távora, 2020/12/16
- [elpa] externals/elpa 8b94cf4 02/71: Per #397: Add new eglot-lsp-abiding-column test, João Távora, 2020/12/16
- [elpa] externals/elpa 1056ef5 03/71: Close #413: update dependencies and copyright years, João Távora, 2020/12/16
- [elpa] externals/elpa d99a447 12/71: Close #439: Hide eldoc-message on empty hover info, João Távora, 2020/12/16
- [elpa] externals/elpa af32ebf 06/71: Close #444: use text-mode for plaintext markup, João Távora, 2020/12/16
- [elpa] externals/elpa ef6c483 13/71: Fix #452: also check types when destructuring LSP objects, João Távora, 2020/12/16
- [elpa] externals/elpa 487cde5 18/71: Close #443: kind of honour eldoc-echo-area-use-multiline-p, João Távora, 2020/12/16
- [elpa] externals/elpa 22aa27c 01/71: Close #397: Simplify a bit of code, João Távora, 2020/12/16
- [elpa] externals/elpa 8900a35 04/71: Prevent "Cant guess python-indent-offset..." messages in tests,
João Távora <=
- [elpa] externals/elpa dd48f4a 08/71: * eglot.el (eglot-put-doc-in-help-buffer): Tiny docstring fix., João Távora, 2020/12/16
- [elpa] externals/elpa e5cf30e 09/71: Close #435: create match xrefs when possible, João Távora, 2020/12/16
- [elpa] externals/elpa ad3f049 24/71: Close #417: minimally document relation with project.el, João Távora, 2020/12/16
- [elpa] externals/elpa 2f75da2 28/71: Fix #460: fix "free variable" warning, João Távora, 2020/12/16
- [elpa] externals/elpa 0f57efb 26/71: Simplify bug-reporting instructions, João Távora, 2020/12/16
- [elpa] externals/elpa 91a7cba 33/71: Fix #474, #478: prompt for executable if supplied name does not exist, João Távora, 2020/12/16
- [elpa] externals/elpa 9efe207 05/71: Make curl invocation fail more explicitly in .travis.yml, João Távora, 2020/12/16
- [elpa] externals/elpa 73bc752 11/71: Close #441: shield tests from some user customizations, João Távora, 2020/12/16
- [elpa] externals/elpa b6519a5 16/71: Per #446: Add tests for eglot-server-programs, João Távora, 2020/12/16
- [elpa] externals/elpa 9bc58df 17/71: Fix #446: unbreak eglot--guess-contact for host-and-port case, João Távora, 2020/12/16