summaryrefslogtreecommitdiff
path: root/tests/postgres_tests
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2019-02-04 11:07:46 -0500
committerTim Graham <timograham@gmail.com>2019-02-04 18:07:02 -0500
commit39ebdf5a3c5e4e979c71a18b4bad73e3946b02d0 (patch)
treeba3325b4d05a2bc40a4471ac807b08e10f1f379b /tests/postgres_tests
parentd47498c5df7e8861c19fea22e5b04229b510bc3e (diff)
Fixed #30155 -- Dropped support for PostgreSQL 9.4 and PostGIS 2.1.
Diffstat (limited to 'tests/postgres_tests')
-rw-r--r--tests/postgres_tests/test_aggregates.py3
-rw-r--r--tests/postgres_tests/test_indexes.py24
2 files changed, 1 insertions, 26 deletions
diff --git a/tests/postgres_tests/test_aggregates.py b/tests/postgres_tests/test_aggregates.py
index 85d6f45fd1..ec81f5ad75 100644
--- a/tests/postgres_tests/test_aggregates.py
+++ b/tests/postgres_tests/test_aggregates.py
@@ -1,7 +1,6 @@
import json
from django.db.models.expressions import F, Value
-from django.test.testcases import skipUnlessDBFeature
from django.test.utils import Approximate
from . import PostgreSQLTestCase
@@ -184,12 +183,10 @@ class TestGeneralAggregate(PostgreSQLTestCase):
)
self.assertEqual(values, {'arrayagg': [0, 1, 0, 2]})
- @skipUnlessDBFeature('has_jsonb_agg')
def test_json_agg(self):
values = AggregateTestModel.objects.aggregate(jsonagg=JSONBAgg('char_field'))
self.assertEqual(values, {'jsonagg': ['Foo1', 'Foo2', 'Foo4', 'Foo3']})
- @skipUnlessDBFeature('has_jsonb_agg')
def test_json_agg_empty(self):
values = AggregateTestModel.objects.none().aggregate(jsonagg=JSONBAgg('integer_field'))
self.assertEqual(values, json.loads('{"jsonagg": []}'))
diff --git a/tests/postgres_tests/test_indexes.py b/tests/postgres_tests/test_indexes.py
index 3f1018c7b9..5772069d25 100644
--- a/tests/postgres_tests/test_indexes.py
+++ b/tests/postgres_tests/test_indexes.py
@@ -205,7 +205,6 @@ class SchemaTests(PostgreSQLTestCase):
editor.remove_index(CharFieldModel, index)
self.assertNotIn(index_name, self.get_constraints(CharFieldModel._meta.db_table))
- @skipUnlessDBFeature('has_gin_pending_list_limit')
def test_gin_parameters(self):
index_name = 'integer_array_gin_params'
index = GinIndex(fields=['field'], name=index_name, fastupdate=True, gin_pending_list_limit=64)
@@ -218,17 +217,6 @@ class SchemaTests(PostgreSQLTestCase):
editor.remove_index(IntegerArrayModel, index)
self.assertNotIn(index_name, self.get_constraints(IntegerArrayModel._meta.db_table))
- @mock.patch('django.db.backends.postgresql.features.DatabaseFeatures.has_gin_pending_list_limit', False)
- def test_gin_parameters_exception(self):
- index_name = 'gin_options_exception'
- index = GinIndex(fields=['field'], name=index_name, gin_pending_list_limit=64)
- msg = 'GIN option gin_pending_list_limit requires PostgreSQL 9.5+.'
- with self.assertRaisesMessage(NotSupportedError, msg):
- with connection.schema_editor() as editor:
- editor.add_index(IntegerArrayModel, index)
- self.assertNotIn(index_name, self.get_constraints(IntegerArrayModel._meta.db_table))
-
- @skipUnlessDBFeature('has_brin_index_support')
def test_brin_index(self):
index_name = 'char_field_model_field_brin'
index = BrinIndex(fields=['field'], name=index_name, pages_per_range=4)
@@ -241,7 +229,7 @@ class SchemaTests(PostgreSQLTestCase):
editor.remove_index(CharFieldModel, index)
self.assertNotIn(index_name, self.get_constraints(CharFieldModel._meta.db_table))
- @skipUnlessDBFeature('has_brin_index_support', 'has_brin_autosummarize')
+ @skipUnlessDBFeature('has_brin_autosummarize')
def test_brin_parameters(self):
index_name = 'char_field_brin_params'
index = BrinIndex(fields=['field'], name=index_name, autosummarize=True)
@@ -254,16 +242,6 @@ class SchemaTests(PostgreSQLTestCase):
editor.remove_index(CharFieldModel, index)
self.assertNotIn(index_name, self.get_constraints(CharFieldModel._meta.db_table))
- def test_brin_index_not_supported(self):
- index_name = 'brin_index_exception'
- index = BrinIndex(fields=['field'], name=index_name)
- with self.assertRaisesMessage(NotSupportedError, 'BRIN indexes require PostgreSQL 9.5+.'):
- with mock.patch('django.db.backends.postgresql.features.DatabaseFeatures.has_brin_index_support', False):
- with connection.schema_editor() as editor:
- editor.add_index(CharFieldModel, index)
- self.assertNotIn(index_name, self.get_constraints(CharFieldModel._meta.db_table))
-
- @skipUnlessDBFeature('has_brin_index_support')
def test_brin_autosummarize_not_supported(self):
index_name = 'brin_options_exception'
index = BrinIndex(fields=['field'], name=index_name, autosummarize=True)