python html 报告期间的覆盖错误(NoSource:没有代码来源:)

python coverage error during html report (NoSource: No source for code:)

我在报告 html 报道时遇到以下错误。

myrepo>coverage report html
html   NoSource: No source for code: 'C:\Users\usr\AppData\Local\Programs\Python\Python37-32\Lib\html': [Errno 13] Permission denied: 'C:\Users\usr\AppData\Local\Programs\Python\Python37-32\Lib\html'
Name    Stmts   Miss  Cover
---------------------------
No data to report.

但是,目录存在,我有权限:

myrepo>ls -la C:\Users\usr\AppData\Local\Programs\Python\Python37-32\Lib\html
total 172
drwxr-xr-x 1 usr 197121     0 Nov 26  2018 .
drwxr-xr-x 1 usr 197121     0 Nov 26  2018 ..
-rw-r--r-- 1 usr 197121  4888 Oct 20  2018 __init__.py
drwxr-xr-x 1 usr 197121     0 Nov 26  2018 __pycache__
-rw-r--r-- 1 usr 197121 77824 Oct 20  2018 entities.py
-rw-r--r-- 1 usr 197121 18191 Oct 20  2018 parser.py

请注意,我可以在终端中打印覆盖率报告:

myrepo>coverage report
Name                               Stmts   Miss  Cover
------------------------------------------------------
tests\PexpectTestCase.py              46     18    61%
tests\__init__.py                      2      0   100%
tests\test_command_list_split.py      18      1    94%
tests\test_constructor.py             18      1    94%
tests\test_delay.py                   25      0   100%
tests\test_destructor.py              56      2    96%
wexpect.py                          1401    819    42%
------------------------------------------------------
TOTAL                               1566    841    46%

如何生成 html 报告?

您使用 coverage html 生成了一份 HTML 报告。