1
0
mirror of https://github.com/django/django.git synced 2025-10-29 00:26:07 +00:00

Added warning silencers to some noisy tests.

These warnings all emerged as the result of the introduction of the checks framework.

Thanks to Anssi Kääriäinen for the report.
This commit is contained in:
Russell Keith-Magee
2014-01-20 20:30:29 +08:00
parent b0602e935c
commit 53aa6c6ac1
4 changed files with 85 additions and 33 deletions

View File

@@ -1,5 +1,7 @@
from __future__ import unicode_literals
import warnings
from django import forms
from django.contrib import admin
from django.core import checks
@@ -425,12 +427,15 @@ class SystemChecksTestCase(TestCase):
class MyModelAdmin(admin.ModelAdmin):
validator_class = MyValidator
errors = MyModelAdmin.check(model=Song)
expected = [
checks.Error(
'error!',
hint=None,
obj=MyModelAdmin,
)
]
self.assertEqual(errors, expected)
with warnings.catch_warnings(record=True):
warnings.filterwarnings('ignore', module='django.contrib.admin.options')
errors = MyModelAdmin.check(model=Song)
expected = [
checks.Error(
'error!',
hint=None,
obj=MyModelAdmin,
)
]
self.assertEqual(errors, expected)