如何设置 bash 自动补全¶
当您使用 bash 作为 shell 时,pytest 可以使用 argcomplete (https://kislyuk.github.io/argcomplete/) 进行自动补全。为此,argcomplete 需要被安装并启用。
使用以下命令安装 argcomplete
sudo pip install 'argcomplete>=0.5.7'
要全局激活所有支持 argcomplete 的 Python 应用程序,请运行
sudo activate-global-python-argcomplete
要永久(但非全局)激活 pytest,请使用
register-python-argcomplete pytest >> ~/.bashrc
要仅针对 pytest 一次性激活 argcomplete,请使用
eval "$(register-python-argcomplete pytest)"