~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-09-29 22:03:03 UTC
  • mfrom: (5416.2.6 jam-integration)
  • Revision ID: pqm@pqm.ubuntu.com-20100929220303-cr95h8iwtggco721
(mbp) Add 'break-lock --force'

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Tests for lock-breaking user interface"""
18
18
 
19
 
import os
20
 
 
21
 
import bzrlib
22
19
from bzrlib import (
23
20
    branch,
24
21
    bzrdir,
25
22
    config,
26
23
    errors,
27
 
    lockdir,
28
24
    osutils,
29
25
    tests,
30
26
    )
 
27
from bzrlib.tests.script import (
 
28
    ScriptRunner,
 
29
    run_script,
 
30
    )
31
31
 
32
32
 
33
33
class TestBreakLock(tests.TestCaseWithTransport):
70
70
        # shouldn't fail and should not produce error output
71
71
        self.assertEqual('', err)
72
72
 
 
73
    def test_break_lock_no_interaction(self):
 
74
        """With --force, the user isn't asked for confirmation"""
 
75
        self.master_branch.lock_write()
 
76
        run_script(self, """
 
77
        $ bzr break-lock --force master-repo/master-branch
 
78
        Broke lock ...master-branch/.bzr/...
 
79
        """)
 
80
        # lock should now be dead
 
81
        self.assertRaises(errors.LockBroken, self.master_branch.unlock)
 
82
 
73
83
    def test_break_lock_everything_locked(self):
74
84
        ### if everything is locked, we should be able to unlock the lot.
75
85
        # however, we dont test breaking the working tree because we