671
671
# For cleanup purposes, make sure we are unlocked
672
672
b.repository._other.unlock()
674
def test_04_lock_read_fail_repo(self):
674
def test_04_lock_fail_unlock_control(self):
675
# Make sure repository.unlock() is called, if we fail to unlock self
676
b = self.get_instrumented_branch()
677
b.control_files.disable_unlock()
679
self.assertFalse(b.is_locked())
680
self.assertFalse(b.repository.is_locked())
683
self.assertTrue(b.is_locked())
684
self.assertTrue(b.repository.is_locked())
685
self.assertRaises(TestPreventLocking, b.unlock)
686
self.assertTrue(b.is_locked())
687
if self.combined_control:
688
self.assertTrue(b.repository.is_locked())
690
self.assertFalse(b.repository.is_locked())
692
# We unlock the repository even if
693
# we fail to unlock the control files
694
self.assertEqual([('b', 'lw', True),
705
# For cleanup purposes, make sure we are unlocked
706
b.control_files._other.unlock()
708
def test_05_lock_read_fail_repo(self):
675
709
# Test that the branch is not locked if it cannot lock the repository
676
710
b = self.get_instrumented_branch()
677
711
b.repository.disable_lock_read()
684
718
('r', 'lr', False),
687
def test_05_lock_write_fail_repo(self):
721
def test_06_lock_write_fail_repo(self):
688
722
# Test that the branch is not locked if it cannot lock the repository
689
723
b = self.get_instrumented_branch()
690
724
b.repository.disable_lock_write()
697
731
('r', 'lw', False),
700
def test_06_lock_read_fail_control(self):
734
def test_07_lock_read_fail_control(self):
701
735
# Test the repository is unlocked if we can't lock self
702
736
b = self.get_instrumented_branch()
703
737
b.control_files.disable_lock_read()
714
748
('rc', 'ul', True),
717
def test_07_lock_write_fail_control(self):
751
def test_08_lock_write_fail_control(self):
718
752
# Test the repository is unlocked if we can't lock self
719
753
b = self.get_instrumented_branch()
720
754
b.control_files.disable_lock_write()