@unittest.skip("i don't want to run this case.")
def test_minus(self):
self.assertEqual(1, minus(3, 2))
输出:
[python] view plain copy
test_add (test_mathfunc.TestMathFunc) ... ok
test_minus (test_mathfunc.TestMathFunc) ... skipped "i don't want to run this case."
test_divide (test_mathfunc.TestMathFunc) ... FAIL
with open('HTMLReport.html', 'w') as f:
runner = HTMLTestRunner(stream=f,
title = 'MathFunc Test Report',
description='generated by HTMLTestRunner.',
verbosity=2
)
runner.run(suite)
执行后,控制台输出如下:
[python] view plain copy
ok test_add (test_mathfunc.TestMathFunc)
F test_divide (test_mathfunc.TestMathFunc)