[英]How to specify xml output for nose programatically
我正在使用Nose的腳本運行測試。 我希望能夠指定xunit xml輸出文件。 文檔說我可以使用--xunit-file = FILE選項。
我有
noseargs = ['--with-xunit', '--xunit-file=output.xml', '--tests=mytest']
nose.run(argv=noseargs)
運行此命令后,output.xml文件不存在。 我發現如果我交換這兩個參數,它看起來像:
noseargs = ['--xunit-file=output.xml', '--with-xunit', '--tests=mytest']
nose.run(argv=noseargs)
它將在我的工作目錄中創建一個nosetests.xml文件。 所以看起來需要首先處理--with-xunit參數,然后需要指定文件。 有沒有什么特別的關於如何指定我丟失的文件?
Nose吃了argv的第一個參數,因為在命令行上它是程序的名稱。
這適用於:
noseargs = ['foo', '--with-xunit', '--xunit-file=output.xml', '--tests=mytest']
nose.run(argv=noseargs)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.