[英]How to increase verbosity in python unittest?
I have a test case class
like this one: 我有一个像这样的测试用例
class
:
import unittest
import sys
class Test(unittest.TestCase):
def test_a(self):
pass
def test_b(self):
pass
# etc
if __name__ == "__main__":
unittest.main(verbosity=2)
This is a file in eclipse using PyDev. 这是使用PyDev的eclipse文件。 I run it as unittest .
我把它作为unittest运行。 Somehow the verbosity option does not trigger.
不知何故,详细程度选项不会触发。 There are no errors.
没有错误。 What do I miss?
我错过了什么?
I figured out, that the Answer is in the eclipse configuration and not in the source code. 我想通了,答案是在eclipse配置中,而不是在源代码中。
Open Preferences -> PyDev -> PyUnit and adjust the Parameters for test runner field. 打开首选项 - > PyDev - > PyUnit并调整测试运行器字段的参数 。 change
--verbosity0
to --verbosity2
or whatever number you like. 将
--verbosity0
更改为--verbosity2
或您喜欢的任何数字。
Unfortunately I don't know, how high you can set this.
不幸的是我不知道,你可以设置多高。
As @Jace pointed out in the comments the verbosity-levels range from --verbosity0
to --verbosity9
. 正如@Jace在评论中指出的那样,冗长级别从
--verbosity0
到--verbosity9
。
Set the verbosity=0
(or 1 up to 2 ) in the Parameters for test runner
field of pyUnit
windows preference in Eclipse. 在Eclipse中的
pyUnit
窗口首选项的Parameters for test runner
字段中设置verbosity=0
(或1到2)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.