Fixed test failures introduced in refs #23861.

This commit is contained in:
Tim Graham 2015-01-05 14:15:14 -05:00
parent ce17b045bf
commit 789baf9c3a
2 changed files with 7 additions and 4 deletions

View File

@ -2,8 +2,10 @@ from django.db import models
from django.core import checks
from django.test import SimpleTestCase
from .tests import IsolateModelsMixin
class TestDeprecatedField(SimpleTestCase):
class TestDeprecatedField(IsolateModelsMixin, SimpleTestCase):
def test_default_details(self):
class MyField(models.Field):
system_check_deprecated_details = {}
@ -43,7 +45,7 @@ class TestDeprecatedField(SimpleTestCase):
])
class TestRemovedField(SimpleTestCase):
class TestRemovedField(IsolateModelsMixin, SimpleTestCase):
def test_default_details(self):
class MyField(models.Field):
system_check_removed_details = {}

View File

@ -291,8 +291,7 @@ class SilencingCheckTests(TestCase):
self.assertEqual(err.getvalue(), '')
class CheckFrameworkReservedNamesTests(TestCase):
class IsolateModelsMixin(object):
def setUp(self):
self.current_models = apps.all_models[__package__]
self.saved_models = set(self.current_models)
@ -302,6 +301,8 @@ class CheckFrameworkReservedNamesTests(TestCase):
del self.current_models[model]
apps.clear_cache()
class CheckFrameworkReservedNamesTests(IsolateModelsMixin, TestCase):
@override_settings(
SILENCED_SYSTEM_CHECKS=['models.E20', 'fields.W342'], # ForeignKey(unique=True)
INSTALLED_APPS=['django.contrib.auth', 'django.contrib.contenttypes', 'check_framework']