~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_lockdir.py

  • Committer: Martin Pool
  • Date: 2006-02-21 07:48:58 UTC
  • mto: This revision was merged to the branch mainline in revision 1569.
  • Revision ID: mbp@sourcefrog.net-20060221074858-d25cba72aacf23c0
Start adding LockDir.confirm() method

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
from threading import Thread
20
20
import time
21
21
 
22
 
from bzrlib.errors import LockContention, LockError, UnlockableTransport
 
22
from bzrlib.errors import LockContention, LockError, UnlockableTransport, \
 
23
        LockNotHeld
23
24
from bzrlib.lockdir import LockDir
24
25
from bzrlib.tests import TestCaseInTempDir, TestCaseWithTransport
25
26
 
193
194
            self.assertTrue(after - before <= 1.0)
194
195
        finally:
195
196
            unlocker.join()
 
197
 
 
198
    def test_40_confirm_easy(self):
 
199
        """Confirm a lock that's already held"""
 
200
        t = self.get_transport()
 
201
        lf1 = LockDir(t, 'test_lock')
 
202
        lf1.attempt_lock()
 
203
        lf1.confirm()
 
204
 
 
205
    def test_41_confirm_not_held(self):
 
206
        """Confirm a lock that's already held"""
 
207
        t = self.get_transport()
 
208
        lf1 = LockDir(t, 'test_lock')
 
209
        self.assertRaises(LockNotHeld, lf1.confirm)