Turn some print off in python unittest

前端 未结 2 1226
你的背包
你的背包 2021-02-15 21:59

Im using unittest and it prints \".\", \"E\" or \"F\" for \"ok\", \"error\" and \"fail\" after each test it does. How do I switch it off ? Im using Python 2.7 and these print co

2条回答
  •  爱一瞬间的悲伤
    2021-02-15 22:14

    A bit late response, but someone may find it useful. You can turn . E and F off by setting verbosity level to 0:

    testRunner = unittest.TextTestRunner( verbosity = 0 )
    

    You will still have the final result and possible errors/exceptions at the end of tests in the stderr.

    Tested in Python 2.4 and 2.7.

提交回复
热议问题