Merge pull request #11603 from edx/usman/migrations-setup

Update migrations setup during Python unit tests
This commit is contained in:
Renzo Lucioni
2016-02-29 13:54:30 -05:00
6 changed files with 76 additions and 8 deletions

View File

@@ -24,6 +24,7 @@ from path import Path as path
from uuid import uuid4
from warnings import filterwarnings, simplefilter
from util.db import NoOpMigrationModules
from openedx.core.lib.tempdir import mkdtemp_clean
# This patch disables the commit_on_success decorator during tests
@@ -86,7 +87,7 @@ PARENTAL_CONSENT_AGE_LIMIT = 13
SOUTH_TESTS_MIGRATE = False # To disable migrations and use syncdb instead
# Nose Test Runner
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
TEST_RUNNER = 'openedx.core.djangolib.nose.NoseTestSuiteRunner'
_SYSTEM = 'lms'
@@ -188,9 +189,10 @@ DATABASES = {
}
# This hack disables migrations during tests. We want to create tables directly from the models for speed.
# See https://groups.google.com/d/msg/django-developers/PWPj3etj3-U/kCl6pMsQYYoJ.
MIGRATION_MODULES = {app: "app.migrations_not_used_in_tests" for app in INSTALLED_APPS}
if os.environ.get('DISABLE_MIGRATIONS'):
# Create tables directly from apps' models. This can be removed once we upgrade
# to Django 1.9, which allows setting MIGRATION_MODULES to None in order to skip migrations.
MIGRATION_MODULES = NoOpMigrationModules()
CACHES = {
# This is the cache used for most things.