Fixed #16372 -- Changed strategy implemented in r16369 to fix #14049 to avoid affecting the statistics of test cases ran/skipped kept by unittest. Thanks zimnyx for the report.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16579 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Ramiro Morales 2011-08-02 22:30:26 +00:00
parent 290d7d4d21
commit cb1f413e4a
1 changed files with 19 additions and 20 deletions

View File

@ -283,28 +283,27 @@ class TransactionTestCase(ut2.TestCase):
include a call to super().setUp(). include a call to super().setUp().
""" """
testMethod = getattr(self, self._testMethodName) testMethod = getattr(self, self._testMethodName)
if (getattr(self.__class__, "__unittest_skip__", False) or skipped = (getattr(self.__class__, "__unittest_skip__", False) or
getattr(testMethod, "__unittest_skip__", False)): getattr(testMethod, "__unittest_skip__", False))
return
self.client = self.client_class() if not skipped:
try: self.client = self.client_class()
self._pre_setup() try:
except (KeyboardInterrupt, SystemExit): self._pre_setup()
raise except (KeyboardInterrupt, SystemExit):
except Exception: raise
import sys except Exception:
result.addError(self, sys.exc_info()) result.addError(self, sys.exc_info())
return return
super(TransactionTestCase, self).__call__(result) super(TransactionTestCase, self).__call__(result)
try: if not skipped:
self._post_teardown() try:
except (KeyboardInterrupt, SystemExit): self._post_teardown()
raise except (KeyboardInterrupt, SystemExit):
except Exception: raise
import sys except Exception:
result.addError(self, sys.exc_info()) result.addError(self, sys.exc_info())
return return
def _post_teardown(self): def _post_teardown(self):
""" Performs any post-test things. This includes: """ Performs any post-test things. This includes: