Merge lp:~cjwatson/storm/fix-isolation-level-psycopg2-version into lp:storm

Proposed by Colin Watson
Status: Merged
Merged at revision: 495
Proposed branch: lp:~cjwatson/storm/fix-isolation-level-psycopg2-version
Merge into: lp:storm
Diff against target: 18 lines (+2/-2)
1 file modified
tests/databases/postgres.py (+2/-2)
To merge this branch: bzr merge lp:~cjwatson/storm/fix-isolation-level-psycopg2-version
Reviewer Review Type Date Requested Status
Adam Collard (community) Approve
Review via email: mp+368207@code.launchpad.net

Commit message

Fix tests with psycopg2 2.4 and 2.4.1.

Description of the change

Support for the REPEATABLE READ isolation level was only added in psycopg2 2.4.2, not 2.4 (see http://initd.org/psycopg/docs/news.html#what-s-new-in-psycopg-2-4-2). Correct the version guard in the test suite to make it easier to run test matrixes that include psycopg2 2.4 and 2.4.1.

To post a comment you must log in.
Revision history for this message
Adam Collard (adam-collard) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/databases/postgres.py'
2--- tests/databases/postgres.py 2019-05-30 13:39:54 +0000
3+++ tests/databases/postgres.py 2019-05-31 19:10:56 +0000
4@@ -603,12 +603,12 @@
5 def test_default_isolation(self):
6 """
7 The default isolation level is REPEATABLE READ, but it's only supported
8- by psycopg2 2.4 and newer. Before, SERIALIZABLE is used instead.
9+ by psycopg2 2.4.2 and newer. Before, SERIALIZABLE is used instead.
10 """
11 result = self.connection.execute("SHOW TRANSACTION ISOLATION LEVEL")
12 import psycopg2
13 psycopg2_version = psycopg2.__version__.split(None, 1)[0]
14- if psycopg2_version < "2.4":
15+ if psycopg2_version < "2.4.2":
16 self.assertEquals(result.get_one()[0], u"serializable")
17 else:
18 self.assertEquals(result.get_one()[0], u"repeatable read")

Subscribers

People subscribed via source and target branches

to status/vote changes: