Removed forced settings in runtests

Tests that require USE_I18N, LOGIN_URL or certain MIDDLEWARE_CLASSES
should be decorated appropriately.
This commit is contained in:
Claude Paroz 2013-03-11 16:59:59 +01:00
parent 3f1efc44f6
commit 9b74a8391d
2 changed files with 2 additions and 15 deletions

View File

@ -1,6 +1,6 @@
<html> <html>
<body> <body>
<form method="post" action="."> <form method="post" action=".">{% csrf_token %}
{{ form.as_p }}<br> {{ form.as_p }}<br>
<input id="submit" type="submit"> <input id="submit" type="submit">
</form> </form>

View File

@ -62,14 +62,12 @@ def get_test_modules():
def setup(verbosity, test_labels): def setup(verbosity, test_labels):
from django.conf import settings from django.conf import settings
from django.db.models.loading import get_apps, load_app
state = { state = {
'INSTALLED_APPS': settings.INSTALLED_APPS, 'INSTALLED_APPS': settings.INSTALLED_APPS,
'ROOT_URLCONF': getattr(settings, "ROOT_URLCONF", ""), 'ROOT_URLCONF': getattr(settings, "ROOT_URLCONF", ""),
'TEMPLATE_DIRS': settings.TEMPLATE_DIRS, 'TEMPLATE_DIRS': settings.TEMPLATE_DIRS,
'USE_I18N': settings.USE_I18N,
'LOGIN_URL': settings.LOGIN_URL,
'LANGUAGE_CODE': settings.LANGUAGE_CODE, 'LANGUAGE_CODE': settings.LANGUAGE_CODE,
'MIDDLEWARE_CLASSES': settings.MIDDLEWARE_CLASSES,
'STATIC_URL': settings.STATIC_URL, 'STATIC_URL': settings.STATIC_URL,
'STATIC_ROOT': settings.STATIC_ROOT, 'STATIC_ROOT': settings.STATIC_ROOT,
} }
@ -80,15 +78,7 @@ def setup(verbosity, test_labels):
settings.STATIC_URL = '/static/' settings.STATIC_URL = '/static/'
settings.STATIC_ROOT = os.path.join(TEMP_DIR, 'static') settings.STATIC_ROOT = os.path.join(TEMP_DIR, 'static')
settings.TEMPLATE_DIRS = (os.path.join(RUNTESTS_DIR, TEST_TEMPLATE_DIR),) settings.TEMPLATE_DIRS = (os.path.join(RUNTESTS_DIR, TEST_TEMPLATE_DIR),)
settings.USE_I18N = True
settings.LANGUAGE_CODE = 'en' settings.LANGUAGE_CODE = 'en'
settings.LOGIN_URL = 'django.contrib.auth.views.login'
settings.MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.common.CommonMiddleware',
)
settings.SITE_ID = 1 settings.SITE_ID = 1
# For testing comment-utils, we require the MANAGERS attribute # For testing comment-utils, we require the MANAGERS attribute
# to be set, so that a test email is sent out which we catch # to be set, so that a test email is sent out which we catch
@ -96,9 +86,6 @@ def setup(verbosity, test_labels):
settings.MANAGERS = ("admin@djangoproject.com",) settings.MANAGERS = ("admin@djangoproject.com",)
# Load all the ALWAYS_INSTALLED_APPS. # Load all the ALWAYS_INSTALLED_APPS.
# (This import statement is intentionally delayed until after we
# access settings because of the USE_I18N dependency.)
from django.db.models.loading import get_apps, load_app
get_apps() get_apps()
# Load all the test model apps. # Load all the test model apps.