Fixed #25746 -- Isolated inlined test models registration.

Thanks to Tim for the review.
This commit is contained in:
Simon Charette 2015-11-17 00:39:28 -05:00
parent 3096f4b082
commit a08fda2111
29 changed files with 285 additions and 371 deletions

View file

@ -4,11 +4,11 @@ import unittest
import uuid
from django import forms
from django.apps.registry import Apps
from django.core import exceptions, serializers, validators
from django.core.management import call_command
from django.db import IntegrityError, connection, models
from django.test import TransactionTestCase, override_settings
from django.test.utils import isolate_apps
from django.utils import timezone
from . import PostgreSQLTestCase
@ -333,17 +333,13 @@ class TestOtherTypesExactQuerying(PostgreSQLTestCase):
)
@isolate_apps('postgres_tests')
class TestChecks(PostgreSQLTestCase):
def test_field_checks(self):
test_apps = Apps(['postgres_tests'])
class MyModel(PostgreSQLModel):
field = ArrayField(models.CharField())
class Meta:
apps = test_apps
model = MyModel()
errors = model.check()
self.assertEqual(len(errors), 1)
@ -352,14 +348,9 @@ class TestChecks(PostgreSQLTestCase):
self.assertIn('max_length', errors[0].msg)
def test_invalid_base_fields(self):
test_apps = Apps(['postgres_tests'])
class MyModel(PostgreSQLModel):
field = ArrayField(models.ManyToManyField('postgres_tests.IntegerArrayModel'))
class Meta:
apps = test_apps
model = MyModel()
errors = model.check()
self.assertEqual(len(errors), 1)
@ -369,14 +360,9 @@ class TestChecks(PostgreSQLTestCase):
"""
Nested ArrayFields are permitted.
"""
test_apps = Apps(['postgres_tests'])
class MyModel(PostgreSQLModel):
field = ArrayField(ArrayField(models.CharField()))
class Meta:
apps = test_apps
model = MyModel()
errors = model.check()
self.assertEqual(len(errors), 1)