summaryrefslogtreecommitdiff
path: root/tests/postgres_tests
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2022-05-19 09:26:48 +0200
committerGitHub <noreply@github.com>2022-05-19 09:26:48 +0200
commit981c23c0ccbcaa155a80f894fd9e832beaab661d (patch)
treee74d0d4ef436c10bbd426d8197f8486e551f2144 /tests/postgres_tests
parent9f5548952906c6ea97200c016734b4f519520a64 (diff)
Fixed #33717 -- Dropped support for PostgreSQL 11.
Diffstat (limited to 'tests/postgres_tests')
-rw-r--r--tests/postgres_tests/test_constraints.py26
-rw-r--r--tests/postgres_tests/test_indexes.py15
-rw-r--r--tests/postgres_tests/test_operations.py25
-rw-r--r--tests/postgres_tests/test_trigram.py6
4 files changed, 3 insertions, 69 deletions
diff --git a/tests/postgres_tests/test_constraints.py b/tests/postgres_tests/test_constraints.py
index b8e53eb4a0..d36c6fd9ed 100644
--- a/tests/postgres_tests/test_constraints.py
+++ b/tests/postgres_tests/test_constraints.py
@@ -845,7 +845,6 @@ class ExclusionConstraintTests(PostgreSQLTestCase):
RangesModel.objects.create(ints=(10, 19))
RangesModel.objects.create(ints=(51, 60))
- @skipUnlessDBFeature("supports_covering_gist_indexes")
def test_range_adjacent_gist_include(self):
constraint_name = "ints_adjacent_gist_include"
self.assertNotIn(
@@ -887,7 +886,6 @@ class ExclusionConstraintTests(PostgreSQLTestCase):
RangesModel.objects.create(ints=(10, 19))
RangesModel.objects.create(ints=(51, 60))
- @skipUnlessDBFeature("supports_covering_gist_indexes")
def test_range_adjacent_gist_include_condition(self):
constraint_name = "ints_adjacent_gist_include_condition"
self.assertNotIn(
@@ -921,7 +919,6 @@ class ExclusionConstraintTests(PostgreSQLTestCase):
editor.add_constraint(RangesModel, constraint)
self.assertIn(constraint_name, self.get_constraints(RangesModel._meta.db_table))
- @skipUnlessDBFeature("supports_covering_gist_indexes")
def test_range_adjacent_gist_include_deferrable(self):
constraint_name = "ints_adjacent_gist_include_deferrable"
self.assertNotIn(
@@ -955,27 +952,6 @@ class ExclusionConstraintTests(PostgreSQLTestCase):
editor.add_constraint(RangesModel, constraint)
self.assertIn(constraint_name, self.get_constraints(RangesModel._meta.db_table))
- def test_gist_include_not_supported(self):
- constraint_name = "ints_adjacent_gist_include_not_supported"
- constraint = ExclusionConstraint(
- name=constraint_name,
- expressions=[("ints", RangeOperators.ADJACENT_TO)],
- index_type="gist",
- include=["id"],
- )
- msg = (
- "Covering exclusion constraints using a GiST index require "
- "PostgreSQL 12+."
- )
- with connection.schema_editor() as editor:
- with mock.patch(
- "django.db.backends.postgresql.features.DatabaseFeatures."
- "supports_covering_gist_indexes",
- False,
- ):
- with self.assertRaisesMessage(NotSupportedError, msg):
- editor.add_constraint(RangesModel, constraint)
-
def test_spgist_include_not_supported(self):
constraint_name = "ints_adjacent_spgist_include_not_supported"
constraint = ExclusionConstraint(
@@ -1062,7 +1038,6 @@ class ExclusionConstraintTests(PostgreSQLTestCase):
editor.add_constraint(RangesModel, constraint)
self.assertIn(constraint_name, self.get_constraints(RangesModel._meta.db_table))
- @skipUnlessDBFeature("supports_covering_gist_indexes")
def test_range_adjacent_gist_opclass_include(self):
constraint_name = "ints_adjacent_gist_opclass_include"
self.assertNotIn(
@@ -1210,7 +1185,6 @@ class ExclusionConstraintOpclassesDepracationTests(PostgreSQLTestCase):
self.assertIn(constraint_name, self.get_constraints(RangesModel._meta.db_table))
@ignore_warnings(category=RemovedInDjango50Warning)
- @skipUnlessDBFeature("supports_covering_gist_indexes")
def test_range_adjacent_gist_opclasses_include(self):
constraint_name = "ints_adjacent_gist_opclasses_include"
self.assertNotIn(
diff --git a/tests/postgres_tests/test_indexes.py b/tests/postgres_tests/test_indexes.py
index 9da2f33ae8..dc1064b35d 100644
--- a/tests/postgres_tests/test_indexes.py
+++ b/tests/postgres_tests/test_indexes.py
@@ -505,7 +505,6 @@ class SchemaTests(PostgreSQLTestCase):
index_name, self.get_constraints(CharFieldModel._meta.db_table)
)
- @skipUnlessDBFeature("supports_covering_gist_indexes")
def test_gist_include(self):
index_name = "scene_gist_include_setting"
index = GistIndex(name=index_name, fields=["scene"], include=["setting"])
@@ -519,20 +518,6 @@ class SchemaTests(PostgreSQLTestCase):
editor.remove_index(Scene, index)
self.assertNotIn(index_name, self.get_constraints(Scene._meta.db_table))
- def test_gist_include_not_supported(self):
- index_name = "gist_include_exception"
- index = GistIndex(fields=["scene"], name=index_name, include=["setting"])
- msg = "Covering GiST indexes require PostgreSQL 12+."
- with self.assertRaisesMessage(NotSupportedError, msg):
- with mock.patch(
- "django.db.backends.postgresql.features.DatabaseFeatures."
- "supports_covering_gist_indexes",
- False,
- ):
- with connection.schema_editor() as editor:
- editor.add_index(Scene, index)
- self.assertNotIn(index_name, self.get_constraints(Scene._meta.db_table))
-
def test_tsvector_op_class_gist_index(self):
index_name = "tsvector_op_class_gist"
index = GistIndex(
diff --git a/tests/postgres_tests/test_operations.py b/tests/postgres_tests/test_operations.py
index a54f8811ba..f395198533 100644
--- a/tests/postgres_tests/test_operations.py
+++ b/tests/postgres_tests/test_operations.py
@@ -1,5 +1,4 @@
import unittest
-from unittest import mock
from migrations.test_base import OperationTestBase
@@ -7,7 +6,7 @@ from django.db import IntegrityError, NotSupportedError, connection, transaction
from django.db.migrations.state import ProjectState
from django.db.models import CheckConstraint, Index, Q, UniqueConstraint
from django.db.utils import ProgrammingError
-from django.test import modify_settings, override_settings, skipUnlessDBFeature
+from django.test import modify_settings, override_settings
from django.test.utils import CaptureQueriesContext
from . import PostgreSQLTestCase
@@ -318,7 +317,6 @@ class CreateCollationTests(PostgreSQLTestCase):
self.assertEqual(args, [])
self.assertEqual(kwargs, {"name": "C_test", "locale": "C"})
- @skipUnlessDBFeature("supports_non_deterministic_collations")
def test_create_non_deterministic_collation(self):
operation = CreateCollation(
"case_insensitive_test",
@@ -383,27 +381,6 @@ class CreateCollationTests(PostgreSQLTestCase):
self.assertEqual(len(captured_queries), 1)
self.assertIn("DROP COLLATION", captured_queries[0]["sql"])
- def test_nondeterministic_collation_not_supported(self):
- operation = CreateCollation(
- "case_insensitive_test",
- provider="icu",
- locale="und-u-ks-level2",
- deterministic=False,
- )
- project_state = ProjectState()
- new_state = project_state.clone()
- msg = "Non-deterministic collations require PostgreSQL 12+."
- with connection.schema_editor(atomic=False) as editor:
- with mock.patch(
- "django.db.backends.postgresql.features.DatabaseFeatures."
- "supports_non_deterministic_collations",
- False,
- ):
- with self.assertRaisesMessage(NotSupportedError, msg):
- operation.database_forwards(
- self.app_label, editor, project_state, new_state
- )
-
@unittest.skipUnless(connection.vendor == "postgresql", "PostgreSQL specific tests.")
class RemoveCollationTests(PostgreSQLTestCase):
diff --git a/tests/postgres_tests/test_trigram.py b/tests/postgres_tests/test_trigram.py
index a0502e0b9b..6870e80737 100644
--- a/tests/postgres_tests/test_trigram.py
+++ b/tests/postgres_tests/test_trigram.py
@@ -46,8 +46,7 @@ class TrigramTest(PostgreSQLTestCase):
def test_trigram_similarity(self):
search = "Bat sat on cat."
- # Round result of similarity because PostgreSQL 12+ uses greater
- # precision.
+ # Round result of similarity because PostgreSQL uses greater precision.
self.assertQuerysetEqual(
self.Model.objects.filter(
field__trigram_similar=search,
@@ -77,8 +76,7 @@ class TrigramTest(PostgreSQLTestCase):
)
def test_trigram_similarity_alternate(self):
- # Round result of distance because PostgreSQL 12+ uses greater
- # precision.
+ # Round result of distance because PostgreSQL uses greater precision.
self.assertQuerysetEqual(
self.Model.objects.annotate(
distance=TrigramDistance("field", "Bat sat on cat."),