diff options
author | Claude Paroz <claude@2xlibre.net> | 2014-12-21 21:19:05 +0100 |
---|---|---|
committer | Claude Paroz <claude@2xlibre.net> | 2014-12-30 18:16:25 +0100 |
commit | 51890ce8898f821d28f2f6fb6071c936e9bd88f0 (patch) | |
tree | 6522c597d411086b0a5c2ec3dd7a1d9bc2feeafd /tests/modeladmin | |
parent | 66f9a74b4514bd259976ce8ee3a4e78288358a5f (diff) | |
download | django-51890ce8898f821d28f2f6fb6071c936e9bd88f0.tar.gz |
Applied ignore_warnings to Django tests
Diffstat (limited to 'tests/modeladmin')
-rw-r--r-- | tests/modeladmin/tests.py | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/tests/modeladmin/tests.py b/tests/modeladmin/tests.py index a0dfb2a72d..ca3a8dbfaf 100644 --- a/tests/modeladmin/tests.py +++ b/tests/modeladmin/tests.py @@ -1,7 +1,6 @@ from __future__ import unicode_literals from datetime import date -import warnings from django import forms from django.contrib.admin.options import (ModelAdmin, TabularInline, @@ -15,7 +14,7 @@ from django.core.checks import Error 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 import TestCase, ignore_warnings from django.utils import six from django.utils.deprecation import RemovedInDjango19Warning @@ -1505,19 +1504,18 @@ class FormsetCheckTests(CheckTestCase): class CustomModelAdminTests(CheckTestCase): + @ignore_warnings(category=RemovedInDjango19Warning) def test_deprecation(self): "Deprecated Custom Validator definitions still work with the check framework." - with warnings.catch_warnings(): - warnings.simplefilter("ignore", category=RemovedInDjango19Warning) - class CustomValidator(ModelAdminValidator): - def validate_me(self, model_admin, model): - raise ImproperlyConfigured('error!') + class CustomValidator(ModelAdminValidator): + def validate_me(self, model_admin, model): + raise ImproperlyConfigured('error!') - class CustomModelAdmin(ModelAdmin): - validator_class = CustomValidator + class CustomModelAdmin(ModelAdmin): + validator_class = CustomValidator - self.assertIsInvalid(CustomModelAdmin, ValidationTestModel, 'error!') + self.assertIsInvalid(CustomModelAdmin, ValidationTestModel, 'error!') class ListDisplayEditableTests(CheckTestCase): |