-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding custom plugins support easily #71
Comments
is there a way to not have that ‘local options’ section in the transient window at all? i'd like to avoid useless clutter for a feature that not many people will use and that doesn't do anything by default. |
Yes ! (defvar pytest-local-transient nil "Local transient options for pytest")
(transient-define-prefix python-pytest-dispatch ()
"Show popup for running pytest."
:man-page "pytest"
:incompatible '(("--exitfirst" "--maxfail="))
:value '("--color")
["Output"
[("-c" "color" "--color")
("-q" "quiet" "--quiet")
("-s" "no output capture" "--capture=no")
(python-pytest:-v)]]
["Selection, filtering, ordering"
[(python-pytest:-k)
(python-pytest:-m)
" "] ;; visual alignment
[("--dm" "run doctests" "--doctest-modules")
("--nf" "new first" "--new-first")
("--sw" "stepwise" "--stepwise")
("--co" "collect only" "--collect-only")]]
["Failures, errors, debugging"
[("-l" "show locals" "--showlocals")
("-p" "debug on error" "--pdb")
("-x" "exit after first failure" "--exitfirst")]
[("--ff" "failed first" "--failed-first")
("--ft" "full tracebacks" "--full-trace")
("--mf" "exit after N failures or errors" "--maxfail=")
("--rx" "run xfail tests" "--runxfail")
(python-pytest:--tb)
("--tr" "debug on each test" "--trace")]]
["Options for pytest-xdist"
[(python-pytest:-n)]
[("-f" "loop on failure" "--looponfail")]]
["Local Options"
:setup-children (lambda (_) (transient-parse-suffixes transient--suffixes pytest-local-transient))
:if-non-nil pytest-local-transient
(:info "No Local options")]
["Run tests"
[("t" "all" python-pytest)]
[("r" "repeat" python-pytest-repeat)
("x" "last failed" python-pytest-last-failed)]
[("f" "file (dwim)" python-pytest-file-dwim)
("F" "file (this)" python-pytest-file)]
[("m" "files" python-pytest-files)
("M" "directories" python-pytest-directories)]
[("d" "def/class (dwim)" python-pytest-function-dwim)
("D" "def/class (this)" python-pytest-function)]]) I overwrite the definition for prototyping , using Also now we can define multiple CLI arguments like so ((python-mode (pytest-local-transient .
[(
"b" "Backend to run" "--backend="
:multi-value repeat
:choices ("cpu" "gpu")
)
("c" "custom command" "--custom-command")])
)) |
Oooh, this looks really interesting. I just discovered some of the options to pytest-mpl such as the ability to add the flag |
Hello there,
I am using your package more and more, and keep liking it. In my python projects I usually defines some custom command lines arguments for pytest, and found a nice way to add them dynamically to the transient menu.
I rely on .dir-locals.el for projects variables, to store custom transients menu and load them accordingly:
And then define custom transient suffix in a .dir-locals.el file:
Let me know if you would like to have this as a PR, but as it is fairly minimal coda I think it will still be happy if it stayed comfy in my config.
The text was updated successfully, but these errors were encountered: