[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/eglot 40a3d8c 16/69: Fix broken python formatting tests
From: |
João Távora |
Subject: |
[elpa] externals/eglot 40a3d8c 16/69: Fix broken python formatting tests |
Date: |
Sun, 20 Oct 2019 08:21:44 -0400 (EDT) |
branch: externals/eglot
commit 40a3d8cbe837a10b3024d6fe6fcfe1fbda12c3d6
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>
Fix broken python formatting tests
* eglot-tests.el (formatting): Split test.
(python-autopep-formatting, python-yapf-formatting): New tests.
---
eglot-tests.el | 43 +++++++++++++++++++++++++++++--------------
1 file changed, 29 insertions(+), 14 deletions(-)
diff --git a/eglot-tests.el b/eglot-tests.el
index 8a9aba6..d1f56db 100644
--- a/eglot-tests.el
+++ b/eglot-tests.el
@@ -447,32 +447,47 @@ Pass TIMEOUT to `eglot--with-timeout'."
(while (not eldoc-last-message) (accept-process-output nil 0.1))
(should (string-match "^exit" eldoc-last-message)))))
-(ert-deftest formatting ()
- "Test formatting in a python LSP"
+(ert-deftest python-autopep-formatting ()
+ "Test formatting in the pyls python LSP.
+pyls prefers autopep over yafp"
(skip-unless (and (executable-find "pyls")
- (or (executable-find "yapf")
- (executable-find "autopep8"))))
+ (executable-find "autopep8")))
(eglot--with-fixture
'(("project" . (("something.py" . "def a():pass\ndef b():pass"))))
(with-current-buffer
(eglot--find-file-noselect "project/something.py")
(should (eglot--tests-connect))
+ ;; Try to format just the second line
(search-forward "b():pa")
(eglot-format (point-at-bol) (point-at-eol))
(should (looking-at "ss"))
(should
- (or
- ;; yapf
- (string= (buffer-string) "def a():pass\n\n\ndef b():\n pass\n")
- ;; autopep8
- (string= (buffer-string) "def a():pass\n\n\ndef b(): pass\n")))
+ (string= (buffer-string) "def a():pass\n\n\ndef b(): pass\n"))
+ ;; now format the whole buffer
(eglot-format-buffer)
(should
- (or
- ;; yapf
- (string= (buffer-string) "def a():\n pass\n\n\ndef b():\n
pass\n")
- ;; autopep8
- (string= (buffer-string) "def a(): pass\n\n\ndef b(): pass\n"))))))
+ (string= (buffer-string) "def a(): pass\n\n\ndef b(): pass\n")))))
+
+(ert-deftest python-yapf-formatting ()
+ "Test formatting in the pyls python LSP"
+ (skip-unless (and (executable-find "pyls")
+ (not (executable-find "autopep8"))
+ (executable-find "yapf")))
+ (eglot--with-fixture
+ '(("project" . (("something.py" . "def a():pass\ndef b():pass"))))
+ (with-current-buffer
+ (eglot--find-file-noselect "project/something.py")
+ (should (eglot--tests-connect))
+ ;; Try to format just the second line
+ (search-forward "b():pa")
+ (eglot-format (point-at-bol) (point-at-eol))
+ (should (looking-at "ss"))
+ (should
+ (string= (buffer-string) "def a():pass\n\n\ndef b():\n pass\n"))
+ ;; now format the whole buffer
+ (eglot-format-buffer)
+ (should
+ (string= (buffer-string) "def a():\n pass\n\n\ndef b():\n
pass\n")))))
(ert-deftest javascript-basic ()
"Test basic autocompletion in a python LSP"
- [elpa] externals/eglot 9377988 02/69: Per #198: Show large docs in help buffer instead of echo are by default, (continued)
- [elpa] externals/eglot 9377988 02/69: Per #198: Show large docs in help buffer instead of echo are by default, João Távora, 2019/10/20
- [elpa] externals/eglot e5e5125 04/69: Rename new defcustoms with friendlier names, João Távora, 2019/10/20
- [elpa] externals/eglot cba3987 07/69: README.md: minor cosmetic tweaks, João Távora, 2019/10/20
- [elpa] externals/eglot dc371b8 08/69: Display truncated docstring if too large for echo area, João Távora, 2019/10/20
- [elpa] externals/eglot 17ec29b 14/69: Per #177: consider mode derivation when guessing servers, João Távora, 2019/10/20
- [elpa] externals/eglot fcb8ab6 11/69: Per #121: fix bug introduced by commit fixing this issue, João Távora, 2019/10/20
- [elpa] externals/eglot 5fc7ecc 10/69: Add built-in support for Dart's dart_language_server, João Távora, 2019/10/20
- [elpa] externals/eglot 1671dc4 12/69: Fix #209: protect against null messages from eldoc, João Távora, 2019/10/20
- [elpa] externals/eglot dbf2dd2 20/69: * eglot.el (xref-backend-references): Don't use return-from., João Távora, 2019/10/20
- [elpa] externals/eglot 3ecdef1 09/69: Fix #201: handle label offsets in ParameterInformation, João Távora, 2019/10/20
- [elpa] externals/eglot 40a3d8c 16/69: Fix broken python formatting tests,
João Távora <=
- [elpa] externals/eglot 1c6c30f 17/69: Disable another test on Travis, João Távora, 2019/10/20
- [elpa] externals/eglot d65d139 15/69: Don't teardown company if started via trigger chars, João Távora, 2019/10/20
- [elpa] externals/eglot 7d6e3cf 21/69: Per #220: unbreak build, João Távora, 2019/10/20
- [elpa] externals/eglot b868ee1 23/69: Fix #260: Only consider Eglot's own diagnostics in eglot-code-actions, João Távora, 2019/10/20
- [elpa] externals/eglot 5f629eb 26/69: Add built-in support for Elixir's elixir-ls (#264), João Távora, 2019/10/20
- [elpa] externals/eglot 356100a 19/69: Fix #220: don't sort xref's by default, João Távora, 2019/10/20
- [elpa] externals/eglot 195c311 22/69: Fix local function call in directory watcher (#255), João Távora, 2019/10/20
- [elpa] externals/eglot 2df3991 13/69: Fix #206: Update README.md, João Távora, 2019/10/20
- [elpa] externals/eglot 8d0c8de 05/69: Add NEWS.md file and rework README.md, João Távora, 2019/10/20
- [elpa] externals/eglot b4f3028 18/69: Fix #223: use a less buggy Flymake, João Távora, 2019/10/20