Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #6031 -- Added error handling for _pre_test in django.test.Test…

…Case; exceptions during pre-test setup are now reported as test failures, rather than crashing the entire test framework. Thanks, Thomas Guttler <hv@tbz-pariv.de>.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@7023 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 12efef06357544ee81a3731899f528e9b867792a 1 parent fd20365
Russell Keith-Magee authored January 18, 2008

Showing 1 changed file with 6 additions and 1 deletion. Show diff stats Hide diff stats

  1. 7  django/test/testcases.py
7  django/test/testcases.py
@@ -70,7 +70,12 @@ def __call__(self, result=None):
70 70
         include a call to super().setUp().
71 71
         """
72 72
         self.client = Client()
73  
-        self._pre_setup()
  73
+        try:
  74
+            self._pre_setup()
  75
+        except Exception:
  76
+            import sys
  77
+            result.addError(self, sys.exc_info())
  78
+            return
74 79
         super(TestCase, self).__call__(result)
75 80
 
76 81
     def assertRedirects(self, response, expected_url, status_code=302,

0 notes on commit 12efef0

Please sign in to comment.
Something went wrong with that request. Please try again.