RdT*_*Tek 4 python coverage.py python-3.x python-unittest visual-studio-code
我为 Visual Studio 代码安装了覆盖范围扩展,但没有显示行覆盖范围,当我按覆盖范围显示覆盖范围或按页脚中的“监视”选项时,它显示“找不到覆盖范围文件”
在此 github 中没有提及任何有关配置覆盖文件或任何内容
https://github.com/ryanluker/vscode-coverage-gutters
这是我正在使用unittest的测试之一的代码
class Test_SetValuesService(unittest.TestCase):
def test_given_none_property_when_checking_if_none_return_empty(self):
#ASSERT
self.assertEqual(" ", setValuesService.check_if_json_property_is_null(""))
Run Code Online (Sandbox Code Playgroud)
我收到的错误是一条消息“无法找到覆盖文件!”
默认情况下,Coverage Gutter 希望从项目根目录中包含覆盖率数据的cov.xml文件中读取覆盖率数据。
例如,在项目的根文件夹中运行它。它将运行 test/ 文件夹中的所有测试,并创建一个 cov.xml
pytest --cov=. tests/ --cov-report xml:cov.xml
Run Code Online (Sandbox Code Playgroud)
当然,您需要安装正确的 python 插件,在本例中为“pytest”、“coverage”和“pytest-cov”。
您还可以将 Visual Studio 中覆盖范围的扩展设置中使用的默认文件名调整为某某。如果您愿意,可以像 mypersonalcovfile.xml 一样。
| 归档时间: |
|
| 查看次数: |
14226 次 |
| 最近记录: |