diff --git a/django/contrib/auth/tests/auth_backends.py b/django/contrib/auth/tests/auth_backends.py
index afef0e7..d203fc8 100644
--- a/django/contrib/auth/tests/auth_backends.py
+++ b/django/contrib/auth/tests/auth_backends.py
@@ -2,26 +2,49 @@ from django.conf import settings
 from django.contrib.auth.models import User, Group, Permission, AnonymousUser
 from django.contrib.contenttypes.models import ContentType
 from django.core.exceptions import ImproperlyConfigured
-from django.test import TestCase
+from django.test import DefaultSettingsTestCase
+from django.test.utils import override_settings
 
 
-class BackendTest(TestCase):
+class CustomBackendTestCase(DefaultSettingsTestCase):
+    def setUp(self):
+        self.settings_override = override_settings(
+            AUTHENTICATION_BACKENDS=(self.backend,)
+        )
+        self.settings_override.enable()
 
-    backend = 'django.contrib.auth.backends.ModelBackend'
+    def tearDown(self):
+        self.settings_override.disable()
+        # Some tests (e.g. custom_perms) mess with ContentTypes, which will
+        # be cached; flush the cache to ensure there are no side effects
+        # Refs #14975, #14925
+        ContentType.objects.clear_cache()
 
+
+class AdditionalBackendTestCase(DefaultSettingsTestCase):
     def setUp(self):
-        self.curr_auth = settings.AUTHENTICATION_BACKENDS
-        settings.AUTHENTICATION_BACKENDS = (self.backend,)
-        User.objects.create_user('test', 'test@example.com', 'test')
-        User.objects.create_superuser('test2', 'test2@example.com', 'test')
+        self.settings_override = override_settings(
+            AUTHENTICATION_BACKENDS = settings.AUTHENTICATION_BACKENDS + (self.backend,)
+        )
+        self.settings_override.enable()
 
     def tearDown(self):
-        settings.AUTHENTICATION_BACKENDS = self.curr_auth
-        # The custom_perms test messes with ContentTypes, which will
+        self.settings_override.disable()
+        # Some tests (e.g. custom_perms) mess with ContentTypes, which will
         # be cached; flush the cache to ensure there are no side effects
         # Refs #14975, #14925
         ContentType.objects.clear_cache()
 
+
+class BackendTest(CustomBackendTestCase):
+
+    backend = 'django.contrib.auth.backends.ModelBackend'
+
+    def setUp(self):
+        super(BackendTest, self).setUp()
+        User.objects.create_user('test', 'test@example.com', 'test')
+        User.objects.create_superuser('test2', 'test2@example.com', 'test')
+
     def test_has_perm(self):
         user = User.objects.get(username='test')
         self.assertEqual(user.has_perm('auth.test'), False)
@@ -154,26 +177,18 @@ class SimpleRowlevelBackend(object):
             return ['none']
 
 
-class RowlevelBackendTest(TestCase):
+class RowlevelBackendTest(AdditionalBackendTestCase):
     """
     Tests for auth backend that supports object level permissions
     """
     backend = 'django.contrib.auth.tests.auth_backends.SimpleRowlevelBackend'
 
     def setUp(self):
-        self.curr_auth = settings.AUTHENTICATION_BACKENDS
-        settings.AUTHENTICATION_BACKENDS = tuple(self.curr_auth) + (self.backend,)
+        super(RowlevelBackendTest, self).setUp()
         self.user1 = User.objects.create_user('test', 'test@example.com', 'test')
         self.user2 = User.objects.create_user('test2', 'test2@example.com', 'test')
         self.user3 = User.objects.create_user('test3', 'test3@example.com', 'test')
 
-    def tearDown(self):
-        settings.AUTHENTICATION_BACKENDS = self.curr_auth
-        # The get_group_permissions test messes with ContentTypes, which will
-        # be cached; flush the cache to ensure there are no side effects
-        # Refs #14975, #14925
-        ContentType.objects.clear_cache()
-
     def test_has_perm(self):
         self.assertEqual(self.user1.has_perm('perm', TestObj()), False)
         self.assertEqual(self.user2.has_perm('perm', TestObj()), True)
@@ -189,7 +204,6 @@ class RowlevelBackendTest(TestCase):
         self.assertEqual(self.user2.get_all_permissions(), set([]))
 
     def test_get_group_permissions(self):
-        content_type=ContentType.objects.get_for_model(Group)
         group = Group.objects.create(name='test_group')
         self.user3.groups.add(group)
         self.assertEqual(self.user3.get_group_permissions(TestObj()), set(['group_perm']))
@@ -199,7 +213,7 @@ class AnonymousUserBackend(SimpleRowlevelBackend):
     supports_inactive_user = False
 
 
-class AnonymousUserBackendTest(TestCase):
+class AnonymousUserBackendTest(CustomBackendTestCase):
     """
     Tests for AnonymousUser delegating to backend.
     """
@@ -207,13 +221,9 @@ class AnonymousUserBackendTest(TestCase):
     backend = 'django.contrib.auth.tests.auth_backends.AnonymousUserBackend'
 
     def setUp(self):
-        self.curr_auth = settings.AUTHENTICATION_BACKENDS
-        settings.AUTHENTICATION_BACKENDS = (self.backend,)
+        super(AnonymousUserBackendTest, self).setUp()
         self.user1 = AnonymousUser()
 
-    def tearDown(self):
-        settings.AUTHENTICATION_BACKENDS = self.curr_auth
-
     def test_has_perm(self):
         self.assertEqual(self.user1.has_perm('perm', TestObj()), False)
         self.assertEqual(self.user1.has_perm('anon', TestObj()), True)
@@ -232,18 +242,14 @@ class AnonymousUserBackendTest(TestCase):
 
 
 
-class NoBackendsTest(TestCase):
+class NoBackendsTest(DefaultSettingsTestCase):
     """
     Tests that an appropriate error is raised if no auth backends are provided.
     """
     def setUp(self):
-        self.old_AUTHENTICATION_BACKENDS = settings.AUTHENTICATION_BACKENDS
-        settings.AUTHENTICATION_BACKENDS = []
         self.user = User.objects.create_user('test', 'test@example.com', 'test')
 
-    def tearDown(self):
-        settings.AUTHENTICATION_BACKENDS = self.old_AUTHENTICATION_BACKENDS
-
+    @override_settings(AUTHENTICATION_BACKENDS=[])
     def test_raises_exception(self):
         self.assertRaises(ImproperlyConfigured, self.user.has_perm, ('perm', TestObj(),))
 
@@ -256,7 +262,7 @@ class NoInActiveUserBackend(SimpleRowlevelBackend):
     supports_inactive_user = False
 
 
-class InActiveUserBackendTest(TestCase):
+class InActiveUserBackendTest(CustomBackendTestCase):
     """
     Tests for a inactive user delegating to backend if it has 'supports_inactive_user' = True
     """
@@ -264,15 +270,11 @@ class InActiveUserBackendTest(TestCase):
     backend = 'django.contrib.auth.tests.auth_backends.InActiveUserBackend'
 
     def setUp(self):
-        self.curr_auth = settings.AUTHENTICATION_BACKENDS
-        settings.AUTHENTICATION_BACKENDS = (self.backend,)
+        super(InActiveUserBackendTest, self).setUp()
         self.user1 = User.objects.create_user('test', 'test@example.com', 'test')
         self.user1.is_active = False
         self.user1.save()
 
-    def tearDown(self):
-        settings.AUTHENTICATION_BACKENDS = self.curr_auth
-
     def test_has_perm(self):
         self.assertEqual(self.user1.has_perm('perm', TestObj()), False)
         self.assertEqual(self.user1.has_perm('inactive', TestObj()), True)
@@ -282,22 +284,18 @@ class InActiveUserBackendTest(TestCase):
         self.assertEqual(self.user1.has_module_perms("app2"), False)
 
 
-class NoInActiveUserBackendTest(TestCase):
+class NoInActiveUserBackendTest(AdditionalBackendTestCase):
     """
     Tests that an inactive user does not delegate to backend if it has 'supports_inactive_user' = False
     """
     backend = 'django.contrib.auth.tests.auth_backends.NoInActiveUserBackend'
 
     def setUp(self):
-        self.curr_auth = settings.AUTHENTICATION_BACKENDS
-        settings.AUTHENTICATION_BACKENDS = tuple(self.curr_auth) + (self.backend,)
+        super(NoInActiveUserBackendTest, self).setUp()
         self.user1 = User.objects.create_user('test', 'test@example.com', 'test')
         self.user1.is_active = False
         self.user1.save()
 
-    def tearDown(self):
-        settings.AUTHENTICATION_BACKENDS = self.curr_auth
-
     def test_has_perm(self):
         self.assertEqual(self.user1.has_perm('perm', TestObj()), False)
         self.assertEqual(self.user1.has_perm('inactive', TestObj()), True)
@@ -305,4 +303,3 @@ class NoInActiveUserBackendTest(TestCase):
     def test_has_module_perms(self):
         self.assertEqual(self.user1.has_module_perms("app1"), False)
         self.assertEqual(self.user1.has_module_perms("app2"), False)
-
diff --git a/django/contrib/auth/tests/basic.py b/django/contrib/auth/tests/basic.py
index 9f94c2a..f44be08 100644
--- a/django/contrib/auth/tests/basic.py
+++ b/django/contrib/auth/tests/basic.py
@@ -1,9 +1,10 @@
-from django.test import TestCase
-from django.utils.unittest import skipUnless
-from django.contrib.auth.models import User, AnonymousUser
+from StringIO import StringIO
+
 from django.contrib.auth import utils
+from django.contrib.auth.models import User, AnonymousUser
 from django.core.management import call_command
-from StringIO import StringIO
+from django.test import DefaultSettingsTestCase
+from django.utils.unittest import skipUnless
 
 try:
     import crypt as crypt_module
@@ -11,7 +12,7 @@ except ImportError:
     crypt_module = None
 
 
-class BasicTestCase(TestCase):
+class BasicTestCase(DefaultSettingsTestCase):
     def test_user(self):
         "Check that users can be created and can set their password"
         u = User.objects.create_user('testuser', 'test@example.com', 'testpw')
@@ -113,7 +114,7 @@ class BasicTestCase(TestCase):
         self.assertFalse(u.has_usable_password())
 
 
-class PasswordUtilsTestCase(TestCase):
+class PasswordUtilsTestCase(DefaultSettingsTestCase):
 
     def _test_make_password(self, algo):
         password = utils.make_password(algo, "foobar")
diff --git a/django/contrib/auth/tests/context_processors.py b/django/contrib/auth/tests/context_processors.py
index 49172c6..0e1f5ac 100644
--- a/django/contrib/auth/tests/context_processors.py
+++ b/django/contrib/auth/tests/context_processors.py
@@ -1,27 +1,14 @@
-import os
-
-from django.conf import settings
 from django.contrib.auth import authenticate
+from django.contrib.auth.tests.views import AuthViewsTestCase
 from django.db.models import Q
-from django.test import TestCase
 
 
-class AuthContextProcessorTests(TestCase):
+class AuthContextProcessorTests(AuthViewsTestCase):
     """
     Tests for the ``django.contrib.auth.context_processors.auth`` processor
     """
-    urls = 'django.contrib.auth.tests.urls'
     fixtures = ['context-processors-users.xml']
 
-    def setUp(self):
-        self.old_TEMPLATE_DIRS = settings.TEMPLATE_DIRS
-        settings.TEMPLATE_DIRS = (
-            os.path.join(os.path.dirname(__file__), 'templates'),
-        )
-
-    def tearDown(self):
-        settings.TEMPLATE_DIRS = self.old_TEMPLATE_DIRS
-
     def test_session_not_accessed(self):
         """
         Tests that the session is not accessed simply by including
diff --git a/django/contrib/auth/tests/forms.py b/django/contrib/auth/tests/forms.py
index 429967c..85f7d4b 100644
--- a/django/contrib/auth/tests/forms.py
+++ b/django/contrib/auth/tests/forms.py
@@ -3,10 +3,10 @@ import os
 from django.core import mail
 from django.contrib.auth.models import User
 from django.contrib.auth.forms import UserCreationForm, AuthenticationForm,  PasswordChangeForm, SetPasswordForm, UserChangeForm, PasswordResetForm
-from django.test import TestCase
+from django.test import DefaultSettingsTestCase
 
 
-class UserCreationFormTest(TestCase):
+class UserCreationFormTest(DefaultSettingsTestCase):
 
     fixtures = ['authtestdata.json']
 
@@ -77,7 +77,7 @@ class UserCreationFormTest(TestCase):
         self.assertEqual(repr(u), '<User: jsmith@example.com>')
 
 
-class AuthenticationFormTest(TestCase):
+class AuthenticationFormTest(DefaultSettingsTestCase):
 
     fixtures = ['authtestdata.json']
 
@@ -116,7 +116,7 @@ class AuthenticationFormTest(TestCase):
         self.assertEqual(form.non_field_errors(), [])
 
 
-class SetPasswordFormTest(TestCase):
+class SetPasswordFormTest(DefaultSettingsTestCase):
 
     fixtures = ['authtestdata.json']
 
@@ -142,7 +142,7 @@ class SetPasswordFormTest(TestCase):
         self.assertTrue(form.is_valid())
 
 
-class PasswordChangeFormTest(TestCase):
+class PasswordChangeFormTest(DefaultSettingsTestCase):
 
     fixtures = ['authtestdata.json']
 
@@ -190,7 +190,7 @@ class PasswordChangeFormTest(TestCase):
         self.assertEqual(PasswordChangeForm(user, {}).fields.keys(),
                          ['old_password', 'new_password1', 'new_password2'])
 
-class UserChangeFormTest(TestCase):
+class UserChangeFormTest(DefaultSettingsTestCase):
 
     fixtures = ['authtestdata.json']
 
@@ -218,7 +218,7 @@ class UserChangeFormTest(TestCase):
         form = MyUserForm({})
 
 
-class PasswordResetFormTest(TestCase):
+class PasswordResetFormTest(DefaultSettingsTestCase):
 
     fixtures = ['authtestdata.json']
 
diff --git a/django/contrib/auth/tests/management.py b/django/contrib/auth/tests/management.py
index 0af6873..bec15b4 100644
--- a/django/contrib/auth/tests/management.py
+++ b/django/contrib/auth/tests/management.py
@@ -1,8 +1,8 @@
-from django.test import TestCase
 from django.contrib.auth import models, management
+from django.test import DefaultSettingsTestCase
 
 
-class GetDefaultUsernameTestCase(TestCase):
+class GetDefaultUsernameTestCase(DefaultSettingsTestCase):
 
     def setUp(self):
         self._getpass_getuser = management.get_system_username
diff --git a/django/contrib/auth/tests/models.py b/django/contrib/auth/tests/models.py
index 754c6db..8a25224 100644
--- a/django/contrib/auth/tests/models.py
+++ b/django/contrib/auth/tests/models.py
@@ -1,35 +1,25 @@
-from django.conf import settings
-from django.test import TestCase
 from django.contrib.auth.models import User, SiteProfileNotAvailable
+from django.test import DefaultSettingsTestCase
+from django.test.utils import override_settings
 
-class ProfileTestCase(TestCase):
-    fixtures = ['authtestdata.json']
-    def setUp(self):
-        """Backs up the AUTH_PROFILE_MODULE"""
-        self.old_AUTH_PROFILE_MODULE = getattr(settings,
-                                               'AUTH_PROFILE_MODULE', None)
-
-    def tearDown(self):
-        """Restores the AUTH_PROFILE_MODULE -- if it was not set it is deleted,
-        otherwise the old value is restored"""
-        if self.old_AUTH_PROFILE_MODULE is None and \
-                hasattr(settings, 'AUTH_PROFILE_MODULE'):
-            del settings.AUTH_PROFILE_MODULE
 
-        if self.old_AUTH_PROFILE_MODULE is not None:
-            settings.AUTH_PROFILE_MODULE = self.old_AUTH_PROFILE_MODULE
+class ProfileTestCase(DefaultSettingsTestCase):
+    fixtures = ['authtestdata.json']
 
+    @override_settings(AUTH_PROFILE_MODULE='')
     def test_site_profile_not_available(self):
         # calling get_profile without AUTH_PROFILE_MODULE set
-        if hasattr(settings, 'AUTH_PROFILE_MODULE'):
-            del settings.AUTH_PROFILE_MODULE
         user = User.objects.get(username='testclient')
         self.assertRaises(SiteProfileNotAvailable, user.get_profile)
 
+    @override_settings(AUTH_PROFILE_MODULE='foobar')
+    def test_site_profile_bad_syntax(self):
         # Bad syntax in AUTH_PROFILE_MODULE: 
-        settings.AUTH_PROFILE_MODULE = 'foobar'
+        user = User.objects.get(username='testclient')
         self.assertRaises(SiteProfileNotAvailable, user.get_profile)
 
+    @override_settings(AUTH_PROFILE_MODULE='foo.bar')
+    def test_site_profile_missing_module(self):
         # module that doesn't exist
-        settings.AUTH_PROFILE_MODULE = 'foo.bar'
+        user = User.objects.get(username='testclient')
         self.assertRaises(SiteProfileNotAvailable, user.get_profile)
diff --git a/django/contrib/auth/tests/remote_user.py b/django/contrib/auth/tests/remote_user.py
index 6ca6a2b..201a434 100644
--- a/django/contrib/auth/tests/remote_user.py
+++ b/django/contrib/auth/tests/remote_user.py
@@ -3,10 +3,11 @@ from datetime import datetime
 from django.conf import settings
 from django.contrib.auth.backends import RemoteUserBackend
 from django.contrib.auth.models import User
-from django.test import TestCase
+from django.test import DefaultSettingsTestCase
+from django.test.utils import override_settings
 
 
-class RemoteUserTest(TestCase):
+class RemoteUserTest(DefaultSettingsTestCase):
 
     urls = 'django.contrib.auth.tests.urls'
     middleware = 'django.contrib.auth.middleware.RemoteUserMiddleware'
@@ -17,10 +18,14 @@ class RemoteUserTest(TestCase):
     known_user2 = 'knownuser2'
 
     def setUp(self):
-        self.curr_middleware = settings.MIDDLEWARE_CLASSES
-        self.curr_auth = settings.AUTHENTICATION_BACKENDS
-        settings.MIDDLEWARE_CLASSES += (self.middleware,)
-        settings.AUTHENTICATION_BACKENDS = (self.backend,)
+        self.settings_override = override_settings(
+            MIDDLEWARE_CLASSES = settings.MIDDLEWARE_CLASSES + (self.middleware,),
+            AUTHENTICATION_BACKENDS = (self.backend,),
+        )
+        self.settings_override.enable()
+
+    def tearDown(self):
+        self.settings_override.disable()
 
     def test_no_remote_user(self):
         """
@@ -92,11 +97,6 @@ class RemoteUserTest(TestCase):
         response = self.client.get('/remote_user/', REMOTE_USER=self.known_user)
         self.assertEqual(default_login, response.context['user'].last_login)
 
-    def tearDown(self):
-        """Restores settings to avoid breaking other tests."""
-        settings.MIDDLEWARE_CLASSES = self.curr_middleware
-        settings.AUTHENTICATION_BACKENDS = self.curr_auth
-
 
 class RemoteUserNoCreateBackend(RemoteUserBackend):
     """Backend that doesn't create unknown users."""
diff --git a/django/contrib/auth/tests/signals.py b/django/contrib/auth/tests/signals.py
index 3806021..4b507a1 100644
--- a/django/contrib/auth/tests/signals.py
+++ b/django/contrib/auth/tests/signals.py
@@ -1,8 +1,8 @@
-from django.test import TestCase
 from django.contrib.auth import signals
+from django.test import DefaultSettingsTestCase
 
 
-class SignalTestCase(TestCase):
+class SignalTestCase(DefaultSettingsTestCase):
     urls = 'django.contrib.auth.tests.urls'
     fixtures = ['authtestdata.json']
 
diff --git a/django/contrib/auth/tests/tokens.py b/django/contrib/auth/tests/tokens.py
index f7fc32e..b26646a 100644
--- a/django/contrib/auth/tests/tokens.py
+++ b/django/contrib/auth/tests/tokens.py
@@ -3,10 +3,10 @@ from datetime import date, timedelta
 from django.conf import settings
 from django.contrib.auth.models import User
 from django.contrib.auth.tokens import PasswordResetTokenGenerator
-from django.test import TestCase
+from django.test import DefaultSettingsTestCase
 
 
-class TokenGeneratorTest(TestCase):
+class TokenGeneratorTest(DefaultSettingsTestCase):
 
     def test_make_token(self):
         """
diff --git a/django/contrib/auth/tests/views.py b/django/contrib/auth/tests/views.py
index 9fccb3e..da598b0 100644
--- a/django/contrib/auth/tests/views.py
+++ b/django/contrib/auth/tests/views.py
@@ -6,37 +6,22 @@ import urllib
 from django.conf import settings
 from django.contrib.auth import SESSION_KEY, REDIRECT_FIELD_NAME
 from django.contrib.auth.forms import AuthenticationForm
-from django.contrib.sites.models import Site, RequestSite
 from django.contrib.auth.models import User
-from django.core.urlresolvers import NoReverseMatch
-from django.test import TestCase
+from django.contrib.sites.models import Site, RequestSite
 from django.core import mail
-from django.core.urlresolvers import reverse
+from django.core.urlresolvers import reverse, NoReverseMatch
 from django.http import QueryDict
+from django.test import DefaultSettingsTestCase
+from django.test.utils import override_settings
 
 
-class AuthViewsTestCase(TestCase):
+class AuthViewsTestCase(DefaultSettingsTestCase):
     """
     Helper base class for all the follow test cases.
     """
     fixtures = ['authtestdata.json']
     urls = 'django.contrib.auth.tests.urls'
 
-    def setUp(self):
-        self.old_LANGUAGES = settings.LANGUAGES
-        self.old_LANGUAGE_CODE = settings.LANGUAGE_CODE
-        settings.LANGUAGES = (('en', 'English'),)
-        settings.LANGUAGE_CODE = 'en'
-        self.old_TEMPLATE_DIRS = settings.TEMPLATE_DIRS
-        settings.TEMPLATE_DIRS = (
-            os.path.join(os.path.dirname(__file__), 'templates'),
-        )
-
-    def tearDown(self):
-        settings.LANGUAGES = self.old_LANGUAGES
-        settings.LANGUAGE_CODE = self.old_LANGUAGE_CODE
-        settings.TEMPLATE_DIRS = self.old_TEMPLATE_DIRS
-
     def login(self, password='password'):
         response = self.client.post('/login/', {
             'username': 'testclient',
@@ -47,6 +32,13 @@ class AuthViewsTestCase(TestCase):
         self.assertTrue(response['Location'].endswith(settings.LOGIN_REDIRECT_URL))
         self.assertTrue(SESSION_KEY in self.client.session)
 
+AuthViewsTestCase = override_settings(
+    SITE_ID = 1,
+    TEMPLATE_DIRS = (
+        os.path.join(os.path.dirname(__file__), 'templates'),
+    ),
+)(AuthViewsTestCase)
+
 
 class AuthViewNamedURLTests(AuthViewsTestCase):
     urls = 'django.contrib.auth.urls'
@@ -145,8 +137,8 @@ class PasswordResetTest(AuthViewsTestCase):
         url, path = self._test_confirm_start()
         path = path[:-5] + ("0"*4) + path[-1]
 
-        response = self.client.post(path, {'new_password1': 'anewpassword',
-                                           'new_password2':' anewpassword'})
+        self.client.post(path, {'new_password1': 'anewpassword',
+                                'new_password2':' anewpassword'})
         # Check the password has not been changed
         u = User.objects.get(email='staffmember@example.com')
         self.assertTrue(not u.check_password("anewpassword"))
@@ -185,7 +177,7 @@ class ChangePasswordTest(AuthViewsTestCase):
         self.assertTrue("Please enter a correct username and password. Note that both fields are case-sensitive." in response.content)
 
     def logout(self):
-        response = self.client.get('/logout/')
+        self.client.get('/logout/')
 
     def test_password_change_fails_with_invalid_old_password(self):
         self.login()
@@ -304,60 +296,50 @@ class LoginTest(AuthViewsTestCase):
 class LoginURLSettings(AuthViewsTestCase):
     urls = 'django.contrib.auth.tests.urls'
 
-    def setUp(self):
-        super(LoginURLSettings, self).setUp()
-        self.old_LOGIN_URL = settings.LOGIN_URL
-
-    def tearDown(self):
-        super(LoginURLSettings, self).tearDown()
-        settings.LOGIN_URL = self.old_LOGIN_URL
-
-    def get_login_required_url(self, login_url):
-        settings.LOGIN_URL = login_url
+    def get_login_required_url(self, login=settings.LOGIN_URL):
         response = self.client.get('/login_required/')
         self.assertEqual(response.status_code, 302)
         return response['Location']
 
+    @override_settings(LOGIN_URL='/login/')
     def test_standard_login_url(self):
-        login_url = '/login/'
-        login_required_url = self.get_login_required_url(login_url)
+        login_required_url = self.get_login_required_url()
         querystring = QueryDict('', mutable=True)
         querystring['next'] = '/login_required/'
         self.assertEqual(login_required_url,
-             'http://testserver%s?%s' % (login_url, querystring.urlencode('/')))
+             'http://testserver%s?%s' % (settings.LOGIN_URL, querystring.urlencode('/')))
 
+    @override_settings(LOGIN_URL='http://remote.example.com/login')
     def test_remote_login_url(self):
-        login_url = 'http://remote.example.com/login'
-        login_required_url = self.get_login_required_url(login_url)
+        login_required_url = self.get_login_required_url()
         querystring = QueryDict('', mutable=True)
         querystring['next'] = 'http://testserver/login_required/'
         self.assertEqual(login_required_url,
-                         '%s?%s' % (login_url, querystring.urlencode('/')))
+                         '%s?%s' % (settings.LOGIN_URL, querystring.urlencode('/')))
 
+    @override_settings(LOGIN_URL='https:///login/')
     def test_https_login_url(self):
-        login_url = 'https:///login/'
-        login_required_url = self.get_login_required_url(login_url)
+        login_required_url = self.get_login_required_url()
         querystring = QueryDict('', mutable=True)
         querystring['next'] = 'http://testserver/login_required/'
         self.assertEqual(login_required_url,
-                         '%s?%s' % (login_url, querystring.urlencode('/')))
+                         '%s?%s' % (settings.LOGIN_URL, querystring.urlencode('/')))
 
+    @override_settings(LOGIN_URL='/login/?pretty=1')
     def test_login_url_with_querystring(self):
-        login_url = '/login/?pretty=1'
-        login_required_url = self.get_login_required_url(login_url)
+        login_required_url = self.get_login_required_url()
         querystring = QueryDict('pretty=1', mutable=True)
         querystring['next'] = '/login_required/'
         self.assertEqual(login_required_url, 'http://testserver/login/?%s' %
                          querystring.urlencode('/'))
 
+    @override_settings(LOGIN_URL='http://remote.example.com/login/?next=/default/')
     def test_remote_login_url_with_next_querystring(self):
-        login_url = 'http://remote.example.com/login/'
-        login_required_url = self.get_login_required_url('%s?next=/default/' %
-                                                         login_url)
+        login_required_url = self.get_login_required_url()
         querystring = QueryDict('', mutable=True)
         querystring['next'] = 'http://testserver/login_required/'
-        self.assertEqual(login_required_url, '%s?%s' % (login_url,
-                                                    querystring.urlencode('/')))
+        self.assertEqual(login_required_url, settings.LOGIN_URL.replace(
+            'next=/default/', querystring.urlencode('/')))
 
 
 class LogoutTest(AuthViewsTestCase):
diff --git a/django/test/__init__.py b/django/test/__init__.py
index a3a03e3..df75a21 100644
--- a/django/test/__init__.py
+++ b/django/test/__init__.py
@@ -4,5 +4,5 @@ Django Unit Test and Doctest framework.
 
 from django.test.client import Client, RequestFactory
 from django.test.testcases import (TestCase, TransactionTestCase,
-        SimpleTestCase, skipIfDBFeature, skipUnlessDBFeature)
+        SimpleTestCase, DefaultSettingsTestCase, skipIfDBFeature, skipUnlessDBFeature)
 from django.test.utils import Approximate
diff --git a/django/test/testcases.py b/django/test/testcases.py
index ee22ac2..b9b851f 100644
--- a/django/test/testcases.py
+++ b/django/test/testcases.py
@@ -6,7 +6,7 @@ from functools import wraps
 from urlparse import urlsplit, urlunsplit
 from xml.dom.minidom import parseString, Node
 
-from django.conf import settings
+from django.conf import settings, global_settings, UserSettingsHolder
 from django.core import mail
 from django.core.exceptions import ValidationError
 from django.core.management import call_command
@@ -23,6 +23,7 @@ from django.test.utils import (get_warnings_state, restore_warnings_state,
     override_settings)
 from django.utils import simplejson, unittest as ut2
 from django.utils.encoding import smart_str
+from django.utils.translation import deactivate
 
 __all__ = ('DocTestRunner', 'OutputChecker', 'TestCase', 'TransactionTestCase',
            'SimpleTestCase', 'skipIfDBFeature', 'skipUnlessDBFeature')
@@ -350,10 +351,14 @@ class TransactionTestCase(SimpleTestCase):
               ROOT_URLCONF with it.
             * Clearing the mail test outbox.
         """
+        self._settings_setup()
         self._fixture_setup()
         self._urlconf_setup()
         mail.outbox = []
 
+    def _settings_setup(self):
+        pass
+
     def _fixture_setup(self):
         # If the test case has a multi_db=True flag, flush all databases.
         # Otherwise, just flush default.
@@ -414,6 +419,7 @@ class TransactionTestCase(SimpleTestCase):
         """
         self._fixture_teardown()
         self._urlconf_teardown()
+        self._settings_teardown()
         # Some DB cursors include SQL statements as part of cursor
         # creation. If you have a test that does rollback, the effect
         # of these statements is lost, which can effect the operation
@@ -432,6 +438,9 @@ class TransactionTestCase(SimpleTestCase):
             settings.ROOT_URLCONF = self._old_root_urlconf
             clear_url_caches()
 
+    def _settings_teardown(self):
+        pass
+
     def assertRedirects(self, response, expected_url, status_code=302,
                         target_status_code=200, host=None, msg_prefix=''):
         """Asserts that a response redirected to a specific URL, and that the
@@ -703,6 +712,28 @@ class TestCase(TransactionTestCase):
             transaction.rollback(using=db)
             transaction.leave_transaction_management(using=db)
 
+
+class DefaultSettingsTestCase(TestCase):
+    """
+    A testcase class that reset settings to Django defaults for its tests
+    """
+    def _settings_setup(self):
+        self.wrapped = settings._wrapped
+        holder = UserSettingsHolder(global_settings)
+        for setting_name in ('ROOT_URLCONF', 'EMAIL_BACKEND'):
+            setattr(holder, setting_name, getattr(settings, setting_name, ""))
+        settings._wrapped = holder
+        deactivate()
+        super(DefaultSettingsTestCase, self)._settings_setup()
+
+    def _settings_teardown(self):
+        super(DefaultSettingsTestCase, self)._settings_teardown()
+        settings._wrapped = self.wrapped
+        # Damned cached global variables :-(
+        from django.template import base
+        base.templatetags_modules = []
+
+
 def _deferredSkip(condition, reason):
     def decorator(test_func):
         if not (isinstance(test_func, type) and
diff --git a/django/test/utils.py b/django/test/utils.py
index 87f2311..421a726 100644
--- a/django/test/utils.py
+++ b/django/test/utils.py
@@ -196,16 +196,16 @@ class override_settings(object):
     def __call__(self, test_func):
         from django.test import TransactionTestCase
         if isinstance(test_func, type) and issubclass(test_func, TransactionTestCase):
-            original_pre_setup = test_func._pre_setup
-            original_post_teardown = test_func._post_teardown
-            def _pre_setup(innerself):
+            original_settings_setup = test_func._settings_setup
+            original_settings_teardown = test_func._settings_teardown
+            def _settings_setup(innerself):
+                original_settings_setup(innerself)
                 self.enable()
-                original_pre_setup(innerself)
-            def _post_teardown(innerself):
-                original_post_teardown(innerself)
+            def _settings_teardown(innerself):
                 self.disable()
-            test_func._pre_setup = _pre_setup
-            test_func._post_teardown = _post_teardown
+                original_settings_teardown(innerself)
+            test_func._settings_setup = _settings_setup
+            test_func._settings_teardown = _settings_teardown
             return test_func
         else:
             @wraps(test_func)
