1.
if __name__ == '__main__': unittest.main()
2.
测试用例实例根据测试的特点分组在一起。 unittest
为此提供了一个机制:测试套件由unittest
's TestSuite
class
widgetTestSuite = unittest 。TestSuite ()
widgetTestSuite 。addTest (WidgetTestCase ('test_default_size' ))
widgetTestSuite 。addTest (WidgetTestCase ('test_resize' ))
runner = unittest.TextTestRunner()
runner.run(suite)