Django 1.7 introduced database migrations.
When running the unit tests in Django 1.7, it forces a migrate, that takes a long time. So I woul
I just figure out how to disable migrations after django 1.10,may be it could help for somebody. Here is link at git
class DisableMigrations(dict):
def __contains__(self, item):
return True
def __getitem__(self, item):
return None
DATABASES = DisableMigrations()
MIGRATION_MODULES = DisableMigrations()
Migrations for django 1.10 has two part,please look at load_disk and recorder
The part of load_disk
for migrations model of app that be added at INSTALL_APP
And the part of recorder
for database connection
For the version before 1.9 we need set MIGRATION_MODULES={'do.not.migrate':'notmigrations'}
when you are running test
Now we need set it None like MIGRATION_MODULES={'do.not.migrate':None}
So if we do not want make migrations for any app, just extend a dict and return None
for getitem
function , and do the same at DATABASES
, that is the right thing you need to do
PS: For command, you need to specify --setting=module.path.settings_test_snippet
after test
PPS If you are working with pycharm
,do not set --settings
options at Run/Debug configurations
, just add path of settings_test_snippet.py
at Custom setting. That just be fine!!
enjoy