summaryrefslogtreecommitdiff
path: root/tests/migrations/test_base.py
diff options
context:
space:
mode:
authorMads Jensen <mje@inducks.org>2019-07-25 13:44:18 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2019-08-21 13:10:06 +0200
commit85ac838d9e6975130b5c55299e9d7d1222a8e289 (patch)
tree2466fdf4773081dfbaa33c24cda4b01ec9fc23e6 /tests/migrations/test_base.py
parent9a88e43aeba6cc85ffb2a48a06c296ccf68e0d71 (diff)
Fixed #21039 -- Added AddIndexConcurrently/RemoveIndexConcurrently operations for PostgreSQL.
Thanks to Simon Charettes for review. Co-Authored-By: Daniel Tao <daniel.tao@gmail.com>
Diffstat (limited to 'tests/migrations/test_base.py')
-rw-r--r--tests/migrations/test_base.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/tests/migrations/test_base.py b/tests/migrations/test_base.py
index 7c1cf82e16..94ff6ff0c9 100644
--- a/tests/migrations/test_base.py
+++ b/tests/migrations/test_base.py
@@ -13,8 +13,6 @@ from django.test import TransactionTestCase
from django.test.utils import extend_sys_path
from django.utils.module_loading import module_dir
-from .models import FoodManager, FoodQuerySet
-
class MigrationTestBase(TransactionTestCase):
"""
@@ -57,14 +55,14 @@ class MigrationTestBase(TransactionTestCase):
def assertColumnNotNull(self, table, column, using='default'):
self.assertEqual(self._get_column_allows_null(table, column, using), False)
- def assertIndexExists(self, table, columns, value=True, using='default'):
+ def assertIndexExists(self, table, columns, value=True, using='default', index_type=None):
with connections[using].cursor() as cursor:
self.assertEqual(
value,
any(
c["index"]
for c in connections[using].introspection.get_constraints(cursor, table).values()
- if c['columns'] == list(columns)
+ if c['columns'] == list(columns) and (index_type is None or c['type'] == index_type)
),
)
@@ -266,6 +264,7 @@ class OperationTestBase(MigrationTestBase):
bases=['%s.Pony' % app_label],
))
if manager_model:
+ from .models import FoodManager, FoodQuerySet
operations.append(migrations.CreateModel(
'Food',
fields=[