Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

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 <>.

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent fd20365 commit 12efef06357544ee81a3731899f528e9b867792a @freakboy3742 freakboy3742 committed
Showing with 6 additions and 1 deletion.
  1. +6 −1 django/test/
7 django/test/
@@ -70,7 +70,12 @@ def __call__(self, result=None):
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,

0 comments on commit 12efef0

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