From ba497653589f67b2ffd85dfccc80f8669dd61cc4 Mon Sep 17 00:00:00 2001 From: Edmund Miller Date: Thu, 22 Nov 2018 12:53:08 -0600 Subject: [PATCH 1/4] Initial pytest --- modules/lang/python/config.el | 12 ++++++++++++ modules/lang/python/packages.el | 1 + 2 files changed, 13 insertions(+) diff --git a/modules/lang/python/config.el b/modules/lang/python/config.el index 3814e787a..406c4b577 100644 --- a/modules/lang/python/config.el +++ b/modules/lang/python/config.el @@ -110,6 +110,18 @@ :n "O" #'nosetests-pdb-one :n "V" #'nosetests-pdb-module)) +(def-package! python-pytest + :commands pytest-mode + :preface (defvar pytest-mode-map (make-sparse-keymap)) + :init (associate! pytest-mode :match "/test_.+\\.py$" :modes (python-mode)) + (set-yas-minor-mode! 'pytest-mode) + (when (featurep 'evil) + (add-hook 'pytest-mode-hook #'evil-normalize-keymaps)) + + (map! :map nose-mode-map + :localleader + :prefix "t" + :n "r" #'nosetests-again)) ;; ;; Environment management diff --git a/modules/lang/python/packages.el b/modules/lang/python/packages.el index 1c30b8bf1..cfe418184 100644 --- a/modules/lang/python/packages.el +++ b/modules/lang/python/packages.el @@ -4,6 +4,7 @@ ;; requires: python setuptools (package! nose) +(package! python-pytest) (package! pip-requirements) ;; Environmet management From 2c0b0fac775150a479c13053695395ce2757a2a8 Mon Sep 17 00:00:00 2001 From: Edmund Miller Date: Fri, 23 Nov 2018 11:06:03 -0600 Subject: [PATCH 2/4] Keybindings are added to python-mode-map --- modules/lang/python/config.el | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/modules/lang/python/config.el b/modules/lang/python/config.el index 406c4b577..0fc993815 100644 --- a/modules/lang/python/config.el +++ b/modules/lang/python/config.el @@ -111,17 +111,11 @@ :n "V" #'nosetests-pdb-module)) (def-package! python-pytest - :commands pytest-mode - :preface (defvar pytest-mode-map (make-sparse-keymap)) - :init (associate! pytest-mode :match "/test_.+\\.py$" :modes (python-mode)) - (set-yas-minor-mode! 'pytest-mode) - (when (featurep 'evil) - (add-hook 'pytest-mode-hook #'evil-normalize-keymaps)) - - (map! :map nose-mode-map + :config + (map! :map python-mode-map :localleader :prefix "t" - :n "r" #'nosetests-again)) + :nv "p" #'python-pytest-popup)) ;; ;; Environment management From 52f805ba621f2ce19a3b7b80f5046405fb434be8 Mon Sep 17 00:00:00 2001 From: Edmund Miller Date: Fri, 23 Nov 2018 11:14:25 -0600 Subject: [PATCH 3/4] Add some extra keybindings --- modules/lang/python/config.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/lang/python/config.el b/modules/lang/python/config.el index 0fc993815..c290b9058 100644 --- a/modules/lang/python/config.el +++ b/modules/lang/python/config.el @@ -115,6 +115,9 @@ (map! :map python-mode-map :localleader :prefix "t" + :nv "f" #'python-pytest-file + :nv "k" #'python-pytest-file-dwim + :nv "m" #'python-pytest-repeat :nv "p" #'python-pytest-popup)) ;; From 30fbb0d62f092b67c5d15e81512ef0bf125bc970 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 3 Dec 2018 23:15:40 -0500 Subject: [PATCH 4/4] Lazy-load python-pytest --- modules/lang/python/config.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/lang/python/config.el b/modules/lang/python/config.el index c290b9058..0f5077473 100644 --- a/modules/lang/python/config.el +++ b/modules/lang/python/config.el @@ -111,8 +111,9 @@ :n "V" #'nosetests-pdb-module)) (def-package! python-pytest - :config - (map! :map python-mode-map + :init + (map! :after python + :map python-mode-map :localleader :prefix "t" :nv "f" #'python-pytest-file