summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--django/test/testcases.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/django/test/testcases.py b/django/test/testcases.py
index 6fe6b9c397..6f8cbabd86 100644
--- a/django/test/testcases.py
+++ b/django/test/testcases.py
@@ -843,13 +843,17 @@ class TestCase(TransactionTestCase):
for db in self._databases_names(include_mirrors=False):
if hasattr(self, 'fixtures'):
- call_command('loaddata', *self.fixtures,
- **{
- 'verbosity': 0,
- 'commit': False,
- 'database': db,
- 'skip_validation': True,
- })
+ try:
+ call_command('loaddata', *self.fixtures,
+ **{
+ 'verbosity': 0,
+ 'commit': False,
+ 'database': db,
+ 'skip_validation': True,
+ })
+ except Exception:
+ self._fixture_teardown()
+ raise
def _fixture_teardown(self):
if not connections_support_transactions():