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/serializers | |
| parent | 499cd912ca36597df737df73c8f91ffab36c83d9 (diff) | |
Removed some direct settings manipulations in tests; refs #21230.
Diffstat (limited to 'tests/serializers')
| -rw-r--r-- | tests/serializers/tests.py | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/tests/serializers/tests.py b/tests/serializers/tests.py index a6b396fec1..30f775b9af 100644 --- a/tests/serializers/tests.py +++ b/tests/serializers/tests.py @@ -18,7 +18,7 @@ from django.conf import settings from django.core import management, serializers from django.db import transaction, connection from django.test import TestCase, TransactionTestCase -from django.test.utils import Approximate +from django.test.utils import Approximate, override_settings from django.utils import six from django.utils.six import StringIO @@ -26,22 +26,18 @@ from .models import (Category, Author, Article, AuthorProfile, Actor, Movie, Score, Player, Team) -class SerializerRegistrationTests(unittest.TestCase): +@override_settings( + SERIALIZATION_MODULES = { + "json2" : "django.core.serializers.json", + } +) +class SerializerRegistrationTests(TestCase): def setUp(self): - self.old_SERIALIZATION_MODULES = getattr(settings, 'SERIALIZATION_MODULES', None) self.old_serializers = serializers._serializers - serializers._serializers = {} - settings.SERIALIZATION_MODULES = { - "json2" : "django.core.serializers.json", - } def tearDown(self): serializers._serializers = self.old_serializers - if self.old_SERIALIZATION_MODULES: - settings.SERIALIZATION_MODULES = self.old_SERIALIZATION_MODULES - else: - delattr(settings, 'SERIALIZATION_MODULES') def test_register(self): "Registering a new serializer populates the full registry. Refs #14823" |
