Refs #11964 -- Made constraint support check respect required_db_features.

This will notably silence the warnings issued when running the test
suite on MySQL.
This commit is contained in:
Simon Charette 2019-08-10 02:41:18 -04:00 committed by Mariusz Felisiak
parent 2fb872e56f
commit 8b3e1b6e9e
6 changed files with 67 additions and 26 deletions

View file

@ -1191,3 +1191,13 @@ class ConstraintsTests(SimpleTestCase):
)
expected = [] if connection.features.supports_table_check_constraints else [warn, warn]
self.assertCountEqual(errors, expected)
def test_check_constraints_required_db_features(self):
class Model(models.Model):
age = models.IntegerField()
class Meta:
required_db_features = {'supports_table_check_constraints'}
constraints = [models.CheckConstraint(check=models.Q(age__gte=18), name='is_adult')]
self.assertEqual(Model.check(), [])