如何获取 python 测试覆盖率中遗漏的语句
how to get which statements are missed in python test coverage
我是 python 的新手,
我已经为 class 编写了测试用例,
我在用
python -m pytest --cov=azuread_api
获取代码覆盖率。
我在控制台上的报道是
如何获取测试遗漏的行,例如 aadadapter.py 文件
谢谢,
如果您检查 pytest-cov 中的 documentation for reporting,您可以了解如何操作报告并生成额外的版本。
例如,添加选项 --cov-report term-missing
您将在终端中打印缺失的行。
一个对用户更友好的选项是通过使用 --cov-report html
选项生成 html 报告。然后您可以导航到生成的文件夹(默认情况下为 htmlcov
)并使用浏览器打开 index.html
并导航您的源代码,突出显示缺少的行。
除了 .coveragerc
中的 , one can also set show_missing = true
之外,pytest-cov 也会读取该配置文件。
我是 python 的新手,
我已经为 class 编写了测试用例,
我在用
python -m pytest --cov=azuread_api
获取代码覆盖率。
我在控制台上的报道是
如何获取测试遗漏的行,例如 aadadapter.py 文件
谢谢,
如果您检查 pytest-cov 中的 documentation for reporting,您可以了解如何操作报告并生成额外的版本。
例如,添加选项 --cov-report term-missing
您将在终端中打印缺失的行。
一个对用户更友好的选项是通过使用 --cov-report html
选项生成 html 报告。然后您可以导航到生成的文件夹(默认情况下为 htmlcov
)并使用浏览器打开 index.html
并导航您的源代码,突出显示缺少的行。
除了 .coveragerc
中的 show_missing = true
之外,pytest-cov 也会读取该配置文件。