summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRamiro Morales <cramm0@gmail.com>2011-08-02 22:30:26 +0000
committerRamiro Morales <cramm0@gmail.com>2011-08-02 22:30:26 +0000
commitcb1f413e4a154b3c5d308d3625d707685d79f912 (patch)
tree383b5014cad95a3e3f17982c9fca22ad513cd29f
parent290d7d4d21692336aeb074917acbf9804275fbdd (diff)
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
-rw-r--r--django/test/testcases.py39
1 files changed, 19 insertions, 20 deletions
diff --git a/django/test/testcases.py b/django/test/testcases.py
index 4b19dfdbf2..5a06e3f634 100644
--- a/django/test/testcases.py
+++ b/django/test/testcases.py
@@ -283,28 +283,27 @@ class TransactionTestCase(ut2.TestCase):
include a call to super().setUp().
"""
testMethod = getattr(self, self._testMethodName)
- if (getattr(self.__class__, "__unittest_skip__", False) or
- getattr(testMethod, "__unittest_skip__", False)):
- return
+ skipped = (getattr(self.__class__, "__unittest_skip__", False) or
+ getattr(testMethod, "__unittest_skip__", False))
- self.client = self.client_class()
- try:
- self._pre_setup()
- except (KeyboardInterrupt, SystemExit):
- raise
- except Exception:
- import sys
- result.addError(self, sys.exc_info())
- return
+ if not skipped:
+ self.client = self.client_class()
+ try:
+ self._pre_setup()
+ except (KeyboardInterrupt, SystemExit):
+ raise
+ except Exception:
+ result.addError(self, sys.exc_info())
+ return
super(TransactionTestCase, self).__call__(result)
- try:
- self._post_teardown()
- except (KeyboardInterrupt, SystemExit):
- raise
- except Exception:
- import sys
- result.addError(self, sys.exc_info())
- return
+ if not skipped:
+ try:
+ self._post_teardown()
+ except (KeyboardInterrupt, SystemExit):
+ raise
+ except Exception:
+ result.addError(self, sys.exc_info())
+ return
def _post_teardown(self):
""" Performs any post-test things. This includes: