Skip to content

Instantly share code, notes, and snippets.

@marcwebbie
Forked from TauPan/elpy-test-pdb-config.el
Last active April 13, 2018 21:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcwebbie/c4289679b938f4ce80c5 to your computer and use it in GitHub Desktop.
Save marcwebbie/c4289679b938f4ce80c5 to your computer and use it in GitHub Desktop.
(use-package elpy
:config
(progn (elpy-enable)
(defun elpy-nose-test-spec (module test)
(cond (test
(format "%s:%s" module test))
(module module)
(t "")))
(defun elpy-test-nose-pdb-runner (top file module test)
"Test the project using the nose test runner with the --pdb arg.
This requires the nose package to be installed."
(interactive (elpy-test-at-point))
(let ((default-directory top))
(pdb (format "nosetests --pdb %s"
(elpy-nose-test-spec module test)))))
(put 'elpy-test-nose-pdb-runner 'elpy-test-runner-p t)
(defvar elpy-test-pdb-runner
#'elpy-test-nose-pdb-runner
"Test runner to run with pdb")
(defun elpy-test-django-nose-pdb-runner (top file module test)
"Test the project using the django-nose test runner with the --pdb arg.
This requires the django-nose package to be installed and
properly configured for the django project."
(interactive (elpy-test-at-point))
(let ((default-directory top))
(pdb (format "django-admin.py test --noinput %s --pdb"
(elpy-nose-test-spec module test)))))
(defun elpy-test-pdb (&optional test-whole-project)
"Run test the current project with the elpy-test-pdb-runner
prefix args have the same semantics as for `elpy-test'"
(interactive "P")
(let ((elpy-test-runner elpy-test-pdb-runner))
(elpy-test test-whole-project)))
(eval-after-load 'elpy
'(progn
(define-key elpy-mode-map
(kbd "C-c t") 'elpy-test-pdb)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment