summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2017-03-01 13:14:35 -0500
committerTim Graham <timograham@gmail.com>2017-03-01 13:20:51 -0500
commite2a30959a773b7899f5888ef259a62120ae5ba78 (patch)
tree60087374cb7d83245cd06d099d4a7d3c3e5b0eaa
parent740cdbea0496e519c1c3ab503c1c68f0e1198579 (diff)
[1.9.x] Fixed a backends test with psycopg2 2.7.
Backport of 49a63d08d3b3e2ac32e391d1413a4ac99429e4af from master
-rw-r--r--tests/backends/tests.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/tests/backends/tests.py b/tests/backends/tests.py
index 1bb019bb55..9af662b6fb 100644
--- a/tests/backends/tests.py
+++ b/tests/backends/tests.py
@@ -294,6 +294,7 @@ class PostgreSQLTests(TestCase):
"""
Regression test for #18130 and #24318.
"""
+ import psycopg2
from psycopg2.extensions import (
ISOLATION_LEVEL_READ_COMMITTED as read_committed,
ISOLATION_LEVEL_SERIALIZABLE as serializable,
@@ -304,7 +305,8 @@ class PostgreSQLTests(TestCase):
# PostgreSQL is configured with the default isolation level.
# 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.settings_dict['OPTIONS']['isolation_level'] = serializable