mirror of https://github.com/django/django.git
Merge pull request #1127 from filias/20142
Fixed #20142 -- Added error handling for fixture setup
This commit is contained in:
commit
5915800deb
|
@ -843,13 +843,17 @@ class TestCase(TransactionTestCase):
|
||||||
|
|
||||||
for db in self._databases_names(include_mirrors=False):
|
for db in self._databases_names(include_mirrors=False):
|
||||||
if hasattr(self, 'fixtures'):
|
if hasattr(self, 'fixtures'):
|
||||||
call_command('loaddata', *self.fixtures,
|
try:
|
||||||
**{
|
call_command('loaddata', *self.fixtures,
|
||||||
'verbosity': 0,
|
**{
|
||||||
'commit': False,
|
'verbosity': 0,
|
||||||
'database': db,
|
'commit': False,
|
||||||
'skip_validation': True,
|
'database': db,
|
||||||
})
|
'skip_validation': True,
|
||||||
|
})
|
||||||
|
except Exception:
|
||||||
|
self._fixture_teardown()
|
||||||
|
raise
|
||||||
|
|
||||||
def _fixture_teardown(self):
|
def _fixture_teardown(self):
|
||||||
if not connections_support_transactions():
|
if not connections_support_transactions():
|
||||||
|
|
Loading…
Reference in New Issue