Fixed a backends test with psycopg2 2.7.
This commit is contained in:
parent
9cbf48693d
commit
49a63d08d3
|
@ -314,6 +314,7 @@ class PostgreSQLTests(TestCase):
|
||||||
"""
|
"""
|
||||||
Regression test for #18130 and #24318.
|
Regression test for #18130 and #24318.
|
||||||
"""
|
"""
|
||||||
|
import psycopg2
|
||||||
from psycopg2.extensions import (
|
from psycopg2.extensions import (
|
||||||
ISOLATION_LEVEL_READ_COMMITTED as read_committed,
|
ISOLATION_LEVEL_READ_COMMITTED as read_committed,
|
||||||
ISOLATION_LEVEL_SERIALIZABLE as serializable,
|
ISOLATION_LEVEL_SERIALIZABLE as serializable,
|
||||||
|
@ -324,7 +325,8 @@ class PostgreSQLTests(TestCase):
|
||||||
# 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.
|
||||||
self.assertEqual(connection.connection.isolation_level, read_committed)
|
default_level = read_committed if psycopg2.__version__ < '2.7' else None
|
||||||
|
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
|
||||||
|
|
Loading…
Reference in New Issue