Fixes for common/lib tests in Django 1.9+

This commit is contained in:
Jeremy Bowman
2017-11-15 11:00:39 -05:00
parent 68890dabf3
commit d6dc209569
5 changed files with 39 additions and 10 deletions

View File

@@ -1,8 +0,0 @@
from django.conf import settings
def pytest_configure():
"""
Use Django's default settings for tests in common/lib.
"""
settings.configure()

View File

@@ -1,4 +1,5 @@
[pytest]
DJANGO_SETTINGS_MODULE = openedx.tests.settings
addopts = --nomigrations --reuse-db --durations=20
norecursedirs = .cache
python_classes =

View File

@@ -23,7 +23,8 @@ class DummyConfig(ConfigurationModel):
"""
Dummy Configuration
"""
pass
class Meta:
app_label = 'xmoduletestservices'
class DummyUnexpected(object):

33
openedx/tests/settings.py Normal file
View File

@@ -0,0 +1,33 @@
"""
Minimal Django settings for tests of common/lib.
Required in Django 1.9+ due to imports of models in stock Django apps.
"""
from __future__ import absolute_import, unicode_literals
import tempfile
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'default.db',
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': '',
}
}
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'openedx.core.djangoapps.video_config',
'edxval',
)
MEDIA_ROOT = tempfile.mkdtemp()
SECRET_KEY = 'insecure-secret-key'
USE_TZ = True

View File

@@ -1,5 +1,5 @@
[tox]
envlist = py27-django{18,111}
envlist = py27-django{18,19,110,111}
[testenv]
setenv =
@@ -9,6 +9,8 @@ passenv =
EDXAPP_TEST_MONGO_HOST
deps =
django18: Django>=1.8,<1.9
django19: Django>=1.9,<1.10
django110: Django>=1.10,<1.11
django111: Django>=1.11,<2
-rrequirements/edx/pre.txt
-rrequirements/edx/github.txt