mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +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
|
@ -12,6 +12,7 @@ from django.core.files.storage import FileSystemStorage
|
|||
from django.db import models
|
||||
from django.db.models.fields.files import ImageFieldFile, ImageField
|
||||
from django.utils import six
|
||||
from django.utils.deprecation import RemovedInDjango19Warning
|
||||
|
||||
|
||||
class Foo(models.Model):
|
||||
|
@ -160,8 +161,8 @@ class VerboseNameField(models.Model):
|
|||
# Don't want to depend on Pillow in this test
|
||||
#field_image = models.ImageField("verbose field")
|
||||
field12 = models.IntegerField("verbose field12")
|
||||
with warnings.catch_warnings(record=True) as w:
|
||||
warnings.simplefilter("always")
|
||||
with warnings.catch_warnings():
|
||||
warnings.simplefilter("ignore", category=RemovedInDjango19Warning)
|
||||
field13 = models.IPAddressField("verbose field13")
|
||||
field14 = models.GenericIPAddressField("verbose field14", protocol="ipv4")
|
||||
field15 = models.NullBooleanField("verbose field15")
|
||||
|
|
|
@ -3,7 +3,6 @@ from __future__ import unicode_literals
|
|||
import datetime
|
||||
from decimal import Decimal
|
||||
import unittest
|
||||
import warnings
|
||||
|
||||
from django import test
|
||||
from django import forms
|
||||
|
@ -800,16 +799,15 @@ class PromiseTest(test.TestCase):
|
|||
int)
|
||||
|
||||
def test_IPAddressField(self):
|
||||
with warnings.catch_warnings(record=True):
|
||||
warnings.simplefilter("always")
|
||||
lazy_func = lazy(lambda: '127.0.0.1', six.text_type)
|
||||
self.assertIsInstance(
|
||||
IPAddressField().get_prep_value(lazy_func()),
|
||||
six.text_type)
|
||||
lazy_func = lazy(lambda: 0, int)
|
||||
self.assertIsInstance(
|
||||
IPAddressField().get_prep_value(lazy_func()),
|
||||
six.text_type)
|
||||
# Deprecation silenced in runtests.py
|
||||
lazy_func = lazy(lambda: '127.0.0.1', six.text_type)
|
||||
self.assertIsInstance(
|
||||
IPAddressField().get_prep_value(lazy_func()),
|
||||
six.text_type)
|
||||
lazy_func = lazy(lambda: 0, int)
|
||||
self.assertIsInstance(
|
||||
IPAddressField().get_prep_value(lazy_func()),
|
||||
six.text_type)
|
||||
|
||||
def test_GenericIPAddressField(self):
|
||||
lazy_func = lazy(lambda: '127.0.0.1', six.text_type)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue