mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #28626 -- Dropped support for PostgreSQL 9.3.
Thanks Simon Charette for the introspection changes.
This commit is contained in:
@@ -7,16 +7,6 @@ from django.db.backends.signals import connection_created
|
||||
from django.test import TestCase, modify_settings
|
||||
|
||||
|
||||
def skipUnlessPG94(test):
|
||||
try:
|
||||
PG_VERSION = connection.pg_version
|
||||
except AttributeError:
|
||||
PG_VERSION = 0
|
||||
if PG_VERSION < 90400:
|
||||
return unittest.skip('PostgreSQL ≥ 9.4 required')(test)
|
||||
return test
|
||||
|
||||
|
||||
@unittest.skipUnless(connection.vendor == 'postgresql', "PostgreSQL specific tests")
|
||||
class PostgreSQLTestCase(TestCase):
|
||||
@classmethod
|
||||
|
||||
@@ -242,7 +242,7 @@ class Migration(migrations.Migration):
|
||||
('field_custom', JSONField(null=True, blank=True, encoder=DjangoJSONEncoder)),
|
||||
],
|
||||
options={
|
||||
'required_db_features': {'has_jsonb_datatype'},
|
||||
'required_db_vendor': 'postgresql',
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
|
||||
@@ -140,13 +140,10 @@ class RangeLookupsModel(PostgreSQLModel):
|
||||
date = models.DateField(blank=True, null=True)
|
||||
|
||||
|
||||
class JSONModel(models.Model):
|
||||
class JSONModel(PostgreSQLModel):
|
||||
field = JSONField(blank=True, null=True)
|
||||
field_custom = JSONField(blank=True, null=True, encoder=DjangoJSONEncoder)
|
||||
|
||||
class Meta:
|
||||
required_db_features = ['has_jsonb_datatype']
|
||||
|
||||
|
||||
class ArrayFieldSubclass(ArrayField):
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
||||
@@ -4,7 +4,7 @@ from time import sleep
|
||||
|
||||
from django.contrib.postgres.functions import RandomUUID, TransactionNow
|
||||
|
||||
from . import PostgreSQLTestCase, skipUnlessPG94
|
||||
from . import PostgreSQLTestCase
|
||||
from .models import NowTestModel, UUIDTestModel
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@ class TestTransactionNow(PostgreSQLTestCase):
|
||||
self.assertEqual(m1.when, m2.when)
|
||||
|
||||
|
||||
@skipUnlessPG94
|
||||
class TestRandomUUID(PostgreSQLTestCase):
|
||||
|
||||
def test_random_uuid(self):
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
from io import StringIO
|
||||
|
||||
from django.core.management import call_command
|
||||
from django.test import skipUnlessDBFeature
|
||||
from django.test.utils import modify_settings
|
||||
|
||||
from . import PostgreSQLTestCase
|
||||
@@ -20,7 +19,6 @@ class InspectDBTests(PostgreSQLTestCase):
|
||||
for field_output in field_outputs:
|
||||
self.assertIn(field_output, output)
|
||||
|
||||
@skipUnlessDBFeature('has_jsonb_datatype')
|
||||
def test_json_field(self):
|
||||
self.assertFieldsInModel(
|
||||
'postgres_tests_jsonmodel',
|
||||
|
||||
@@ -5,7 +5,6 @@ from decimal import Decimal
|
||||
from django.core import exceptions, serializers
|
||||
from django.core.serializers.json import DjangoJSONEncoder
|
||||
from django.forms import CharField, Form, widgets
|
||||
from django.test import skipUnlessDBFeature
|
||||
from django.utils.html import escape
|
||||
|
||||
from . import PostgreSQLTestCase
|
||||
@@ -18,7 +17,6 @@ except ImportError:
|
||||
pass
|
||||
|
||||
|
||||
@skipUnlessDBFeature('has_jsonb_datatype')
|
||||
class TestSaveLoad(PostgreSQLTestCase):
|
||||
def test_null(self):
|
||||
instance = JSONModel()
|
||||
@@ -92,7 +90,6 @@ class TestSaveLoad(PostgreSQLTestCase):
|
||||
self.assertEqual(loaded.field_custom, obj_after)
|
||||
|
||||
|
||||
@skipUnlessDBFeature('has_jsonb_datatype')
|
||||
class TestQuerying(PostgreSQLTestCase):
|
||||
@classmethod
|
||||
def setUpTestData(cls):
|
||||
@@ -262,7 +259,6 @@ class TestQuerying(PostgreSQLTestCase):
|
||||
self.assertTrue(JSONModel.objects.filter(field__foo__iregex=r'^bAr$').exists())
|
||||
|
||||
|
||||
@skipUnlessDBFeature('has_jsonb_datatype')
|
||||
class TestSerialization(PostgreSQLTestCase):
|
||||
test_data = (
|
||||
'[{"fields": {"field": {"a": "b", "c": null}, "field_custom": null}, '
|
||||
|
||||
Reference in New Issue
Block a user