mirror of
https://github.com/django/django.git
synced 2025-08-03 10:34:04 +00:00
Applied ignore_warnings to Django tests
This commit is contained in:
parent
66f9a74b45
commit
51890ce889
57 changed files with 513 additions and 711 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue