summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorHasan Ramezani <hasan.r67@gmail.com>2019-07-14 01:24:35 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2019-07-19 11:05:06 +0200
commit1fc2c70f7613e014a31771afa537439b28dd35fb (patch)
treedae8ebfe89e687edb518bd6031d89f9c47f774c9 /tests
parent7f612eda80db1c1c8e502aced54c2062080eae46 (diff)
Fixed #30593 -- Added support for check constraints on MariaDB 10.2+.
Diffstat (limited to 'tests')
-rw-r--r--tests/constraints/tests.py4
-rw-r--r--tests/introspection/tests.py5
-rw-r--r--tests/schema/tests.py4
3 files changed, 8 insertions, 5 deletions
diff --git a/tests/constraints/tests.py b/tests/constraints/tests.py
index c2f99c565d..7ac478a89f 100644
--- a/tests/constraints/tests.py
+++ b/tests/constraints/tests.py
@@ -73,7 +73,7 @@ class CheckConstraintTests(TestCase):
with self.assertRaises(IntegrityError):
Product.objects.create(name='Invalid', price=10, discounted_price=20)
- @skipUnlessDBFeature('supports_table_check_constraints')
+ @skipUnlessDBFeature('supports_table_check_constraints', 'can_introspect_check_constraints')
def test_name(self):
constraints = get_constraints(Product._meta.db_table)
for expected_name in (
@@ -83,7 +83,7 @@ class CheckConstraintTests(TestCase):
with self.subTest(expected_name):
self.assertIn(expected_name, constraints)
- @skipUnlessDBFeature('supports_table_check_constraints')
+ @skipUnlessDBFeature('supports_table_check_constraints', 'can_introspect_check_constraints')
def test_abstract_name(self):
constraints = get_constraints(ChildModel._meta.db_table)
self.assertIn('constraints_childmodel_adult', constraints)
diff --git a/tests/introspection/tests.py b/tests/introspection/tests.py
index 10524cdacb..7edb01a4b7 100644
--- a/tests/introspection/tests.py
+++ b/tests/introspection/tests.py
@@ -237,7 +237,10 @@ class IntrospectionTests(TransactionTestCase):
'article_email_pub_date_uniq',
'email_pub_date_idx',
}
- if connection.features.supports_column_check_constraints:
+ if (
+ connection.features.supports_column_check_constraints and
+ connection.features.can_introspect_check_constraints
+ ):
custom_constraints.add('up_votes_gte_0_check')
assertDetails(constraints['up_votes_gte_0_check'], ['up_votes'], check=True)
assertDetails(constraints['article_email_pub_date_uniq'], ['article_id', 'email', 'pub_date'], unique=True)
diff --git a/tests/schema/tests.py b/tests/schema/tests.py
index 91760987d7..2a22e9dec3 100644
--- a/tests/schema/tests.py
+++ b/tests/schema/tests.py
@@ -1556,7 +1556,7 @@ class SchemaTests(TransactionTestCase):
# Ensure the m2m table is still there.
self.assertEqual(len(self.column_classes(LocalM2M)), 1)
- @skipUnlessDBFeature('supports_column_check_constraints')
+ @skipUnlessDBFeature('supports_column_check_constraints', 'can_introspect_check_constraints')
def test_check_constraints(self):
"""
Tests creating/deleting CHECK constraints
@@ -1586,7 +1586,7 @@ class SchemaTests(TransactionTestCase):
if not any(details['columns'] == ['height'] and details['check'] for details in constraints.values()):
self.fail("No check constraint for height found")
- @skipUnlessDBFeature('supports_column_check_constraints')
+ @skipUnlessDBFeature('supports_column_check_constraints', 'can_introspect_check_constraints')
def test_remove_field_check_does_not_remove_meta_constraints(self):
with connection.schema_editor() as editor:
editor.create_model(Author)