Skip to content

Commit d57572e

Browse files
author
James William Pye
committed
Make the alock test failures consistent.
1 parent ccb68c9 commit d57572e

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

postgresql/test/test_alock.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@ def testALockWait(self):
1717
self.failUnlessEqual(ad(), 0)
1818
state = [False, False, False]
1919
alt = new()
20+
first = alock.ExclusiveLock(db, (0,0))
21+
second = alock.ExclusiveLock(db, 1)
2022
def concurrent_lock():
2123
try:
22-
with alock.ExclusiveLock(alt, (1,1)):
24+
with alock.ExclusiveLock(alt, 1):
2325
with alock.ExclusiveLock(alt, (0,0)):
2426
# start it
2527
state[0] = True
@@ -37,10 +39,10 @@ def concurrent_lock():
3739
time.sleep(0.01)
3840
self.failUnlessEqual(ad(), 2)
3941
state[1] = True
40-
with alock.ExclusiveLock(db, (0,0)):
42+
with first:
4143
self.failUnlessEqual(ad(), 2)
4244
state[2] = True
43-
with alock.ExclusiveLock(db, (1,1)):
45+
with second:
4446
self.failUnlessEqual(ad(), 2)
4547
t.join(timeout = 1)
4648

0 commit comments

Comments
 (0)