pytest-dev / pytest

The pytest framework makes it easy to write small tests, yet scales to support complex functional testing
https://pytest.org
MIT License
11.87k stars 2.64k forks source link

Add shell completion (zsh) #1992

Open blueyed opened 7 years ago

blueyed commented 7 years ago

Should we include/ship shell completion with pytest, e.g. in a contrib folder?

I have something for Zsh: https://github.com/zsh-users/zsh-completions/pull/454/files.

Added to my dotfiles: https://github.com/blueyed/oh-my-zsh/commit/fd89b191b808adc4c913f667109d5c9702bba713 (2020-03-01)

RonnyPfannschmidt commented 7 years ago

pytest already supports the argcomplete protocol

blueyed commented 7 years ago

Thanks! I came across that before, but for zsh it requires bashcompinit (a wrapper to enable bash completions), and the completion itself is slow (it seems to be not cached at all), and does not support completing (c)tags after -k, which was my initial motivation to create a completion script for pytest, since this easily allows to complete test functions.

RonnyPfannschmidt commented 7 years ago

i see what you mean, i wonder if that can be done in a multi shell fashion

Freed-Wu commented 1 year ago

How about shtab? It is faster than argcomplete and pyzshcomplete. And it supports more shells.

The-Compiler commented 1 month ago

Seems useful if we had at least basic shell completion for the built-in pytest arguments.