1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

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

@@ -1,11 +1,11 @@
import datetime
from operator import attrgetter
from django.apps.registry import Apps
from django.core.exceptions import FieldError
from django.db import models
from django.db.models.fields.related import ForeignObject
from django.test import SimpleTestCase, TestCase, skipUnlessDBFeature
from django.test.utils import isolate_apps
from django.utils import translation
from .models import (
@@ -410,15 +410,13 @@ class MultiColumnFKTests(TestCase):
class TestModelCheckTests(SimpleTestCase):
@isolate_apps('foreign_object')
def test_check_composite_foreign_object(self):
test_apps = Apps(['foreign_object'])
class Parent(models.Model):
a = models.PositiveIntegerField()
b = models.PositiveIntegerField()
class Meta:
apps = test_apps
unique_together = (('a', 'b'),)
class Child(models.Model):
@@ -433,21 +431,16 @@ class TestModelCheckTests(SimpleTestCase):
related_name='children',
)
class Meta:
apps = test_apps
self.assertEqual(Child._meta.get_field('parent').check(from_model=Child), [])
@isolate_apps('foreign_object')
def test_check_subset_composite_foreign_object(self):
test_apps = Apps(['foreign_object'])
class Parent(models.Model):
a = models.PositiveIntegerField()
b = models.PositiveIntegerField()
c = models.PositiveIntegerField()
class Meta:
apps = test_apps
unique_together = (('a', 'b'),)
class Child(models.Model):
@@ -463,7 +456,4 @@ class TestModelCheckTests(SimpleTestCase):
related_name='children',
)
class Meta:
apps = test_apps
self.assertEqual(Child._meta.get_field('parent').check(from_model=Child), [])