如何设置 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)"