diff .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
line wrap: on
line diff
--- a/.elisp/nose.el
+++ b/.elisp/nose.el
@@ -27,6 +27,20 @@
 ;; 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
+;; 'setup.py', '.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 ()
@@ -41,6 +55,7 @@
 (defvar nose-project-root-files '("setup.py" ".hg" ".git"))
 (defvar nose-project-root-test 'nose-project-root)
 (defvar nose-global-name "nosetests")
+(defvar nose-use-verbose t)
 
 (defun run-nose (&optional tests debug)
   "run nosetests"
@@ -54,8 +69,11 @@
                   (compilation-start command
                                      nil
                                      (lambda (mode) (concat "*nosetests*")))))
-             (format "%s -v %s -w %s -c %ssetup.cfg %s"
-                     (nose-find-test-runner) args where where tnames)))
+             (format
+              (concat "%s "
+                      (if nose-use-verbose "-v" "")
+                      "%s -w %s -c %ssetup.cfg %s")
+              (nose-find-test-runner) args where where tnames)))
   )
 
 (defun nosetests-all (&optional debug)
@@ -136,12 +154,11 @@
        result))))
 
 (defun nose-find-project-root (&optional dirname)
-  (interactive)
   (let ((dn
          (if dirname
              dirname
            (file-name-directory buffer-file-name))))
-    (cond ((nose-project-root dn) (expand-file-name dn))
+    (cond ((funcall nose-project-root-test dn) (expand-file-name dn))
           ((equal (expand-file-name dn) "/") nil)
         (t (nose-find-project-root
              (file-name-directory (directory-file-name dn)))))))