/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/tests/test_lockdir.py

  • Committer: Jelmer Vernooij
  • Date: 2019-03-05 07:32:38 UTC
  • mto: (7290.1.21 work)
  • mto: This revision was merged to the branch mainline in revision 7311.
  • Revision ID: jelmer@jelmer.uk-20190305073238-zlqn981opwnqsmzi
Add appveyor configuration.

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
    LockDir,
41
41
    LockHeldInfo,
42
42
    )
 
43
from ..sixish import (
 
44
    text_type,
 
45
    )
43
46
from . import (
44
47
    features,
45
48
    TestCase,
665
668
 
666
669
    def test_unicode(self):
667
670
        info = LockHeldInfo.for_this_process(None)
668
 
        self.assertContainsRe(str(info),
 
671
        self.assertContainsRe(text_type(info),
669
672
                              r'held by .* on .* \(process #\d+\), acquired .* ago')
670
673
 
671
674
    def test_is_locked_by_this_process(self):
732
735
        """
733
736
        self.overrideAttr(lockdir, 'get_host_name',
734
737
                          lambda: 'aproperhostname')
735
 
        # Stealing dead locks is enabled by default.
 
738
        # This is off by default at present; see the discussion in the bug.
 
739
        # If you change the default, don't forget to update the docs.
 
740
        config.GlobalStack().set('locks.steal_dead', True)
736
741
        # Create a lock pretending to come from a different nonexistent
737
742
        # process on the same machine.
738
743
        l1 = LockDir(self.get_transport(), 'a',
749
754
        """Automatic breaking can be turned off"""
750
755
        l1 = LockDir(self.get_transport(), 'a',
751
756
                     extra_holder_info={'pid': '12312313'})
752
 
        # Stealing dead locks is enabled by default, so disable it.
753
 
        config.GlobalStack().set('locks.steal_dead', False)
754
757
        token_1 = l1.attempt_lock()
755
758
        self.addCleanup(l1.unlock)
756
759
        l2 = LockDir(self.get_transport(), 'a')
757
 
        # This fails now, because dead lock breaking is disabled.
 
760
        # This fails now, because dead lock breaking is off by default.
758
761
        self.assertRaises(LockContention,
759
762
                          l2.attempt_lock)
760
763
        # and it's in fact not broken