遇到问题–python–pytest: error: unrecognized arguments: --cov-report=html

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/q383965374/article/details/84785598

转载请注明出处:遇到问题–python–pytest: error: unrecognized arguments: --cov-report=html

问题

pytest可以输出覆盖率的html报告

使用命令如下:

pytest -vv --cov=./ --cov-report=html
open htmlcov/index.html 

有可能遇到报错:

(venv) zhangxiaofans-MacBook-Pro:mgap-mendel joe$ pytest --cov-report=html
usage: pytest [options] [file_or_dir] [file_or_dir] [...]
pytest: error: unrecognized arguments: --cov-report=html
  inifile: None
  rootdir: /Users/joe/workspace/platform/mgap-mendel/mgap-mendel

原因

缺少pytest cov的包

解决方法

pip3 install pytest-cov

转载请注明出处:遇到问题–python–pytest: error: unrecognized arguments: --cov-report=html

猜你喜欢

转载自blog.csdn.net/q383965374/article/details/84785598
今日推荐