summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2008-01-18 13:37:40 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2008-01-18 13:37:40 +0000
commit12efef06357544ee81a3731899f528e9b867792a (patch)
tree3de37845a2bb3849115f8d134721abd79af4178c
parentfd20365b277bf48dbdbd82afa1346eadb96d9574 (diff)
Fixed #6031 -- Added error handling for _pre_test in django.test.TestCase; 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
-rw-r--r--django/test/testcases.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/django/test/testcases.py b/django/test/testcases.py
index 1d65ee1d23..5b5c6f67ec 100644
--- a/django/test/testcases.py
+++ b/django/test/testcases.py
@@ -70,7 +70,12 @@ class TestCase(unittest.TestCase):
include a call to super().setUp().
"""
self.client = Client()
- self._pre_setup()
+ try:
+ self._pre_setup()
+ except Exception:
+ import sys
+ result.addError(self, sys.exc_info())
+ return
super(TestCase, self).__call__(result)
def assertRedirects(self, response, expected_url, status_code=302,