为什么teardown函数里的代码没有执行?关于pyunit

为什么teardown函数里的代码没有执行?关于pyunit

被测试代码:Hello.py
#!/usr/bin/env python

def hello():
    return "test message"

测试用例:TestCase.py
#!/usr/bin/env python

import unittest
from Hello import *

class HelloTest(unittest.TestCase):
    def setUp(self):
        print "i am set up"
    def testHello(self):
        self.assertEquals(hello(),"test message")
        print "i am testHello"
    def teardown(self):
        print "i am teardown"

测试套件:
#!/usr/bin/env python

import unittest
from HelloTest import testHello

def suite():   
    suite1=unittest.TestSuite()
    suite1.addTest(HelloTest(testHello))
    return suite1

if __name__ == '__main__':
    unittest.main()

运行结果是:
i am set up
i am testHello2
.
----------------------------------------------------------------------
Ran 1 test in 0.000s

OK
根据pyunit文档中的描述:If setUp succeeded, the tearDown method will be run regardless of whether or not runTest succeeded.
http://pyunit.sourceforge.net/pyunit.html
teardown()的代码应该执行才对啊
谢谢大家先!

知道原因了,tearDown,写成了teardown.哎。