summaryrefslogtreecommitdiff
path: root/tests/postgres_tests/test_array.py
diff options
context:
space:
mode:
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)