让每次运行的python解释器自动调用`coverage`?

时间:2017-03-27 14:52:19

标签: python coverage.py

我有test.sh在许多不同的脚本上运行python命令。有没有办法为每个python调用发出coverage -a而不用coverage -a预先添加每个命令?

1 个答案:

答案 0 :(得分:1)

有关在启动Python时自动调用coverage的方法,请参阅有关子进程度量的coverage.py文档:http://coverage.readthedocs.io/en/latest/subprocess.html。这将需要一些摆弄。

在shell脚本中别名可能更容易。对于像“nosetests”这样的东西,把它改成“python -m nose”。