Author: ramiro
Date: 2011-08-02 15:30:26 -0700 (Tue, 02 Aug 2011)
New Revision: 16579

Modified:
   django/trunk/django/test/testcases.py
Log:
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.

Modified: django/trunk/django/test/testcases.py
===================================================================
--- django/trunk/django/test/testcases.py       2011-08-01 23:38:11 UTC (rev 
16578)
+++ django/trunk/django/test/testcases.py       2011-08-02 22:30:26 UTC (rev 
16579)
@@ -283,28 +283,27 @@
         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:

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to