[3.10] bpo-45238: Fix unittest.IsolatedAsyncioTestCase.debug() (GH-28449) (GH-28521)
It runs now asynchronous methods and callbacks.
If it fails, doCleanups() can be called for cleaning up.
(cherry picked from commit ecb6922ff2d56476a6cfb0941ae55aca5e7fae3d)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
diff --git a/Lib/unittest/case.py b/Lib/unittest/case.py
index b771ce0..607c7ae 100644
--- a/Lib/unittest/case.py
+++ b/Lib/unittest/case.py
@@ -659,12 +659,12 @@ def debug(self):
or getattr(testMethod, '__unittest_skip_why__', ''))
raise SkipTest(skip_why)
- self.setUp()
- testMethod()
- self.tearDown()
+ self._callSetUp()
+ self._callTestMethod(testMethod)
+ self._callTearDown()
while self._cleanups:
- function, args, kwargs = self._cleanups.pop(-1)
- function(*args, **kwargs)
+ function, args, kwargs = self._cleanups.pop()
+ self._callCleanup(function, *args, **kwargs)
def skipTest(self, reason):
"""Skip this test."""