Spreadable Elisp

nose 0.1.0

Easy Python test running in Emacs

M-x package-install nose

This gives a bunch of functions that handle running nosetests on a particular buffer or part of a buffer.


In your emacs config:

(require 'nose) ; next line only for people with non-eco non-global test runners ; (add-to-list 'nose-project-names "my/crazy/runner")

Note that if your global nose isn't called "nosetests", then you'll want to redefine nose-global-name to be the command that should be used.

By default, the root of a project is found by looking for any of the files '', '.hg' and '.git'. You can add files to check for to the file list:

; (add-to-list 'nose-project-root-files "something")

or you can change the project root test to detect in some other way whether a directory is the project root:

; (setq nose-project-root-test (lambda (dirname) (equal dirname "foo")))

If you want dots as output, rather than the verbose output: (defvar nose-use-verbose nil) ; default is t

Probably also want some keybindings: (add-hook 'python-mode-hook (lambda () (local-set-key "\C-ca" 'nosetests-all) (local-set-key "\C-cm" 'nosetests-module) (local-set-key "\C-c." 'nosetests-one) (local-set-key "\C-cpa" 'nosetests-pdb-all) (local-set-key "\C-cpm" 'nosetests-pdb-module) (local-set-key "\C-cp." 'nosetests-pdb-one)))