~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_break_lock.py

  • Committer: Robert Collins
  • Date: 2006-05-05 04:03:51 UTC
  • mto: (1697.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 1701.
  • Revision ID: robertc@robertcollins.net-20060505040351-7322a57e9085748b
Ensure that answering no to break lock leaves the locks in place. This is currently simple - ask for everything always.

Show diffs side-by-side

added added

removed removed

Lines of Context:
84
84
        mb.unlock()
85
85
        self.assertRaises(errors.LockBroken, self.wt.unlock)
86
86
        self.assertRaises(errors.LockBroken, self.master_branch.unlock)
 
87
 
 
88
    def test_saying_no_leaves_it_locked(self):
 
89
        ### if 'no' is answered, objects should remain locked.
 
90
        self.wt.lock_write()
 
91
        self.master_branch.lock_write()
 
92
        # run the break-lock
 
93
        # we need 5 yes's - wt, branch, repo, bound branch, bound repo.
 
94
        self.run_bzr('break-lock', 'checkout', stdin="n\nn\nn\nn\nn\n")
 
95
        # a new tree instance should not be lockable
 
96
        wt = bzrlib.workingtree.WorkingTree.open('checkout')
 
97
        self.assertRaises(errors.LockContention, wt.lock_write)
 
98
        # and a new instance of the master branch 
 
99
        mb = wt.branch.get_master_branch()
 
100
        self.assertRaises(errors.LockContention, mb.lock_write)
 
101
        # unlock our branches normally.
 
102
        self.wt.unlock()
 
103
        self.master_branch.unlock()