comparison .elisp/nose.el @ 88:79eec81404c3

Import latest nosemacs.
author Augie Fackler <durin42@gmail.com>
date Thu, 16 Apr 2009 14:59:44 -0500
parents 4b9b90486260
children 2563edf11e59
comparison
equal deleted inserted replaced
87:b958738c16f3 88:79eec81404c3
25 ;; ; (add-to-list 'nose-project-names "my/crazy/runner") 25 ;; ; (add-to-list 'nose-project-names "my/crazy/runner")
26 26
27 ;; Note that if your global nose isn't called "nosetests", then you'll want to 27 ;; Note that if your global nose isn't called "nosetests", then you'll want to
28 ;; redefine nose-global-name to be the command that should be used. 28 ;; redefine nose-global-name to be the command that should be used.
29 29
30 ;; By default, the root of a project is found by looking for any of the files
31 ;; 'setup.py', '.hg' and '.git'. You can add files to check for to the file
32 ;; list:
33 ;;
34 ;; ; (add-to-list 'nose-project-root-files "something")
35
36 ;; or you can change the project root test to detect in some other way
37 ;; whether a directory is the project root:
38 ;;
39 ;; ; (setq nose-project-root-test (lambda (dirname) (equal dirname "foo")))
40
41 ;; If you want dots as output, rather than the verbose output:
42 ;; (defvar nose-use-verbose nil) ; default is t
43
30 ;; Probably also want some keybindings: 44 ;; Probably also want some keybindings:
31 ;; (add-hook 'python-mode-hook 45 ;; (add-hook 'python-mode-hook
32 ;; (lambda () 46 ;; (lambda ()
33 ;; (local-set-key "\C-ca" 'nosetests-all) 47 ;; (local-set-key "\C-ca" 'nosetests-all)
34 ;; (local-set-key "\C-cm" 'nosetests-module) 48 ;; (local-set-key "\C-cm" 'nosetests-module)
39 53
40 (defvar nose-project-names '("eco/bin/test")) 54 (defvar nose-project-names '("eco/bin/test"))
41 (defvar nose-project-root-files '("setup.py" ".hg" ".git")) 55 (defvar nose-project-root-files '("setup.py" ".hg" ".git"))
42 (defvar nose-project-root-test 'nose-project-root) 56 (defvar nose-project-root-test 'nose-project-root)
43 (defvar nose-global-name "nosetests") 57 (defvar nose-global-name "nosetests")
58 (defvar nose-use-verbose t)
44 59
45 (defun run-nose (&optional tests debug) 60 (defun run-nose (&optional tests debug)
46 "run nosetests" 61 "run nosetests"
47 (let* ((nose (nose-find-test-runner)) 62 (let* ((nose (nose-find-test-runner))
48 (where (nose-find-project-root)) 63 (where (nose-find-project-root))
52 'pdb 67 'pdb
53 '(lambda (command) 68 '(lambda (command)
54 (compilation-start command 69 (compilation-start command
55 nil 70 nil
56 (lambda (mode) (concat "*nosetests*"))))) 71 (lambda (mode) (concat "*nosetests*")))))
57 (format "%s -v %s -w %s -c %ssetup.cfg %s" 72 (format
58 (nose-find-test-runner) args where where tnames))) 73 (concat "%s "
74 (if nose-use-verbose "-v" "")
75 "%s -w %s -c %ssetup.cfg %s")
76 (nose-find-test-runner) args where where tnames)))
59 ) 77 )
60 78
61 (defun nosetests-all (&optional debug) 79 (defun nosetests-all (&optional debug)
62 "run all tests" 80 "run all tests"
63 (interactive) 81 (interactive)
134 (cons 152 (cons
135 (buffer-substring-no-properties (match-beginning 1) (match-end 1)) 153 (buffer-substring-no-properties (match-beginning 1) (match-end 1))
136 result)))) 154 result))))
137 155
138 (defun nose-find-project-root (&optional dirname) 156 (defun nose-find-project-root (&optional dirname)
139 (interactive)
140 (let ((dn 157 (let ((dn
141 (if dirname 158 (if dirname
142 dirname 159 dirname
143 (file-name-directory buffer-file-name)))) 160 (file-name-directory buffer-file-name))))
144 (cond ((nose-project-root dn) (expand-file-name dn)) 161 (cond ((funcall nose-project-root-test dn) (expand-file-name dn))
145 ((equal (expand-file-name dn) "/") nil) 162 ((equal (expand-file-name dn) "/") nil)
146 (t (nose-find-project-root 163 (t (nose-find-project-root
147 (file-name-directory (directory-file-name dn))))))) 164 (file-name-directory (directory-file-name dn)))))))
148 165
149 (defun nose-project-root (dirname) 166 (defun nose-project-root (dirname)