diff options
author | Tim Graham <timograham@gmail.com> | 2017-03-01 13:14:35 -0500 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2017-03-01 13:19:11 -0500 |
commit | ead5b14d8cb85341ff0a1048abd477c3b537685c (patch) | |
tree | fb50c6e8af8eb9eef79ee9f10a9a32048bd62e68 | |
parent | fac22535ab7cc6a1ad483c6ba22d55abd8494db2 (diff) | |
download | django-ead5b14d8cb85341ff0a1048abd477c3b537685c.tar.gz |
[1.10.x] Fixed a backends test with psycopg2 2.7.
Backport of 49a63d08d3b3e2ac32e391d1413a4ac99429e4af from master
-rw-r--r-- | tests/backends/tests.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tests/backends/tests.py b/tests/backends/tests.py index 2cb5703e9d..e9c7a35ab7 100644 --- a/tests/backends/tests.py +++ b/tests/backends/tests.py @@ -292,6 +292,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, @@ -302,7 +303,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 |