Skip to content

Commit

Permalink
Disable migrations when running tests
Browse files Browse the repository at this point in the history
They make test runs really slow. This fix uses a cheeky gist to avoid
running migrations for any apps:
https://gist.github.com/NotSqrt/5f3c76cd15e40ef62d09
  • Loading branch information
codeinthehole committed Dec 23, 2014
1 parent 6b16097 commit 5ab6ea6
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions tests/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,19 @@
import os
import django

from django.conf import settings, global_settings
from django.conf import settings
import oscar


class DisableMigrations(object):

def __contains__(self, item):
return True

def __getitem__(self, item):
return "notmigrations"


def configure():
if not settings.configured:
from oscar.defaults import OSCAR_SETTINGS
Expand All @@ -27,7 +36,7 @@ def configure():
'django.contrib.admin',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.sites',
'django.contrib.flatpages',
'django.contrib.staticfiles',
'compressor',
Expand Down Expand Up @@ -108,6 +117,8 @@ def configure():
# warning regarding a changed default test runner. The Oscar test
# suite is run with nose, so it does not matter.
'SILENCED_SYSTEM_CHECKS': ['1_6.W001'],

'MIGRATION_MODULES': DisableMigrations(),
})

settings.configure(**test_settings)
Expand Down

0 comments on commit 5ab6ea6

Please sign in to comment.