首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Python的doctest输出可以被Bamboo的JUnit解析器解析吗?

Python的doctest输出可以被Bamboo的JUnit解析器解析吗?
EN

Stack Overflow用户
提问于 2015-07-30 09:38:26
回答 2查看 454关注 0票数 1

我有兴趣将Python项目的doctest作为竹子构建的一部分来运行。有没有办法将doctest配置为输出JUnit可解析的xml文件?

EN

回答 2

Stack Overflow用户

发布于 2015-07-30 10:22:06

看起来没有一种方法可以用doctest本身做到这一点。

如果通过nosepy.test等测试运行器运行文档测试,这些工具可以选择将测试输出作为junit XML返回。

  • Xunit plugin
  • Doctest plugin

  • Nose

  • py.test

票数 1
EN

Stack Overflow用户

发布于 2015-07-30 11:19:23

史蒂文的建议是正确的-鼻子是正确的。下面是执行此操作的代码:

代码语言:javascript
复制
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) 
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31713872

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档