@@ -128,8 +128,8 @@ When non-nil only ‘test_foo()’ will match, and nothing else."
128
128
(" -s" " no output capture" " --capture=no" )
129
129
(python-pytest:-v)]]
130
130
[" Selection, filtering, ordering"
131
- [(" -k " " only names matching expression " " -k= " )
132
- (" -m " " only marks matching expression " " -m= " )
131
+ [(python-pytest:-k )
132
+ (python-pytest:-m )
133
133
" " ] ; ; visual alignment
134
134
[(" --dm" " run doctests" " --doctest-modules" )
135
135
(" --nf" " new first" " --new-first" )
@@ -417,9 +417,7 @@ With a prefix ARG, allow editing."
417
417
" Transform ARGS so that pytest understands them."
418
418
(-->
419
419
args
420
- (python-pytest--switch-to-option it " --color" " --color=yes" " --color=no" )
421
- (python-pytest--quote-string-option it " -k" )
422
- (python-pytest--quote-string-option it " -m" )))
420
+ (python-pytest--switch-to-option it " --color" " --color=yes" " --color=no" )))
423
421
424
422
(defun python-pytest--switch-to-option (args name on-replacement off-replacement )
425
423
" Look in ARGS for switch NAME and turn it into option with a value.
@@ -441,6 +439,29 @@ When present ON-REPLACEMENT is substituted, else OFF-REPLACEMENT is appended."
441
439
(format " %s %s " option it)))
442
440
args))
443
441
442
+ (defun python-pytest--read-quoted-argument-for-short-flag (prompt initial-input history )
443
+ " Read a quoted string for use as a argument after a short-form command line flag."
444
+ (let* ((input (read-from-minibuffer prompt initial-input nil nil history))
445
+ (quoted-input (python-pytest--shell-quote input))
446
+ (formatted-input (format " %s " quoted-input)))
447
+ formatted-input))
448
+
449
+ (transient-define-argument python-pytest:-k ()
450
+ :description " only names matching expression"
451
+ :class 'transient-option
452
+ :argument " -k"
453
+ :allow-empty nil
454
+ :key " -k"
455
+ :reader 'python-pytest--read-quoted-argument-for-short-flag )
456
+
457
+ (transient-define-argument python-pytest:-m ()
458
+ :description " only marks matching expression"
459
+ :class 'transient-option
460
+ :argument " -m"
461
+ :allow-empty nil
462
+ :key " -m"
463
+ :reader 'python-pytest--read-quoted-argument-for-short-flag )
464
+
444
465
(transient-define-argument python-pytest:-v ()
445
466
:description " verbosity"
446
467
:class 'transient-switches
0 commit comments