pytest
pytest copied to clipboard
Add shell completions by shtab
See #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
❯ pytest --<TAB>
option
--assert Control assertion debugging tools.
'plain' performs no assertion debugging.
'rewrite' (the default) rewrites assert statements in test modules on import to provide assert expression information.
--basetemp Base temporary directory for this test run. (Warning: this directory is removed if it exists.)
--cache-clear Remove all cache contents at start of test run
--cache-show Show cache contents, don't perform collection or tests. Optional argument: glob (default: '*').
--capture Per-test capturing method: one of fd|sys|no|tee-sys
...
❯ pytest --log-file <TAB>
log_file
AUTHORS CHANGELOG.rst CODE_OF_CONDUCT.md extra/ pyproject.toml scripts/ src/ tox.ini
bench/ CITATION CONTRIBUTING.rst LICENSE README.rst setup.cfg testing/
changelog/ codecov.yml doc/ OPENCOLLECTIVE.rst RELEASING.rst setup.py TIDELIFT.rst
- [ ] Include documentation when adding new features.
- [ ] Include new tests or update existing tests when applicable.
- [X] Allow maintainers to push and squash when merging my commits. Please uncheck this if you prefer to squash the commits yourself.
If this change fixes an issue, please:
- [ ] Add text like
closes #XYZWto the PR description and/or commits (whereXYZWis 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:
-
[x] Create a new changelog file in the
changelogfolder, with a name like<ISSUE NUMBER>.<TYPE>.rst. See changelog/README.rst for details.Write sentences in the past or present tense, examples:
- Improved verbose diff output with sequences.
- Terminal summary statistics now use multiple colors.
Also make sure to end the sentence with a
.. -
[x] Add yourself to
AUTHORSin alphabetical order.
as far as i recall we use argcomplete to also handle options added by pytest plugins after the fact or locally i wonder how to enable something similar for this as pytest completion is optionally tricky
handle options added by pytest plugins after the fact or locally
If any plugin add new option for pytest, I think regenerating the shell script can solve this problem.
How to fix coverage check failure?
i beleive the coverage diff issue can be ignored in this case
i beleive the coverage diff issue can be ignored in this case
OK.
i like the idea of a quick tab complete very much
Me too.
This had been approved, but sadly went stale in the meantime. @Freed-Wu do you want to rebase and see, if we can merge it then?