我有兴趣将Python项目的doctest作为竹子构建的一部分来运行。有没有办法将doctest配置为输出JUnit可解析的xml文件?
发布于 2015-07-30 10:22:06
看起来没有一种方法可以用doctest本身做到这一点。
如果通过nose或py.test等测试运行器运行文档测试,这些工具可以选择将测试输出作为junit XML返回。
:
:
发布于 2015-07-30 11:19:23
史蒂文的建议是正确的-鼻子是正确的。下面是执行此操作的代码:
if __name__ == "__main__":
import nose
# First argument is a dummy
# --with-doctest enables parsing the doctests
# --with-xunit and --xunit-file generate output files compatible with a JUnit parser (i.e. for Bamboo)
# The last argument is the name of the file to run tests on
argv = ["", "--with-doctest", "--with-xunit", "--xunit-file=" + __file__ + ".xml", __file__]
nose.run(argv=argv) https://stackoverflow.com/questions/31713872
复制相似问题