Skip to content

Commit c3fb645

Browse files
committed
Updated the mechanism to disable iteration trough all migrations when setting up test databases.
- Legacy-Id: 14671
1 parent e859a55 commit c3fb645

2 files changed

Lines changed: 3 additions & 17 deletions

File tree

ietf/settings_releasetest.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,13 @@
1111
# the test database instead of doing it through the migrations. Taken from
1212
# https://gist.github.com/NotSqrt/5f3c76cd15e40ef62d09
1313

14-
## To be removed after upgrade to Django 1.8 ##
15-
1614
class DisableMigrations(object):
1715

1816
def __contains__(self, item):
1917
return True
2018

2119
def __getitem__(self, item):
22-
# The string below is significant. It has to include the value of
23-
# django.db.migrations.loader.MIGRATIONS_MODULE_NAME. Used by django
24-
# 1.7 code in django.db.migrations.loader.MigrationLoader to
25-
# determine whether or not to run migrations for a given module
26-
from django.db.migrations.loader import MIGRATIONS_MODULE_NAME
27-
return "no " + MIGRATIONS_MODULE_NAME
20+
return None
2821

2922
MIGRATION_MODULES = DisableMigrations()
3023

ietf/settings_sqlitetest.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,17 @@
1515
# the test database instead of doing it through the migrations. Taken from
1616
# https://gist.github.com/NotSqrt/5f3c76cd15e40ef62d09
1717

18-
## To be removed after upgrade to Django 1.8 ##
19-
2018
class DisableMigrations(object):
2119

2220
def __contains__(self, item):
2321
return True
2422

2523
def __getitem__(self, item):
26-
from django.db.migrations.loader import MIGRATIONS_MODULE_NAME
27-
# The string below is significant. It has to include the value of
28-
# django.db.migrations.loader.MIGRATIONS_MODULE_NAME. Used by django
29-
# 1.7 code in django.db.migrations.loader.MigrationLoader to
30-
# determine whether or not to run migrations for a given module.
31-
# By returning a non-existent path, we ignore migrations.
32-
return "no_" + MIGRATIONS_MODULE_NAME
24+
return None
3325

3426
MIGRATION_MODULES = DisableMigrations()
3527

28+
3629
DATABASES = {
3730
'default': {
3831
'NAME': 'test.db',

0 commit comments

Comments
 (0)