From 42178867db7a9f23a8c080568b37bbac9fc8807b Mon Sep 17 00:00:00 2001 From: Ryan Pilgrim Date: Wed, 22 Jul 2020 14:28:57 -0400 Subject: [PATCH 1/6] add very verbose option --- python-pytest.el | 1 + 1 file changed, 1 insertion(+) diff --git a/python-pytest.el b/python-pytest.el index 0b479e3..8aed112 100644 --- a/python-pytest.el +++ b/python-pytest.el @@ -133,6 +133,7 @@ When non-nil only ‘test_foo()’ will match, and nothing else." (?s "do not capture output" "--capture=no") (?t "do not cut tracebacks" "--full-trace") (?v "verbose" "--verbose") + (?w "very verbose" "-vv") (?x "exit after first failure" "--exitfirst")) :options '((?k "only names matching expression" "-k") From a7f80b2225c41461682fe5ed2ff74213c943a07c Mon Sep 17 00:00:00 2001 From: Ryan Pilgrim Date: Thu, 30 Jul 2020 10:22:32 -0400 Subject: [PATCH 2/6] attempt to add cycle behavior --- python-pytest.el | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/python-pytest.el b/python-pytest.el index 8aed112..39cbb6a 100644 --- a/python-pytest.el +++ b/python-pytest.el @@ -116,11 +116,15 @@ When non-nil only ‘test_foo()’ will match, and nothing else." (defvar-local python-pytest--current-command nil "Current command; used in python-pytest-mode buffers.") +(defvar-local python-pytest--verbosity-level 0 + "Verbosity level.") + (fmakunbound 'python-pytest-popup) (makunbound 'python-pytest-popup) ;;;###autoload (autoload 'python-pytest-popup "python-pytest" nil t) -(magit-define-popup python-pytest-popup +(magit + -define-popup python-pytest-popup "Show popup for running pytest." 'python-pytest :switches @@ -132,8 +136,7 @@ When non-nil only ‘test_foo()’ will match, and nothing else." (?q "quiet" "--quiet") (?s "do not capture output" "--capture=no") (?t "do not cut tracebacks" "--full-trace") - (?v "verbose" "--verbose") - (?w "very verbose" "-vv") + (?v "verbose" "--verbose" python-pytest--cycle-verbosity) (?x "exit after first failure" "--exitfirst")) :options '((?k "only names matching expression" "-k") @@ -562,6 +565,18 @@ Example: ‘MyABCThingy.__repr__’ becomes ‘test_my_abc_thingy_repr’." (t nil))) +(defun python-pytest--cycle-verbosity () + "Cycle the verbosity level from 0 (no -v flag) to 2 (-vv flag)." + (cond + ((memq python-pytest--verbosity '(0 1)) + (setq python-pytest--verbosity (+ 1 python-pytest--verbosity))) + (t (setq python-pytest--verbosity 0))) + (cond + ((= python-pytest--verbosity 0) "") + ((= python-pytest--verbosity 1) "-v") + ((= python-pytest--verbosity 2) "-vv"))) + + ;; third party integration (with-eval-after-load 'direnv From 5013c7c8889ba1e7fe4b0d6d7b15630a43a83df2 Mon Sep 17 00:00:00 2001 From: Ryan Pilgrim Date: Thu, 30 Jul 2020 10:32:02 -0400 Subject: [PATCH 3/6] fix typo --- python-pytest.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/python-pytest.el b/python-pytest.el index 39cbb6a..6caaba5 100644 --- a/python-pytest.el +++ b/python-pytest.el @@ -123,8 +123,7 @@ When non-nil only ‘test_foo()’ will match, and nothing else." (makunbound 'python-pytest-popup) ;;;###autoload (autoload 'python-pytest-popup "python-pytest" nil t) -(magit - -define-popup python-pytest-popup +(magit-define-popup python-pytest-popup "Show popup for running pytest." 'python-pytest :switches From c5747a6cf6bef7dce2fcfe610c4616933cbd9b35 Mon Sep 17 00:00:00 2001 From: Ryan Pilgrim Date: Thu, 30 Jul 2020 10:37:56 -0400 Subject: [PATCH 4/6] move function to appropriate place in list --- python-pytest.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-pytest.el b/python-pytest.el index 6caaba5..31916d4 100644 --- a/python-pytest.el +++ b/python-pytest.el @@ -135,7 +135,7 @@ When non-nil only ‘test_foo()’ will match, and nothing else." (?q "quiet" "--quiet") (?s "do not capture output" "--capture=no") (?t "do not cut tracebacks" "--full-trace") - (?v "verbose" "--verbose" python-pytest--cycle-verbosity) + (?v "verbose" python-pytest--cycle-verbosity) (?x "exit after first failure" "--exitfirst")) :options '((?k "only names matching expression" "-k") From 259ec1102dab0adbc066cc9f839693e5a45d73cc Mon Sep 17 00:00:00 2001 From: Ryan Pilgrim Date: Thu, 30 Jul 2020 10:42:02 -0400 Subject: [PATCH 5/6] try again --- python-pytest.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-pytest.el b/python-pytest.el index 31916d4..5028302 100644 --- a/python-pytest.el +++ b/python-pytest.el @@ -135,7 +135,7 @@ When non-nil only ‘test_foo()’ will match, and nothing else." (?q "quiet" "--quiet") (?s "do not capture output" "--capture=no") (?t "do not cut tracebacks" "--full-trace") - (?v "verbose" python-pytest--cycle-verbosity) + (?v python-pytest--cycle-verbosity "verbose") (?x "exit after first failure" "--exitfirst")) :options '((?k "only names matching expression" "-k") From 33ccfca075fe7e4d1b2083b42053fde002c08b06 Mon Sep 17 00:00:00 2001 From: Ryan Pilgrim Date: Thu, 30 Jul 2020 10:47:37 -0400 Subject: [PATCH 6/6] back to last reasonable attempt (not working) --- python-pytest.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-pytest.el b/python-pytest.el index 5028302..31916d4 100644 --- a/python-pytest.el +++ b/python-pytest.el @@ -135,7 +135,7 @@ When non-nil only ‘test_foo()’ will match, and nothing else." (?q "quiet" "--quiet") (?s "do not capture output" "--capture=no") (?t "do not cut tracebacks" "--full-trace") - (?v python-pytest--cycle-verbosity "verbose") + (?v "verbose" python-pytest--cycle-verbosity) (?x "exit after first failure" "--exitfirst")) :options '((?k "only names matching expression" "-k")