class WidgetTestCase(unittest.TestCase): def setUp(self): pass def tearDown(self): pass def test_func(self): self.assertEqual(exp1, exp2) self.assertTrue(exp) self.assertFalse(exp) with self.assertRaises(ExcepType) exp if __name__ == "__main__": unittest.main() def suite(): suite = unittest.TestSuite() suite.addTest(WidgetTestCase('test_func')) return suite if __name__ == '__main__': runner = unittest.TextTestRunner() runner.run(suite()) class TMTest(unittest.TestCase): def setUp(self): pass def tearDown(self): unittest.TestCase.tearDown(self) @classmethod def setUpClass(cls): super(TMTest, cls).setUpClass() @classmethod def tearDownClass(cls): super(TMTest, cls).tearDownClass() if __name__ == "__main__": unittest.main() if __name__ == "__main__": suite = unittest.TestSuite() suite.addTest(TMTest("test_delete_failed_when_tenant_bound_node")) unittest.TextTestRunner().run(suite) if __name__ == "__main__": test_case_dir = os.path.dirname(__file__) suite = unittest.TestLoader().discover(test_case_dir, 'tm_test.py') unittest.TextTestRunner(verbosity=2).run(suite) def test_all(): suite = unittest.TestLoader().loadTestsFromTestCase(TestUpgradeAppGroup) unittest.TextTestRunner(verbosity=0).run(suite) def test_one_case(case_name): suite = unittest.TestSuite() suite.addTest(TestUpgradeAppGroup(case_name)) runner = unittest.TextTestRunner() runner.run(suite)
转载于:https://www.cnblogs.com/wenlin-gk/p/9512556.html
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/101475.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...