/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_lockdir.py

  • Committer: Daniel Watkins
  • Date: 2007-11-06 09:33:05 UTC
  • mfrom: (2967 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2993.
  • Revision ID: d.m.watkins@warwick.ac.uk-20071106093305-zfef3c0jbcvunnuz
Merged bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006 Canonical Ltd
 
1
# Copyright (C) 2006, 2007 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
30
30
    transport,
31
31
    )
32
32
from bzrlib.errors import (
33
 
        LockBreakMismatch,
34
 
        LockContention, LockError, UnlockableTransport,
35
 
        LockNotHeld, LockBroken
36
 
        )
 
33
    LockBreakMismatch,
 
34
    LockBroken,
 
35
    LockContention,
 
36
    LockError,
 
37
    LockFailed,
 
38
    LockNotHeld,
 
39
    )
37
40
from bzrlib.lockdir import LockDir
38
41
from bzrlib.tests import TestCaseWithTransport
39
42
from bzrlib.trace import note
105
108
        """Fail to create lock on readonly transport"""
106
109
        t = self.get_readonly_transport()
107
110
        lf = LockDir(t, 'test_lock')
108
 
        self.assertRaises(UnlockableTransport, lf.create)
 
111
        self.assertRaises(LockFailed, lf.create)
109
112
 
110
113
    def test_12_lock_readonly_transport(self):
111
114
        """Fail to lock on readonly transport"""
112
115
        lf = LockDir(self.get_transport(), 'test_lock')
113
116
        lf.create()
114
117
        lf = LockDir(self.get_readonly_transport(), 'test_lock')
115
 
        self.assertRaises(UnlockableTransport, lf.attempt_lock)
 
118
        self.assertRaises(LockFailed, lf.attempt_lock)
116
119
 
117
120
    def test_20_lock_contested(self):
118
121
        """Contention to get a lock"""
599
602
        lock_path = ld1.transport.local_abspath('test_lock')
600
603
        os.mkdir(lock_path)
601
604
        osutils.make_readonly(lock_path)
602
 
        self.assertRaises(errors.PermissionDenied, ld1.attempt_lock)
 
605
        self.assertRaises(errors.LockFailed, ld1.attempt_lock)
603
606
 
604
607
    def test_lock_by_token(self):
605
608
        ld1 = self.get_lock()