~bzr/ubuntu/maverick/bzr/beta-ppa

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_lockdir.py

  • Committer: Max Bowsher
  • Date: 2011-11-05 13:21:49 UTC
  • mfrom: (144.1.22 natty)
  • Revision ID: _@maxb.eu-20111105132149-lirc1vdd0rwolz2e
Tags: 2.5.0~beta2-1~bazaar1~maverick1
Merge 2.5b2

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
"""Tests for LockDir"""
18
18
 
19
19
import os
20
 
import sys
21
20
import time
22
21
 
23
22
import bzrlib
46
45
    TestCase,
47
46
    TestCaseWithTransport,
48
47
    )
49
 
from bzrlib.trace import note
50
48
 
51
49
# These tests are run on the default transport provided by the test framework
52
50
# (typically a local disk transport).  That can be changed by the --transport
465
463
    def test_lock_with_buggy_rename(self):
466
464
        # test that lock acquisition handles servers which pretend they
467
465
        # renamed correctly but that actually fail
468
 
        t = transport.get_transport('brokenrename+' + self.get_url())
 
466
        t = transport.get_transport_from_url(
 
467
            'brokenrename+' + self.get_url())
469
468
        ld1 = LockDir(t, 'test_lock')
470
469
        ld1.create()
471
470
        ld1.attempt_lock()
684
683
 
685
684
    def test_lock_holder_dead_process(self):
686
685
        """Detect that the holder (this process) is still running."""
 
686
        self.overrideAttr(lockdir, 'get_host_name',
 
687
            lambda: 'aproperhostname')
687
688
        info = LockHeldInfo.for_this_process(None)
688
689
        info.info_dict['pid'] = '123123123'
689
 
        if sys.platform == 'win32':
690
 
            self.knownFailure(
691
 
                'live lock holder detection not implemented yet on win32')
692
690
        self.assertTrue(info.is_lock_holder_known_dead())
693
691
 
694
692
    def test_lock_holder_other_machine(self):
731
729
 
732
730
        This generates a warning but no other user interaction.
733
731
        """
 
732
        self.overrideAttr(lockdir, 'get_host_name',
 
733
            lambda: 'aproperhostname')
734
734
        # This is off by default at present; see the discussion in the bug.
735
735
        # If you change the default, don't forget to update the docs.
736
736
        config.GlobalConfig().set_user_option('locks.steal_dead', True)