Skip to content

Commit

Permalink
Fixed #16372 -- Changed strategy implemented in r16369 to fix #14049
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
ramiro committed Aug 2, 2011
1 parent 290d7d4 commit cb1f413
Showing 1 changed file with 20 additions and 21 deletions.
41 changes: 20 additions & 21 deletions django/test/testcases.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -283,28 +283,27 @@ def __call__(self, result=None):
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

if not skipped:
self.client = self.client_class() self.client = self.client_class()
try: try:
self._pre_setup() self._pre_setup()
except (KeyboardInterrupt, SystemExit): except (KeyboardInterrupt, SystemExit):
raise raise
except Exception: except Exception:
import sys 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:
Expand Down

0 comments on commit cb1f413

Please sign in to comment.