我正在尝试运行trace.py
时使用pytest
进行覆盖。我知道pytest
有自己的coverage插件pytest-cov
,但是限制(每行执行的次数不可用)现在不允许我使用。 coverage.py
我正在尝试以下命令:python3.4 -m trace -c -m -C . pytest test_script.py
test_script.py
:
class TestScript():
def test_print(self):
print ('Hello')
输出为:
nikhilh$ python3.4 -m trace -c -m -C . pytest test_script.py
pytest: Cannot run file 'pytest' because: [Errno 2] No such file or directory: 'pytest'
trace.py
显然期望其参数中包含文件,而不是其他模块。如何修改此命令以使trace.py
与pytest
一起使用?
编辑:我能够找到一种方法来完成此任务
nikhilh$ python3.4 -m trace -c -m -C . <pytest_script_absolute_path> test_script.py
听到大卫的评论,所以这是我当时使用的答案:
python3.4 -m trace -c -m -C . <pytest_script_absolute_path> test_script.py