summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2014-02-01 16:10:59 -0500
committerKyle Meyer <kyle@kyleam.com>2014-02-01 16:10:59 -0500
commite38b769d324cc3ae56dff19689fdd7c47441b4fe (patch)
tree6b07733f4b5d3661ddd6315d0f9b4d2580e2d97b /lisp
parent529a72c995769765dc2ab91de3bce4ceb0cfaf16 (diff)
downloademacs.d-e38b769d324cc3ae56dff19689fdd7c47441b4fe.tar.gz
Use prefix argument to choose py.test{,2} compile
Diffstat (limited to 'lisp')
-rw-r--r--lisp/init-python.el14
1 files changed, 8 insertions, 6 deletions
diff --git a/lisp/init-python.el b/lisp/init-python.el
index bbd477b..48bbf6d 100644
--- a/lisp/init-python.el
+++ b/lisp/init-python.el
@@ -25,14 +25,16 @@ Unless a prefix argument ARG is given, py.test is also imported."
(unless arg
(insert "import pytest\n")))))
+(defun km/pytest-compile (arg)
+ "Run pytest.
+If ARG, use pytest2 instead of pytest."
+ (interactive "P")
+ (let ((pytest (if arg "py.test2" "py.test")))
+ (compile pytest)))
+
(defun km/python-hook ()
(local-set-key (kbd "C-c m c") 'km/create-python-test-file)
- (local-set-key (kbd "C-c m t") '(lambda ()
- (interactive)
- (compile "py.test")))
- (local-set-key (kbd "C-c m T") '(lambda ()
- (interactive)
- (compile "py.test2"))))
+ (local-set-key (kbd "C-c m t") 'km/pytest-compile))
(add-hook 'python-mode-hook 'km/python-hook)