~ubuntu-branches/ubuntu/karmic/bzr/karmic-proposed

« back to all changes in this revision

Viewing changes to bzrlib/tests/branch_implementations/test_locking.py

  • Committer: Bazaar Package Importer
  • Author(s): Jelmer Vernooij
  • Date: 2009-05-16 13:51:08 UTC
  • mfrom: (1.1.53 upstream) (3.1.8 sid)
  • Revision ID: james.westby@ubuntu.com-20090516135108-aqmj2jtbt445f5ul
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
171
171
            b.repository._other.unlock()
172
172
 
173
173
    def test_04_lock_fail_unlock_control(self):
174
 
        # Make sure repository.unlock() is called, if we fail to unlock self
 
174
        # Make sure repository.unlock() is not called, if we fail to unlock
 
175
        # self leaving ourselves still locked, so that attempts to recover
 
176
        # don't encounter an unlocked repository.
175
177
        b = self.get_instrumented_branch()
176
178
        b.control_files.disable_unlock()
177
179
 
183
185
            self.assertTrue(b.repository.is_locked())
184
186
            self.assertRaises(TestPreventLocking, b.unlock)
185
187
            self.assertTrue(b.is_locked())
186
 
            if self.combined_control:
187
 
                self.assertTrue(b.repository.is_locked())
188
 
            else:
189
 
                self.assertFalse(b.repository.is_locked())
 
188
            self.assertTrue(b.repository.is_locked())
190
189
 
191
190
            # We unlock the repository even if
192
191
            # we fail to unlock the control files
206
205
                                  ('bc', 'lw', True),
207
206
                                  ('b', 'ul', True),
208
207
                                  ('bc', 'ul', False),
209
 
                                  ('r', 'ul', True),
210
208
                                 ], self.locks)
211
209
 
212
210
        finally:
434
432
            branch.unlock()
435
433
        # We should be unable to relock the repo.
436
434
        self.assertRaises(errors.LockContention, branch.lock_write)
 
435
        # Cleanup
 
436
        branch.lock_write(token)
 
437
        branch.dont_leave_lock_in_place()
 
438
        branch.unlock()
437
439
 
438
440
    def test_dont_leave_lock_in_place(self):
439
441
        branch = self.make_branch('b')