summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorBaptiste Mispelon <bmispelon@gmail.com>2013-09-11 15:20:15 +0200
committerBaptiste Mispelon <bmispelon@gmail.com>2013-09-11 15:28:04 +0200
commitabb10db06fb2ecb3e897462ec72417d10b39b8a4 (patch)
tree6f850ba160ea4e88ce40f4c4ead699dcbd1bbc54 /django
parent170f72136758add6c9c0c59240cfce73d5672cc2 (diff)
Fixed #21089 -- Allow TransactionTestcase subclasses to define an empty list of fixtures.
Thanks to lgs for the report and initial patch.
Diffstat (limited to 'django')
-rw-r--r--django/test/testcases.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/django/test/testcases.py b/django/test/testcases.py
index b90fafaf50..bc73496801 100644
--- a/django/test/testcases.py
+++ b/django/test/testcases.py
@@ -699,6 +699,9 @@ class TransactionTestCase(SimpleTestCase):
# Subclasses can enable only a subset of apps for faster tests
available_apps = None
+ # Subclasses can define fixtures which will be automatically installed.
+ fixtures = None
+
def _pre_setup(self):
"""Performs any pre-test setup. This includes:
@@ -746,7 +749,7 @@ class TransactionTestCase(SimpleTestCase):
if self.reset_sequences:
self._reset_sequences(db_name)
- if hasattr(self, 'fixtures'):
+ if self.fixtures:
# We have to use this slightly awkward syntax due to the fact
# that we're using *args and **kwargs together.
call_command('loaddata', *self.fixtures,
@@ -838,7 +841,7 @@ class TestCase(TransactionTestCase):
disable_transaction_methods()
for db_name in self._databases_names(include_mirrors=False):
- if hasattr(self, 'fixtures'):
+ if self.fixtures:
try:
call_command('loaddata', *self.fixtures,
**{