我正在学习用Python进行测试,现在我正在使用pytest-cov。
我尝试运行这个命令:
pytest --cov=myProj tests/ --cov-report term-missing
测试完成后,我得到了这样的报告:
----------- coverage: platform linux, python 3.6.7-final-0 -----------
Name Stmts Miss Cover Missing
----------------------------------------------------------------------------------------------
myProject/__init__.py 0 0 100%
myProject/alert.py 14 14 0% 1-21
myProject/api/__init__.py 1 0 100%
myProject/api/spaces/__init__.py 0 0 100%
myProject/api/spaces/admin.py 279 179 36% 154-223, 312-335, 351-398, 422-432, 505-515, 534-565, 591-697
myProject/api/spaces/global.py 89 66 26% 35-43, 47-69, 72-92, 96-124
myProject/api/spaces/inventory.py 79 79 0% 1-119
myProject/api/spaces/keyword.py 134 110 18% 33-42, 46-68, 72-93, 101-112, 116-134, 138-165, 168-190
有几件事让我仍然对我在文档中找不到的报告感到困惑:什么是 Stmts、Miss、Cover和Missing,如果Cover上的结果不是 100% 这意味着我的代码仍然很糟糕还是什么..?