diff --git a/common/lib/conftest.py b/common/lib/conftest.py deleted file mode 100644 index 0295dabcc80cd75fdbcae4d2632be82d4fb300b1..0000000000000000000000000000000000000000 --- a/common/lib/conftest.py +++ /dev/null @@ -1,8 +0,0 @@ -from django.conf import settings - - -def pytest_configure(): - """ - Use Django's default settings for tests in common/lib. - """ - settings.configure() diff --git a/common/lib/pytest.ini b/common/lib/pytest.ini index bcdab5935157ab72b5522ec3375740f9cf3f2ec7..349b1dff15e80dd7e0b48e86ebe93a125cf50f1e 100644 --- a/common/lib/pytest.ini +++ b/common/lib/pytest.ini @@ -1,4 +1,5 @@ [pytest] +DJANGO_SETTINGS_MODULE = openedx.tests.settings addopts = --nomigrations --reuse-db --durations=20 norecursedirs = .cache python_classes = diff --git a/common/lib/xmodule/xmodule/tests/test_services.py b/common/lib/xmodule/xmodule/tests/test_services.py index 16a25d4d6f285a2651c178eb2ec293c4ec25ad05..01f8416e8a41b80ac946691abe2335e02fde665e 100644 --- a/common/lib/xmodule/xmodule/tests/test_services.py +++ b/common/lib/xmodule/xmodule/tests/test_services.py @@ -23,7 +23,8 @@ class DummyConfig(ConfigurationModel): """ Dummy Configuration """ - pass + class Meta: + app_label = 'xmoduletestservices' class DummyUnexpected(object): diff --git a/openedx/tests/settings.py b/openedx/tests/settings.py new file mode 100644 index 0000000000000000000000000000000000000000..5ff68cf9906b55276365378397ae47d4d2b8791b --- /dev/null +++ b/openedx/tests/settings.py @@ -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 diff --git a/tox.ini b/tox.ini index 5813105837821198410e336cff65203f81c98c43..7712615aad9ee94f7e830f3bb58b03a74127c332 100644 --- a/tox.ini +++ b/tox.ini @@ -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