Loading tests/migrations/test_operations.py +2 −2 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ from django.db.migrations.state import ProjectState from django.db.models.fields import NOT_PROVIDED from django.db.transaction import atomic from django.db.utils import IntegrityError from django.test import override_settings from django.test import override_settings, skipUnlessDBFeature from django.utils import six from .models import FoodManager, FoodQuerySet Loading Loading @@ -1114,7 +1114,7 @@ class OperationTests(OperationTestBase): with connection.schema_editor() as editor: operation.database_backwards("test_alflpk", editor, new_state, project_state) @unittest.skipUnless(connection.features.supports_foreign_keys, "No FK support") @skipUnlessDBFeature('supports_foreign_keys') def test_alter_field_pk_fk(self): """ Tests the AlterField operation on primary keys changes any FKs pointing to it. Loading tests/queries/tests.py +1 −2 Original line number Diff line number Diff line Loading @@ -1964,8 +1964,7 @@ class ExistsSql(TestCase): self.assertTrue(Article.objects.distinct()[1:3].exists()) self.assertFalse(Article.objects.distinct()[1:1].exists()) @unittest.skipUnless(connection.features.can_distinct_on_fields, 'Uses distinct(fields)') @skipUnlessDBFeature('can_distinct_on_fields') def test_ticket_18414_distinct_on(self): Article.objects.create(name='one', created=datetime.datetime.now()) Article.objects.create(name='one', created=datetime.datetime.now()) Loading tests/schema/tests.py +17 −15 Original line number Diff line number Diff line Loading @@ -17,7 +17,9 @@ from django.db.models.fields.related import ( ForeignKey, ForeignObject, ManyToManyField, OneToOneField, ) from django.db.transaction import atomic from django.test import TransactionTestCase, skipIfDBFeature from django.test import ( TransactionTestCase, skipIfDBFeature, skipUnlessDBFeature, ) from .fields import ( CustomManyToManyField, InheritedManyToManyField, MediumBlobField, Loading Loading @@ -142,7 +144,7 @@ class SchemaTests(TransactionTestCase): lambda: list(Author.objects.all()), ) @unittest.skipUnless(connection.features.supports_foreign_keys, "No FK support") @skipUnlessDBFeature('supports_foreign_keys') def test_fk(self): "Tests that creating tables out of FK order, then repointing, works" # Create the table Loading Loading @@ -175,7 +177,7 @@ class SchemaTests(TransactionTestCase): else: self.fail("No FK constraint for author_id found") @unittest.skipUnless(connection.features.supports_foreign_keys, "No FK support") @skipUnlessDBFeature('supports_foreign_keys') def test_fk_db_constraint(self): "Tests that the db_constraint parameter is respected" # Create the table Loading Loading @@ -255,15 +257,15 @@ class SchemaTests(TransactionTestCase): if details['columns'] == ["tag_id"] and details['foreign_key']: self.fail("FK constraint for tag_id found") @unittest.skipUnless(connection.features.supports_foreign_keys, "No FK support") @skipUnlessDBFeature('supports_foreign_keys') def test_m2m_db_constraint(self): self._test_m2m_db_constraint(ManyToManyField) @unittest.skipUnless(connection.features.supports_foreign_keys, "No FK support") @skipUnlessDBFeature('supports_foreign_keys') def test_m2m_db_constraint_custom(self): self._test_m2m_db_constraint(CustomManyToManyField) @unittest.skipUnless(connection.features.supports_foreign_keys, "No FK support") @skipUnlessDBFeature('supports_foreign_keys') def test_m2m_db_constraint_inherited(self): self._test_m2m_db_constraint(InheritedManyToManyField) Loading Loading @@ -589,7 +591,7 @@ class SchemaTests(TransactionTestCase): with connection.schema_editor() as editor: editor.alter_field(Note, old_field, new_field) @unittest.skipUnless(connection.features.supports_combined_alters, "No combined ALTER support") @skipUnlessDBFeature('supports_combined_alters') def test_alter_null_to_not_null_keeping_default(self): """ #23738 - Can change a nullable field with default to non-nullable Loading @@ -611,7 +613,7 @@ class SchemaTests(TransactionTestCase): columns = self.column_classes(AuthorWithDefaultHeight) self.assertFalse(columns['height'][1][6]) @unittest.skipUnless(connection.features.supports_foreign_keys, "No FK support") @skipUnlessDBFeature('supports_foreign_keys') def test_alter_fk(self): """ Tests altering of FKs Loading Loading @@ -649,7 +651,7 @@ class SchemaTests(TransactionTestCase): else: self.fail("No FK constraint for author_id found") @unittest.skipUnless(connection.features.supports_foreign_keys, "No FK support") @skipUnlessDBFeature('supports_foreign_keys') def test_alter_to_fk(self): """ #24447 - Tests adding a FK constraint for an existing column Loading Loading @@ -688,7 +690,7 @@ class SchemaTests(TransactionTestCase): else: self.fail("No FK constraint for author_id found") @unittest.skipUnless(connection.features.supports_foreign_keys, "No FK support") @skipUnlessDBFeature('supports_foreign_keys') def test_alter_o2o_to_fk(self): """ #24163 - Tests altering of OneToOneField to ForeignKey Loading Loading @@ -735,7 +737,7 @@ class SchemaTests(TransactionTestCase): author_is_fk = True self.assertTrue(author_is_fk, "No FK constraint for author_id found") @unittest.skipUnless(connection.features.supports_foreign_keys, "No FK support") @skipUnlessDBFeature('supports_foreign_keys') def test_alter_fk_to_o2o(self): """ #24163 - Tests altering of ForeignKey to OneToOneField Loading Loading @@ -1131,7 +1133,7 @@ class SchemaTests(TransactionTestCase): def test_m2m_repoint_inherited(self): self._test_m2m_repoint(InheritedManyToManyField) @unittest.skipUnless(connection.features.supports_column_check_constraints, "No check constraints") @skipUnlessDBFeature('supports_column_check_constraints') def test_check_constraints(self): """ Tests creating/deleting CHECK constraints Loading Loading @@ -1473,7 +1475,7 @@ class SchemaTests(TransactionTestCase): except SomeError: self.assertFalse(connection.in_atomic_block) @unittest.skipUnless(connection.features.supports_foreign_keys, "No FK support") @skipUnlessDBFeature('supports_foreign_keys') def test_foreign_key_index_long_names_regression(self): """ Regression test for #21497. Loading @@ -1492,7 +1494,7 @@ class SchemaTests(TransactionTestCase): self.get_indexes(BookWithLongName._meta.db_table), ) @unittest.skipUnless(connection.features.supports_foreign_keys, "No FK support") @skipUnlessDBFeature('supports_foreign_keys') def test_add_foreign_key_long_names(self): """ Regression test for #23009. Loading Loading @@ -1540,7 +1542,7 @@ class SchemaTests(TransactionTestCase): lambda: list(Thing.objects.all()), ) @unittest.skipUnless(connection.features.supports_foreign_keys, "No FK support") @skipUnlessDBFeature('supports_foreign_keys') def test_remove_constraints_capital_letters(self): """ #23065 - Constraint names must be quoted if they contain capital letters. Loading Loading
tests/migrations/test_operations.py +2 −2 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ from django.db.migrations.state import ProjectState from django.db.models.fields import NOT_PROVIDED from django.db.transaction import atomic from django.db.utils import IntegrityError from django.test import override_settings from django.test import override_settings, skipUnlessDBFeature from django.utils import six from .models import FoodManager, FoodQuerySet Loading Loading @@ -1114,7 +1114,7 @@ class OperationTests(OperationTestBase): with connection.schema_editor() as editor: operation.database_backwards("test_alflpk", editor, new_state, project_state) @unittest.skipUnless(connection.features.supports_foreign_keys, "No FK support") @skipUnlessDBFeature('supports_foreign_keys') def test_alter_field_pk_fk(self): """ Tests the AlterField operation on primary keys changes any FKs pointing to it. Loading
tests/queries/tests.py +1 −2 Original line number Diff line number Diff line Loading @@ -1964,8 +1964,7 @@ class ExistsSql(TestCase): self.assertTrue(Article.objects.distinct()[1:3].exists()) self.assertFalse(Article.objects.distinct()[1:1].exists()) @unittest.skipUnless(connection.features.can_distinct_on_fields, 'Uses distinct(fields)') @skipUnlessDBFeature('can_distinct_on_fields') def test_ticket_18414_distinct_on(self): Article.objects.create(name='one', created=datetime.datetime.now()) Article.objects.create(name='one', created=datetime.datetime.now()) Loading
tests/schema/tests.py +17 −15 Original line number Diff line number Diff line Loading @@ -17,7 +17,9 @@ from django.db.models.fields.related import ( ForeignKey, ForeignObject, ManyToManyField, OneToOneField, ) from django.db.transaction import atomic from django.test import TransactionTestCase, skipIfDBFeature from django.test import ( TransactionTestCase, skipIfDBFeature, skipUnlessDBFeature, ) from .fields import ( CustomManyToManyField, InheritedManyToManyField, MediumBlobField, Loading Loading @@ -142,7 +144,7 @@ class SchemaTests(TransactionTestCase): lambda: list(Author.objects.all()), ) @unittest.skipUnless(connection.features.supports_foreign_keys, "No FK support") @skipUnlessDBFeature('supports_foreign_keys') def test_fk(self): "Tests that creating tables out of FK order, then repointing, works" # Create the table Loading Loading @@ -175,7 +177,7 @@ class SchemaTests(TransactionTestCase): else: self.fail("No FK constraint for author_id found") @unittest.skipUnless(connection.features.supports_foreign_keys, "No FK support") @skipUnlessDBFeature('supports_foreign_keys') def test_fk_db_constraint(self): "Tests that the db_constraint parameter is respected" # Create the table Loading Loading @@ -255,15 +257,15 @@ class SchemaTests(TransactionTestCase): if details['columns'] == ["tag_id"] and details['foreign_key']: self.fail("FK constraint for tag_id found") @unittest.skipUnless(connection.features.supports_foreign_keys, "No FK support") @skipUnlessDBFeature('supports_foreign_keys') def test_m2m_db_constraint(self): self._test_m2m_db_constraint(ManyToManyField) @unittest.skipUnless(connection.features.supports_foreign_keys, "No FK support") @skipUnlessDBFeature('supports_foreign_keys') def test_m2m_db_constraint_custom(self): self._test_m2m_db_constraint(CustomManyToManyField) @unittest.skipUnless(connection.features.supports_foreign_keys, "No FK support") @skipUnlessDBFeature('supports_foreign_keys') def test_m2m_db_constraint_inherited(self): self._test_m2m_db_constraint(InheritedManyToManyField) Loading Loading @@ -589,7 +591,7 @@ class SchemaTests(TransactionTestCase): with connection.schema_editor() as editor: editor.alter_field(Note, old_field, new_field) @unittest.skipUnless(connection.features.supports_combined_alters, "No combined ALTER support") @skipUnlessDBFeature('supports_combined_alters') def test_alter_null_to_not_null_keeping_default(self): """ #23738 - Can change a nullable field with default to non-nullable Loading @@ -611,7 +613,7 @@ class SchemaTests(TransactionTestCase): columns = self.column_classes(AuthorWithDefaultHeight) self.assertFalse(columns['height'][1][6]) @unittest.skipUnless(connection.features.supports_foreign_keys, "No FK support") @skipUnlessDBFeature('supports_foreign_keys') def test_alter_fk(self): """ Tests altering of FKs Loading Loading @@ -649,7 +651,7 @@ class SchemaTests(TransactionTestCase): else: self.fail("No FK constraint for author_id found") @unittest.skipUnless(connection.features.supports_foreign_keys, "No FK support") @skipUnlessDBFeature('supports_foreign_keys') def test_alter_to_fk(self): """ #24447 - Tests adding a FK constraint for an existing column Loading Loading @@ -688,7 +690,7 @@ class SchemaTests(TransactionTestCase): else: self.fail("No FK constraint for author_id found") @unittest.skipUnless(connection.features.supports_foreign_keys, "No FK support") @skipUnlessDBFeature('supports_foreign_keys') def test_alter_o2o_to_fk(self): """ #24163 - Tests altering of OneToOneField to ForeignKey Loading Loading @@ -735,7 +737,7 @@ class SchemaTests(TransactionTestCase): author_is_fk = True self.assertTrue(author_is_fk, "No FK constraint for author_id found") @unittest.skipUnless(connection.features.supports_foreign_keys, "No FK support") @skipUnlessDBFeature('supports_foreign_keys') def test_alter_fk_to_o2o(self): """ #24163 - Tests altering of ForeignKey to OneToOneField Loading Loading @@ -1131,7 +1133,7 @@ class SchemaTests(TransactionTestCase): def test_m2m_repoint_inherited(self): self._test_m2m_repoint(InheritedManyToManyField) @unittest.skipUnless(connection.features.supports_column_check_constraints, "No check constraints") @skipUnlessDBFeature('supports_column_check_constraints') def test_check_constraints(self): """ Tests creating/deleting CHECK constraints Loading Loading @@ -1473,7 +1475,7 @@ class SchemaTests(TransactionTestCase): except SomeError: self.assertFalse(connection.in_atomic_block) @unittest.skipUnless(connection.features.supports_foreign_keys, "No FK support") @skipUnlessDBFeature('supports_foreign_keys') def test_foreign_key_index_long_names_regression(self): """ Regression test for #21497. Loading @@ -1492,7 +1494,7 @@ class SchemaTests(TransactionTestCase): self.get_indexes(BookWithLongName._meta.db_table), ) @unittest.skipUnless(connection.features.supports_foreign_keys, "No FK support") @skipUnlessDBFeature('supports_foreign_keys') def test_add_foreign_key_long_names(self): """ Regression test for #23009. Loading Loading @@ -1540,7 +1542,7 @@ class SchemaTests(TransactionTestCase): lambda: list(Thing.objects.all()), ) @unittest.skipUnless(connection.features.supports_foreign_keys, "No FK support") @skipUnlessDBFeature('supports_foreign_keys') def test_remove_constraints_capital_letters(self): """ #23065 - Constraint names must be quoted if they contain capital letters. Loading