~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_lockdir.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-02-01 20:24:03 UTC
  • mfrom: (1551.10.4 Aaron's mergeable stuff)
  • Revision ID: pqm@pqm.ubuntu.com-20070201202403-7e92ef4d6842ba85
Treat Permission Denied as a lock failure, not lock contention

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
"""Tests for LockDir"""
18
18
 
19
19
from cStringIO import StringIO
 
20
import os
20
21
from threading import Thread, Lock
21
22
import time
22
23
 
23
24
import bzrlib
24
25
from bzrlib import (
25
26
    config,
 
27
    errors,
26
28
    osutils,
 
29
    tests,
27
30
    )
28
31
from bzrlib.errors import (
29
32
        LockBreakMismatch,
600
603
        ld1.create()
601
604
        ld1.lock_write()
602
605
        ld1.unlock()
 
606
 
 
607
    def test_lock_permission(self):
 
608
        if not osutils.supports_posix_readonly():
 
609
            raise tests.TestSkipped('Cannot induce a permission failure')
 
610
        ld1 = self.get_lock()
 
611
        lock_path = ld1.transport.local_abspath('test_lock')
 
612
        os.mkdir(lock_path)
 
613
        osutils.make_readonly(lock_path)
 
614
        self.assertRaises(errors.PermissionDenied, ld1.attempt_lock)