| Python覆盖范围报告错误|没有代码的来源:path +'/_remote_module_non_scriptable.py'

问题描述 投票:0回答:1

当我跑步时

coverage run -m pytest tests/
在终端中
coverage report
我有以下错误:

No source for code: '/private/var/.../_remote_module_non_scriptable.py'.

这似乎已经解决了一个类似的问题,但是我不了解
solution

可以帮助我了解问题的原因是什么?

coverage xml -i

对我不起作用。
python code-coverage coverage.py
1个回答
0
投票
<tmpdir>/_remote_module_non_scriptable.py

是由Pytorch生成的。

Solution:添加到
pyproject.toml

[tool.coverage.run]
omit = [
    # omit pytorch-generated files in /tmp
    "/tmp/*",
]

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.