Skip to content

Commit a7f80b2

Browse files
author
Ryan Pilgrim
committed
attempt to add cycle behavior
1 parent 4217886 commit a7f80b2

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

python-pytest.el

+18-3
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,15 @@ When non-nil only ‘test_foo()’ will match, and nothing else."
116116
(defvar-local python-pytest--current-command nil
117117
"Current command; used in python-pytest-mode buffers.")
118118

119+
(defvar-local python-pytest--verbosity-level 0
120+
"Verbosity level.")
121+
119122
(fmakunbound 'python-pytest-popup)
120123
(makunbound 'python-pytest-popup)
121124

122125
;;;###autoload (autoload 'python-pytest-popup "python-pytest" nil t)
123-
(magit-define-popup python-pytest-popup
126+
(magit
127+
-define-popup python-pytest-popup
124128
"Show popup for running pytest."
125129
'python-pytest
126130
:switches
@@ -132,8 +136,7 @@ When non-nil only ‘test_foo()’ will match, and nothing else."
132136
(?q "quiet" "--quiet")
133137
(?s "do not capture output" "--capture=no")
134138
(?t "do not cut tracebacks" "--full-trace")
135-
(?v "verbose" "--verbose")
136-
(?w "very verbose" "-vv")
139+
(?v "verbose" "--verbose" python-pytest--cycle-verbosity)
137140
(?x "exit after first failure" "--exitfirst"))
138141
:options
139142
'((?k "only names matching expression" "-k")
@@ -562,6 +565,18 @@ Example: ‘MyABCThingy.__repr__’ becomes ‘test_my_abc_thingy_repr’."
562565
(t nil)))
563566

564567

568+
(defun python-pytest--cycle-verbosity ()
569+
"Cycle the verbosity level from 0 (no -v flag) to 2 (-vv flag)."
570+
(cond
571+
((memq python-pytest--verbosity '(0 1))
572+
(setq python-pytest--verbosity (+ 1 python-pytest--verbosity)))
573+
(t (setq python-pytest--verbosity 0)))
574+
(cond
575+
((= python-pytest--verbosity 0) "")
576+
((= python-pytest--verbosity 1) "-v")
577+
((= python-pytest--verbosity 2) "-vv")))
578+
579+
565580
;; third party integration
566581

567582
(with-eval-after-load 'direnv

0 commit comments

Comments
 (0)