diff options
author | Simon Charette <charette.s@gmail.com> | 2015-11-17 00:39:28 -0500 |
---|---|---|
committer | Simon Charette <charette.s@gmail.com> | 2016-01-06 20:00:07 -0500 |
commit | a08fda2111d811aa53f11218fa03f3300dfff4cb (patch) | |
tree | 0263cf99adf17c5123b3a53c686f637d5b40eda4 /tests/foreign_object | |
parent | 3096f4b0829a005c67a14cc4bb6d345aa32672a1 (diff) | |
download | django-a08fda2111d811aa53f11218fa03f3300dfff4cb.tar.gz |
Fixed #25746 -- Isolated inlined test models registration.
Thanks to Tim for the review.
Diffstat (limited to 'tests/foreign_object')
-rw-r--r-- | tests/foreign_object/tests.py | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/tests/foreign_object/tests.py b/tests/foreign_object/tests.py index bcdadc6d6d..f83698175e 100644 --- a/tests/foreign_object/tests.py +++ b/tests/foreign_object/tests.py @@ -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), []) |