Refs #32355 -- Bumped required psycopg2 version to 2.8.4.

psycopg2 2.8.4 is the first release to support Python 3.8.
This commit is contained in:
Mariusz Felisiak 2021-12-22 20:32:55 +01:00 committed by GitHub
parent c4328c2f4e
commit ca04659b4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 8 additions and 11 deletions

View File

@ -36,8 +36,8 @@ def psycopg2_version():
PSYCOPG2_VERSION = psycopg2_version() PSYCOPG2_VERSION = psycopg2_version()
if PSYCOPG2_VERSION < (2, 5, 4): if PSYCOPG2_VERSION < (2, 8, 4):
raise ImproperlyConfigured("psycopg2_version 2.5.4 or newer is required; you have %s" % psycopg2.__version__) raise ImproperlyConfigured("psycopg2 version 2.8.4 or newer is required; you have %s" % psycopg2.__version__)
# Some of these import psycopg2, so import them after checking if it's installed. # Some of these import psycopg2, so import them after checking if it's installed.

View File

@ -114,7 +114,7 @@ below for information on how to set up your database correctly.
PostgreSQL notes PostgreSQL notes
================ ================
Django supports PostgreSQL 10 and higher. `psycopg2`_ 2.5.4 or higher is Django supports PostgreSQL 10 and higher. `psycopg2`_ 2.8.4 or higher is
required, though the latest release is recommended. required, though the latest release is recommended.
.. _psycopg2: https://www.psycopg.org/ .. _psycopg2: https://www.psycopg.org/

View File

@ -419,6 +419,9 @@ Dropped support for PostgreSQL 9.6
Upstream support for PostgreSQL 9.6 ends in November 2021. Django 4.0 supports Upstream support for PostgreSQL 9.6 ends in November 2021. Django 4.0 supports
PostgreSQL 10 and higher. PostgreSQL 10 and higher.
Also, the minimum supported version of ``psycopg2`` is increased from 2.5.4 to
2.8.4, as ``psycopg2`` 2.8.4 is the first release to support Python 3.8.
Dropped support for Oracle 12.2 and 18c Dropped support for Oracle 12.2 and 18c
--------------------------------------- ---------------------------------------

View File

@ -207,9 +207,7 @@ class Tests(TestCase):
The transaction level can be configured with The transaction level can be configured with
DATABASES ['OPTIONS']['isolation_level']. DATABASES ['OPTIONS']['isolation_level'].
""" """
import psycopg2
from psycopg2.extensions import ( from psycopg2.extensions import (
ISOLATION_LEVEL_READ_COMMITTED as read_committed,
ISOLATION_LEVEL_SERIALIZABLE as serializable, ISOLATION_LEVEL_SERIALIZABLE as serializable,
) )
@ -217,8 +215,7 @@ class Tests(TestCase):
# and the isolation level isn't reported as 0. This test assumes that # and the isolation level isn't reported as 0. This test assumes that
# PostgreSQL is configured with the default isolation level. # PostgreSQL is configured with the default isolation level.
# Check the level on the psycopg2 connection, not the Django wrapper. # Check the level on the psycopg2 connection, not the Django wrapper.
default_level = read_committed if psycopg2.__version__ < '2.7' else None self.assertIsNone(connection.connection.isolation_level)
self.assertEqual(connection.connection.isolation_level, default_level)
new_connection = connection.copy() new_connection = connection.copy()
new_connection.settings_dict['OPTIONS']['isolation_level'] = serializable new_connection.settings_dict['OPTIONS']['isolation_level'] = serializable

View File

@ -36,7 +36,6 @@ try:
from django.contrib.postgres.forms import ( from django.contrib.postgres.forms import (
SimpleArrayField, SplitArrayField, SplitArrayWidget, SimpleArrayField, SplitArrayField, SplitArrayWidget,
) )
from django.db.backends.postgresql.base import PSYCOPG2_VERSION
except ImportError: except ImportError:
pass pass
@ -193,8 +192,6 @@ class TestSaveLoad(PostgreSQLTestCase):
self.assertEqual(field.base_field.model, IntegerArrayModel) self.assertEqual(field.base_field.model, IntegerArrayModel)
def test_nested_nullable_base_field(self): def test_nested_nullable_base_field(self):
if PSYCOPG2_VERSION < (2, 7, 5):
self.skipTest('See https://github.com/psycopg/psycopg2/issues/325')
instance = NullableIntegerArrayModel.objects.create( instance = NullableIntegerArrayModel.objects.create(
field_nested=[[None, None], [None, None]], field_nested=[[None, None], [None, None]],
) )

View File

@ -1 +1 @@
psycopg2>=2.5.4 psycopg2>=2.8.4