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/admin_checks | |
parent | 66f9a74b4514bd259976ce8ee3a4e78288358a5f (diff) | |
download | django-51890ce8898f821d28f2f6fb6071c936e9bd88f0.tar.gz |
Applied ignore_warnings to Django tests
Diffstat (limited to 'tests/admin_checks')
-rw-r--r-- | tests/admin_checks/tests.py | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/tests/admin_checks/tests.py b/tests/admin_checks/tests.py index 500a889c71..d8e6c125dd 100644 --- a/tests/admin_checks/tests.py +++ b/tests/admin_checks/tests.py @@ -1,14 +1,11 @@ from __future__ import unicode_literals -import warnings - from django import forms from django.contrib import admin from django.contrib.contenttypes.admin import GenericStackedInline from django.core import checks from django.core.exceptions import ImproperlyConfigured -from django.test import TestCase -from django.test.utils import override_settings +from django.test import TestCase, ignore_warnings, override_settings from .models import Song, Book, Album, TwoAlbumFKAndAnE, City, State, Influence @@ -589,6 +586,7 @@ class SystemChecksTestCase(TestCase): errors = FieldsOnFormOnlyAdmin.check(model=Song) self.assertEqual(errors, []) + @ignore_warnings(module='django.contrib.admin.options') def test_validator_compatibility(self): class MyValidator(object): def validate(self, cls, model): @@ -597,18 +595,16 @@ class SystemChecksTestCase(TestCase): class MyModelAdmin(admin.ModelAdmin): validator_class = MyValidator - with warnings.catch_warnings(record=True): - warnings.filterwarnings('ignore', module='django.contrib.admin.options') - errors = MyModelAdmin.check(model=Song) + errors = MyModelAdmin.check(model=Song) - expected = [ - checks.Error( - 'error!', - hint=None, - obj=MyModelAdmin, - ) - ] - self.assertEqual(errors, expected) + expected = [ + checks.Error( + 'error!', + hint=None, + obj=MyModelAdmin, + ) + ] + self.assertEqual(errors, expected) def test_check_sublists_for_duplicates(self): class MyModelAdmin(admin.ModelAdmin): |