~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_lockable_files.py

  • Committer: John Arbash Meinel
  • Date: 2007-05-04 18:59:36 UTC
  • mto: This revision was merged to the branch mainline in revision 2643.
  • Revision ID: john@arbash-meinel.com-20070504185936-1mjdoqmtz74xe5mg
A C implementation of _fields_to_entry_0_parents drops the time from 400ms to 330ms for a 21k-entry tree

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
from StringIO import StringIO
18
18
 
19
19
import bzrlib
20
 
from bzrlib import (
21
 
    errors,
22
 
    lockdir,
23
 
    osutils,
24
 
    )
 
20
import bzrlib.errors as errors
25
21
from bzrlib.errors import BzrBadParameterNotString, NoSuchFile, ReadOnlyError
26
22
from bzrlib.lockable_files import LockableFiles, TransportLock
 
23
from bzrlib import lockdir
 
24
from bzrlib.lockdir import LockDir
27
25
from bzrlib.tests import TestCaseInTempDir
28
26
from bzrlib.tests.test_smart import TestCaseWithSmartMedium
29
27
from bzrlib.tests.test_transactions import DummyWeave
349
347
        self.lockable.create_lock()
350
348
 
351
349
    def get_lockable(self):
352
 
        return LockableFiles(self.transport, 'my-lock', lockdir.LockDir)
 
350
        return LockableFiles(self.transport, 'my-lock', LockDir)
353
351
 
354
352
    def test_lock_created(self):
355
353
        self.assertTrue(self.transport.has('my-lock'))
359
357
        self.assertFalse(self.transport.has('my-lock/held/info'))
360
358
        self.assertTrue(self.transport.has('my-lock'))
361
359
 
362
 
    def test__file_modes(self):
363
 
        self.transport.mkdir('readonly')
364
 
        osutils.make_readonly('readonly')
365
 
        lockable = LockableFiles(self.transport.clone('readonly'), 'test-lock',
366
 
                                 lockdir.LockDir)
367
 
        # The directory mode should be read-write-execute for the current user
368
 
        self.assertEqual(00700, lockable._dir_mode & 00700)
369
 
        # Files should be read-write for the current user
370
 
        self.assertEqual(00600, lockable._file_mode & 00700)
371
360
 
 
361
    # TODO: Test the lockdir inherits the right file and directory permissions
 
362
    # from the LockableFiles.
 
363
        
372
364
 
373
365
class TestLockableFiles_RemoteLockDir(TestCaseWithSmartMedium,
374
366
                              _TestLockableFiles_mixin):