[英]nose2.main() verbose output
I'm writing a separate nose2 tests.py for my program and because I want it to run on both Windows and Linux fairly seamlessly I've decided to forgo using the normal commandline nose2 and instead import it in the file and run it from there. 我为我的程序编写了一个单独的nas22.py,因为我希望它可以在Windows和Linux上无缝运行,所以我决定放弃使用常规命令行nas2,而是将其导入文件并从那里运行。
if __name__ == '__main__':
import nose2
nose2.main()
This works fine, no problems. 这工作正常,没有问题。 But I'd like the verbose output and I can't see how to get it to do this.
但是我想要详细的输出,但是我看不到如何获得它来执行此操作。 I've tried:
我试过了:
nose2.main("-v")
nose2.main(kwargs="-v")
nose2.main(args="-v")
Anyone know how to get the imported version of nose2 to run in verbose mode? 有人知道如何使导入的nas2版本在详细模式下运行吗?
Since the PluggableTestProgram
class accepts the same parameters of unittest.TestProgram
, you can pass verbosity
to the main
function as such: 由于
PluggableTestProgram
类接受与 unittest.TestProgram
相同的参数 ,因此可以将verbosity
传递给main
函数,如下所示:
nose2.main(verbosity=2) # default is 1
See: Unittest.main
documentation about verbosity 请参阅: 有关详细程度的
Unittest.main
文档
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.