Add nosetests run-command recipe

This commit is contained in:
Jeremy Dormitzer 2021-03-19 12:13:19 -04:00
parent 6d0b0c6bd9
commit 13a3837f45

View File

@ -176,6 +176,26 @@
"::"
(python-info-current-defun)))))))))
(defun run-command-recipe-nosetests()
(when (and (derived-mode-p 'python-mode)
(= 0 (call-process "python" nil nil nil "-c" "import nose")))
(let ((test-file-p (string-match-p "test" (or (buffer-file-name) ""))))
(list
(when (and (projectile-project-root)
(file-exists-p (concat (file-name-as-directory (projectile-project-root))
"tests")))
(list :command-name "test all"
:command-line "nosetests -w tests"
:working-dir (projectile-project-root)))
(when test-file-p
(list :command-name "test this file"
:command-line (format "nosetests %s" (buffer-file-name))))
(when (and test-file-p (python-info-current-defun))
(list :command-name "test this function"
:command-line (format "nosetests %s:%s"
(buffer-file-name)
(python-info-current-defun))))))))
(defun run-command-recipe-web-ext ()
(when-let* ((_ (executable-find "web-ext"))
(manifest (locate-dominating-file default-directory "manifest.json"))
@ -210,6 +230,7 @@
run-command-recipe-kustomize
run-command-recipe-sops
run-command-recipe-pytest
run-command-recipe-nosetests
run-command-recipe-web-ext
run-command-recipe-pip)))