I've got Django 1.4. In my test.py, I've got the requisite TestCase import:
from django.test import TestCase
To isolate the issue, I've added the line:
fixtures = ['westeros']
to the default example test case, i.e.
class SimpleTest(TestCase):
fixtures = ['westeros']
def test_basic_addition(self):
"""
Tests that 1 + 1 always equals 2.
"""
self.assertEqual(1 + 1, 2)
Using django-admin.py dumpdata, I created a fixture file called "westeros" in my customers/fixtures directory, where "customers" is an app that is listed in settings.INSTALLED_APPS.
When I run the test, at any verbosity, Django simply ignores the fixture and passes the test_basic_addition
test. No error, no fixture loading. It's as if the TestCase import isn't there. Any ideas on what could be wrong or how to debug this?
It's ok to omit the extension when defining fixtures
as you have done, i.e.
fixtures = ['westeros']
However, the fixture file itself must have the extension that corresponds to its serializer e.g westeros.json
, westeros.json.zip
or westeros.xml
for json, zipped json or xml respectively.