~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_lockable_files.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-06-06 07:08:07 UTC
  • mfrom: (3474.1.3 countedlock)
  • Revision ID: pqm@pqm.ubuntu.com-20080606070807-q0ro9i4kgllr5mbu
(mbp) CountedLock support for lock tokens

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
from bzrlib.symbol_versioning import (
28
28
    deprecated_in,
29
29
    )
30
 
from bzrlib.tests import TestCaseInTempDir
 
30
from bzrlib.tests import (
 
31
    TestCaseInTempDir,
 
32
    TestNotApplicable,
 
33
    )
31
34
from bzrlib.tests.test_smart import TestCaseWithSmartMedium
32
35
from bzrlib.tests.test_transactions import DummyWeave
33
36
from bzrlib.transactions import (PassThroughTransaction,
154
157
        except NotImplementedError:
155
158
            # this lock cannot be broken
156
159
            self.lockable.unlock()
157
 
            return
 
160
            raise TestNotApplicable("%r is not breakable" % (self.lockable,))
158
161
        l2 = self.get_lockable()
159
162
        orig_factory = bzrlib.ui.ui_factory
160
163
        # silent ui - no need for stdout
177
180
            if token is not None:
178
181
                # This test does not apply, because this lockable supports
179
182
                # tokens.
180
 
                return
 
183
                raise TestNotApplicable("%r uses tokens" % (self.lockable,))
181
184
            self.assertRaises(errors.TokenLockingNotSupported,
182
185
                              self.lockable.lock_write, token='token')
183
186
        finally:
371
374
        super(TestLockableFiles_TransportLock, self).tearDown()
372
375
        # free the subtransport so that we do not get a 5 second
373
376
        # timeout due to the SFTP connection cache.
374
 
        del self.sub_transport
 
377
        try:
 
378
            del self.sub_transport
 
379
        except AttributeError:
 
380
            pass
375
381
 
376
382
    def get_lockable(self):
377
383
        return LockableFiles(self.sub_transport, 'my-lock', TransportLock)