Skip to content

Commit

Permalink
Be sure check is usable even if flycheck-modules is deactivated
Browse files Browse the repository at this point in the history
see #1804
  • Loading branch information
galaunay committed Aug 5, 2020
1 parent 255cd73 commit 467d8b3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
4 changes: 2 additions & 2 deletions elpy.el
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,8 @@ virtualenv.
(error "Please enable Elpy with `(elpy-enable)` before using it"))
(when (boundp 'xref-backend-functions)
(add-hook 'xref-backend-functions #'elpy--xref-backend nil t))
;; Set this for `elpy-check' command
(setq-local python-check-command elpy-syntax-check-command)
(cond
(elpy-mode
(elpy-modules-buffer-init))
Expand Down Expand Up @@ -3603,8 +3605,6 @@ If a region is selected, fold that region."
elpy-folding-fringe-indicators)
(setq-local flymake-fringe-indicator-position 'right-fringe)
(setq-local flymake-fringe-indicator-position 'left-fringe))
;; Set this for `elpy-check' command
(setq-local python-check-command elpy-syntax-check-command)
;; For emacs > 26.1, python.el natively supports flymake,
;; so we just tell python.el to use the wanted syntax checker
(when (version<= "26.1" emacs-version)
Expand Down
10 changes: 10 additions & 0 deletions test/elpy-mode-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,13 @@
(elpy-mode -1)

(should buffer-stop-called))))


(ert-deftest elpy-mode-should-set-python-check-command ()
(elpy-testcase ()
(mletf* ((executable-find (name) (equal name "flake8")))
(elpy-enable)
(python-mode)
(should (equal python-check-command "flake8"))
(if (version<= "26.1" emacs-version)
(should (equal python-flymake-command '("flake8" "-")))))))
9 changes: 0 additions & 9 deletions test/elpy-module-flymake-test.el
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
(ert-deftest elpy-module-flymake-global-init-should-use-flake8 ()
(elpy-testcase ()
(mletf* ((executable-find (name) (equal name "flake8")))
(elpy-module-flymake 'global-init)
(elpy-module-flymake 'buffer-init)
(should (equal python-check-command "flake8"))
(if (version<= "26.1" emacs-version)
(should (equal python-flymake-command '("flake8" "-")))))))

(ert-deftest elpy-module-flymake-global-init ()
(elpy-testcase ()
(elpy-module-flymake 'global-init)
Expand Down

0 comments on commit 467d8b3

Please sign in to comment.