branch: elpa/flymake-pyrefly commit 45409e6092cbfab223869315a7e8fe794b82cc16 Merge: 2059935c0d fb50543eba Author: Boris Shminke <1696493+inpef...@users.noreply.github.com> Commit: GitHub <nore...@github.com>
Merge pull request #17 from inpefess/3-test-with-multiple-emacs-versions Test with multiple Emacs versions --- .gitignore | 2 ++ flymake-pyrefly.el | 2 ++ run-tests.sh | 5 +++++ tests/test-flymake-pyrefly.el | 5 ++++- 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index adef969d3d..319b805436 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,5 @@ dist/ # Undo-tree save-files *.~undo-tree + +*.xml diff --git a/flymake-pyrefly.el b/flymake-pyrefly.el index 2d5b0d4646..5163cdd01c 100644 --- a/flymake-pyrefly.el +++ b/flymake-pyrefly.el @@ -14,6 +14,8 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see <https://www.gnu.org/licenses/>. +;;; Version: 0.0.1 + ;;; Commentary: ;; Based on the annotated example from Flymake info. ;; Usage: diff --git a/run-tests.sh b/run-tests.sh new file mode 100755 index 0000000000..ca0727a498 --- /dev/null +++ b/run-tests.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +export EMACS_TEST_JUNIT_REPORT=1 +emacs --batch -L . -L tests -l test-flymake-pyrefly \ + -f ert-run-tests-batch-and-exit diff --git a/tests/test-flymake-pyrefly.el b/tests/test-flymake-pyrefly.el index 27bd37d51b..bd355d4607 100644 --- a/tests/test-flymake-pyrefly.el +++ b/tests/test-flymake-pyrefly.el @@ -22,16 +22,19 @@ (require 'flymake) (ert-deftest flymake-pyrefly-test-no-pyrefly () "Test error message when Pyrefly is not found." + (find-file "tests/example.py") (should-error (flymake-pyrefly 'identity))) (ert-deftest flymake-pyrefly-test-normal-use-case () "Test a normal Pyrefly use-case." (defun mock-report-fn (args) (setq saved-args args)) - (find-file "example.py") + (push (getenv "PYREFLY_BIN_DIR") exec-path) + (find-file "tests/example.py") (setq saved-args nil) (flymake-pyrefly 'mock-report-fn) (flymake-pyrefly 'mock-report-fn) (sleep-for 1) + (pop exec-path) (should (equal (aref (car saved-args) 2) (cons 2 5)))) (ert-deftest flymake-pyrefly-test-setup ()