How to increase verbosity in python unittest?

I have a test case for a class like this:

 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. I run it as unittest. Somehow the verbosity parameter does not start. There are no errors. What am I missing?

+6
source share
2 answers

I realized that the answer is in the eclipse configuration, not in the source code.

Open Settings → PyDev → PyUnit and configure the Parameters field for the test runner . change --verbosity0 to --verbosity2 or whatever number you like. Unfortunately, I do not know how high you can set this.

As @Jace noted in the comments, verbosity levels range from --verbosity0 to --verbosity9 .

+5
source

Set verbosity=0 (or 1 to 2) in the Parameters for test runner field of pyUnit window pyUnit in Eclipse.

Screenshothot reference

0
source

Source: https://habr.com/ru/post/891037/


All Articles