Rev 4328: Start addressing test failing when run with -Dlock. in file:///home/vila/src/bzr/experimental/failing-lock-tests/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Tue May 5 12:28:01 BST 2009
At file:///home/vila/src/bzr/experimental/failing-lock-tests/
------------------------------------------------------------
revno: 4328
revision-id: v.ladeuil+lp at free.fr-20090505112801-6ijinkqgaymoofxq
parent: pqm at pqm.ubuntu.com-20090505094032-o2kvwmfl4dqaf1jr
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: failing-lock-tests
timestamp: Tue 2009-05-05 13:28:01 +0200
message:
Start addressing test failing when run with -Dlock.
* tests/test_lockdir.py:
Fix 7 out 10 failures when using -Dlock.
* lock.py:
(LockResult.__repr__): For debug and to make 'Broken test' traces
less obscure.
-------------- next part --------------
=== modified file 'bzrlib/lock.py'
--- a/bzrlib/lock.py 2009-03-23 14:59:43 +0000
+++ b/bzrlib/lock.py 2009-05-05 11:28:01 +0000
@@ -77,6 +77,10 @@
def __eq__(self, other):
return self.lock_url == other.lock_url and self.details == other.details
+ def __repr__(self):
+ return '%s(%s%s)' % (self.__class__.__name__,
+ self.lock_url, self.details)
+
try:
import fcntl
=== modified file 'bzrlib/tests/test_lockdir.py'
--- a/bzrlib/tests/test_lockdir.py 2009-03-23 14:59:43 +0000
+++ b/bzrlib/tests/test_lockdir.py 2009-05-05 11:28:01 +0000
@@ -142,6 +142,7 @@
lf1 = LockDir(t, 'test_lock')
lf1.create()
lf1.attempt_lock()
+ self.addCleanup(lf1.unlock)
# lock is held, should get some info on it
info1 = lf1.peek()
self.assertEqual(set(info1.keys()),
@@ -161,6 +162,7 @@
lf2 = LockDir(self.get_readonly_transport(), 'test_lock')
self.assertEqual(lf2.peek(), None)
lf1.attempt_lock()
+ self.addCleanup(lf1.unlock)
info2 = lf2.peek()
self.assertTrue(info2)
self.assertEqual(info2['nonce'], lf1.nonce)
@@ -451,6 +453,7 @@
lf1 = LockDir(t, 'test_lock')
lf1.create()
lf1.attempt_lock()
+ self.addCleanup(lf1.unlock)
lf1.confirm()
def test_41_confirm_not_held(self):
@@ -468,6 +471,9 @@
lf1.attempt_lock()
t.move('test_lock', 'lock_gone_now')
self.assertRaises(LockBroken, lf1.confirm)
+ # Clean up
+ t.move('lock_gone_now', 'test_lock')
+ lf1.unlock()
def test_43_break(self):
"""Break a lock whose caller has forgotten it"""
@@ -501,6 +507,7 @@
lf2.force_break(holder_info)
# now we should be able to take it
lf2.attempt_lock()
+ self.addCleanup(lf2.unlock)
lf2.confirm()
def test_45_break_mismatch(self):
@@ -621,9 +628,11 @@
def test_lock_by_token(self):
ld1 = self.get_lock()
token = ld1.lock_write()
+ self.addCleanup(ld1.unlock)
self.assertNotEqual(None, token)
ld2 = self.get_lock()
t2 = ld2.lock_write(token)
+ self.addCleanup(ld2.unlock)
self.assertEqual(token, t2)
def test_lock_with_buggy_rename(self):
@@ -654,6 +663,7 @@
check_dir([])
# when held, that's all we see
ld1.attempt_lock()
+ self.addCleanup(ld1.unlock)
check_dir(['held'])
# second guy should fail
self.assertRaises(errors.LockContention, ld2.attempt_lock)
More information about the bazaar-commits
mailing list