【发布时间】:2022-06-17 22:35:20
【问题描述】:
我正在尝试通过我的 pytest 测试来衡量代码覆盖率。我尝试遵循覆盖率的快速入门指南 (https://coverage.readthedocs.io/en/6.4.1/)
当我使用以下命令运行测试时,一切似乎都很好
coverage run -m pytest tests/
===================================== test session starts ======================================
platform linux -- Python 3.10.4, pytest-7.1.2, pluggy-1.0.0
rootdir: /home/arnaud/Documents/Github/gotcha
collected 4 items
tests/preprocessing/test_preprocessing.py .... [100%]
====================================== 4 passed in 0.30s =======================================
但是,当我尝试使用其中任一命令访问报告时,
coverage report
coverage html
我收到以下消息:
No source for code: '<project_directory>/config-3.py'.
到目前为止,我还没有找到解决这个问题的合适方法
【问题讨论】:
标签: python unit-testing pytest code-coverage coverage.py