~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_lockable_files.py

  • Committer: Vincent Ladeuil
  • Date: 2016-01-21 11:42:23 UTC
  • mto: This revision was merged to the branch mainline in revision 6610.
  • Revision ID: v.ladeuil+lp@free.fr-20160121114223-ngcvndi02ydiqs5z
Allow hyphens in option names to unbreak compatibility.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006, 2008, 2009 Canonical Ltd
 
1
# Copyright (C) 2005-2011 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
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
 
from StringIO import StringIO
18
 
 
19
17
import bzrlib
20
18
from bzrlib import (
21
19
    errors,
22
20
    lockdir,
23
21
    osutils,
 
22
    transport,
24
23
    )
25
 
from bzrlib.errors import BzrBadParameterNotString, NoSuchFile, ReadOnlyError
26
24
from bzrlib.lockable_files import LockableFiles, TransportLock
27
 
from bzrlib.symbol_versioning import (
28
 
    deprecated_in,
29
 
    )
30
25
from bzrlib.tests import (
31
26
    TestCaseInTempDir,
32
27
    TestNotApplicable,
37
32
                                 ReadOnlyTransaction,
38
33
                                 WriteTransaction,
39
34
                                 )
40
 
from bzrlib.transport import get_transport
41
35
 
42
36
 
43
37
# these tests are applied in each parameterized suite for LockableFiles
278
272
                                      _TestLockableFiles_mixin):
279
273
 
280
274
    def setUp(self):
281
 
        TestCaseInTempDir.setUp(self)
282
 
        transport = get_transport('.')
283
 
        transport.mkdir('.bzr')
284
 
        self.sub_transport = transport.clone('.bzr')
 
275
        super(TestLockableFiles_TransportLock, self).setUp()
 
276
        t = transport.get_transport_from_path('.')
 
277
        t.mkdir('.bzr')
 
278
        self.sub_transport = t.clone('.bzr')
285
279
        self.lockable = self.get_lockable()
286
280
        self.lockable.create_lock()
287
281
 
288
 
    def tearDown(self):
289
 
        super(TestLockableFiles_TransportLock, self).tearDown()
 
282
    def stop_server(self):
 
283
        super(TestLockableFiles_TransportLock, self).stop_server()
290
284
        # free the subtransport so that we do not get a 5 second
291
285
        # timeout due to the SFTP connection cache.
292
286
        try:
299
293
 
300
294
 
301
295
class TestLockableFiles_LockDir(TestCaseInTempDir,
302
 
                              _TestLockableFiles_mixin):
 
296
                                _TestLockableFiles_mixin):
303
297
    """LockableFile tests run with LockDir underneath"""
304
298
 
305
299
    def setUp(self):
306
 
        TestCaseInTempDir.setUp(self)
307
 
        self.transport = get_transport('.')
 
300
        super(TestLockableFiles_LockDir, self).setUp()
 
301
        self.transport = transport.get_transport_from_path('.')
308
302
        self.lockable = self.get_lockable()
309
303
        # the lock creation here sets mode - test_permissions on branch
310
304
        # tests that implicitly, but it might be a good idea to factor
335
329
 
336
330
 
337
331
class TestLockableFiles_RemoteLockDir(TestCaseWithSmartMedium,
338
 
                              _TestLockableFiles_mixin):
 
332
                                      _TestLockableFiles_mixin):
339
333
    """LockableFile tests run with RemoteLockDir on a branch."""
340
334
 
341
335
    def setUp(self):
342
 
        TestCaseWithSmartMedium.setUp(self)
 
336
        super(TestLockableFiles_RemoteLockDir, self).setUp()
343
337
        # can only get a RemoteLockDir with some RemoteObject...
344
338
        # use a branch as thats what we want. These mixin tests test the end
345
339
        # to end behaviour, so stubbing out the backend and simulating would
347
341
        # in test_remote and test_smart as usual.
348
342
        b = self.make_branch('foo')
349
343
        self.addCleanup(b.bzrdir.transport.disconnect)
350
 
        self.transport = get_transport('.')
 
344
        self.transport = transport.get_transport_from_path('.')
351
345
        self.lockable = self.get_lockable()
352
346
 
353
347
    def get_lockable(self):