summaryrefslogtreecommitdiffstats
path: root/Lib/unittest/test/test_runner.py
diff options
context:
space:
mode:
authorMichael Foord <fuzzyman@voidspace.org.uk>2010-06-10 16:16:08 (GMT)
committerMichael Foord <fuzzyman@voidspace.org.uk>2010-06-10 16:16:08 (GMT)
commitb8748741945beb03ccb6bcf59b08f590109cb21b (patch)
tree36ceae277408765488c67d107449a5117593c836 /Lib/unittest/test/test_runner.py
parentc73013127b2791476ade69d36b69736b9caa674c (diff)
downloadcpython-b8748741945beb03ccb6bcf59b08f590109cb21b.zip
cpython-b8748741945beb03ccb6bcf59b08f590109cb21b.tar.gz
cpython-b8748741945beb03ccb6bcf59b08f590109cb21b.tar.bz2
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(). ........
Diffstat (limited to 'Lib/unittest/test/test_runner.py')
-rw-r--r--Lib/unittest/test/test_runner.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/Lib/unittest/test/test_runner.py b/Lib/unittest/test/test_runner.py
index a7bd1a3..25f7541 100644
--- a/Lib/unittest/test/test_runner.py
+++ b/Lib/unittest/test/test_runner.py
@@ -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."""