summaryrefslogtreecommitdiff
path: root/tests/runtests.py
diff options
context:
space:
mode:
authormlavin <markdlavin@gmail.com>2014-04-20 08:58:29 -0400
committerTim Graham <timograham@gmail.com>2014-06-13 12:40:42 -0400
commitd94de802d34c858805a01d3c699799aebc247ec3 (patch)
treee6a99c7b37a052a9ebb6820f59f251357a573c72 /tests/runtests.py
parentd3bf537324c1164dee45070f90d48661b27a781f (diff)
[1.7.x] Fixed #22477 -- Removed contrib middleware from the global settings defaults.
Also added a compatibility check for changed middleware defaults.
Diffstat (limited to 'tests/runtests.py')
-rwxr-xr-xtests/runtests.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/runtests.py b/tests/runtests.py
index a347157f05..53d754be07 100755
--- a/tests/runtests.py
+++ b/tests/runtests.py
@@ -56,6 +56,14 @@ ALWAYS_INSTALLED_APPS = [
'servers.another_app',
]
+ALWAYS_MIDDLEWARE_CLASSES = (
+ 'django.contrib.sessions.middleware.SessionMiddleware',
+ 'django.middleware.common.CommonMiddleware',
+ 'django.middleware.csrf.CsrfViewMiddleware',
+ 'django.contrib.auth.middleware.AuthenticationMiddleware',
+ 'django.contrib.messages.middleware.MessageMiddleware',
+)
+
def get_test_modules():
from django.contrib.gis.tests.utils import HAS_SPATIAL_DB
@@ -107,6 +115,7 @@ def setup(verbosity, test_labels):
'LANGUAGE_CODE': settings.LANGUAGE_CODE,
'STATIC_URL': settings.STATIC_URL,
'STATIC_ROOT': settings.STATIC_ROOT,
+ 'MIDDLEWARE_CLASSES': settings.MIDDLEWARE_CLASSES,
}
# Redirect some settings for the duration of these tests.
@@ -117,6 +126,9 @@ def setup(verbosity, test_labels):
settings.TEMPLATE_DIRS = (os.path.join(RUNTESTS_DIR, TEST_TEMPLATE_DIR),)
settings.LANGUAGE_CODE = 'en'
settings.SITE_ID = 1
+ settings.MIDDLEWARE_CLASSES = ALWAYS_MIDDLEWARE_CLASSES
+ # Ensure the middleware classes are seen as overridden otherwise we get a compatibility warning.
+ settings._explicit_settings.add('MIDDLEWARE_CLASSES')
if verbosity > 0:
# Ensure any warnings captured to logging are piped through a verbose