diff options
author | Bouke Haarsma <bouke@webatoom.nl> | 2013-10-14 15:14:17 +0200 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2013-10-21 11:31:05 -0400 |
commit | 3565efaa451db6eb735a085ea6aae3fe86e6d283 (patch) | |
tree | 7030dcebfb01ef75bd1d6b308fd21caea3f20034 /tests/modeladmin | |
parent | 499cd912ca36597df737df73c8f91ffab36c83d9 (diff) | |
download | django-3565efaa451db6eb735a085ea6aae3fe86e6d283.tar.gz |
Removed some direct settings manipulations in tests; refs #21230.
Diffstat (limited to 'tests/modeladmin')
-rw-r--r-- | tests/modeladmin/tests.py | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/tests/modeladmin/tests.py b/tests/modeladmin/tests.py index acc3c94271..df77202704 100644 --- a/tests/modeladmin/tests.py +++ b/tests/modeladmin/tests.py @@ -15,7 +15,7 @@ from django.core.exceptions import ImproperlyConfigured from django.forms.models import BaseModelFormSet from django.forms.widgets import Select from django.test import TestCase -from django.test.utils import str_prefix +from django.test.utils import str_prefix, override_settings from django.utils import six from .models import Band, Concert, ValidationTestModel, ValidationTestInlineModel @@ -540,9 +540,7 @@ class ModelAdminTests(TestCase): class ValidationTests(unittest.TestCase): def test_validation_only_runs_in_debug(self): # Ensure validation only runs when DEBUG = True - try: - settings.DEBUG = True - + with override_settings(DEBUG=True): class ValidationTestModelAdmin(ModelAdmin): raw_id_fields = 10 @@ -555,11 +553,10 @@ class ValidationTests(unittest.TestCase): ValidationTestModel, ValidationTestModelAdmin, ) - finally: - settings.DEBUG = False - site = AdminSite() - site.register(ValidationTestModel, ValidationTestModelAdmin) + with override_settings(DEBUG=False): + site = AdminSite() + site.register(ValidationTestModel, ValidationTestModelAdmin) def test_raw_id_fields_validation(self): |