~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Mark Hammond
  • Date: 2008-09-04 12:03:01 UTC
  • mto: This revision was merged to the branch mainline in revision 3697.
  • Revision ID: mhammond@skippinet.com.au-20080904120301-x3tujl7hloy0o75j
build the list of icons without changing directory.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
17
"""Tests for break_lock on a repository with external references."""
18
18
 
19
 
from bzrlib import (
20
 
    errors,
21
 
    ui,
22
 
    )
 
19
import bzrlib.ui
 
20
from bzrlib import errors
23
21
from bzrlib.tests.per_repository_reference import (
24
22
    TestCaseWithExternalReferenceRepository,
25
23
    )
29
27
 
30
28
    def test_break_lock(self):
31
29
        base = self.make_repository('base')
32
 
        repo = self.make_referring('referring', base)
 
30
        repo = self.make_referring('referring', 'base')
33
31
        unused_repo = repo.bzrdir.open_repository()
34
32
        base.lock_write()
35
33
        self.addCleanup(base.unlock)
41
39
            # 'lock_write' has not taken a physical mutex out.
42
40
            repo.unlock()
43
41
            return
44
 
        ui.ui_factory = ui.CannedInputUIFactory([True])
 
42
        # we want a UI factory that accepts canned input for the tests:
 
43
        # while SilentUIFactory still accepts stdin, we need to customise
 
44
        # ours
 
45
        self.old_factory = bzrlib.ui.ui_factory
 
46
        self.addCleanup(self.restoreFactory)
 
47
        bzrlib.ui.ui_factory = bzrlib.ui.SilentUIFactory()
 
48
        bzrlib.ui.ui_factory.stdin = StringIO("y\n")
45
49
        unused_repo.break_lock()
46
50
        self.assertRaises(errors.LockBroken, repo.unlock)