Issue 8948. cleanup functions are not run by unittest.TestCase.debug(), plus class and module teardowns are not run by unittest.TestSuite.debug().
diff --git a/Lib/unittest/case.py b/Lib/unittest/case.py
index 8341b88..b609caf 100644
--- a/Lib/unittest/case.py
+++ b/Lib/unittest/case.py
@@ -380,6 +380,9 @@
self.setUp()
getattr(self, self._testMethodName)()
self.tearDown()
+ while self._cleanups:
+ function, args, kwargs = self._cleanups.pop(-1)
+ function(*args, **kwargs)
def skipTest(self, reason):
"""Skip this test."""