Applied ignore_warnings to Django tests

This commit is contained in:
Claude Paroz 2014-12-21 21:19:05 +01:00
parent 66f9a74b45
commit 51890ce889
57 changed files with 513 additions and 711 deletions

View file

@ -11,7 +11,6 @@ from __future__ import unicode_literals
import datetime
import decimal
from unittest import skipUnless
import warnings
try:
import yaml
@ -24,8 +23,9 @@ from django.core.serializers.base import DeserializationError
from django.core.serializers.xml_serializer import DTDForbidden
from django.db import connection, models
from django.http import HttpResponse
from django.test import skipUnlessDBFeature, TestCase
from django.test import ignore_warnings, skipUnlessDBFeature, TestCase
from django.utils import six
from django.utils.deprecation import RemovedInDjango19Warning
from django.utils.functional import curry
from .models import (BinaryData, BooleanData, CharData, DateData, DateTimeData, EmailData,
@ -484,6 +484,7 @@ def serializerTest(format, self):
self.assertEqual(count, klass.objects.count())
@ignore_warnings(category=RemovedInDjango19Warning) # for use_natural_keys
def naturalKeySerializerTest(format, self):
# Create all the objects defined in the test data
objects = []
@ -497,11 +498,9 @@ def naturalKeySerializerTest(format, self):
instance_count[klass] = klass.objects.count()
# use_natural_keys is deprecated and to be removed in Django 1.9
with warnings.catch_warnings(record=True):
warnings.simplefilter("always")
# Serialize the test database
serialized_data = serializers.serialize(format, objects, indent=2,
use_natural_keys=True)
# Serialize the test database
serialized_data = serializers.serialize(format, objects, indent=2,
use_natural_keys=True)
for obj in serializers.deserialize(format, serialized_data):
obj.save()