diff --git a/tests/requirements.txt b/tests/requirements.txt index 6112d46..ef0ba9e 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,3 +1,2 @@ flake8 -coverage==4.2 -django-discover-runner \ No newline at end of file +coverage==4.2 \ No newline at end of file diff --git a/tests/settings.py b/tests/settings.py index 471b8fe..51316ce 100644 --- a/tests/settings.py +++ b/tests/settings.py @@ -1,7 +1,5 @@ import os -import django -VERSION = django.VERSION SETTINGS_DIR = os.path.dirname(__file__) DATABASE_ENGINE = 'sqlite3' @@ -21,6 +19,7 @@ INSTALLED_APPS = [ 'avatar', ] +# Django 1.9 MIDDLEWARE_CLASSES = ( "django.middleware.common.CommonMiddleware", "django.contrib.sessions.middleware.SessionMiddleware", @@ -29,20 +28,24 @@ MIDDLEWARE_CLASSES = ( "django.contrib.messages.middleware.MessageMiddleware", ) -if VERSION[0] == 1 and VERSION[1] < 8: - TEMPLATE_DIRS = ( - os.path.join(SETTINGS_DIR, 'templates'), - ) -else: - TEMPLATES = [ - { - 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'APP_DIRS': True, - 'DIRS': [ - os.path.join(SETTINGS_DIR, 'templates') - ] - } - ] +# Django 1.10+ +MIDDLEWARE = ( + "django.middleware.common.CommonMiddleware", + "django.contrib.sessions.middleware.SessionMiddleware", + "django.middleware.csrf.CsrfViewMiddleware", + "django.contrib.auth.middleware.AuthenticationMiddleware", + "django.contrib.messages.middleware.MessageMiddleware", +) + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'APP_DIRS': True, + 'DIRS': [ + os.path.join(SETTINGS_DIR, 'templates') + ] + } +] ROOT_URLCONF = 'tests.urls' @@ -50,9 +53,6 @@ SITE_ID = 1 SECRET_KEY = 'something-something' -if django.VERSION[:2] < (1, 6): - TEST_RUNNER = 'discover_runner.DiscoverRunner' - ROOT_URLCONF = 'tests.urls' STATIC_URL = '/site_media/static/'