mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Merged revisions 81853 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r81853 | michael.foord | 2010-06-08 23:44:52 +0100 (Tue, 08 Jun 2010) | 1 line Issue 8948. cleanup functions are not run by unittest.TestCase.debug(), plus class and module teardowns are not run by unittest.TestSuite.debug(). ........
This commit is contained in:
parent
c73013127b
commit
b874874194
4 changed files with 116 additions and 2 deletions
|
@ -110,6 +110,31 @@ class TestCleanUp(unittest.TestCase):
|
|||
test.run(result)
|
||||
self.assertEqual(ordering, ['setUp', 'cleanup1'])
|
||||
|
||||
def testTestCaseDebugExecutesCleanups(self):
|
||||
ordering = []
|
||||
|
||||
class TestableTest(unittest.TestCase):
|
||||
def setUp(self):
|
||||
ordering.append('setUp')
|
||||
self.addCleanup(cleanup1)
|
||||
|
||||
def testNothing(self):
|
||||
ordering.append('test')
|
||||
|
||||
def tearDown(self):
|
||||
ordering.append('tearDown')
|
||||
|
||||
test = TestableTest('testNothing')
|
||||
|
||||
def cleanup1():
|
||||
ordering.append('cleanup1')
|
||||
test.addCleanup(cleanup2)
|
||||
def cleanup2():
|
||||
ordering.append('cleanup2')
|
||||
|
||||
test.debug()
|
||||
self.assertEqual(ordering, ['setUp', 'test', 'tearDown', 'cleanup1', 'cleanup2'])
|
||||
|
||||
|
||||
class Test_TextTestRunner(unittest.TestCase):
|
||||
"""Tests for TextTestRunner."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue