[Python-modules-commits] [django-polymorphic] 01/05: Add separate test configuration for Django 1.10.

Michael Fladischer fladi at moszumanska.debian.org
Sun Aug 21 11:24:29 UTC 2016


This is an automated email from the git hooks/post-receive script.

fladi pushed a commit to branch master
in repository django-polymorphic.

commit 661f9712cac2ca128abd892cf10c3c37181a6569
Author: Michael Fladischer <FladischerMichael at fladi.at>
Date:   Fri Aug 12 13:10:53 2016 +0200

    Add separate test configuration for Django 1.10.
    
    This is necessary because TEMPLATES configuration is now mandatory.
---
 runtests.py | 103 ++++++++++++++++++++++++++++++++++++++++++------------------
 1 file changed, 72 insertions(+), 31 deletions(-)

diff --git a/runtests.py b/runtests.py
index f9517d2..680cfb9 100755
--- a/runtests.py
+++ b/runtests.py
@@ -18,37 +18,78 @@ sys.stderr.write('Using Django version {0} from {1}\n'.format(
 )
 
 if not settings.configured:
-    settings.configure(
-        DEBUG=True,
-        TEMPLATE_DEBUG=True,
-        DATABASES={
-            'default': {
-                'ENGINE': 'django.db.backends.sqlite3',
-                'NAME': ':memory:'
-            }
-        },
-        TEMPLATE_LOADERS=(
-            'django.template.loaders.app_directories.Loader',
-        ),
-        TEMPLATE_CONTEXT_PROCESSORS=(
-            # list() is only needed for older versions of django where this is
-            # a tuple:
-            list(default_settings.TEMPLATE_CONTEXT_PROCESSORS) + [
-                'django.core.context_processors.request',
-            ]
-        ),
-        TEST_RUNNER = 'django.test.runner.DiscoverRunner' if django.VERSION >= (1, 7) else 'django.test.simple.DjangoTestSuiteRunner',
-        INSTALLED_APPS = (
-            'django.contrib.auth',
-            'django.contrib.contenttypes',
-            'django.contrib.messages',
-            'django.contrib.sites',
-            'django.contrib.admin',
-            'polymorphic',
-        ),
-        MIDDLEWARE_CLASSES = (),
-        SITE_ID = 3,
-    )
+    if django.VERSION < (1, 10):
+        settings.configure(
+            DEBUG=True,
+            TEMPLATE_DEBUG=True,
+            DATABASES={
+                'default': {
+                    'ENGINE': 'django.db.backends.sqlite3',
+                    'NAME': ':memory:'
+                }
+            },
+            TEMPLATE_LOADERS=(
+                'django.template.loaders.app_directories.Loader',
+            ),
+            TEMPLATE_CONTEXT_PROCESSORS=(
+                # list() is only needed for older versions of django where this is
+                # a tuple:
+                list(default_settings.TEMPLATE_CONTEXT_PROCESSORS) + [
+                    'django.core.context_processors.request',
+                ]
+            ),
+            TEST_RUNNER = 'django.test.runner.DiscoverRunner' if django.VERSION >= (1, 7) else 'django.test.simple.DjangoTestSuiteRunner',
+            INSTALLED_APPS = (
+                'django.contrib.auth',
+                'django.contrib.contenttypes',
+                'django.contrib.messages',
+                'django.contrib.sites',
+                'django.contrib.admin',
+                'polymorphic',
+            ),
+            MIDDLEWARE_CLASSES = (),
+            SITE_ID = 3,
+        )
+    else:
+        settings.configure(
+            DEBUG=True,
+            DATABASES={
+                'default': {
+                    'ENGINE': 'django.db.backends.sqlite3',
+                    'NAME': ':memory:'
+                }
+            },
+            TEST_RUNNER = 'django.test.runner.DiscoverRunner',
+            INSTALLED_APPS = (
+                'django.contrib.auth',
+                'django.contrib.contenttypes',
+                'django.contrib.messages',
+                'django.contrib.sites',
+                'django.contrib.admin',
+                'polymorphic',
+            ),
+            MIDDLEWARE_CLASSES = (),
+            SITE_ID = 3,
+            TEMPLATES = [
+                {
+                    'BACKEND': 'django.template.backends.django.DjangoTemplates',
+                    'DIRS': [],
+                    'APP_DIRS': True,
+                    'OPTIONS': {
+                        'context_processors': [
+                            'django.contrib.auth.context_processors.auth',
+                            'django.template.context_processors.debug',
+                            'django.template.context_processors.i18n',
+                            'django.template.context_processors.media',
+                            'django.template.context_processors.static',
+                            'django.template.context_processors.tz',
+                            'django.template.context_processors.request',
+                            'django.contrib.messages.context_processors.messages',
+                        ],
+                    },
+                },
+            ],
+        )
 
 DEFAULT_TEST_APPS = [
     'polymorphic',

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/django-polymorphic.git



More information about the Python-modules-commits mailing list