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
Add shell completions by shtab #10304
base: main
Are you sure you want to change the base?
Conversation
as far as i recall we use argcomplete to also handle options added by pytest plugins after the fact or locally |
src/_pytest/helpconfig.py
Outdated
@@ -12,6 +12,11 @@ | |||
from _pytest.config import PrintHelp | |||
from _pytest.config.argparsing import Parser | |||
|
|||
try: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we repeat that all over the place it might make sense to have a single module that exposes the api we need to have a optional dep
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your meaning is wrapping the code to expose an API, right?
If any plugin add new option for pytest, I think regenerating the shell script can solve this problem. |
f9d50a2
to
6b86d6e
Compare
How to fix coverage check failure? |
i beleive the coverage diff issue can be ignored in this case |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as far as i understand, this simply adds shtab generate support without touching the argcomplete dynamic support
i do wonder if we could add a better argparse wrapper to manage import costs there (but thats a followup)
it may be sensible/necessary to have better type values in the shims
but i would consider creating a better typesafe + shtab aware argpase wrapper a followup exercise)
thanks for getting this started ,i like the idea of a quick tab complete very much
See pytest-dev#1992 pytest --print-completion bash | sudo tee /usr/share/bash-completion/completions/pytest pytest --print-completion tcsh | sudo tee /etc/profile.d/pytest.completion.csh pytest --print-completion zsh | sudo tee /usr/share/zsh/site-functions/_pytest
OK.
Me too. |
See #1992
If this change fixes an issue, please:
closes #XYZW
to the PR description and/or commits (whereXYZW
is the issue number). See the github docs for more information.Unless your change is trivial or a small documentation fix (e.g., a typo or reword of a small section) please:
Create a new changelog file in the
changelog
folder, with a name like<ISSUE NUMBER>.<TYPE>.rst
. See changelog/README.rst for details.Write sentences in the past or present tense, examples:
Also make sure to end the sentence with a
.
.Add yourself to
AUTHORS
in alphabetical order.