阅读(3084) (1)

pytest bash设置

2022-03-22 09:18:28 更新

如果使用 bash 作为 shell,pytest 可以使用 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)"