summaryrefslogtreecommitdiff
path: root/tests/middleware_exceptions
diff options
context:
space:
mode:
authorBouke Haarsma <bouke@webatoom.nl>2013-10-14 15:14:17 +0200
committerTim Graham <timograham@gmail.com>2013-10-21 11:31:05 -0400
commit3565efaa451db6eb735a085ea6aae3fe86e6d283 (patch)
tree7030dcebfb01ef75bd1d6b308fd21caea3f20034 /tests/middleware_exceptions
parent499cd912ca36597df737df73c8f91ffab36c83d9 (diff)
downloaddjango-3565efaa451db6eb735a085ea6aae3fe86e6d283.tar.gz
Removed some direct settings manipulations in tests; refs #21230.
Diffstat (limited to 'tests/middleware_exceptions')
-rw-r--r--tests/middleware_exceptions/tests.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/tests/middleware_exceptions/tests.py b/tests/middleware_exceptions/tests.py
index fccfdbbd8c..e0f3729e9b 100644
--- a/tests/middleware_exceptions/tests.py
+++ b/tests/middleware_exceptions/tests.py
@@ -6,6 +6,7 @@ from django.http import HttpResponse
from django.template.response import TemplateResponse
from django.template import Template
from django.test import TestCase
+from django.test.utils import override_settings
class TestException(Exception):
pass
@@ -772,15 +773,11 @@ _missing = object()
class RootUrlconfTests(TestCase):
urls = 'middleware_exceptions.urls'
+ @override_settings(ROOT_URLCONF=None)
def test_missing_root_urlconf(self):
- try:
- original_ROOT_URLCONF = settings.ROOT_URLCONF
- del settings.ROOT_URLCONF
- except AttributeError:
- original_ROOT_URLCONF = _missing
+ # Removing ROOT_URLCONF is safe, as override_settings will restore
+ # the previously defined settings.
+ del settings.ROOT_URLCONF
self.assertRaises(AttributeError,
self.client.get, "/middleware_exceptions/view/"
)
-
- if original_ROOT_URLCONF is not _missing:
- settings.ROOT_URLCONF = original_ROOT_URLCONF