Look at this workaround, posted by Bernie Sumption to the Django developers mailing list:
If makemigrations has not yet been run, the “migrate” command treats
an app as unmigrated, and creates tables directly from the models just
like syncdb did in 1.6. I defined a new settings module just for unit
tests called “settings_test.py”, which imports * from the main
settings module and adds this line:MIGRATION_MODULES = {“myapp”: “myapp.migrations_not_used_in_tests”}
Then I run tests like this:
DJANGO_SETTINGS_MODULE=”myapp.settings_test” python manage.py test
This fools migrate into thinking that the app is unmigrated, and so
every time a test database is created it reflects the current
structure of models.py.
In Django 1.9, this situation is improved somewhat, and you can set the value to None
:
MIGRATION_MODULES = {“myapp”: None}