我正在使用 Hudson 持续构建一个 Python 项目。单元测试和代码覆盖效果很好,但是当针对我的不是单元测试的文件深入Cobertura Coverage Report时会出现此消息:
Source code is unavailable.Some possible reasons are:
* This is not the most recent build (to save on disk space, this plugin only keeps the most recent builds source code).
* Cobertura found the source code but did not provide enough information to locate the source code.
* Cobertura could not find the source code, so this plugin has no hope of finding it.
奇怪的是找到并显示了单元测试的源代码。我尝试手动将其他 .py 文件的源文件复制到 ~/.hudson/jobs/<projectname>/cobertura
中(单元测试被复制的地方),但它没有用。
有什么建议吗?
最佳答案
Cobertura 报告文件(此时位于 $HUDSON/jobs/foo/workspace
中的某处)需要在开头包含如下内容:
<sources>
<source>/path/to/source</source>
<source>/another/path</source>
</sources>
它有吗?路径是否指向正确的位置?
另一个陷阱:当它说“最近的构建”时,它实际上意味着“最近的稳定构建”(即状态球是蓝色的,而不是黄色)。
关于python - hudson "Source code is unavailable.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2285672/