summaryrefslogtreecommitdiff
path: root/tests/postgres_tests/test_array.py
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2015-11-17 00:39:28 -0500
committerSimon Charette <charette.s@gmail.com>2016-01-06 20:00:07 -0500
commita08fda2111d811aa53f11218fa03f3300dfff4cb (patch)
tree0263cf99adf17c5123b3a53c686f637d5b40eda4 /tests/postgres_tests/test_array.py
parent3096f4b0829a005c67a14cc4bb6d345aa32672a1 (diff)
Fixed #25746 -- Isolated inlined test models registration.
Thanks to Tim for the review.
Diffstat (limited to 'tests/postgres_tests/test_array.py')
-rw-r--r--tests/postgres_tests/test_array.py18
1 files changed, 2 insertions, 16 deletions
diff --git a/tests/postgres_tests/test_array.py b/tests/postgres_tests/test_array.py
index e9cec6b5b5..24a47db1d7 100644
--- a/tests/postgres_tests/test_array.py
+++ b/tests/postgres_tests/test_array.py
@@ -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)